Remove use of deprecated methods

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812911 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-10-22 13:03:33 +00:00
parent 1ea1a692e0
commit 26cc1e4d32
20 changed files with 199 additions and 293 deletions

View File

@ -161,8 +161,8 @@ public class SVTableCellRenderer extends JLabel
SVTableUtils.getAWTColor(s.getRightBorderColor(), SVTableUtils.black),
SVTableUtils.getAWTColor(s.getBottomBorderColor(), SVTableUtils.black),
SVTableUtils.getAWTColor(s.getLeftBorderColor(), SVTableUtils.black),
s.getBorderTopEnum(), s.getBorderRightEnum(),
s.getBorderBottomEnum(), s.getBorderLeftEnum(),
s.getBorderTop(), s.getBorderRight(),
s.getBorderBottom(), s.getBorderLeft(),
hasFocus);
setBorder(cellBorder);
isBorderSet=true;

View File

@ -352,23 +352,23 @@ public class ExcelComparator {
String borderName;
switch (borderSide) {
case 't': default:
b1 = style1.getBorderTopEnum() == BorderStyle.THIN;
b2 = style2.getBorderTopEnum() == BorderStyle.THIN;
b1 = style1.getBorderTop() == BorderStyle.THIN;
b2 = style2.getBorderTop() == BorderStyle.THIN;
borderName = "TOP";
break;
case 'b':
b1 = style1.getBorderBottomEnum() == BorderStyle.THIN;
b2 = style2.getBorderBottomEnum() == BorderStyle.THIN;
b1 = style1.getBorderBottom() == BorderStyle.THIN;
b2 = style2.getBorderBottom() == BorderStyle.THIN;
borderName = "BOTTOM";
break;
case 'l':
b1 = style1.getBorderLeftEnum() == BorderStyle.THIN;
b2 = style2.getBorderLeftEnum() == BorderStyle.THIN;
b1 = style1.getBorderLeft() == BorderStyle.THIN;
b2 = style2.getBorderLeft() == BorderStyle.THIN;
borderName = "LEFT";
break;
case 'r':
b1 = style1.getBorderRightEnum() == BorderStyle.THIN;
b2 = style2.getBorderRightEnum() == BorderStyle.THIN;
b1 = style1.getBorderRight() == BorderStyle.THIN;
b2 = style2.getBorderRight() == BorderStyle.THIN;
borderName = "RIGHT";
break;
}

View File

@ -297,10 +297,10 @@ public class ToHtml {
}
private void borderStyles(CellStyle style) {
styleOut("border-left", style.getBorderLeftEnum(), BORDER);
styleOut("border-right", style.getBorderRightEnum(), BORDER);
styleOut("border-top", style.getBorderTopEnum(), BORDER);
styleOut("border-bottom", style.getBorderBottomEnum(), BORDER);
styleOut("border-left", style.getBorderLeft(), BORDER);
styleOut("border-right", style.getBorderRight(), BORDER);
styleOut("border-top", style.getBorderTop(), BORDER);
styleOut("border-bottom", style.getBorderBottom(), BORDER);
}
private void fontStyle(CellStyle style) {

View File

@ -408,28 +408,15 @@ public final class HSSFCellStyle implements CellStyle {
_format.setBorderLeft(border.getCode());
}
/**
* get the type of border to use for the left border of the cell
* @return border type
* @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderLeftEnum()}.
*/
@Deprecated
@Override
public short getBorderLeft()
{
return _format.getBorderLeft();
}
/**
* get the type of border to use for the left border of the cell
* @return border type
* @since POI 3.15
*/
@Override
public BorderStyle getBorderLeftEnum()
public BorderStyle getBorderLeft()
{
return BorderStyle.valueOf(_format.getBorderLeft());
}
@Override
public BorderStyle getBorderLeftEnum() { return getBorderLeft(); }
/**
* set the type of border to use for the right border of the cell
* @param border type
@ -442,28 +429,15 @@ public final class HSSFCellStyle implements CellStyle {
_format.setBorderRight(border.getCode());
}
/**
* get the type of border to use for the right border of the cell
* @return border type
* @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderRightEnum()}.
*/
@Deprecated
@Override
public short getBorderRight()
{
return _format.getBorderRight();
}
/**
* get the type of border to use for the right border of the cell
* @return border type
* @since POI 3.15
*/
@Override
public BorderStyle getBorderRightEnum()
public BorderStyle getBorderRight()
{
return BorderStyle.valueOf(_format.getBorderRight());
}
@Override
public BorderStyle getBorderRightEnum() { return getBorderRight(); }
/**
* set the type of border to use for the top border of the cell
* @param border type
@ -476,28 +450,15 @@ public final class HSSFCellStyle implements CellStyle {
_format.setBorderTop(border.getCode());
}
/**
* get the type of border to use for the top border of the cell
* @return border type
* @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderTopEnum()}.
*/
@Deprecated
@Override
public short getBorderTop()
{
return _format.getBorderTop();
}
/**
* get the type of border to use for the top border of the cell
* @return border type
* @since 3.15
*/
@Override
public BorderStyle getBorderTopEnum()
public BorderStyle getBorderTop()
{
return BorderStyle.valueOf(_format.getBorderTop());
}
@Override
public BorderStyle getBorderTopEnum() { return getBorderTop(); }
/**
* set the type of border to use for the bottom border of the cell
* @param border type
@ -510,28 +471,15 @@ public final class HSSFCellStyle implements CellStyle {
_format.setBorderBottom(border.getCode());
}
/**
* get the type of border to use for the bottom border of the cell
* @return border type
* @deprecated POI 3.15. Will return a BorderStyle enum in the future. Use {@link #getBorderBottomEnum()}.
*/
@Deprecated
@Override
public short getBorderBottom()
{
return _format.getBorderBottom();
}
/**
* get the type of border to use for the bottom border of the cell
* @return border type
* @since 3.15
*/
@Override
public BorderStyle getBorderBottomEnum()
public BorderStyle getBorderBottom()
{
return BorderStyle.valueOf(_format.getBorderBottom());
}
@Override
public BorderStyle getBorderBottomEnum() { return getBorderBottom(); }
/**
* set the color to use for the left border
* @param color The index of the color definition

View File

@ -208,15 +208,17 @@ public interface CellStyle {
/**
* get the type of border to use for the left border of the cell
* @return border type
* @deprecated POI 3.15. Use {@link #getBorderLeftEnum()} instead.
* This will return a BorderStyle enum in the future.
* @since POI 4.0.0
*/
short getBorderLeft();
BorderStyle getBorderLeft();
/**
* get the type of border to use for the left border of the cell
* @return border type
* @since POI 3.15
* @deprecated use <code>getBorderLeft()</code> instead
*/
@Removal(version = "4.2")
BorderStyle getBorderLeftEnum();
/**
@ -229,15 +231,17 @@ public interface CellStyle {
/**
* get the type of border to use for the right border of the cell
* @return border type
* @deprecated POI 3.15. Use {@link #getBorderRightEnum()} instead.
* This will return a BorderStyle enum in the future.
* @since POI 4.0.0
*/
short getBorderRight();
BorderStyle getBorderRight();
/**
* get the type of border to use for the right border of the cell
* @return border type
* @since POI 3.15
* @deprecated use <code>getBorderRight()</code> instead
*/
@Removal(version = "4.2")
BorderStyle getBorderRightEnum();
/**
@ -250,15 +254,17 @@ public interface CellStyle {
/**
* get the type of border to use for the top border of the cell
* @return border type
* @deprecated POI 3.15. Use {@link #getBorderTopEnum()} instead.
* This will return a BorderStyle enum in the future.
* @since POI 4.0.0
*/
short getBorderTop();
BorderStyle getBorderTop();
/**
* get the type of border to use for the top border of the cell
* @return border type
* @since POI 3.15
* @deprecated use <code>getBorderTop()</code> instead
*/
@Removal(version = "4.2")
BorderStyle getBorderTopEnum();
/**
@ -271,15 +277,17 @@ public interface CellStyle {
/**
* get the type of border to use for the bottom border of the cell
* @return border type
* @deprecated POI 3.15. Use {@link #getBorderBottomEnum()} instead.
* This will return a BorderStyle enum in the future.
* @since POI 4.0.0
*/
short getBorderBottom();
BorderStyle getBorderBottom();
/**
* get the type of border to use for the bottom border of the cell
* @return border type
* @since POI 3.15
* @deprecated use <code>getBorderBottom()</code> instead
*/
@Removal(version = "4.2")
BorderStyle getBorderBottomEnum();
/**

View File

@ -337,10 +337,10 @@ public final class CellUtil {
Map<String, Object> properties = new HashMap<>();
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, BORDER_BOTTOM, style.getBorderBottom());
put(properties, BORDER_LEFT, style.getBorderLeft());
put(properties, BORDER_RIGHT, style.getBorderRight());
put(properties, BORDER_TOP, style.getBorderTop());
put(properties, BOTTOM_BORDER_COLOR, style.getBottomBorderColor());
put(properties, DATA_FORMAT, style.getDataFormat());
put(properties, FILL_PATTERN, style.getFillPattern());

View File

@ -230,15 +230,9 @@ public class XSSFCellStyle implements CellStyle {
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
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
* @since POI 3.15
*/
@Override
public BorderStyle getBorderBottomEnum() {
public BorderStyle getBorderBottom() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
@ -249,26 +243,14 @@ public class XSSFCellStyle implements CellStyle {
}
return BorderStyle.valueOf((short)(ptrn.intValue() - 1));
}
/**
* Get the type of border to use for the bottom border of the cell
* This will return a BorderStyle enum in the future.
*
* @return border type code
* @deprecated 3.15 beta 2. Use {@link #getBorderBottomEnum()}
*/
public short getBorderBottom() {
return getBorderBottomEnum().getCode();
@Override
public BorderStyle getBorderBottomEnum() {
return getBorderBottom();
}
/**
* Get the type of border to use for the left border of the cell
* Will be removed when {@link #getBorderLeft()} returns a BorderStyle enum
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
* @since POI 3.15
*/
@Override
public BorderStyle getBorderLeftEnum() {
public BorderStyle getBorderLeft() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
@ -280,26 +262,11 @@ public class XSSFCellStyle implements CellStyle {
return BorderStyle.valueOf((short)(ptrn.intValue() - 1));
}
/**
* Get the type of border to use for the left border of the cell
* This will return a BorderStyle enum in the future.
*
* @return border type code
* @deprecated 3.15 beta 2. Use {@link #getBorderLeftEnum()}
*/
public short getBorderLeft() {
return getBorderLeftEnum().getCode();
}
/**
* Get the type of border to use for the right border of the cell
* Will be removed when {@link #getBorderRight()} returns a BorderStyle enum
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
* @since POI 3.15
*/
@Override
public BorderStyle getBorderRightEnum() {
public BorderStyle getBorderLeftEnum() { return getBorderLeft(); }
@Override
public BorderStyle getBorderRight() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
@ -310,26 +277,14 @@ public class XSSFCellStyle implements CellStyle {
}
return BorderStyle.valueOf((short)(ptrn.intValue() - 1));
}
/**
* Get the type of border to use for the right border of the cell
* This will return a BorderStyle enum in the future.
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
* @deprecated 3.15 beta 2. Use {@link #getBorderRightEnum()} instead
*/
public short getBorderRight() {
return getBorderRightEnum().getCode();
@Override
public BorderStyle getBorderRightEnum() {
return getBorderRight();
}
/**
* Get the type of border to use for the top border of the cell
* Will be removed when {@link #getBorderTop()} returns a BorderStyle enum
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
* @since POI 3.15
*/
@Override
public BorderStyle getBorderTopEnum() {
public BorderStyle getBorderTop() {
if(!_cellXf.getApplyBorder()) return BorderStyle.NONE;
int idx = (int)_cellXf.getBorderId();
@ -340,15 +295,10 @@ public class XSSFCellStyle implements CellStyle {
}
return BorderStyle.valueOf((short) (ptrn.intValue() - 1));
}
/**
* Get the type of border to use for the top border of the cell
* This will return a BorderStyle enum in the future.
*
* @return border type, default value is {@link org.apache.poi.ss.usermodel.BorderStyle#NONE}
* @deprecated 3.15 beta 2. Use {@link #getBorderTopEnum()} instead.
*/
public short getBorderTop() {
return getBorderTopEnum().getCode();
@Override
public BorderStyle getBorderTopEnum() {
return getBorderTop();
}
/**

View File

@ -49,13 +49,13 @@ public class TestXSSFPropertyTemplate {
for (Row row: sheet) {
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
}
}
@ -67,28 +67,28 @@ public class TestXSSFPropertyTemplate {
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
if (cell.getColumnIndex() != 1 || row.getRowNum() == 0) {
assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderTopEnum());
assertEquals(BorderStyle.NONE, cs.getBorderTop());
}
if (cell.getColumnIndex() != 1 || row.getRowNum() == 2) {
assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderBottomEnum());
assertEquals(BorderStyle.NONE, cs.getBorderBottom());
}
if (cell.getColumnIndex() == 0 || row.getRowNum() != 1) {
assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderLeftEnum());
assertEquals(BorderStyle.NONE, cs.getBorderLeft());
}
if (cell.getColumnIndex() == 2 || row.getRowNum() != 1) {
assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderRightEnum());
assertEquals(BorderStyle.NONE, cs.getBorderRight());
}
}
}
@ -120,10 +120,10 @@ public class TestXSSFPropertyTemplate {
for (Row row : sheet) {
for (Cell cell : row) {
CellStyle cs = cell.getCellStyle();
assertEquals(BorderStyle.MEDIUM, cs.getBorderTopEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderBottomEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderLeftEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderTop());
assertEquals(BorderStyle.MEDIUM, cs.getBorderBottom());
assertEquals(BorderStyle.MEDIUM, cs.getBorderLeft());
assertEquals(BorderStyle.MEDIUM, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());

View File

@ -104,11 +104,11 @@ public class TestXSSFCellStyle {
@Test
public void testGetSetBorderBottom() {
//default values
assertEquals(BorderStyle.NONE, cellStyle.getBorderBottomEnum());
assertEquals(BorderStyle.NONE, cellStyle.getBorderBottom());
int num = stylesTable.getBorders().size();
cellStyle.setBorderBottom(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottomEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottom());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
@ -122,7 +122,7 @@ public class TestXSSFCellStyle {
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderBottom(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottomEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderBottom());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@ -139,11 +139,11 @@ public class TestXSSFCellStyle {
@Test
public void testGetSetBorderRight() {
//default values
assertEquals(BorderStyle.NONE, cellStyle.getBorderRightEnum());
assertEquals(BorderStyle.NONE, cellStyle.getBorderRight());
int num = stylesTable.getBorders().size();
cellStyle.setBorderRight(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRight());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
@ -157,7 +157,7 @@ public class TestXSSFCellStyle {
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderRight(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderRight());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@ -174,11 +174,11 @@ public class TestXSSFCellStyle {
@Test
public void testGetSetBorderLeft() {
//default values
assertEquals(BorderStyle.NONE, cellStyle.getBorderLeftEnum());
assertEquals(BorderStyle.NONE, cellStyle.getBorderLeft());
int num = stylesTable.getBorders().size();
cellStyle.setBorderLeft(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeftEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeft());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
@ -192,7 +192,7 @@ public class TestXSSFCellStyle {
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderLeft(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeftEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderLeft());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@ -209,11 +209,11 @@ public class TestXSSFCellStyle {
@Test
public void testGetSetBorderTop() {
//default values
assertEquals(BorderStyle.NONE, cellStyle.getBorderTopEnum());
assertEquals(BorderStyle.NONE, cellStyle.getBorderTop());
int num = stylesTable.getBorders().size();
cellStyle.setBorderTop(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTopEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTop());
//a new border has been added
assertEquals(num + 1, stylesTable.getBorders().size());
//id of the created border
@ -227,7 +227,7 @@ public class TestXSSFCellStyle {
//setting the same border multiple times should not change borderId
for (int i = 0; i < 3; i++) {
cellStyle.setBorderTop(BorderStyle.MEDIUM);
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTopEnum());
assertEquals(BorderStyle.MEDIUM, cellStyle.getBorderTop());
}
assertEquals(borderId, cellStyle.getCoreXf().getBorderId());
assertEquals(num, stylesTable.getBorders().size());
@ -243,7 +243,7 @@ public class TestXSSFCellStyle {
private void testGetSetBorderXMLBean(BorderStyle border, STBorderStyle.Enum expected) {
cellStyle.setBorderTop(border);
assertEquals(border, cellStyle.getBorderTopEnum());
assertEquals(border, cellStyle.getBorderTop());
int borderId = (int)cellStyle.getCoreXf().getBorderId();
assertTrue(borderId > 0);
//check changes in the underlying xml bean
@ -256,7 +256,7 @@ public class TestXSSFCellStyle {
@Test
public void testGetSetBorderNone() {
cellStyle.setBorderTop(BorderStyle.NONE);
assertEquals(BorderStyle.NONE, cellStyle.getBorderTopEnum());
assertEquals(BorderStyle.NONE, cellStyle.getBorderTop());
int borderId = (int)cellStyle.getCoreXf().getBorderId();
assertTrue(borderId > 0);
//check changes in the underlying xml bean
@ -563,10 +563,10 @@ public class TestXSSFCellStyle {
assertEquals(style2.getRightBorderColor(), style1.getRightBorderColor());
assertEquals(style2.getBottomBorderColor(), style1.getBottomBorderColor());
assertEquals(style2.getBorderBottomEnum(), style1.getBorderBottomEnum());
assertEquals(style2.getBorderLeftEnum(), style1.getBorderLeftEnum());
assertEquals(style2.getBorderRightEnum(), style1.getBorderRightEnum());
assertEquals(style2.getBorderTopEnum(), style1.getBorderTopEnum());
assertEquals(style2.getBorderBottom(), style1.getBorderBottom());
assertEquals(style2.getBorderLeft(), style1.getBorderLeft());
assertEquals(style2.getBorderRight(), style1.getBorderRight());
assertEquals(style2.getBorderTop(), style1.getBorderTop());
wb2.close();
}
@ -1003,7 +1003,7 @@ public class TestXSSFCellStyle {
Workbook copy = XSSFTestDataSamples.writeOutAndReadBack(target);
// previously this failed because the border-element was not copied over
copy.getCellStyleAt((short)1).getBorderBottomEnum();
copy.getCellStyleAt((short)1).getBorderBottom();
copy.close();

View File

@ -196,10 +196,10 @@ public class ExcelToFoConverter extends AbstractExcelConverter
protected boolean isEmptyStyle( CellStyle cellStyle ) {
return cellStyle == null || (
cellStyle.getFillPattern() == FillPatternType.NO_FILL
&& cellStyle.getBorderTopEnum() == BorderStyle.NONE
&& cellStyle.getBorderRightEnum() == BorderStyle.NONE
&& cellStyle.getBorderBottomEnum() == BorderStyle.NONE
&& cellStyle.getBorderLeftEnum() == BorderStyle.NONE
&& cellStyle.getBorderTop() == BorderStyle.NONE
&& cellStyle.getBorderRight() == BorderStyle.NONE
&& cellStyle.getBorderBottom() == BorderStyle.NONE
&& cellStyle.getBorderLeft() == BorderStyle.NONE
);
}
@ -363,13 +363,13 @@ public class ExcelToFoConverter extends AbstractExcelConverter
}
processCellStyleBorder( workbook, cellTarget, "top",
cellStyle.getBorderTopEnum(), cellStyle.getTopBorderColor() );
cellStyle.getBorderTop(), cellStyle.getTopBorderColor() );
processCellStyleBorder( workbook, cellTarget, "right",
cellStyle.getBorderRightEnum(), cellStyle.getRightBorderColor() );
cellStyle.getBorderRight(), cellStyle.getRightBorderColor() );
processCellStyleBorder( workbook, cellTarget, "bottom",
cellStyle.getBorderBottomEnum(), cellStyle.getBottomBorderColor() );
cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
processCellStyleBorder( workbook, cellTarget, "left",
cellStyle.getBorderLeftEnum(), cellStyle.getLeftBorderColor() );
cellStyle.getBorderLeft(), cellStyle.getLeftBorderColor() );
HSSFFont font = cellStyle.getFont( workbook );
processCellStyleFont( workbook, blockTarget, font );

View File

@ -209,13 +209,13 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
break;
}
buildStyle_border( workbook, style, "top", cellStyle.getBorderTopEnum(),
buildStyle_border( workbook, style, "top", cellStyle.getBorderTop(),
cellStyle.getTopBorderColor() );
buildStyle_border( workbook, style, "right",
cellStyle.getBorderRightEnum(), cellStyle.getRightBorderColor() );
cellStyle.getBorderRight(), cellStyle.getRightBorderColor() );
buildStyle_border( workbook, style, "bottom",
cellStyle.getBorderBottomEnum(), cellStyle.getBottomBorderColor() );
buildStyle_border( workbook, style, "left", cellStyle.getBorderLeftEnum(),
cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
buildStyle_border( workbook, style, "left", cellStyle.getBorderLeft(),
cellStyle.getLeftBorderColor() );
HSSFFont font = cellStyle.getFont( workbook );

View File

@ -2595,7 +2595,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
Row row = sheet.getRow(0);
CellStyle rstyle = row.getRowStyle();
assertNotNull(rstyle);
assertEquals(BorderStyle.DOUBLE, rstyle.getBorderBottomEnum());
assertEquals(BorderStyle.DOUBLE, rstyle.getBorderBottom());
wb.close();
}

View File

@ -350,40 +350,40 @@ public final class TestCellStyle extends TestCase {
HSSFCellStyle cs;
cs = s.getRow(0).getCell(0).getCellStyle();
assertEquals(BorderStyle.HAIR, cs.getBorderRightEnum());
assertEquals(BorderStyle.HAIR, cs.getBorderRight());
cs = s.getRow(1).getCell(1).getCellStyle();
assertEquals(BorderStyle.DOTTED, cs.getBorderRightEnum());
assertEquals(BorderStyle.DOTTED, cs.getBorderRight());
cs = s.getRow(2).getCell(2).getCellStyle();
assertEquals(BorderStyle.DASH_DOT_DOT, cs.getBorderRightEnum());
assertEquals(BorderStyle.DASH_DOT_DOT, cs.getBorderRight());
cs = s.getRow(3).getCell(3).getCellStyle();
assertEquals(BorderStyle.DASHED, cs.getBorderRightEnum());
assertEquals(BorderStyle.DASHED, cs.getBorderRight());
cs = s.getRow(4).getCell(4).getCellStyle();
assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals(BorderStyle.THIN, cs.getBorderRight());
cs = s.getRow(5).getCell(5).getCellStyle();
assertEquals(BorderStyle.MEDIUM_DASH_DOT_DOT, cs.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM_DASH_DOT_DOT, cs.getBorderRight());
cs = s.getRow(6).getCell(6).getCellStyle();
assertEquals(BorderStyle.SLANTED_DASH_DOT, cs.getBorderRightEnum());
assertEquals(BorderStyle.SLANTED_DASH_DOT, cs.getBorderRight());
cs = s.getRow(7).getCell(7).getCellStyle();
assertEquals(BorderStyle.MEDIUM_DASH_DOT, cs.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM_DASH_DOT, cs.getBorderRight());
cs = s.getRow(8).getCell(8).getCellStyle();
assertEquals(BorderStyle.MEDIUM_DASHED, cs.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM_DASHED, cs.getBorderRight());
cs = s.getRow(9).getCell(9).getCellStyle();
assertEquals(BorderStyle.MEDIUM, cs.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderRight());
cs = s.getRow(10).getCell(10).getCellStyle();
assertEquals(BorderStyle.THICK, cs.getBorderRightEnum());
assertEquals(BorderStyle.THICK, cs.getBorderRight());
cs = s.getRow(11).getCell(11).getCellStyle();
assertEquals(BorderStyle.DOUBLE, cs.getBorderRightEnum());
assertEquals(BorderStyle.DOUBLE, cs.getBorderRight());
}
public void testShrinkToFit() {
@ -502,7 +502,7 @@ public final class TestCellStyle extends TestCase {
newCell.setCellValue("2testtext2");
CellStyle newStyle = newCell.getCellStyle();
assertEquals(BorderStyle.DOTTED, newStyle.getBorderBottomEnum());
assertEquals(BorderStyle.DOTTED, newStyle.getBorderBottom());
assertEquals(Font.COLOR_RED, ((HSSFCellStyle)newStyle).getFont(wb).getColor());
// OutputStream out = new FileOutputStream("/tmp/56959.xls");

View File

@ -309,8 +309,8 @@ public final class TestHSSFOptimiser extends TestCase {
// Check
assertEquals(23, wb.getNumCellStyles());
assertEquals(BorderStyle.THICK, r.getCell(0).getCellStyle().getBorderBottomEnum());
assertEquals(BorderStyle.DASH_DOT, r.getCell(1).getCellStyle().getBorderBottomEnum());
assertEquals(BorderStyle.THICK, r.getCell(2).getCellStyle().getBorderBottomEnum());
assertEquals(BorderStyle.THICK, r.getCell(0).getCellStyle().getBorderBottom());
assertEquals(BorderStyle.DASH_DOT, r.getCell(1).getCellStyle().getBorderBottom());
assertEquals(BorderStyle.THICK, r.getCell(2).getCellStyle().getBorderBottom());
}
}

View File

@ -155,10 +155,10 @@ public final class TestRowStyle extends TestCase {
assertNotNull("Row is not null", r);
cs = r.getRowStyle();
assertEquals("Bottom Border Style for row:", BorderStyle.THIN, cs.getBorderBottomEnum());
assertEquals("Left Border Style for row:", BorderStyle.THIN, cs.getBorderLeftEnum());
assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals("Bottom Border Style for row:", BorderStyle.THIN, cs.getBorderBottom());
assertEquals("Left Border Style for row:", BorderStyle.THIN, cs.getBorderLeft());
assertEquals("Right Border Style for row:", BorderStyle.THIN, cs.getBorderRight());
assertEquals("Top Border Style for row:", BorderStyle.THIN, cs.getBorderTop());
assertEquals("FillForegroundColor for row:", 0xA, cs.getFillForegroundColor());
assertEquals("FillPattern for row:", FillPatternType.BRICKS, cs.getFillPattern());

View File

@ -73,10 +73,10 @@ public class BaseTestBorderStyle {
protected void assertBorderStyleEquals(BorderStyle expected, Cell cell) {
CellStyle style = cell.getCellStyle();
assertEquals(expected, style.getBorderTopEnum());
assertEquals(expected, style.getBorderBottomEnum());
assertEquals(expected, style.getBorderLeftEnum());
assertEquals(expected, style.getBorderRightEnum());
assertEquals(expected, style.getBorderTop());
assertEquals(expected, style.getBorderBottom());
assertEquals(expected, style.getBorderLeft());
assertEquals(expected, style.getBorderRight());
}
}

View File

@ -277,10 +277,10 @@ public abstract class BaseTestCell {
assertNotNull("Formula Cell Style", cs);
assertEquals("Font Index Matches", f.getIndex(), cs.getFontIndex());
assertEquals("Top Border", BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals("Left Border", BorderStyle.THIN, cs.getBorderLeftEnum());
assertEquals("Right Border", BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals("Bottom Border", BorderStyle.THIN, cs.getBorderBottomEnum());
assertEquals("Top Border", BorderStyle.THIN, cs.getBorderTop());
assertEquals("Left Border", BorderStyle.THIN, cs.getBorderLeft());
assertEquals("Right Border", BorderStyle.THIN, cs.getBorderRight());
assertEquals("Bottom Border", BorderStyle.THIN, cs.getBorderBottom());
wb2.close();
}

View File

@ -96,11 +96,11 @@ public class BaseTestCellUtil {
// A valid BorderStyle constant, as a Short
CellUtil.setCellStyleProperty(c, CellUtil.BORDER_BOTTOM, BorderStyle.DASH_DOT.getCode());
assertEquals(BorderStyle.DASH_DOT, c.getCellStyle().getBorderBottomEnum());
assertEquals(BorderStyle.DASH_DOT, c.getCellStyle().getBorderBottom());
// A valid BorderStyle constant, as an Enum
CellUtil.setCellStyleProperty(c, CellUtil.BORDER_TOP, BorderStyle.MEDIUM_DASH_DOT);
assertEquals(BorderStyle.MEDIUM_DASH_DOT, c.getCellStyle().getBorderTopEnum());
assertEquals(BorderStyle.MEDIUM_DASH_DOT, c.getCellStyle().getBorderTop());
wb.close();
}

View File

@ -862,13 +862,13 @@ public final class TestPropertyTemplate {
for (Row row: sheet) {
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
}
}
@ -880,28 +880,28 @@ public final class TestPropertyTemplate {
for (Cell cell: row) {
CellStyle cs = cell.getCellStyle();
if (cell.getColumnIndex() != 1 || row.getRowNum() == 0) {
assertEquals(BorderStyle.THIN, cs.getBorderTopEnum());
assertEquals(BorderStyle.THIN, cs.getBorderTop());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderTopEnum());
assertEquals(BorderStyle.NONE, cs.getBorderTop());
}
if (cell.getColumnIndex() != 1 || row.getRowNum() == 2) {
assertEquals(BorderStyle.THIN, cs.getBorderBottomEnum());
assertEquals(BorderStyle.THIN, cs.getBorderBottom());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderBottomEnum());
assertEquals(BorderStyle.NONE, cs.getBorderBottom());
}
if (cell.getColumnIndex() == 0 || row.getRowNum() != 1) {
assertEquals(BorderStyle.THIN, cs.getBorderLeftEnum());
assertEquals(BorderStyle.THIN, cs.getBorderLeft());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderLeftEnum());
assertEquals(BorderStyle.NONE, cs.getBorderLeft());
}
if (cell.getColumnIndex() == 2 || row.getRowNum() != 1) {
assertEquals(BorderStyle.THIN, cs.getBorderRightEnum());
assertEquals(BorderStyle.THIN, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getRightBorderColor());
} else {
assertEquals(BorderStyle.NONE, cs.getBorderRightEnum());
assertEquals(BorderStyle.NONE, cs.getBorderRight());
}
}
}
@ -933,10 +933,10 @@ public final class TestPropertyTemplate {
for (Row row : sheet) {
for (Cell cell : row) {
CellStyle cs = cell.getCellStyle();
assertEquals(BorderStyle.MEDIUM, cs.getBorderTopEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderBottomEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderLeftEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderRightEnum());
assertEquals(BorderStyle.MEDIUM, cs.getBorderTop());
assertEquals(BorderStyle.MEDIUM, cs.getBorderBottom());
assertEquals(BorderStyle.MEDIUM, cs.getBorderLeft());
assertEquals(BorderStyle.MEDIUM, cs.getBorderRight());
assertEquals(IndexedColors.RED.getIndex(), cs.getTopBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getBottomBorderColor());
assertEquals(IndexedColors.RED.getIndex(), cs.getLeftBorderColor());

View File

@ -66,43 +66,43 @@ public final class TestRegionUtil {
@Test
public void setBorderTop() {
assertEquals(NONE, getCellStyle(0, 0).getBorderTopEnum());
assertEquals(NONE, getCellStyle(0, 1).getBorderTopEnum());
assertEquals(NONE, getCellStyle(0, 2).getBorderTopEnum());
assertEquals(NONE, getCellStyle(0, 0).getBorderTop());
assertEquals(NONE, getCellStyle(0, 1).getBorderTop());
assertEquals(NONE, getCellStyle(0, 2).getBorderTop());
RegionUtil.setBorderTop(THIN, A1C3, sheet);
assertEquals(THIN, getCellStyle(0, 0).getBorderTopEnum());
assertEquals(THIN, getCellStyle(0, 1).getBorderTopEnum());
assertEquals(THIN, getCellStyle(0, 2).getBorderTopEnum());
assertEquals(THIN, getCellStyle(0, 0).getBorderTop());
assertEquals(THIN, getCellStyle(0, 1).getBorderTop());
assertEquals(THIN, getCellStyle(0, 2).getBorderTop());
}
@Test
public void setBorderBottom() {
assertEquals(NONE, getCellStyle(2, 0).getBorderBottomEnum());
assertEquals(NONE, getCellStyle(2, 1).getBorderBottomEnum());
assertEquals(NONE, getCellStyle(2, 2).getBorderBottomEnum());
assertEquals(NONE, getCellStyle(2, 0).getBorderBottom());
assertEquals(NONE, getCellStyle(2, 1).getBorderBottom());
assertEquals(NONE, getCellStyle(2, 2).getBorderBottom());
RegionUtil.setBorderBottom(THIN, A1C3, sheet);
assertEquals(THIN, getCellStyle(2, 0).getBorderBottomEnum());
assertEquals(THIN, getCellStyle(2, 1).getBorderBottomEnum());
assertEquals(THIN, getCellStyle(2, 2).getBorderBottomEnum());
assertEquals(THIN, getCellStyle(2, 0).getBorderBottom());
assertEquals(THIN, getCellStyle(2, 1).getBorderBottom());
assertEquals(THIN, getCellStyle(2, 2).getBorderBottom());
}
@Test
public void setBorderRight() {
assertEquals(NONE, getCellStyle(0, 2).getBorderRightEnum());
assertEquals(NONE, getCellStyle(1, 2).getBorderRightEnum());
assertEquals(NONE, getCellStyle(2, 2).getBorderRightEnum());
assertEquals(NONE, getCellStyle(0, 2).getBorderRight());
assertEquals(NONE, getCellStyle(1, 2).getBorderRight());
assertEquals(NONE, getCellStyle(2, 2).getBorderRight());
RegionUtil.setBorderRight(THIN, A1C3, sheet);
assertEquals(THIN, getCellStyle(0, 2).getBorderRightEnum());
assertEquals(THIN, getCellStyle(1, 2).getBorderRightEnum());
assertEquals(THIN, getCellStyle(2, 2).getBorderRightEnum());
assertEquals(THIN, getCellStyle(0, 2).getBorderRight());
assertEquals(THIN, getCellStyle(1, 2).getBorderRight());
assertEquals(THIN, getCellStyle(2, 2).getBorderRight());
}
@Test
public void setBorderLeft() {
assertEquals(NONE, getCellStyle(0, 0).getBorderLeftEnum());
assertEquals(NONE, getCellStyle(1, 0).getBorderLeftEnum());
assertEquals(NONE, getCellStyle(2, 0).getBorderLeftEnum());
assertEquals(NONE, getCellStyle(0, 0).getBorderLeft());
assertEquals(NONE, getCellStyle(1, 0).getBorderLeft());
assertEquals(NONE, getCellStyle(2, 0).getBorderLeft());
RegionUtil.setBorderLeft(THIN, A1C3, sheet);
assertEquals(THIN, getCellStyle(0, 0).getBorderLeftEnum());
assertEquals(THIN, getCellStyle(1, 0).getBorderLeftEnum());
assertEquals(THIN, getCellStyle(2, 0).getBorderLeftEnum());
assertEquals(THIN, getCellStyle(0, 0).getBorderLeft());
assertEquals(THIN, getCellStyle(1, 0).getBorderLeft());
assertEquals(THIN, getCellStyle(2, 0).getBorderLeft());
}
@Test
@ -149,9 +149,9 @@ public final class TestRegionUtil {
@Test
public void bordersCanBeAddedToNonExistantCells() {
RegionUtil.setBorderTop(THIN, A1C3, sheet);
assertEquals(THIN, getCellStyle(0, 0).getBorderTopEnum());
assertEquals(THIN, getCellStyle(0, 1).getBorderTopEnum());
assertEquals(THIN, getCellStyle(0, 2).getBorderTopEnum());
assertEquals(THIN, getCellStyle(0, 0).getBorderTop());
assertEquals(THIN, getCellStyle(0, 1).getBorderTop());
assertEquals(THIN, getCellStyle(0, 2).getBorderTop());
}
@Test
public void borderColorsCanBeAddedToNonExistantCells() {