diff --git a/src/java/org/apache/poi/ss/util/PropertyTemplate.java b/src/java/org/apache/poi/ss/util/PropertyTemplate.java index c4d7201be4..dc5e43da17 100644 --- a/src/java/org/apache/poi/ss/util/PropertyTemplate.java +++ b/src/java/org/apache/poi/ss/util/PropertyTemplate.java @@ -31,7 +31,6 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; /** *
@@ -56,6 +55,9 @@ public final class PropertyTemplate {
/**
* Provides various extents of the properties being added to the template
+ * Note that the Border Extent differs from a BorderStyle. A BorderStyle
+ * refers to the border around a single cell while a BorderExtent refers to
+ * borders around and through an area of cells.
*/
public enum Extent {
/**
@@ -269,7 +271,7 @@ public final class PropertyTemplate {
int row = range.getFirstRow();
int firstCol = range.getFirstColumn();
int lastCol = range.getLastColumn();
- boolean addBottom = borderType == BorderStyle.NONE && row > 0;
+ boolean addBottom = (borderType == BorderStyle.NONE && row > 0);
for (int i = firstCol; i <= lastCol; i++) {
addProperty(row, i, CellUtil.BORDER_TOP, borderType);
if (addBottom) {
@@ -290,8 +292,7 @@ public final class PropertyTemplate {
int row = range.getLastRow();
int firstCol = range.getFirstColumn();
int lastCol = range.getLastColumn();
- boolean addTop = (borderType == BorderStyle.NONE
- && row < _ss.getLastRowIndex());
+ boolean addTop = (borderType == BorderStyle.NONE && row < _ss.getLastRowIndex());
for (int i = firstCol; i <= lastCol; i++) {
addProperty(row, i, CellUtil.BORDER_BOTTOM, borderType);
if (addTop) {
@@ -312,7 +313,7 @@ public final class PropertyTemplate {
int firstRow = range.getFirstRow();
int lastRow = range.getLastRow();
int col = range.getFirstColumn();
- boolean addRight = borderType == BorderStyle.NONE && col > 0;
+ boolean addRight = (borderType == BorderStyle.NONE && col > 0);
for (int i = firstRow; i <= lastRow; i++) {
addProperty(i, col, CellUtil.BORDER_LEFT, borderType);
if (addRight) {
@@ -333,8 +334,7 @@ public final class PropertyTemplate {
int firstRow = range.getFirstRow();
int lastRow = range.getLastRow();
int col = range.getLastColumn();
- boolean addLeft = (borderType == BorderStyle.NONE
- && col < _ss.getLastColumnIndex());
+ boolean addLeft = (borderType == BorderStyle.NONE && col < _ss.getLastColumnIndex());
for (int i = firstRow; i <= lastRow; i++) {
addProperty(i, col, CellUtil.BORDER_RIGHT, borderType);
if (addLeft) {
@@ -475,12 +475,10 @@ public final class PropertyTemplate {
* the ones that have been drawn by the {@link #drawBorders} and
* {@link #drawBorderColors} methods.
*
- * @param sheet
- * - {@link Sheet} on which to apply borders
+ * @param sheet Sheet on which to apply borders
*/
public void applyBorders(Sheet sheet) {
- Workbook wb = sheet.getWorkbook();
- SpreadsheetVersion ss = wb.getSpreadsheetVersion();
+ SpreadsheetVersion ss = sheet.getWorkbook().getSpreadsheetVersion();
int lastValidRow = ss.getLastRowIndex();
int lastValidCol = ss.getLastColumnIndex();
for (Entry
* Sets the color of the right border for a range of cells. If the border is - * not drawn, it defaults to BORDER_THIN + * not drawn, it defaults to {@link BorderStyle#THIN} *
* - * @param range - * - range of cells on which colors are - * set. - * @param color - * - Color index from {@link IndexedColors} used to draw the - * borders. + * @param range range of cells on which colors are set. + * @param color Color index from {@link IndexedColors} used to draw the borders. */ private void drawRightBorderColor(CellRangeAddress range, short color) { int firstRow = range.getFirstRow(); @@ -667,15 +643,9 @@ public final class PropertyTemplate { * Sets the color of the outside borders for a range of cells. * * - * @param range - * - range of cells on which colors are - * set. - * @param color - * - Color index from {@link IndexedColors} used to draw the - * borders. - * @param extent - * - of the borders for which - * colors are set. Valid Values are: + * @param range range of cells on which colors are set. + * @param color Color index from {@link IndexedColors} used to draw the borders. + * @param extent Extent of the borders for which colors are set. Valid Values are: *