From: Javen O'Neal Date: Sat, 11 Jun 2016 11:12:04 +0000 (+0000) Subject: javadoc update and boolean addLeft|Right|Top|Bottom line wrap update X-Git-Tag: REL_3_15_BETA2~133^2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=adfb17a9163019cb07d51a4332d43b0c525f1b6b;p=poi.git javadoc update and boolean addLeft|Right|Top|Bottom line wrap update git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ss_border_property_template@1747877 13f79535-47bb-0310-9956-ffa450edef68 --- 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> entry : _propertyTemplate.entrySet()) { @@ -499,18 +497,12 @@ public final class PropertyTemplate { /** * Sets the color for a group of cell borders for a cell range. The borders * are not applied to the cells at this time, just the template is drawn. If - * the borders do not exist, a BORDER_THIN border is used. To apply the + * the borders do not exist, a {@link BorderStyle#THIN} border is used. To apply the * drawn borders to a sheet, use {@link #applyBorders}. * - * @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. + * @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. */ public void drawBorderColors(CellRangeAddress range, short color, Extent extent) { switch (extent) { @@ -566,12 +558,8 @@ public final class PropertyTemplate { * Sets the color of the top border 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 range range of cells on which colors are set. + * @param color Color index from {@link IndexedColors} used to draw the borders. */ private void drawTopBorderColor(CellRangeAddress range, short color) { int row = range.getFirstRow(); @@ -591,12 +579,8 @@ public final class PropertyTemplate { * Sets the color of the bottom border 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 range range of cells on which colors are set. + * @param color Color index from {@link IndexedColors} used to draw the borders. */ private void drawBottomBorderColor(CellRangeAddress range, short color) { int row = range.getLastRow(); @@ -616,12 +600,8 @@ public final class PropertyTemplate { * Sets the color of the left border 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 range range of cells on which colors are set. + * @param color Color index from {@link IndexedColors} used to draw the borders. */ private void drawLeftBorderColor(CellRangeAddress range, short color) { int firstRow = range.getFirstRow(); @@ -639,15 +619,11 @@ public final class PropertyTemplate { /** *

* 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: *