poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1721942 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
Date Mon, 28 Dec 2015 16:04:47 GMT
Author: onealj
Date: Mon Dec 28 16:04:47 2015
New Revision: 1721942

URL: http://svn.apache.org/viewvc?rev=1721942&view=rev
Log:
bug 58740: javadocs

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java?rev=1721942&r1=1721941&r2=1721942&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java Mon Dec 28 16:04:47
2015
@@ -312,6 +312,13 @@ public class StylesTable extends POIXMLD
         return borders.get(idx);
     }
 
+    /**
+     * Adds a border to the border style table if it isn't already in the style table
+     * Does nothing if border is already in borders style table
+     *
+     * @param border border to add
+     * @return the index of the added border
+     */
     public int putBorder(XSSFCellBorder border) {
         int idx = borders.indexOf(border);
         if (idx != -1) {
@@ -342,6 +349,13 @@ public class StylesTable extends POIXMLD
         return Collections.unmodifiableMap(numberFormats);
     }
 
+    /**
+     * Adds a fill to the fill style table if it isn't already in the style table
+     * Does nothing if fill is already in fill style table
+     *
+     * @param fill fill to add
+     * @return the index of the added fill
+     */
     public int putFill(XSSFCellFill fill) {
         int idx = fills.indexOf(fill);
         if (idx != -1) {
@@ -356,6 +370,13 @@ public class StylesTable extends POIXMLD
         return xfs.get(idx);
     }
     
+    /**
+     * Adds a cell to the styles table.
+     * Does not check for duplicates.
+     * 
+     * @param cellXf the cell to add to the styles table
+     * @return the added cell ID in the style table
+     */
     @Internal
     public int putCellXf(CTXf cellXf) {
         xfs.add(cellXf);
@@ -369,12 +390,25 @@ public class StylesTable extends POIXMLD
 
     @Internal
     public CTXf getCellStyleXfAt(int idx) {
-        return idx < styleXfs.size() ? styleXfs.get(idx) : null;
+        try {
+            return styleXfs.get(idx);
+        }
+        catch (final IndexOutOfBoundsException e) {
+            return null;
+        }
     }
     
+    /**
+     * Adds a cell style to the styles table.
+     * Does not check for duplicates.
+     * 
+     * @param cellStyleXf the cell style to add to the styles table
+     * @return the cell style ID in the style table
+     */
     @Internal
     public int putCellStyleXf(CTXf cellStyleXf) {
         styleXfs.add(cellStyleXf);
+        // TODO: check for duplicate
         return styleXfs.size();
     }
     
@@ -598,6 +632,13 @@ public class StylesTable extends POIXMLD
         return dxfs.get(idx);
     }
 
+    /**
+     * Adds a Dxf to the style table
+     * Does not check for duplicates.
+     *
+     * @param dxf the Dxf to add
+     * @return added dxf ID in the style table
+     */
     @Internal
     public int putDxf(CTDxf dxf) {
         this.dxfs.add(dxf);
@@ -608,6 +649,7 @@ public class StylesTable extends POIXMLD
      * Create a cell style in this style table.
      * Note - End users probably want to call {@link XSSFWorkbook#createCellStyle()}
      * rather than working with the styles table directly.
+     * @throws IllegalStateException if the maximum number of cell styles has been reached.

      */
     public XSSFCellStyle createCellStyle() {
         if (getNumCellStyles() > MAXIMUM_STYLE_ID) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message