Author: fanningpj
Date: Mon Feb 26 20:26:48 2018
New Revision: 1825409

URL: http://svn.apache.org/viewvc?rev=1825409&view=rev
Log:
tidy up API for font index

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java
    poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/CellStyleDetails.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java
    poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java
    poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
    
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
    
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
    
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java

Modified: 
poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java 
(original)
+++ poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellEditor.java 
Mon Feb 26 20:26:48 2018
@@ -138,7 +138,7 @@ public class SVTableCellEditor extends A
         HSSFCell cell = (HSSFCell) value;
         if (cell != null) {
             HSSFCellStyle style = cell.getCellStyle();
-            HSSFFont f = wb.getFontAt(style.getFontIntIndex());
+            HSSFFont f = wb.getFontAt(style.getFontIndexAsInt());
             boolean isbold = f.getBold();
             boolean isitalics = f.getItalic();
 

Modified: 
poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- 
poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java 
(original)
+++ 
poi/trunk/src/examples/src/org/apache/poi/hssf/view/SVTableCellRenderer.java 
Mon Feb 26 20:26:48 2018
@@ -148,7 +148,7 @@ public class SVTableCellRenderer extends
 
         if (c != null) {
           HSSFCellStyle s = c.getCellStyle();
-          HSSFFont f = wb.getFontAt(s.getFontIntIndex());
+          HSSFFont f = wb.getFontAt(s.getFontIndexAsInt());
           setFont(SVTableUtils.makeFont(f));
 
           if (s.getFillPattern() == FillPatternType.SOLID_FOREGROUND) {

Modified: 
poi/trunk/src/examples/src/org/apache/poi/ss/examples/CellStyleDetails.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/CellStyleDetails.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/CellStyleDetails.java 
(original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/CellStyleDetails.java 
Mon Feb 26 20:26:48 2018
@@ -63,7 +63,7 @@ public class CellStyleDetails {
                         System.out.print("FG=" + 
renderColor(style.getFillForegroundColorColor()) + " ");
                         System.out.print("BG=" + 
renderColor(style.getFillBackgroundColorColor()) + " ");
 
-                        Font font = wb.getFontAt(style.getFontIntIndex());
+                        Font font = wb.getFontAt(style.getFontIndexAsInt());
                         System.out.print("Font=" + font.getFontName() + " ");
                         System.out.print("FontColor=");
                         if (font instanceof HSSFFont) {

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java 
(original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java Mon 
Feb 26 20:26:48 2018
@@ -300,7 +300,7 @@ public class ToHtml {
     }
 
     private void fontStyle(CellStyle style) {
-        Font font = wb.getFontAt(style.getFontIntIndex());
+        Font font = wb.getFontAt(style.getFontIndexAsInt());
 
         if (font.getBold()) {
             out.format("  font-weight: bold;%n");

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java Mon Feb 
26 20:26:48 2018
@@ -198,7 +198,7 @@ public final class HSSFCellStyle impleme
      * @since 4.0.0
      */
     @Override
-    public int getFontIntIndex()
+    public int getFontIndexAsInt()
     {
         return _format.getFontIndex();
     }
@@ -206,11 +206,11 @@ public final class HSSFCellStyle impleme
     /**
      * gets the font for this style
      * @param parentWorkbook The HSSFWorkbook that this style belongs to
-     * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIntIndex()
+     * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndexAsInt()
      * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int)
      */
     public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook 
parentWorkbook) {
-        return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIntIndex());
+        return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndexAsInt());
     }
 
     /**
@@ -849,7 +849,7 @@ public final class HSSFCellStyle impleme
             FontRecord fr = _workbook.createNewFont();
             fr.cloneStyleFrom(
                     source._workbook.getFontRecordAt(
-                            source.getFontIntIndex()
+                            source.getFontIndexAsInt()
                     )
             );
 

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/CellStyle.java Mon Feb 26 
20:26:48 2018
@@ -56,7 +56,7 @@ public interface CellStyle {
     /**
      * gets the index of the font for this style
      * @see Workbook#getFontAt(short)
-     * @deprecated use <code>getFontIntIndex()</code> instead
+     * @deprecated use <code>getFontIndexAsInt()</code> instead
      */
     @Removal(version = "4.2")
     short getFontIndex();
@@ -66,7 +66,7 @@ public interface CellStyle {
      * @see Workbook#getFontAt(int)
      * @since 4.0.0
      */
-    int getFontIntIndex();
+    int getFontIndexAsInt();
 
     /**
      * set the cell's using this style to be hidden

Modified: poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java Mon Feb 26 20:26:48 
2018
@@ -346,7 +346,7 @@ public final class CellUtil {
         put(properties, FILL_PATTERN, style.getFillPattern());
         put(properties, FILL_FOREGROUND_COLOR, style.getFillForegroundColor());
         put(properties, FILL_BACKGROUND_COLOR, style.getFillBackgroundColor());
-        put(properties, FONT, style.getFontIntIndex());
+        put(properties, FONT, style.getFontIndexAsInt());
         put(properties, HIDDEN, style.getHidden());
         put(properties, INDENTION, style.getIndention());
         put(properties, LEFT_BORDER_COLOR, style.getLeftBorderColor());

Modified: poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/util/SheetUtil.java Mon Feb 26 
20:26:48 2018
@@ -144,7 +144,7 @@ public class SheetUtil {
         if (cellType == CellType.FORMULA)
             cellType = cell.getCachedFormulaResultType();
 
-        Font font = wb.getFontAt(style.getFontIntIndex());
+        Font font = wb.getFontAt(style.getFontIndexAsInt());
 
         double width = -1;
         if (cellType == CellType.STRING) {

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java 
Mon Feb 26 20:26:48 2018
@@ -482,7 +482,7 @@ public class XSSFCellStyle implements Ce
      * @since 4.0.0
      */
     @Override
-    public int getFontIntIndex() {
+    public int getFontIndexAsInt() {
         return getFontId();
     }
 

Modified: 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
 (original)
+++ 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
 Mon Feb 26 20:26:48 2018
@@ -210,7 +210,7 @@ public class TestAutoSizeColumnTracker {
     
     private static void assumeRequiredFontsAreInstalled(final Workbook 
workbook, final Cell cell) {
         // autoSize will fail if required fonts are not installed, skip this 
test then
-        Font font = workbook.getFontAt(cell.getCellStyle().getFontIntIndex());
+        Font font = 
workbook.getFontAt(cell.getCellStyle().getFontIndexAsInt());
         Assume.assumeTrue("Cannot verify autoSizeColumn() because the 
necessary Fonts are not installed on this machine: " + font,
                           SheetUtil.canComputeColumnWidth(font));
     }

Modified: 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
 (original)
+++ 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
 Mon Feb 26 20:26:48 2018
@@ -350,7 +350,7 @@ public class TestSXSSFSheetAutoSizeColum
     
     private static void assumeRequiredFontsAreInstalled(final Workbook 
workbook, final Cell cell) {
         // autoSize will fail if required fonts are not installed, skip this 
test then
-        Font font = workbook.getFontAt(cell.getCellStyle().getFontIntIndex());
+        Font font = 
workbook.getFontAt(cell.getCellStyle().getFontIndexAsInt());
         Assume.assumeTrue("Cannot verify autoSizeColumn() because the 
necessary Fonts are not installed on this machine: " + font,
                           SheetUtil.canComputeColumnWidth(font));
     }

Modified: 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java 
(original)
+++ 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java 
Mon Feb 26 20:26:48 2018
@@ -324,7 +324,7 @@ public final class TestXSSFSheet extends
         cellXf.setXfId(1);
         stylesTable.putCellXf(cellXf);
         XSSFCellStyle cellStyle = new XSSFCellStyle(1, 1, stylesTable, null);
-        assertEquals(1, cellStyle.getFontIntIndex());
+        assertEquals(1, cellStyle.getFontIndexAsInt());
 
         sheet.setDefaultColumnStyle(3, cellStyle);
         assertEquals(1, ctWorksheet.getColsArray(0).getColArray(0).getStyle());

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java 
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Mon Feb 
26 20:26:48 2018
@@ -3130,12 +3130,12 @@ public final class TestBugs extends Base
 
             Cell cell = row.getCell(1);
             CellStyle style = cell.getCellStyle();
-            assertEquals(26, style.getFontIntIndex());
+            assertEquals(26, style.getFontIndexAsInt());
 
             row = sheet.getRow(3);
             cell = row.getCell(1);
             style = cell.getCellStyle();
-            assertEquals(28, style.getFontIntIndex());
+            assertEquals(28, style.getFontIndexAsInt());
 
             // check the two fonts
             HSSFFont font = wb.getFontAt(26);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java?rev=1825409&r1=1825408&r2=1825409&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java 
(original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java Mon 
Feb 26 20:26:48 2018
@@ -115,7 +115,7 @@ public abstract class BaseTestFont {
         s1 = wb2.getSheetAt(0);
 
         assertEquals(num0 + 1, wb2.getNumberOfFontsAsInt());
-        int idx = s1.getRow(0).getCell(0).getCellStyle().getFontIntIndex();
+        int idx = s1.getRow(0).getCell(0).getCellStyle().getFontIndexAsInt();
         Font fnt = wb2.getFontAt(idx);
         assertNotNull(fnt);
         assertEquals(IndexedColors.YELLOW.getIndex(), fnt.getColor());



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to