Remove more deprecated code

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1813085 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-10-23 20:27:47 +00:00
parent 245d9b3b7f
commit 6c0ac68e05
9 changed files with 35 additions and 159 deletions

View File

@ -69,9 +69,4 @@ public final class TempFile {
public static File createTempDirectory(String name) throws IOException { public static File createTempDirectory(String name) throws IOException {
return strategy.createTempDirectory(name); return strategy.createTempDirectory(name);
} }
/**
* @deprecated POI 3.15 beta 3. Moved to {@link org.apache.poi.util.DefaultTempFileCreationStrategy}.
*/
public static class DefaultTempFileCreationStrategy extends org.apache.poi.util.DefaultTempFileCreationStrategy {}
} }

View File

@ -571,6 +571,7 @@ public class TestXSSFCellStyle {
} }
@Test @Test
@SuppressWarnings("deprecation")
public void testGetFillForegroundColor() throws IOException { public void testGetFillForegroundColor() throws IOException {
XSSFWorkbook wb = new XSSFWorkbook(); XSSFWorkbook wb = new XSSFWorkbook();
StylesTable styles = wb.getStylesSource(); StylesTable styles = wb.getStylesSource();
@ -581,11 +582,13 @@ public class TestXSSFCellStyle {
assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor()); assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor());
assertEquals(null, defaultStyle.getFillForegroundXSSFColor()); assertEquals(null, defaultStyle.getFillForegroundXSSFColor());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern()); assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern());
assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPatternEnum());
XSSFCellStyle customStyle = wb.createCellStyle(); XSSFCellStyle customStyle = wb.createCellStyle();
customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPattern()); assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPatternEnum());
assertEquals(3, styles.getFills().size()); assertEquals(3, styles.getFills().size());
customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex()); customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex());

View File

@ -33,26 +33,6 @@ public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends
private final int startBytes; private final int startBytes;
private final int endBytes; private final int endBytes;
/**
* @param fcStart The start of the text for this property, in _bytes_
* @param fcEnd The end of the text for this property, in _bytes_
* @deprecated
*/
public BytePropertyNode(int fcStart, int fcEnd, CharIndexTranslator translator, Object buf) {
super(
translator.getCharIndex(fcStart),
translator.getCharIndex(fcEnd, translator.getCharIndex(fcStart)),
buf
);
if ( fcStart > fcEnd )
throw new IllegalArgumentException( "fcStart (" + fcStart
+ ") > fcEnd (" + fcEnd + ")" );
this.startBytes = fcStart;
this.endBytes = fcEnd;
}
public BytePropertyNode( int charStart, int charEnd, Object buf ) public BytePropertyNode( int charStart, int charEnd, Object buf )
{ {
super( charStart, charEnd, buf ); super( charStart, charEnd, buf );

View File

@ -24,7 +24,7 @@ import org.apache.poi.util.Internal;
/** /**
* DANGER - works in bytes! * DANGER - works in bytes!
* * <p>
* Make sure you call getStart() / getEnd() when you want characters * Make sure you call getStart() / getEnd() when you want characters
* (normal use), but getStartByte() / getEndByte() when you're * (normal use), but getStartByte() / getEndByte() when you're
* reading in / writing out! * reading in / writing out!
@ -33,40 +33,22 @@ import org.apache.poi.util.Internal;
*/ */
@Internal @Internal
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public final class CHPX extends BytePropertyNode<CHPX> public final class CHPX extends BytePropertyNode<CHPX> {
{
@Deprecated CHPX(int charStart, int charEnd, SprmBuffer buf) {
public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[] grpprl)
{
super(fcStart, translator.lookIndexBackward(fcEnd), translator, new SprmBuffer(grpprl, 0));
}
@Deprecated
public CHPX(int fcStart, int fcEnd, CharIndexTranslator translator, SprmBuffer buf)
{
super(fcStart, translator.lookIndexBackward(fcEnd), translator ,buf);
}
CHPX( int charStart, int charEnd, SprmBuffer buf )
{
super(charStart, charEnd, buf); super(charStart, charEnd, buf);
} }
public byte[] getGrpprl() public byte[] getGrpprl() {
{
return ((SprmBuffer) _buf).toByteArray(); return ((SprmBuffer) _buf).toByteArray();
} }
public SprmBuffer getSprmBuf() public SprmBuffer getSprmBuf() {
{
return (SprmBuffer) _buf; return (SprmBuffer) _buf;
} }
public CharacterProperties getCharacterProperties( StyleSheet ss, short istd ) public CharacterProperties getCharacterProperties(StyleSheet ss, short istd) {
{ if (ss == null) {
if ( ss == null )
{
// TODO Fix up for Word 6/95 // TODO Fix up for Word 6/95
return new CharacterProperties(); return new CharacterProperties();
} }

View File

@ -30,32 +30,6 @@ public interface CharIndexTranslator {
*/ */
int getByteIndex( int charPos ); int getByteIndex( int charPos );
/**
* Calculates the char index of the given byte index. Look forward if index
* is not in table
*
* @param bytePos
* The character offset to check
* @return the char index
* @deprecated This API were based on incorrect assumption that single byte
* offset corresponds to single char offset
*/
@Deprecated
int getCharIndex(int bytePos);
/**
* Calculates the char index of the given byte index.
* Look forward if index is not in table
*
* @param bytePos The character offset to check
* @param startCP look from this characted position
* @return the char index
* @deprecated This API were based on incorrect assumption that single byte
* offset corresponds to single char offset
*/
@Deprecated
int getCharIndex(int bytePos, int startCP);
/** /**
* Finds character ranges that includes specified byte range. * Finds character ranges that includes specified byte range.
* *

View File

@ -52,37 +52,15 @@ public final class PAPFormattedDiskPage extends FormattedDiskPage {
private ArrayList<PAPX> _papxList = new ArrayList<>(); private ArrayList<PAPX> _papxList = new ArrayList<>();
private ArrayList<PAPX> _overFlow; private ArrayList<PAPX> _overFlow;
/**
* @deprecated Use {@link #PAPFormattedDiskPage()} instead
*/
public PAPFormattedDiskPage( byte[] dataStream )
{
this();
}
public PAPFormattedDiskPage()
{
}
/** public PAPFormattedDiskPage() { }
* Creates a PAPFormattedDiskPage from a 512 byte array
*
* @deprecated Use
* {@link #PAPFormattedDiskPage(byte[], byte[], int, CharIndexTranslator)}
* instead
*/
public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream,
int offset, int fcMin, TextPieceTable tpt )
{
this( documentStream, dataStream, offset, tpt );
}
/** /**
* Creates a PAPFormattedDiskPage from a 512 byte array * Creates a PAPFormattedDiskPage from a 512 byte array
*/ */
public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream, public PAPFormattedDiskPage( byte[] documentStream, byte[] dataStream,
int offset, CharIndexTranslator translator ) int offset, CharIndexTranslator translator ) {
{
super( documentStream, offset ); super( documentStream, offset );
for ( int x = 0; x < _crun; x++ ) for ( int x = 0; x < _crun; x++ )
{ {

View File

@ -40,15 +40,6 @@ public final class PAPX extends BytePropertyNode<PAPX> {
private ParagraphHeight _phe; private ParagraphHeight _phe;
public PAPX(int fcStart, int fcEnd, CharIndexTranslator translator, byte[] papx, ParagraphHeight phe, byte[] dataStream)
{
super(fcStart, fcEnd, translator, new SprmBuffer(papx, 2));
_phe = phe;
SprmBuffer buf = findHuge(new SprmBuffer(papx, 2), dataStream);
if(buf != null)
_buf = buf;
}
public PAPX( int charStart, int charEnd, byte[] papx, ParagraphHeight phe, public PAPX( int charStart, int charEnd, byte[] papx, ParagraphHeight phe,
byte[] dataStream ) byte[] dataStream )
{ {
@ -59,16 +50,6 @@ public final class PAPX extends BytePropertyNode<PAPX> {
_buf = buf; _buf = buf;
} }
@Deprecated
public PAPX(int fcStart, int fcEnd, CharIndexTranslator translator, SprmBuffer buf, byte[] dataStream)
{
super(fcStart, fcEnd, translator, buf);
_phe = new ParagraphHeight();
buf = findHuge(buf, dataStream);
if(buf != null)
_buf = buf;
}
public PAPX( int charStart, int charEnd, SprmBuffer buf ) public PAPX( int charStart, int charEnd, SprmBuffer buf )
{ {
super( charStart, charEnd, buf ); super( charStart, charEnd, buf );

View File

@ -86,6 +86,7 @@ public final class TestHSSFPalette {
/** /**
* Uses the palette from cell stylings * Uses the palette from cell stylings
*/ */
@SuppressWarnings("deprecation")
@Test @Test
public void testPaletteFromCellColours() { public void testPaletteFromCellColours() {
HSSFWorkbook book = HSSFTestDataSamples.openSampleWorkbook("SimpleWithColours.xls"); HSSFWorkbook book = HSSFTestDataSamples.openSampleWorkbook("SimpleWithColours.xls");
@ -104,6 +105,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellA.getCellStyle().getFillBackgroundColor()); assertEquals(64, cellA.getCellStyle().getFillBackgroundColor());
assertEquals(Font.COLOR_NORMAL, cellA.getCellStyle().getFont(book).getColor()); assertEquals(Font.COLOR_NORMAL, cellA.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPattern()); assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPatternEnum());
assertEquals("0:0:0", p.getColor((short)64).getHexString()); assertEquals("0:0:0", p.getColor((short)64).getHexString());
assertEquals(null, p.getColor((short)32767)); assertEquals(null, p.getColor((short)32767));
@ -113,6 +115,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellB.getCellStyle().getFillBackgroundColor()); assertEquals(64, cellB.getCellStyle().getFillBackgroundColor());
assertEquals(10, cellB.getCellStyle().getFont(book).getColor()); assertEquals(10, cellB.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPattern()); assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPatternEnum());
assertEquals("0:0:0", p.getColor((short)64).getHexString()); assertEquals("0:0:0", p.getColor((short)64).getHexString());
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString()); assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
@ -122,6 +125,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellC.getCellStyle().getFillBackgroundColor()); assertEquals(64, cellC.getCellStyle().getFillBackgroundColor());
assertEquals(10, cellC.getCellStyle().getFont(book).getColor()); assertEquals(10, cellC.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPattern()); assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPattern());
assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPatternEnum());
assertEquals("0:FFFF:0", p.getColor((short)11).getHexString()); assertEquals("0:FFFF:0", p.getColor((short)11).getHexString());
assertEquals("FFFF:0:0", p.getColor((short)10).getHexString()); assertEquals("FFFF:0:0", p.getColor((short)10).getHexString());
@ -131,6 +135,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellD.getCellStyle().getFillBackgroundColor()); assertEquals(64, cellD.getCellStyle().getFillBackgroundColor());
assertEquals(14, cellD.getCellStyle().getFont(book).getColor()); assertEquals(14, cellD.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPattern()); assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPatternEnum());
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString()); assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString()); assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
@ -140,6 +145,7 @@ public final class TestHSSFPalette {
assertEquals(64, cellE.getCellStyle().getFillBackgroundColor()); assertEquals(64, cellE.getCellStyle().getFillBackgroundColor());
assertEquals(14, cellE.getCellStyle().getFont(book).getColor()); assertEquals(14, cellE.getCellStyle().getFont(book).getColor());
assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPattern()); assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPattern());
assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPatternEnum());
assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString()); assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString());
assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString()); assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString());
} }

View File

@ -357,29 +357,6 @@ public class BaseTestCellUtil {
} }
} }
/**
* bug 55555
* @deprecated Replaced by {@link #setFillForegroundColorBeforeFillBackgroundColorEnum()}
* @since POI 3.15 beta 3
*/
@Deprecated
// bug 55555
@Test
public void setFillForegroundColorBeforeFillBackgroundColor() throws IOException {
Workbook wb1 = _testDataProvider.createWorkbook();
Cell A1 = wb1.createSheet().createRow(0).createCell(0);
Map<String, Object> properties = new HashMap<>();
properties.put(CellUtil.FILL_PATTERN, FillPatternType.BRICKS);
properties.put(CellUtil.FILL_FOREGROUND_COLOR, IndexedColors.BLUE.index);
properties.put(CellUtil.FILL_BACKGROUND_COLOR, IndexedColors.RED.index);
CellUtil.setCellStyleProperties(A1, properties);
CellStyle style = A1.getCellStyle();
assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPattern());
assertEquals("fill foreground color", IndexedColors.BLUE, IndexedColors.fromInt(style.getFillForegroundColor()));
assertEquals("fill background color", IndexedColors.RED, IndexedColors.fromInt(style.getFillBackgroundColor()));
wb1.close();
}
/** /**
* bug 55555 * bug 55555
* @since POI 3.15 beta 3 * @since POI 3.15 beta 3