aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java229
-rw-r--r--src/java/org/apache/poi/ss/usermodel/BorderFormatting.java117
-rw-r--r--src/java/org/apache/poi/ss/usermodel/CellStyle.java16
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java125
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java4
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java58
6 files changed, 240 insertions, 309 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java b/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
index a78e323fa8..c3098820c5 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
@@ -43,90 +43,36 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
return borderFormatting;
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderBottomEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderBottom() {
- return (short)borderFormatting.getBorderBottom();
- }
- /**
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderBottomEnum() {
- return BorderStyle.valueOf((short)borderFormatting.getBorderBottom());
+ public BorderStyle getBorderBottom() {
+ return BorderStyle.valueOf((short) borderFormatting.getBorderBottom());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderDiagonalEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
- @Override
- public short getBorderDiagonal() {
- return (short)borderFormatting.getBorderDiagonal();
- }
- /**
- * @since POI 3.15
- */
@Override
- public BorderStyle getBorderDiagonalEnum() {
- return BorderStyle.valueOf((short)borderFormatting.getBorderDiagonal());
+ public BorderStyle getBorderDiagonal() {
+ return BorderStyle.valueOf((short) borderFormatting.getBorderDiagonal());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderLeftEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderLeft() {
- return (short)borderFormatting.getBorderLeft();
- }
- /**
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderLeftEnum() {
- return BorderStyle.valueOf((short)borderFormatting.getBorderLeft());
+ public BorderStyle getBorderLeft() {
+ return BorderStyle.valueOf((short) borderFormatting.getBorderLeft());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderRightEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
- @Override
- public short getBorderRight() {
- return (short)borderFormatting.getBorderRight();
- }
- /**
- * @since POI 3.15
- */
@Override
- public BorderStyle getBorderRightEnum() {
- return BorderStyle.valueOf((short)borderFormatting.getBorderRight());
+ public BorderStyle getBorderRight() {
+ return BorderStyle.valueOf((short) borderFormatting.getBorderRight());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderTopEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderTop() {
- return (short)borderFormatting.getBorderTop();
- }
- /**
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderTopEnum() {
- return BorderStyle.valueOf((short)borderFormatting.getBorderTop());
+ public BorderStyle getBorderTop() {
+ return BorderStyle.valueOf((short) borderFormatting.getBorderTop());
}
@Override
public short getBottomBorderColor() {
- return (short)borderFormatting.getBottomBorderColor();
+ return (short) borderFormatting.getBottomBorderColor();
}
+
@Override
public HSSFColor getBottomBorderColorColor() {
return workbook.getCustomPalette().getColor(
@@ -136,8 +82,9 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
@Override
public short getDiagonalBorderColor() {
- return (short)borderFormatting.getDiagonalBorderColor();
+ return (short) borderFormatting.getDiagonalBorderColor();
}
+
@Override
public HSSFColor getDiagonalBorderColorColor() {
return workbook.getCustomPalette().getColor(
@@ -147,8 +94,9 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
@Override
public short getLeftBorderColor() {
- return (short)borderFormatting.getLeftBorderColor();
+ return (short) borderFormatting.getLeftBorderColor();
}
+
@Override
public HSSFColor getLeftBorderColorColor() {
return workbook.getCustomPalette().getColor(
@@ -158,8 +106,9 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
@Override
public short getRightBorderColor() {
- return (short)borderFormatting.getRightBorderColor();
+ return (short) borderFormatting.getRightBorderColor();
}
+
@Override
public HSSFColor getRightBorderColorColor() {
return workbook.getCustomPalette().getColor(
@@ -169,8 +118,9 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
@Override
public short getTopBorderColor() {
- return (short)borderFormatting.getTopBorderColor();
+ return (short) borderFormatting.getTopBorderColor();
}
+
@Override
public HSSFColor getTopBorderColorColor() {
return workbook.getCustomPalette().getColor(
@@ -181,6 +131,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
public boolean isBackwardDiagonalOn() {
return borderFormatting.isBackwardDiagonalOn();
}
+
public boolean isForwardDiagonalOn() {
return borderFormatting.isForwardDiagonalOn();
}
@@ -191,6 +142,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setTopLeftBottomRightBorderModified(on);
}
}
+
public void setForwardDiagonalOn(boolean on) {
borderFormatting.setForwardDiagonalOn(on);
if (on) {
@@ -199,23 +151,21 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
}
@Override
- public void setBorderBottom(short border) {
- borderFormatting.setBorderBottom(border);
- if (border != 0) {
+ public void setBorderBottom(BorderStyle border) {
+ short code = border.getCode();
+ borderFormatting.setBorderBottom(code);
+ if (code != 0) {
cfRuleRecord.setBottomBorderModified(true);
} else {
cfRuleRecord.setBottomBorderModified(false);
}
}
- @Override
- public void setBorderBottom(BorderStyle border) {
- setBorderBottom(border.getCode());
- }
@Override
- public void setBorderDiagonal(short border) {
- borderFormatting.setBorderDiagonal(border);
- if (border != 0) {
+ public void setBorderDiagonal(BorderStyle border) {
+ short code = border.getCode();
+ borderFormatting.setBorderDiagonal(code);
+ if (code != 0) {
cfRuleRecord.setBottomLeftTopRightBorderModified(true);
cfRuleRecord.setTopLeftBottomRightBorderModified(true);
} else {
@@ -223,52 +173,39 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setTopLeftBottomRightBorderModified(false);
}
}
- @Override
- public void setBorderDiagonal(BorderStyle border) {
- setBorderDiagonal(border.getCode());
- }
@Override
- public void setBorderLeft(short border) {
- borderFormatting.setBorderLeft(border);
- if (border != 0) {
+ public void setBorderLeft(BorderStyle border) {
+ short code = border.getCode();
+ borderFormatting.setBorderLeft(code);
+ if (code != 0) {
cfRuleRecord.setLeftBorderModified(true);
} else {
cfRuleRecord.setLeftBorderModified(false);
}
}
- @Override
- public void setBorderLeft(BorderStyle border) {
- setBorderLeft(border.getCode());
- }
@Override
- public void setBorderRight(short border) {
- borderFormatting.setBorderRight(border);
- if (border != 0) {
+ public void setBorderRight(BorderStyle border) {
+ short code = border.getCode();
+ borderFormatting.setBorderRight(code);
+ if (code != 0) {
cfRuleRecord.setRightBorderModified(true);
} else {
cfRuleRecord.setRightBorderModified(false);
}
}
- @Override
- public void setBorderRight(BorderStyle border) {
- setBorderRight(border.getCode());
- }
@Override
- public void setBorderTop(short border) {
- borderFormatting.setBorderTop(border);
- if (border != 0) {
+ public void setBorderTop(BorderStyle border) {
+ short code = border.getCode();
+ borderFormatting.setBorderTop(code);
+ if (code != 0) {
cfRuleRecord.setTopBorderModified(true);
} else {
cfRuleRecord.setTopBorderModified(false);
}
}
- @Override
- public void setBorderTop(BorderStyle border) {
- setBorderTop(border.getCode());
- }
@Override
public void setBottomBorderColor(short color) {
@@ -279,10 +216,11 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setBottomBorderModified(false);
}
}
+
public void setBottomBorderColor(Color color) {
HSSFColor hcolor = HSSFColor.toHSSFColor(color);
if (hcolor == null) {
- setBottomBorderColor((short)0);
+ setBottomBorderColor((short) 0);
} else {
setBottomBorderColor(hcolor.getIndex());
}
@@ -299,11 +237,12 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setTopLeftBottomRightBorderModified(false);
}
}
+
@Override
public void setDiagonalBorderColor(Color color) {
HSSFColor hcolor = HSSFColor.toHSSFColor(color);
if (hcolor == null) {
- setDiagonalBorderColor((short)0);
+ setDiagonalBorderColor((short) 0);
} else {
setDiagonalBorderColor(hcolor.getIndex());
}
@@ -318,11 +257,12 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setLeftBorderModified(false);
}
}
+
@Override
public void setLeftBorderColor(Color color) {
HSSFColor hcolor = HSSFColor.toHSSFColor(color);
if (hcolor == null) {
- setLeftBorderColor((short)0);
+ setLeftBorderColor((short) 0);
} else {
setLeftBorderColor(hcolor.getIndex());
}
@@ -337,11 +277,12 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setRightBorderModified(false);
}
}
+
@Override
public void setRightBorderColor(Color color) {
HSSFColor hcolor = HSSFColor.toHSSFColor(color);
if (hcolor == null) {
- setRightBorderColor((short)0);
+ setRightBorderColor((short) 0);
} else {
setRightBorderColor(hcolor.getIndex());
}
@@ -356,11 +297,12 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
cfRuleRecord.setTopBorderModified(false);
}
}
+
@Override
public void setTopBorderColor(Color color) {
HSSFColor hcolor = HSSFColor.toHSSFColor(color);
if (hcolor == null) {
- setTopBorderColor((short)0);
+ setTopBorderColor((short) 0);
} else {
setTopBorderColor(hcolor.getIndex());
}
@@ -368,22 +310,72 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* HSSF doesn't support table borders, so always {@link BorderStyle#NONE}
- * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderVerticalEnum()
+ *
+ * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderVertical()
*/
- public BorderStyle getBorderVerticalEnum() {
+ public BorderStyle getBorderVertical() {
return BorderStyle.NONE;
}
/**
* HSSF doesn't support table borders, so always {@link BorderStyle#NONE}
- * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderHorizontalEnum()
+ *
+ * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderHorizontal()
*/
- public BorderStyle getBorderHorizontalEnum() {
+ public BorderStyle getBorderHorizontal() {
return BorderStyle.NONE;
}
+ @Override
+ public BorderStyle getBorderBottomEnum() {
+ return getBorderBottom();
+ }
+
+ @Override
+ public BorderStyle getBorderDiagonalEnum() {
+ return getBorderDiagonal();
+ }
+
+ @Override
+ public BorderStyle getBorderLeftEnum() {
+ return getBorderLeft();
+ }
+
+ @Override
+ public BorderStyle getBorderRightEnum() {
+ return getBorderRight();
+ }
+
+ @Override
+ public BorderStyle getBorderTopEnum() {
+ return getBorderTop();
+ }
+
+ /**
+ * HSSF doesn't support table borders, so always {@link BorderStyle#NONE}
+ *
+ * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderVertical()
+ */
+ @Deprecated
+ @Override
+ public BorderStyle getBorderVerticalEnum() {
+ return getBorderVertical();
+ }
+
+ /**
+ * HSSF doesn't support table borders, so always {@link BorderStyle#NONE}
+ *
+ * @see org.apache.poi.ss.usermodel.BorderFormatting#getBorderHorizontal()
+ */
+ @Deprecated
+ @Override
+ public BorderStyle getBorderHorizontalEnum() {
+ return getBorderHorizontal();
+ }
+
/**
* HSSF Doesn't support table borders, so always {@link HSSFColorPredefined#AUTOMATIC}
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#getVerticalBorderColor()
*/
public short getVerticalBorderColor() {
@@ -392,6 +384,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* HSSF Doesn't support table borders, so always {@link HSSFColorPredefined#AUTOMATIC}
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#getVerticalBorderColorColor()
*/
public Color getVerticalBorderColorColor() {
@@ -400,6 +393,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* HSSF Doesn't support table borders, so always {@link HSSFColorPredefined#AUTOMATIC}
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#getHorizontalBorderColor()
*/
public short getHorizontalBorderColor() {
@@ -408,6 +402,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* HSSF Doesn't support table borders, so always {@link HSSFColorPredefined#AUTOMATIC}
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#getHorizontalBorderColorColor()
*/
public Color getHorizontalBorderColorColor() {
@@ -416,6 +411,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* Not available for HSSF.
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#setBorderHorizontal(org.apache.poi.ss.usermodel.BorderStyle)
*/
public void setBorderHorizontal(BorderStyle border) {
@@ -424,6 +420,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* Not available for HSSF.
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#setBorderVertical(org.apache.poi.ss.usermodel.BorderStyle)
*/
public void setBorderVertical(BorderStyle border) {
@@ -432,6 +429,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* Not available for HSSF.
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#setHorizontalBorderColor(short)
*/
public void setHorizontalBorderColor(short color) {
@@ -440,6 +438,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* Not available for HSSF.
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#setHorizontalBorderColor(org.apache.poi.ss.usermodel.Color)
*/
public void setHorizontalBorderColor(Color color) {
@@ -448,6 +447,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* Not available for HSSF.
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#setVerticalBorderColor(short)
*/
public void setVerticalBorderColor(short color) {
@@ -456,6 +456,7 @@ public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.B
/**
* Not available for HSSF.
+ *
* @see org.apache.poi.ss.usermodel.BorderFormatting#setVerticalBorderColor(org.apache.poi.ss.usermodel.Color)
*/
public void setVerticalBorderColor(Color color) {
diff --git a/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java b/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java
index 31ec32cfe9..e0aba8621f 100644
--- a/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java
+++ b/src/java/org/apache/poi/ss/usermodel/BorderFormatting.java
@@ -19,63 +19,100 @@
package org.apache.poi.ss.usermodel;
+import org.apache.poi.util.Removal;
+
/**
* High level representation for Border Formatting component
* of Conditional Formatting settings
*/
public interface BorderFormatting {
+ /** @since POI 4.0.0 */
+ BorderStyle getBorderBottom();
+
+ /** @since POI 4.0.0 */
+ BorderStyle getBorderDiagonal();
+
+ /** @since POI 4.0.0 */
+ BorderStyle getBorderLeft();
+
+ /** @since POI 4.0.0 */
+ BorderStyle getBorderRight();
+
+ /** @since POI 4.0.0 */
+ BorderStyle getBorderTop();
+
/**
- * @deprecated POI 3.15. Use {@link #getBorderBottomEnum()}.
- * This method will return an BorderStyle enum in the future.
+ * Only valid for range borders, such as table styles
+ * @since 4.0.0
+ * @return border style
*/
- short getBorderBottom();
- /** @since POI 3.15 */
+ BorderStyle getBorderVertical();
+ /**
+ * Only valid for range borders, such as table styles
+ * @since 4.0.0
+ * @return border style
+ */
+ BorderStyle getBorderHorizontal();
+
+ /**
+ * @since POI 3.15
+ * @deprecated use <code>getBorderBottom</code> instead
+ */
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderBottomEnum();
/**
- * @deprecated POI 3.15. Use {@link #getBorderDiagonalEnum()}.
- * This method will return an BorderStyle enum in the future.
+ * @since POI 3.15
+ * @deprecated use <code>getBorderDiagonal</code> instead
*/
- short getBorderDiagonal();
- /** @since POI 3.15 */
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderDiagonalEnum();
/**
- * @deprecated POI 3.15. Use {@link #getBorderLeftEnum()}.
- * This method will return an BorderStyle enum in the future.
+ * @since POI 3.15
+ * @deprecated use <code>getBorderLeft</code> instead
*/
- short getBorderLeft();
- /** @since POI 3.15 */
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderLeftEnum();
/**
- * @deprecated POI 3.15. Use {@link #getBorderRightEnum()}.
- * This method will return an BorderStyle enum in the future.
+ * @since POI 3.15
+ * @deprecated use <code>getBorderRight</code> instead
*/
- short getBorderRight();
- /** @since POI 3.15 */
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderRightEnum();
/**
- * @deprecated POI 3.15. Use {@link #getBorderTopEnum()}.
- * This method will return an BorderStyle enum in the future.
+ * @since POI 3.15
+ * @deprecated use <code>getBorderTop</code> instead
*/
- short getBorderTop();
- /** @since POI 3.15 */
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderTopEnum();
/**
* Only valid for range borders, such as table styles
* @since 3.17 beta 1
* @return border style
+ * @deprecated use <code>getBorderVertical</code> instead
*/
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderVerticalEnum();
+
/**
* Only valid for range borders, such as table styles
* @since 3.17 beta 1
* @return border style
+ * @deprecated use <code>getBorderHorizontal</code> instead
*/
+ @Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderHorizontalEnum();
short getBottomBorderColor();
@@ -122,14 +159,6 @@ public interface BorderFormatting {
/**
* Set bottom border.
*
- * @param border MUST be a BORDER_* constant
- * @deprecated 3.15 beta 2. Use {@link BorderFormatting#setBorderBottom(BorderStyle)}
- */
- void setBorderBottom(short border);
-
- /**
- * Set bottom border.
- *
* @param border The style of border to set.
*/
void setBorderBottom(BorderStyle border);
@@ -137,14 +166,6 @@ public interface BorderFormatting {
/**
* Set diagonal border.
*
- * @param border MUST be a BORDER_* constant
- * @deprecated 3.15 beta 2. Use {@link BorderFormatting#setBorderDiagonal(BorderStyle)}
- */
- void setBorderDiagonal(short border);
-
- /**
- * Set diagonal border.
- *
* @param border The style of border to set.
*/
void setBorderDiagonal(BorderStyle border);
@@ -152,14 +173,6 @@ public interface BorderFormatting {
/**
* Set left border.
*
- * @param border MUST be a BORDER_* constant
- * @deprecated 3.15 beta 2. Use {@link BorderFormatting#setBorderLeft(BorderStyle)}
- */
- void setBorderLeft(short border);
-
- /**
- * Set left border.
- *
* @param border The style of border to set.
*/
void setBorderLeft(BorderStyle border);
@@ -167,14 +180,6 @@ public interface BorderFormatting {
/**
* Set right border.
*
- * @param border MUST be a BORDER_* constant
- * @deprecated 3.15 beta 2. Use {@link BorderFormatting#setBorderRight(BorderStyle)}
- */
- void setBorderRight(short border);
-
- /**
- * Set right border.
- *
* @param border The style of border to set.
*/
void setBorderRight(BorderStyle border);
@@ -182,14 +187,6 @@ public interface BorderFormatting {
/**
* Set top border.
*
- * @param border MUST be a BORDER_* constant
- * @deprecated 3.15 beta 2. Use {@link BorderFormatting#setBorderTop(BorderStyle)}
- */
- void setBorderTop(short border);
-
- /**
- * Set top border.
- *
* @param border The style of border to set.
*/
void setBorderTop(BorderStyle border);
diff --git a/src/java/org/apache/poi/ss/usermodel/CellStyle.java b/src/java/org/apache/poi/ss/usermodel/CellStyle.java
index cebdcf3047..57b052b16d 100644
--- a/src/java/org/apache/poi/ss/usermodel/CellStyle.java
+++ b/src/java/org/apache/poi/ss/usermodel/CellStyle.java
@@ -26,14 +26,12 @@ public interface CellStyle {
* @return unique index number of the underlying record this style represents (probably you don't care
* unless you're comparing which one is which)
*/
-
short getIndex();
/**
* set the data format (must be a valid format). Built in formats are defined at {@link BuiltinFormats}.
* @see DataFormat
*/
-
void setDataFormat(short fmt);
/**
@@ -53,7 +51,6 @@ public interface CellStyle {
* @see Workbook#createFont()
* @see Workbook#getFontAt(short)
*/
-
void setFont(Font font);
/**
@@ -66,28 +63,24 @@ public interface CellStyle {
* set the cell's using this style to be hidden
* @param hidden - whether the cell using this style should be hidden
*/
-
void setHidden(boolean hidden);
/**
* get whether the cell's using this style are to be hidden
* @return hidden - whether the cell using this style should be hidden
*/
-
boolean getHidden();
/**
* set the cell's using this style to be locked
* @param locked - whether the cell using this style should be locked
*/
-
void setLocked(boolean locked);
/**
* get whether the cell's using this style are to be locked
* @return hidden - whether the cell using this style should be locked
*/
-
boolean getLocked();
/**
@@ -124,6 +117,7 @@ public interface CellStyle {
* @deprecated use <code>getAlignment()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
HorizontalAlignment getAlignmentEnum();
/**
@@ -159,6 +153,7 @@ public interface CellStyle {
* @deprecated use <code>getVerticalAlignment()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
VerticalAlignment getVerticalAlignmentEnum();
/**
@@ -188,14 +183,12 @@ public interface CellStyle {
* set the number of spaces to indent the text in the cell
* @param indent - number of spaces
*/
-
void setIndention(short indent);
/**
* get the number of spaces to indent the text in the cell
* @return indent - number of spaces
*/
-
short getIndention();
/**
@@ -219,6 +212,7 @@ public interface CellStyle {
* @deprecated use <code>getBorderLeft()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderLeftEnum();
/**
@@ -242,6 +236,7 @@ public interface CellStyle {
* @deprecated use <code>getBorderRight()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderRightEnum();
/**
@@ -265,6 +260,7 @@ public interface CellStyle {
* @deprecated use <code>getBorderTop()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderTopEnum();
/**
@@ -288,6 +284,7 @@ public interface CellStyle {
* @deprecated use <code>getBorderBottom()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
BorderStyle getBorderBottomEnum();
/**
@@ -362,6 +359,7 @@ public interface CellStyle {
* @deprecated use <code>getFillPattern()</code> instead
*/
@Removal(version = "4.2")
+ @Deprecated
FillPatternType getFillPatternEnum();
/**
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java
index 3d18cbec4e..88a910b89a 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFBorderFormatting.java
@@ -37,83 +37,45 @@ public class XSSFBorderFormatting implements BorderFormatting {
_colorMap = colorMap;
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderBottomEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderBottom() {
- return getBorderBottomEnum().getCode();
- }
- /**
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderBottomEnum() {
+ public BorderStyle getBorderBottom() {
return getBorderStyle(_border.getBottom());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderDiagonalEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderDiagonal() {
- return getBorderDiagonalEnum().getCode();
- }
- /**
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderDiagonalEnum() {
+ public BorderStyle getBorderDiagonal() {
return getBorderStyle(_border.getDiagonal());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderLeftEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderLeft() {
- return getBorderLeftEnum().getCode();
- }
- /**
- * @since POI 3.15
- */
- @Override
- public BorderStyle getBorderLeftEnum() {
+ public BorderStyle getBorderLeft() {
return getBorderStyle(_border.getLeft());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderRightEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
- @Override
- public short getBorderRight() {
- return getBorderRightEnum().getCode();
- }
- /**
- * @since POI 3.15
- */
@Override
- public BorderStyle getBorderRightEnum() {
+ public BorderStyle getBorderRight() {
return getBorderStyle(_border.getRight());
}
- /**
- * @deprecated POI 3.15. Use {@link #getBorderTopEnum()}.
- * This method will return an BorderStyle enum in the future.
- */
@Override
- public short getBorderTop() {
- return getBorderTopEnum().getCode();
+ public BorderStyle getBorderTopEnum() { return getBorderTop(); }
+
+ @Override
+ public BorderStyle getBorderBottomEnum() { return getBorderBottom(); }
+
+ @Override
+ public BorderStyle getBorderDiagonalEnum() { return getBorderDiagonal(); }
+
+ @Override
+ public BorderStyle getBorderLeftEnum() {
+ return getBorderLeft();
}
- /**
- * @since POI 3.15
- */
+
@Override
- public BorderStyle getBorderTopEnum() {
+ public BorderStyle getBorderRightEnum() { return getBorderRight(); }
+
+ @Override
+ public BorderStyle getBorderTop() {
return getBorderStyle(_border.getTop());
}
@@ -162,13 +124,6 @@ public class XSSFBorderFormatting implements BorderFormatting {
return getIndexedColor(getTopBorderColorColor());
}
- /**
- * @deprecated 3.15 beta 2. Use {@link #setBorderBottom(BorderStyle)}
- */
- @Override
- public void setBorderBottom(short border) {
- setBorderBottom(BorderStyle.valueOf(border));
- }
@Override
public void setBorderBottom(BorderStyle border) {
CTBorderPr pr = _border.isSetBottom() ? _border.getBottom() : _border.addNewBottom();
@@ -176,13 +131,6 @@ public class XSSFBorderFormatting implements BorderFormatting {
else pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1));
}
- /**
- * @deprecated 3.15 beta 2. Use {@link #setBorderDiagonal(BorderStyle)}
- */
- @Override
- public void setBorderDiagonal(short border) {
- setBorderDiagonal(BorderStyle.valueOf(border));
- }
@Override
public void setBorderDiagonal(BorderStyle border) {
CTBorderPr pr = _border.isSetDiagonal() ? _border.getDiagonal() : _border.addNewDiagonal();
@@ -190,13 +138,6 @@ public class XSSFBorderFormatting implements BorderFormatting {
else pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1));
}
- /**
- * @deprecated 3.15 beta 2. Use {@link #setBorderLeft(BorderStyle)}
- */
- @Override
- public void setBorderLeft(short border) {
- setBorderLeft(BorderStyle.valueOf(border));
- }
@Override
public void setBorderLeft(BorderStyle border) {
CTBorderPr pr = _border.isSetLeft() ? _border.getLeft() : _border.addNewLeft();
@@ -204,13 +145,6 @@ public class XSSFBorderFormatting implements BorderFormatting {
else pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1));
}
- /**
- * @deprecated 3.15 beta 2. Use {@link #setBorderRight(BorderStyle)}
- */
- @Override
- public void setBorderRight(short border) {
- setBorderRight(BorderStyle.valueOf(border));
- }
@Override
public void setBorderRight(BorderStyle border) {
CTBorderPr pr = _border.isSetRight() ? _border.getRight() : _border.addNewRight();
@@ -218,13 +152,6 @@ public class XSSFBorderFormatting implements BorderFormatting {
else pr.setStyle(STBorderStyle.Enum.forInt(border.getCode() + 1));
}
- /**
- * @deprecated 3.15 beta 2. Use {@link #setBorderTop(BorderStyle)}
- */
- @Override
- public void setBorderTop(short border) {
- setBorderTop(BorderStyle.valueOf(border));
- }
@Override
public void setBorderTop(BorderStyle border) {
CTBorderPr pr = _border.isSetTop() ? _border.getTop() : _border.addNewTop();
@@ -337,14 +264,22 @@ public class XSSFBorderFormatting implements BorderFormatting {
}
}
- public BorderStyle getBorderVerticalEnum() {
+ @Override
+ public BorderStyle getBorderVertical() {
return getBorderStyle(_border.getVertical());
}
- public BorderStyle getBorderHorizontalEnum() {
+ @Override
+ public BorderStyle getBorderHorizontal() {
return getBorderStyle(_border.getHorizontal());
}
+ @Override
+ public BorderStyle getBorderVerticalEnum() { return getBorderVertical(); }
+
+ @Override
+ public BorderStyle getBorderHorizontalEnum() { return getBorderHorizontal(); }
+
public short getVerticalBorderColor() {
return getIndexedColor(getVerticalBorderColorColor());
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index b68c92bccb..52a6c1d22b 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -3057,7 +3057,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
HSSFBorderFormatting bord = rule.createBorderFormatting();
bord.setBorderDiagonal(BorderStyle.THICK);
- assertEquals(BorderStyle.THICK, bord.getBorderDiagonalEnum());
+ assertEquals(BorderStyle.THICK, bord.getBorderDiagonal());
bord.setBackwardDiagonalOn(true);
assertTrue(bord.isBackwardDiagonalOn());
@@ -3070,7 +3070,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
// Create the bottom border style so we know what a border is supposed to look like
bord.setBorderBottom(BorderStyle.THICK);
- assertEquals(BorderStyle.THICK, bord.getBorderBottomEnum());
+ assertEquals(BorderStyle.THICK, bord.getBorderBottom());
bord.setBottomBorderColor(BLUE);
assertEquals(BLUE, bord.getBottomBorderColor());
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
index d1b4290100..bbcafbaebd 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java
@@ -358,10 +358,10 @@ public abstract class BaseTestConditionalFormatting {
BorderFormatting r1bf = rule1.getBorderFormatting();
assertNotNull(r1bf);
- assertEquals(BorderStyle.THIN, r1bf.getBorderBottomEnum());
- assertEquals(BorderStyle.THICK,r1bf.getBorderTopEnum());
- assertEquals(BorderStyle.DASHED,r1bf.getBorderLeftEnum());
- assertEquals(BorderStyle.DOTTED,r1bf.getBorderRightEnum());
+ assertEquals(BorderStyle.THIN, r1bf.getBorderBottom());
+ assertEquals(BorderStyle.THICK,r1bf.getBorderTop());
+ assertEquals(BorderStyle.DASHED,r1bf.getBorderLeft());
+ assertEquals(BorderStyle.DOTTED,r1bf.getBorderRight());
PatternFormatting r1pf = rule1.getPatternFormatting();
assertNotNull(r1pf);
@@ -1013,19 +1013,19 @@ public abstract class BaseTestConditionalFormatting {
for (BorderStyle border : BorderStyle.values()) {
borderFmt.setBorderTop(border);
- assertEquals(border, borderFmt.getBorderTopEnum());
+ assertEquals(border, borderFmt.getBorderTop());
borderFmt.setBorderBottom(border);
- assertEquals(border, borderFmt.getBorderBottomEnum());
+ assertEquals(border, borderFmt.getBorderBottom());
borderFmt.setBorderLeft(border);
- assertEquals(border, borderFmt.getBorderLeftEnum());
+ assertEquals(border, borderFmt.getBorderLeft());
borderFmt.setBorderRight(border);
- assertEquals(border, borderFmt.getBorderRightEnum());
+ assertEquals(border, borderFmt.getBorderRight());
borderFmt.setBorderDiagonal(border);
- assertEquals(border, borderFmt.getBorderDiagonalEnum());
+ assertEquals(border, borderFmt.getBorderDiagonal());
}
workbook.close();
@@ -1041,37 +1041,37 @@ public abstract class BaseTestConditionalFormatting {
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule(ComparisonOperator.EQUAL, "7");
BorderFormatting borderFmt = rule1.createBorderFormatting();
- assertEquals(BorderStyle.NONE, borderFmt.getBorderBottomEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderBottom());
borderFmt.setBorderBottom(BorderStyle.DOTTED);
- assertEquals(BorderStyle.DOTTED, borderFmt.getBorderBottomEnum());
+ assertEquals(BorderStyle.DOTTED, borderFmt.getBorderBottom());
borderFmt.setBorderBottom(BorderStyle.NONE);
- assertEquals(BorderStyle.NONE, borderFmt.getBorderBottomEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderBottom());
borderFmt.setBorderBottom(BorderStyle.THICK);
- assertEquals(BorderStyle.THICK, borderFmt.getBorderBottomEnum());
+ assertEquals(BorderStyle.THICK, borderFmt.getBorderBottom());
- assertEquals(BorderStyle.NONE, borderFmt.getBorderTopEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderTop());
borderFmt.setBorderTop(BorderStyle.DOTTED);
- assertEquals(BorderStyle.DOTTED, borderFmt.getBorderTopEnum());
+ assertEquals(BorderStyle.DOTTED, borderFmt.getBorderTop());
borderFmt.setBorderTop(BorderStyle.NONE);
- assertEquals(BorderStyle.NONE, borderFmt.getBorderTopEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderTop());
borderFmt.setBorderTop(BorderStyle.THICK);
- assertEquals(BorderStyle.THICK, borderFmt.getBorderTopEnum());
+ assertEquals(BorderStyle.THICK, borderFmt.getBorderTop());
- assertEquals(BorderStyle.NONE, borderFmt.getBorderLeftEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderLeft());
borderFmt.setBorderLeft(BorderStyle.DOTTED);
- assertEquals(BorderStyle.DOTTED, borderFmt.getBorderLeftEnum());
+ assertEquals(BorderStyle.DOTTED, borderFmt.getBorderLeft());
borderFmt.setBorderLeft(BorderStyle.NONE);
- assertEquals(BorderStyle.NONE, borderFmt.getBorderLeftEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderLeft());
borderFmt.setBorderLeft(BorderStyle.THIN);
- assertEquals(BorderStyle.THIN, borderFmt.getBorderLeftEnum());
+ assertEquals(BorderStyle.THIN, borderFmt.getBorderLeft());
- assertEquals(BorderStyle.NONE, borderFmt.getBorderRightEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderRight());
borderFmt.setBorderRight(BorderStyle.DOTTED);
- assertEquals(BorderStyle.DOTTED, borderFmt.getBorderRightEnum());
+ assertEquals(BorderStyle.DOTTED, borderFmt.getBorderRight());
borderFmt.setBorderRight(BorderStyle.NONE);
- assertEquals(BorderStyle.NONE, borderFmt.getBorderRightEnum());
+ assertEquals(BorderStyle.NONE, borderFmt.getBorderRight());
borderFmt.setBorderRight(BorderStyle.HAIR);
- assertEquals(BorderStyle.HAIR, borderFmt.getBorderRightEnum());
+ assertEquals(BorderStyle.HAIR, borderFmt.getBorderRight());
ConditionalFormattingRule [] cfRules = { rule1 };
@@ -1087,10 +1087,10 @@ public abstract class BaseTestConditionalFormatting {
BorderFormatting r1fp = cf.getRule(0).getBorderFormatting();
assertNotNull(r1fp);
- assertEquals(BorderStyle.THICK, r1fp.getBorderBottomEnum());
- assertEquals(BorderStyle.THICK, r1fp.getBorderTopEnum());
- assertEquals(BorderStyle.THIN, r1fp.getBorderLeftEnum());
- assertEquals(BorderStyle.HAIR, r1fp.getBorderRightEnum());
+ assertEquals(BorderStyle.THICK, r1fp.getBorderBottom());
+ assertEquals(BorderStyle.THICK, r1fp.getBorderTop());
+ assertEquals(BorderStyle.THIN, r1fp.getBorderLeft());
+ assertEquals(BorderStyle.HAIR, r1fp.getBorderRight());
workbook.close();
}