diff options
author | PJ Fanning <fanningpj@apache.org> | 2017-10-22 12:45:35 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2017-10-22 12:45:35 +0000 |
commit | 2cd8c7bc6568238ea504b50566ac8c812827948b (patch) | |
tree | 04b917781e177b7ae0ab0918cdd0116461796081 /src | |
parent | dffa1ccd9c3260ba0671066c32ee6fc513e422d9 (diff) | |
download | poi-2cd8c7bc6568238ea504b50566ac8c812827948b.tar.gz poi-2cd8c7bc6568238ea504b50566ac8c812827948b.zip |
Remove use of deprecated methods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812907 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
17 files changed, 161 insertions, 240 deletions
diff --git a/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java b/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java index 3de27df0d3..41de3d77c4 100644 --- a/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java +++ b/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java @@ -156,7 +156,7 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd Font font = new Font(f.getFontName(),fontstyle,fontheight); editor.setFont(font); - if (style.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) { + if (style.getFillPattern() == FillPatternType.SOLID_FOREGROUND) { editor.setBackground(getAWTColor(style.getFillForegroundColor(), white)); } else { editor.setBackground(white); @@ -187,7 +187,7 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd default: editor.setText("?"); } - switch (style.getAlignmentEnum()) { + switch (style.getAlignment()) { case LEFT: case JUSTIFY: case FILL: diff --git a/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java b/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java index 4e51ba3b72..62778964d9 100644 --- a/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java +++ b/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java @@ -151,7 +151,7 @@ public class SVTableCellRenderer extends JLabel HSSFFont f = wb.getFontAt(s.getFontIndex()); setFont(SVTableUtils.makeFont(f)); - if (s.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) { + if (s.getFillPattern() == FillPatternType.SOLID_FOREGROUND) { setBackground(SVTableUtils.getAWTColor(s.getFillForegroundColor(), SVTableUtils.white)); } else setBackground(SVTableUtils.white); @@ -195,7 +195,7 @@ public class SVTableCellRenderer extends JLabel setValue("?"); } //Set the text alignment of the cell - switch (s.getAlignmentEnum()) { + switch (s.getAlignment()) { case LEFT: case JUSTIFY: case FILL: diff --git a/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java b/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java index ccfe6763e7..25e8433299 100644 --- a/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java +++ b/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java @@ -330,8 +330,8 @@ public class ExcelComparator { */ private void isCellAlignmentMatches(Locator loc1, Locator loc2) { // TODO: check for NPE - HorizontalAlignment align1 = loc1.cell.getCellStyle().getAlignmentEnum(); - HorizontalAlignment align2 = loc2.cell.getCellStyle().getAlignmentEnum(); + HorizontalAlignment align1 = loc1.cell.getCellStyle().getAlignment(); + HorizontalAlignment align2 = loc2.cell.getCellStyle().getAlignment(); if (align1 != align2) { addMessage(loc1, loc2, "Cell Alignment does not Match ::", @@ -460,8 +460,8 @@ public class ExcelComparator { */ private void isCellFillPatternMatches(Locator loc1, Locator loc2) { // TOOO: Check for NPE - FillPatternType fill1 = loc1.cell.getCellStyle().getFillPatternEnum(); - FillPatternType fill2 = loc2.cell.getCellStyle().getFillPatternEnum(); + FillPatternType fill1 = loc1.cell.getCellStyle().getFillPattern(); + FillPatternType fill2 = loc2.cell.getCellStyle().getFillPattern(); if (fill1 != fill2) { addMessage(loc1, loc2, "Cell Fill pattern does not Match ::", diff --git a/src/examples/src/org/apache/poi/ss/examples/html/HSSFHtmlHelper.java b/src/examples/src/org/apache/poi/ss/examples/html/HSSFHtmlHelper.java index 9955eb30f0..e7c4ea6f02 100644 --- a/src/examples/src/org/apache/poi/ss/examples/html/HSSFHtmlHelper.java +++ b/src/examples/src/org/apache/poi/ss/examples/html/HSSFHtmlHelper.java @@ -44,7 +44,7 @@ public class HSSFHtmlHelper implements HtmlHelper { @Override public void colorStyles(CellStyle style, Formatter out) { HSSFCellStyle cs = (HSSFCellStyle) style; - out.format(" /* fill pattern = %d */%n", cs.getFillPatternEnum().getCode()); + out.format(" /* fill pattern = %d */%n", cs.getFillPattern().getCode()); styleColor(out, "background-color", cs.getFillForegroundColor()); styleColor(out, "color", cs.getFont(wb).getColor()); styleColor(out, "border-left-color", cs.getLeftBorderColor()); diff --git a/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java b/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java index d66ef83397..45d8157ea1 100644 --- a/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java +++ b/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java @@ -289,8 +289,8 @@ public class ToHtml { } private void styleContents(CellStyle style) { - styleOut("text-align", style.getAlignmentEnum(), HALIGN); - styleOut("vertical-align", style.getVerticalAlignmentEnum(), VALIGN); + styleOut("text-align", style.getAlignment(), HALIGN); + styleOut("vertical-align", style.getVerticalAlignment(), VALIGN); fontStyle(style); borderStyles(style); helper.colorStyles(style, out); @@ -493,7 +493,7 @@ public class ToHtml { } private String tagStyle(Cell cell, CellStyle style) { - if (style.getAlignmentEnum() == HorizontalAlignment.GENERAL) { + if (style.getAlignment() == HorizontalAlignment.GENERAL) { switch (ultimateCellType(cell)) { case STRING: return "style=\"text-align: left;\""; diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java index 120af40ea9..2e6c5b5c54 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java @@ -272,25 +272,16 @@ public final class HSSFCellStyle implements CellStyle { _format.setAlignment(align.getCode()); } - /** - * get the type of horizontal alignment for the cell - * @return align - the type of alignment - * @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead. - */ - @Deprecated @Override - public short getAlignment() + public HorizontalAlignment getAlignment() { - return _format.getAlignment(); + return HorizontalAlignment.forInt(_format.getAlignment()); } - /** - * get the type of horizontal alignment for the cell - * @return align - the type of alignment - */ + @Override public HorizontalAlignment getAlignmentEnum() { - return HorizontalAlignment.forInt(_format.getAlignment()); + return getAlignment(); } /** @@ -324,27 +315,15 @@ public final class HSSFCellStyle implements CellStyle { _format.setVerticalAlignment(align.getCode()); } - /** - * get the type of vertical alignment for the cell - * @return align the type of alignment - * @see VerticalAlignment - * @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead. - */ - @Deprecated @Override - public short getVerticalAlignment() - { - return _format.getVerticalAlignment(); + public VerticalAlignment getVerticalAlignment() { + return VerticalAlignment.forInt(_format.getVerticalAlignment()); + } + + @Override + public VerticalAlignment getVerticalAlignmentEnum() { + return getVerticalAlignment(); } - /** - * get the type of vertical alignment for the cell - * @return align the type of alignment - */ - @Override - public VerticalAlignment getVerticalAlignmentEnum() - { - return VerticalAlignment.forInt(_format.getVerticalAlignment()); - } /** * set the degree of rotation for the text in the cell @@ -649,28 +628,15 @@ public final class HSSFCellStyle implements CellStyle { _format.setAdtlFillPattern(fp.getCode()); } - /** - * get the fill pattern - * @return fill pattern - * @deprecated POI 3.15 beta 3. This method will return {@link FillPatternType} in the future. Use {@link #setFillPattern(FillPatternType)} instead. - */ - @Deprecated @Override - public short getFillPattern() - { - return getFillPatternEnum().getCode(); - } - - /** - * get the fill pattern - * @return fill pattern - */ - @Override - public FillPatternType getFillPatternEnum() + public FillPatternType getFillPattern() { return FillPatternType.forInt(_format.getAdtlFillPattern()); } + @Override + public FillPatternType getFillPatternEnum() { return getFillPattern(); } + /** * Checks if the background and foreground fills are set correctly when one * or the other is set to the default color. diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java index 565fe6a53a..e260edfff2 100644 --- a/src/java/org/apache/poi/ss/usermodel/CellStyle.java +++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java @@ -17,6 +17,8 @@ package org.apache.poi.ss.usermodel; +import org.apache.poi.util.Removal; + public interface CellStyle { /** @@ -113,13 +115,15 @@ public interface CellStyle { /** * get the type of horizontal alignment for the cell * @return align - the type of alignment - * @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead. */ - short getAlignment(); + HorizontalAlignment getAlignment(); + /** * get the type of horizontal alignment for the cell * @return align - the type of alignment + * @deprecated use <code>getAlignment()</code> instead */ + @Removal(version = "4.2") HorizontalAlignment getAlignmentEnum(); /** @@ -129,14 +133,12 @@ public interface CellStyle { * * @param wrapped wrap text or not */ - void setWrapText(boolean wrapped); /** * get whether the text should be wrapped * @return wrap text or not */ - boolean getWrapText(); /** @@ -148,13 +150,15 @@ public interface CellStyle { /** * get the type of vertical alignment for the cell * @return align the type of alignment - * @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead. */ - short getVerticalAlignment(); + VerticalAlignment getVerticalAlignment(); + /** * get the type of vertical alignment for the cell * @return align the type of alignment + * @deprecated use <code>getVerticalAlignment()</code> instead */ + @Removal(version = "4.2") VerticalAlignment getVerticalAlignmentEnum(); /** @@ -335,16 +339,21 @@ public interface CellStyle { void setFillPattern(FillPatternType fp); /** - * get the fill pattern (??) - set to 1 to fill with foreground color - * @return fill pattern - * @deprecated POI 3.15 beta 3. This method will return {@link FillPatternType} in the future. Use {@link #setFillPattern(FillPatternType)} instead. + * Get the fill pattern + * + * @return the fill pattern, default value is {@link FillPatternType#NO_FILL} + * @since POI 4.0.0 */ - short getFillPattern(); + FillPatternType getFillPattern(); + /** - * get the fill pattern (??) - set to 1 to fill with foreground color - * @return fill pattern + * Get the fill pattern + * + * @return the fill pattern, default value is {@link FillPatternType#NO_FILL} * @since POI 3.15 beta 3 + * @deprecated use <code>getFillPattern()</code> instead */ + @Removal(version = "4.2") FillPatternType getFillPatternEnum(); /** @@ -352,7 +361,6 @@ public interface CellStyle { * * @param bg color */ - void setFillBackgroundColor(short bg); /** diff --git a/src/java/org/apache/poi/ss/util/CellUtil.java b/src/java/org/apache/poi/ss/util/CellUtil.java index cab7d8f49b..1b765b9401 100644 --- a/src/java/org/apache/poi/ss/util/CellUtil.java +++ b/src/java/org/apache/poi/ss/util/CellUtil.java @@ -335,15 +335,15 @@ public final class CellUtil { */ private static Map<String, Object> getFormatProperties(CellStyle style) { Map<String, Object> properties = new HashMap<>(); - put(properties, ALIGNMENT, style.getAlignmentEnum()); - put(properties, VERTICAL_ALIGNMENT, style.getVerticalAlignmentEnum()); + put(properties, ALIGNMENT, style.getAlignment()); + put(properties, VERTICAL_ALIGNMENT, style.getVerticalAlignment()); put(properties, BORDER_BOTTOM, style.getBorderBottomEnum()); put(properties, BORDER_LEFT, style.getBorderLeftEnum()); put(properties, BORDER_RIGHT, style.getBorderRightEnum()); put(properties, BORDER_TOP, style.getBorderTopEnum()); put(properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor()); put(properties, DATA_FORMAT, style.getDataFormat()); - put(properties, FILL_PATTERN, style.getFillPatternEnum()); + put(properties, FILL_PATTERN, style.getFillPattern()); put(properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor()); put(properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor()); put(properties, FONT, style.getFontIndex()); diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index e990cb7736..50ea1829f2 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -217,24 +217,8 @@ public class XSSFCellStyle implements CellStyle { _cellXf.setApplyBorder(true); } - /** - * Get the type of horizontal alignment for the cell - * - * @return short - the type of alignment - * @deprecated POI 3.15 beta 3. Use {@link #getAlignmentEnum()} instead. - */ @Override - public short getAlignment() { - return getAlignmentEnum().getCode(); - } - - /** - * Get the type of horizontal alignment for the cell - * - * @return HorizontalAlignment - the type of alignment - */ - @Override - public HorizontalAlignment getAlignmentEnum() { + public HorizontalAlignment getAlignment() { CTCellAlignment align = _cellXf.getAlignment(); if(align != null && align.isSetHorizontal()) { return HorizontalAlignment.forInt(align.getHorizontal().intValue()-1); @@ -242,6 +226,10 @@ public class XSSFCellStyle implements CellStyle { return HorizontalAlignment.GENERAL; } + @Override + public HorizontalAlignment getAlignmentEnum() { + return getAlignment(); + } /** * Get the type of border to use for the bottom border of the cell * Will be removed when {@link #getBorderBottom()} returns a BorderStyle enum @@ -494,24 +482,9 @@ public class XSSFCellStyle implements CellStyle { return fillForegroundColor; } - /** - * Get the fill pattern - * @return fill pattern, default value is the code for {@link org.apache.poi.ss.usermodel.FillPatternType#NO_FILL} - * @deprecated POI 3.15 beta 3. This method will return {@link FillPatternType} in the future. Use {@link #setFillPattern(FillPatternType)} instead. - */ @Override - public short getFillPattern() { - return getFillPatternEnum().getCode(); - } - - /** - * Get the fill pattern - * - * @return the fill pattern, default value is {@link FillPatternType#NO_FILL} - */ - @Override - public FillPatternType getFillPatternEnum() { - // bug 56295: handle missing applyFill attribute as "true" because Excel does as well + public FillPatternType getFillPattern() { + // bug 56295: handle missing applyFill attribute as "true" because Excel does as well if(_cellXf.isSetApplyFill() && !_cellXf.getApplyFill()) return FillPatternType.NO_FILL; int fillIndex = (int)_cellXf.getFillId(); @@ -522,10 +495,15 @@ public class XSSFCellStyle implements CellStyle { return FillPatternType.forInt(ptrn.intValue() - 1); } + @Override + public FillPatternType getFillPatternEnum() { + return getFillPattern(); + } + /** - * Gets the font for this style - * @return Font - font - */ + * Gets the font for this style + * @return Font - font + */ public XSSFFont getFont() { if (_font == null) { _font = _stylesSource.getFontAt(getFontId()); @@ -708,24 +686,8 @@ public class XSSFCellStyle implements CellStyle { return border.getBorderColor(BorderSide.TOP); } - /** - * Get the type of vertical alignment for the cell - * - * @return align the type of alignment, default value is {@link org.apache.poi.ss.usermodel.VerticalAlignment} - * @deprecated POI 3.15 beta 3. Use {@link #getVerticalAlignmentEnum()} instead. - */ @Override - public short getVerticalAlignment() { - return getVerticalAlignmentEnum().getCode(); - } - - /** - * Get the type of vertical alignment for the cell - * - * @return the type of alignment, default value is {@link VerticalAlignment#BOTTOM} - */ - @Override - public VerticalAlignment getVerticalAlignmentEnum() { + public VerticalAlignment getVerticalAlignment() { CTCellAlignment align = _cellXf.getAlignment(); if(align != null && align.isSetVertical()) { return VerticalAlignment.forInt(align.getVertical().intValue()-1); @@ -733,6 +695,11 @@ public class XSSFCellStyle implements CellStyle { return VerticalAlignment.BOTTOM; } + @Override + public VerticalAlignment getVerticalAlignmentEnum() { + return getVerticalAlignment(); + } + /** * Whether the text should be wrapped * diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java index 0aaa2b6785..c79d8e9682 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java @@ -555,7 +555,7 @@ public class TestXSSFCellStyle { HSSFCellStyle style2 = wb2.createCellStyle(); assertEquals(style2.getFillBackgroundColor(), style1.getFillBackgroundColor()); assertEquals(style2.getFillForegroundColor(), style1.getFillForegroundColor()); - assertEquals(style2.getFillPatternEnum(), style1.getFillPatternEnum()); + assertEquals(style2.getFillPattern(), style1.getFillPattern()); assertEquals(style2.getFillPattern(), style1.getFillPattern()); assertEquals(style2.getLeftBorderColor(), style1.getLeftBorderColor()); @@ -570,7 +570,6 @@ public class TestXSSFCellStyle { wb2.close(); } - @SuppressWarnings("deprecation") @Test public void testGetFillForegroundColor() throws IOException { XSSFWorkbook wb = new XSSFWorkbook(); @@ -581,14 +580,12 @@ public class TestXSSFCellStyle { XSSFCellStyle defaultStyle = wb.getCellStyleAt((short)0); assertEquals(IndexedColors.AUTOMATIC.getIndex(), defaultStyle.getFillForegroundColor()); assertEquals(null, defaultStyle.getFillForegroundXSSFColor()); - assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPatternEnum()); - assertEquals(FillPatternType.NO_FILL.getCode(), defaultStyle.getFillPattern()); + assertEquals(FillPatternType.NO_FILL, defaultStyle.getFillPattern()); XSSFCellStyle customStyle = wb.createCellStyle(); customStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); - assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPatternEnum()); - assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), customStyle.getFillPattern()); + assertEquals(FillPatternType.SOLID_FOREGROUND, customStyle.getFillPattern()); assertEquals(3, styles.getFills().size()); customStyle.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex()); @@ -599,8 +596,7 @@ public class TestXSSFCellStyle { XSSFCellStyle style = wb.createCellStyle(); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); - assertEquals(FillPatternType.SOLID_FOREGROUND, style.getFillPatternEnum()); - assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), style.getFillPattern()); + assertEquals(FillPatternType.SOLID_FOREGROUND, style.getFillPattern()); assertEquals(4, styles.getFills().size()); style.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.getIndex()); @@ -612,17 +608,14 @@ public class TestXSSFCellStyle { wb.close(); } - @SuppressWarnings("deprecation") @Test public void testGetFillPattern() { - assertEquals(STPatternType.INT_DARK_GRAY-1, cellStyle.getFillPatternEnum().getCode()); - assertEquals(STPatternType.INT_DARK_GRAY-1, cellStyle.getFillPattern()); + assertEquals(STPatternType.INT_DARK_GRAY-1, cellStyle.getFillPattern().getCode()); int num = stylesTable.getFills().size(); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); - assertEquals(FillPatternType.SOLID_FOREGROUND, cellStyle.getFillPatternEnum()); - assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), cellStyle.getFillPattern()); + assertEquals(FillPatternType.SOLID_FOREGROUND, cellStyle.getFillPattern()); assertEquals(num + 1, stylesTable.getFills().size()); int fillId = (int)cellStyle.getCoreXf().getFillId(); assertTrue(fillId > 0); @@ -637,8 +630,7 @@ public class TestXSSFCellStyle { assertEquals(num + 1, stylesTable.getFills().size()); cellStyle.setFillPattern(FillPatternType.NO_FILL); - assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPatternEnum()); - assertEquals(FillPatternType.NO_FILL.getCode(), cellStyle.getFillPattern()); + assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPattern()); fillId = (int)cellStyle.getCoreXf().getFillId(); ctFill2 = stylesTable.getFillAt(fillId).getCTFill(); assertFalse(ctFill2.getPatternFill().isSetPatternType()); @@ -677,25 +669,21 @@ public class TestXSSFCellStyle { assertEquals((short)13, cellStyle.getIndention()); } - @SuppressWarnings("deprecation") @Test public void testGetSetAlignment() { assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal()); - assertEquals(HorizontalAlignment.GENERAL, cellStyle.getAlignmentEnum()); + assertEquals(HorizontalAlignment.GENERAL, cellStyle.getAlignment()); cellStyle.setAlignment(HorizontalAlignment.LEFT); - assertEquals(HorizontalAlignment.LEFT.getCode(), cellStyle.getAlignment()); - assertEquals(HorizontalAlignment.LEFT, cellStyle.getAlignmentEnum()); + assertEquals(HorizontalAlignment.LEFT, cellStyle.getAlignment()); assertEquals(STHorizontalAlignment.LEFT, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal()); cellStyle.setAlignment(HorizontalAlignment.JUSTIFY); - assertEquals(HorizontalAlignment.JUSTIFY.getCode(), cellStyle.getAlignment()); - assertEquals(HorizontalAlignment.JUSTIFY, cellStyle.getAlignmentEnum()); + assertEquals(HorizontalAlignment.JUSTIFY, cellStyle.getAlignment()); assertEquals(STHorizontalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal()); cellStyle.setAlignment(HorizontalAlignment.CENTER); - assertEquals(HorizontalAlignment.CENTER.getCode(), cellStyle.getAlignment()); - assertEquals(HorizontalAlignment.CENTER, cellStyle.getAlignmentEnum()); + assertEquals(HorizontalAlignment.CENTER, cellStyle.getAlignment()); assertEquals(STHorizontalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getHorizontal()); } @@ -717,21 +705,17 @@ public class TestXSSFCellStyle { assertEquals(ReadingOrder.CONTEXT.getCode(), cellStyle.getCellAlignment().getCTCellAlignment().getReadingOrder()); } - @SuppressWarnings("deprecation") @Test public void testGetSetVerticalAlignment() { - assertEquals(VerticalAlignment.BOTTOM, cellStyle.getVerticalAlignmentEnum()); - assertEquals(VerticalAlignment.BOTTOM.getCode(), cellStyle.getVerticalAlignment()); + assertEquals(VerticalAlignment.BOTTOM, cellStyle.getVerticalAlignment()); assertNull(cellStyle.getCellAlignment().getCTCellAlignment().getVertical()); cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); - assertEquals(VerticalAlignment.CENTER.getCode(), cellStyle.getVerticalAlignment()); - assertEquals(VerticalAlignment.CENTER, cellStyle.getVerticalAlignmentEnum()); + assertEquals(VerticalAlignment.CENTER, cellStyle.getVerticalAlignment()); assertEquals(STVerticalAlignment.CENTER, cellStyle.getCellAlignment().getCTCellAlignment().getVertical()); cellStyle.setVerticalAlignment(VerticalAlignment.JUSTIFY); - assertEquals(VerticalAlignment.JUSTIFY.getCode(), cellStyle.getVerticalAlignment()); - assertEquals(VerticalAlignment.JUSTIFY, cellStyle.getVerticalAlignmentEnum()); + assertEquals(VerticalAlignment.JUSTIFY, cellStyle.getVerticalAlignment()); assertEquals(STVerticalAlignment.JUSTIFY, cellStyle.getCellAlignment().getCTCellAlignment().getVertical()); } @@ -761,17 +745,17 @@ public class TestXSSFCellStyle { orig.setFont(fnt); orig.setDataFormat((short)18); - assertEquals(HorizontalAlignment.RIGHT, orig.getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, orig.getAlignment()); assertEquals(fnt, orig.getFont()); assertEquals(18, orig.getDataFormat()); XSSFCellStyle clone = wb.createCellStyle(); - assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum()); + assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment()); assertFalse(fnt == clone.getFont()); assertFalse(18 == clone.getDataFormat()); clone.cloneStyleFrom(orig); - assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment()); assertEquals(fnt, clone.getFont()); assertEquals(18, clone.getDataFormat()); assertEquals(2, wb.getNumberOfFonts()); @@ -806,7 +790,7 @@ public class TestXSSFCellStyle { orig.setFont(fnt); orig.setDataFormat(fmt.getFormat("Test##")); - assertTrue(HorizontalAlignment.RIGHT == orig.getAlignmentEnum()); + assertTrue(HorizontalAlignment.RIGHT == orig.getAlignment()); assertTrue(fnt == orig.getFont()); assertTrue(fmt.getFormat("Test##") == orig.getDataFormat()); @@ -826,7 +810,7 @@ public class TestXSSFCellStyle { assertEquals(1, wbClone.getNumberOfFonts()); assertEquals(0, wbClone.getStylesSource().getNumberFormats().size()); - assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum()); + assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment()); assertNotEquals("TestingFont", clone.getFont().getFontName()); clone.cloneStyleFrom(orig); @@ -835,7 +819,7 @@ public class TestXSSFCellStyle { assertEquals(2, wbClone.getNumCellStyles()); assertEquals(1, wbClone.getStylesSource().getNumberFormats().size()); - assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment()); assertEquals("TestingFont", clone.getFont().getFontName()); assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat()); assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##")); @@ -847,7 +831,7 @@ public class TestXSSFCellStyle { assertEquals(1, wbReload.getStylesSource().getNumberFormats().size()); XSSFCellStyle reload = wbReload.getCellStyleAt((short)1); - assertEquals(HorizontalAlignment.RIGHT, reload.getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, reload.getAlignment()); assertEquals("TestingFont", reload.getFont().getFontName()); assertEquals(fmtClone.getFormat("Test##"), reload.getDataFormat()); assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##")); @@ -951,42 +935,38 @@ public class TestXSSFCellStyle { @Test public void testSetColor() throws IOException { - Workbook wb = new XSSFWorkbook(); - Sheet sheet = wb.createSheet(); - Row row = sheet.createRow(0); - - DataFormat format = wb.createDataFormat(); - Cell cell = row.createCell(1); - cell.setCellValue("somevalue"); - CellStyle cellStyle2 = wb.createCellStyle(); - - - cellStyle2.setDataFormat(format.getFormat("###0")); - - cellStyle2.setFillBackgroundColor(IndexedColors.DARK_BLUE.getIndex()); - cellStyle2.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex()); - cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND); - - cellStyle2.setAlignment(HorizontalAlignment.RIGHT); - cellStyle2.setVerticalAlignment(VerticalAlignment.TOP); - - cell.setCellStyle(cellStyle2); - - Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb); - Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(1); - assertNotNull(cellBack); - CellStyle styleBack = cellBack.getCellStyle(); - assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillBackgroundColor()); - assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillForegroundColor()); - assertEquals(HorizontalAlignment.RIGHT, styleBack.getAlignmentEnum()); - assertEquals(VerticalAlignment.TOP, styleBack.getVerticalAlignmentEnum()); - assertEquals(FillPatternType.SOLID_FOREGROUND, styleBack.getFillPatternEnum()); - //noinspection deprecation - assertEquals(FillPatternType.SOLID_FOREGROUND.getCode(), styleBack.getFillPattern()); - - wbBack.close(); - - wb.close(); + try(Workbook wb = new XSSFWorkbook()) { + Sheet sheet = wb.createSheet(); + Row row = sheet.createRow(0); + + DataFormat format = wb.createDataFormat(); + Cell cell = row.createCell(1); + cell.setCellValue("somevalue"); + CellStyle cellStyle2 = wb.createCellStyle(); + + + cellStyle2.setDataFormat(format.getFormat("###0")); + + cellStyle2.setFillBackgroundColor(IndexedColors.DARK_BLUE.getIndex()); + cellStyle2.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex()); + cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND); + + cellStyle2.setAlignment(HorizontalAlignment.RIGHT); + cellStyle2.setVerticalAlignment(VerticalAlignment.TOP); + + cell.setCellStyle(cellStyle2); + + try (Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb)) { + Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(1); + assertNotNull(cellBack); + CellStyle styleBack = cellBack.getCellStyle(); + assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillBackgroundColor()); + assertEquals(IndexedColors.DARK_BLUE.getIndex(), styleBack.getFillForegroundColor()); + assertEquals(HorizontalAlignment.RIGHT, styleBack.getAlignment()); + assertEquals(VerticalAlignment.TOP, styleBack.getVerticalAlignment()); + assertEquals(FillPatternType.SOLID_FOREGROUND, styleBack.getFillPattern()); + } + } } public static void copyStyles(Workbook reference, Workbook target) { @@ -1070,7 +1050,7 @@ public class TestXSSFCellStyle { assertNull(cellStyle.getFillBackgroundColorColor()); cellStyle.setFillPattern(FillPatternType.NO_FILL); - assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPatternEnum()); + assertEquals(FillPatternType.NO_FILL, cellStyle.getFillPattern()); cellStyle.setBottomBorderColor(null); assertNull(cellStyle.getBottomBorderXSSFColor()); diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java index 7666cccbb1..f90f44830a 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java +++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java @@ -195,7 +195,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter */ protected boolean isEmptyStyle( CellStyle cellStyle ) { return cellStyle == null || ( - cellStyle.getFillPattern() == 0 + cellStyle.getFillPattern() == FillPatternType.NO_FILL && cellStyle.getBorderTopEnum() == BorderStyle.NONE && cellStyle.getBorderRightEnum() == BorderStyle.NONE && cellStyle.getBorderBottomEnum() == BorderStyle.NONE @@ -336,16 +336,16 @@ public class ExcelToFoConverter extends AbstractExcelConverter { blockTarget.setAttribute( "white-space-collapse", "false" ); { - String textAlign = ExcelToFoUtils.getAlign( cellStyle.getAlignmentEnum() ); + String textAlign = ExcelToFoUtils.getAlign( cellStyle.getAlignment() ); if ( ExcelToFoUtils.isNotEmpty( textAlign ) ) blockTarget.setAttribute( "text-align", textAlign ); } - if ( cellStyle.getFillPatternEnum() == FillPatternType.NO_FILL ) + if ( cellStyle.getFillPattern() == FillPatternType.NO_FILL ) { // no fill } - else if ( cellStyle.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND ) + else if ( cellStyle.getFillPattern() == FillPatternType.SOLID_FOREGROUND ) { final HSSFColor foregroundColor = cellStyle .getFillForegroundColorColor(); diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java index 1befb72e46..c0c8927b8f 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java +++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java @@ -190,9 +190,9 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter StringBuilder style = new StringBuilder(); style.append( "white-space:pre-wrap;" ); - ExcelToHtmlUtils.appendAlign( style, cellStyle.getAlignmentEnum() ); + ExcelToHtmlUtils.appendAlign( style, cellStyle.getAlignment() ); - switch (cellStyle.getFillPatternEnum()) { + switch (cellStyle.getFillPattern()) { // no fill case NO_FILL: break; case SOLID_FOREGROUND: @@ -444,7 +444,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter innerDivStyle.append( "overflow:hidden;max-height:" ); innerDivStyle.append( normalHeightPt ); innerDivStyle.append( "pt;white-space:nowrap;" ); - ExcelToHtmlUtils.appendAlign( innerDivStyle, cellStyle.getAlignmentEnum() ); + ExcelToHtmlUtils.appendAlign( innerDivStyle, cellStyle.getAlignment() ); htmlDocumentFacade.addStyleClass( outerDiv, cssClassPrefixDiv, innerDivStyle.toString() ); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java b/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java index 6505a391db..844b61270d 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java @@ -232,17 +232,17 @@ public final class TestCellStyle extends TestCase { orig.setFont(fnt); orig.setDataFormat((short)18); - assertEquals(HorizontalAlignment.JUSTIFY, orig.getAlignmentEnum()); + assertEquals(HorizontalAlignment.JUSTIFY, orig.getAlignment()); assertEquals(fnt, orig.getFont(wb)); assertEquals(18, orig.getDataFormat()); HSSFCellStyle clone = wb.createCellStyle(); - assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum()); + assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment()); assertFalse(fnt == clone.getFont(wb)); assertFalse(18 == clone.getDataFormat()); clone.cloneStyleFrom(orig); - assertEquals(HorizontalAlignment.JUSTIFY, clone.getAlignmentEnum()); + assertEquals(HorizontalAlignment.JUSTIFY, clone.getAlignment()); assertEquals(fnt, clone.getFont(wb)); assertEquals(18, clone.getDataFormat()); assertEquals(5, wb.getNumberOfFonts()); @@ -268,7 +268,7 @@ public final class TestCellStyle extends TestCase { orig.setFont(fnt); orig.setDataFormat(fmt.getFormat("Test##")); - assertEquals(HorizontalAlignment.RIGHT, orig.getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, orig.getAlignment()); assertEquals(fnt, orig.getFont(wbOrig)); assertEquals(fmt.getFormat("Test##"), orig.getDataFormat()); @@ -280,11 +280,11 @@ public final class TestCellStyle extends TestCase { HSSFCellStyle clone = wbClone.createCellStyle(); assertEquals(4, wbClone.getNumberOfFonts()); - assertFalse(HorizontalAlignment.RIGHT == clone.getAlignmentEnum()); + assertFalse(HorizontalAlignment.RIGHT == clone.getAlignment()); assertFalse("TestingFont" == clone.getFont(wbClone).getFontName()); clone.cloneStyleFrom(orig); - assertEquals(HorizontalAlignment.RIGHT, clone.getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, clone.getAlignment()); assertEquals("TestingFont", clone.getFont(wbClone).getFontName()); assertEquals(fmtClone.getFormat("Test##"), clone.getDataFormat()); assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##")); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java index f2f572458d..58e07d65b6 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java @@ -103,7 +103,7 @@ public final class TestHSSFPalette { assertEquals(64, cellA.getCellStyle().getFillForegroundColor()); assertEquals(64, cellA.getCellStyle().getFillBackgroundColor()); assertEquals(Font.COLOR_NORMAL, cellA.getCellStyle().getFont(book).getColor()); - assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPatternEnum()); + assertEquals(FillPatternType.NO_FILL, cellA.getCellStyle().getFillPattern()); assertEquals("0:0:0", p.getColor((short)64).getHexString()); assertEquals(null, p.getColor((short)32767)); @@ -112,7 +112,7 @@ public final class TestHSSFPalette { assertEquals(64, cellB.getCellStyle().getFillForegroundColor()); assertEquals(64, cellB.getCellStyle().getFillBackgroundColor()); assertEquals(10, cellB.getCellStyle().getFont(book).getColor()); - assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPatternEnum()); + assertEquals(FillPatternType.NO_FILL, cellB.getCellStyle().getFillPattern()); assertEquals("0:0:0", p.getColor((short)64).getHexString()); assertEquals("FFFF:0:0", p.getColor((short)10).getHexString()); @@ -121,7 +121,7 @@ public final class TestHSSFPalette { assertEquals(11, cellC.getCellStyle().getFillForegroundColor()); assertEquals(64, cellC.getCellStyle().getFillBackgroundColor()); assertEquals(10, cellC.getCellStyle().getFont(book).getColor()); - assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPatternEnum()); + assertEquals(FillPatternType.SOLID_FOREGROUND, cellC.getCellStyle().getFillPattern()); assertEquals("0:FFFF:0", p.getColor((short)11).getHexString()); assertEquals("FFFF:0:0", p.getColor((short)10).getHexString()); @@ -130,7 +130,7 @@ public final class TestHSSFPalette { assertEquals(13, cellD.getCellStyle().getFillForegroundColor()); assertEquals(64, cellD.getCellStyle().getFillBackgroundColor()); assertEquals(14, cellD.getCellStyle().getFont(book).getColor()); - assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPatternEnum()); + assertEquals(FillPatternType.NO_FILL, cellD.getCellStyle().getFillPattern()); assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString()); assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString()); @@ -139,7 +139,7 @@ public final class TestHSSFPalette { assertEquals(13, cellE.getCellStyle().getFillForegroundColor()); assertEquals(64, cellE.getCellStyle().getFillBackgroundColor()); assertEquals(14, cellE.getCellStyle().getFont(book).getColor()); - assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPatternEnum()); + assertEquals(FillPatternType.NO_FILL, cellE.getCellStyle().getFillPattern()); assertEquals("FFFF:FFFF:0", p.getColor((short)13).getHexString()); assertEquals("FFFF:0:FFFF", p.getColor((short)14).getHexString()); } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestRowStyle.java b/src/testcases/org/apache/poi/hssf/usermodel/TestRowStyle.java index dfdff98d02..666e72dc87 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestRowStyle.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestRowStyle.java @@ -160,7 +160,7 @@ public final class TestRowStyle extends TestCase { assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRightEnum()); assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTopEnum()); assertEquals("FillForegroundColor for row:", 0xA, cs.getFillForegroundColor()); - assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPatternEnum()); + assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPattern()); rownum++; if (rownum >= 100) break; // I feel too lazy to check if this isreqd :-/ @@ -169,7 +169,7 @@ public final class TestRowStyle extends TestCase { assertNotNull("Row is not null", r); cs2 = r.getRowStyle(); assertEquals("FillForegroundColor for row: ", cs2.getFillForegroundColor(), (short) 0x0); - assertEquals("FillPattern for row: ", cs2.getFillPatternEnum(), FillPatternType.BRICKS); + assertEquals("FillPattern for row: ", cs2.getFillPattern(), FillPatternType.BRICKS); } IOUtils.closeQuietly(wb2); } diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java index 00bd9d3cf0..0f1079c9c0 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java @@ -715,7 +715,7 @@ public abstract class BaseTestCell { assertFalse(style.getHidden()); assertEquals(0, style.getIndention()); assertEquals(0, style.getFontIndex()); - assertEquals(HorizontalAlignment.GENERAL, style.getAlignmentEnum()); + assertEquals(HorizontalAlignment.GENERAL, style.getAlignment()); assertEquals(0, style.getDataFormat()); assertEquals(false, style.getWrapText()); diff --git a/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java b/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java index e7af379fd0..090cf0ccb8 100644 --- a/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java +++ b/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java @@ -224,17 +224,17 @@ public class BaseTestCellUtil { // should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call. // HSSFCellStyle wraps an underlying style record, and the underlying // style record is the same between multiple getCellStyle() calls. - assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignmentEnum()); - assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum()); + assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignment()); + assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment()); // get/set alignment modifies the cell's style CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT); - assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignment()); // get/set alignment doesn't affect the style of cells with // the same style prior to modifying the style assertNotEquals(A1.getCellStyle(), B1.getCellStyle()); - assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum()); + assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment()); wb.close(); } @@ -252,17 +252,17 @@ public class BaseTestCellUtil { // should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call. // HSSFCellStyle wraps an underlying style record, and the underlying // style record is the same between multiple getCellStyle() calls. - assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignmentEnum()); - assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum()); + assertEquals(HorizontalAlignment.GENERAL, A1.getCellStyle().getAlignment()); + assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment()); // get/set alignment modifies the cell's style CellUtil.setAlignment(A1, HorizontalAlignment.RIGHT); - assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignmentEnum()); + assertEquals(HorizontalAlignment.RIGHT, A1.getCellStyle().getAlignment()); // get/set alignment doesn't affect the style of cells with // the same style prior to modifying the style assertNotEquals(A1.getCellStyle(), B1.getCellStyle()); - assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignmentEnum()); + assertEquals(HorizontalAlignment.GENERAL, B1.getCellStyle().getAlignment()); wb.close(); } @@ -280,17 +280,17 @@ public class BaseTestCellUtil { // should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call. // HSSFCellStyle wraps an underlying style record, and the underlying // style record is the same between multiple getCellStyle() calls. - assertEquals(VerticalAlignment.BOTTOM, A1.getCellStyle().getVerticalAlignmentEnum()); - assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignmentEnum()); + assertEquals(VerticalAlignment.BOTTOM, A1.getCellStyle().getVerticalAlignment()); + assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignment()); // get/set alignment modifies the cell's style CellUtil.setVerticalAlignment(A1, VerticalAlignment.TOP); - assertEquals(VerticalAlignment.TOP, A1.getCellStyle().getVerticalAlignmentEnum()); + assertEquals(VerticalAlignment.TOP, A1.getCellStyle().getVerticalAlignment()); // get/set alignment doesn't affect the style of cells with // the same style prior to modifying the style assertNotEquals(A1.getCellStyle(), B1.getCellStyle()); - assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignmentEnum()); + assertEquals(VerticalAlignment.BOTTOM, B1.getCellStyle().getVerticalAlignment()); wb.close(); } @@ -375,7 +375,7 @@ public class BaseTestCellUtil { CellUtil.setCellStyleProperties(A1, properties); CellStyle style = A1.getCellStyle(); - assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPatternEnum()); + 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(); @@ -395,7 +395,7 @@ public class BaseTestCellUtil { CellUtil.setCellStyleProperties(A1, properties); CellStyle style = A1.getCellStyle(); - assertEquals("fill pattern", FillPatternType.BRICKS, style.getFillPatternEnum()); + 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())); |