You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2020/12/09 16:59:51 UTC

svn commit: r1884259 - in /poi/trunk/src: examples/src/org/apache/poi/examples/ss/ examples/src/org/apache/poi/examples/ss/html/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/ss/util/ ooxml/testcases/org/apache/poi/xssf/streaming/ ooxml/testc...

Author: fanningpj
Date: Wed Dec  9 16:59:51 2020
New Revision: 1884259

URL: http://svn.apache.org/viewvc?rev=1884259&view=rev
Log:
remove more deprecated code

Modified:
    poi/trunk/src/examples/src/org/apache/poi/examples/ss/CellStyleDetails.java
    poi/trunk/src/examples/src/org/apache/poi/examples/ss/ExcelComparator.java
    poi/trunk/src/examples/src/org/apache/poi/examples/ss/html/ToHtml.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.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/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/BaseTestBugzillaIssues.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
    poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java

Modified: poi/trunk/src/examples/src/org/apache/poi/examples/ss/CellStyleDetails.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/ss/CellStyleDetails.java?rev=1884259&r1=1884258&r2=1884259&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/examples/ss/CellStyleDetails.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/examples/ss/CellStyleDetails.java Wed Dec  9 16:59:51 2020
@@ -66,7 +66,7 @@ public final class CellStyleDetails {
                         System.out.print("FG=" + renderColor(style.getFillForegroundColorColor()) + " ");
                         System.out.print("BG=" + renderColor(style.getFillBackgroundColorColor()) + " ");
 
-                        Font font = wb.getFontAt(style.getFontIndexAsInt());
+                        Font font = wb.getFontAt(style.getFontIndex());
                         System.out.print("Font=" + font.getFontName() + " ");
                         System.out.print("FontColor=");
                         if (font instanceof HSSFFont) {

Modified: poi/trunk/src/examples/src/org/apache/poi/examples/ss/ExcelComparator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/ss/ExcelComparator.java?rev=1884259&r1=1884258&r2=1884259&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/examples/ss/ExcelComparator.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/examples/ss/ExcelComparator.java Wed Dec  9 16:59:51 2020
@@ -545,9 +545,9 @@ public class ExcelComparator {
     }
 
     private boolean hasInvalidFontIndex(Locator loc1, Locator loc2) {
-        int fontIdx1 = loc1.cell.getCellStyle().getFontIndexAsInt();
+        int fontIdx1 = loc1.cell.getCellStyle().getFontIndex();
         int fontCount1 = ((XSSFWorkbook)loc1.workbook).getStylesSource().getFonts().size();
-        int fontIdx2 = loc2.cell.getCellStyle().getFontIndexAsInt();
+        int fontIdx2 = loc2.cell.getCellStyle().getFontIndex();
         int fontCount2 = ((XSSFWorkbook)loc2.workbook).getStylesSource().getFonts().size();
 
         if(fontIdx1 >= fontCount1 || fontIdx2 >= fontCount2) {

Modified: poi/trunk/src/examples/src/org/apache/poi/examples/ss/html/ToHtml.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/ss/html/ToHtml.java?rev=1884259&r1=1884258&r2=1884259&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/examples/ss/html/ToHtml.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/examples/ss/html/ToHtml.java Wed Dec  9 16:59:51 2020
@@ -299,7 +299,7 @@ public final class ToHtml {
     }
 
     private void fontStyle(CellStyle style) {
-        Font font = wb.getFontAt(style.getFontIndexAsInt());
+        Font font = wb.getFontAt(style.getFontIndex());
 
         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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -214,11 +214,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#getFontIndexAsInt()
+     * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
      * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int)
      */
     public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
-        return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndexAsInt());
+        return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndex());
     }
 
     /**
@@ -831,7 +831,7 @@ public final class HSSFCellStyle impleme
             FontRecord fr = _workbook.createNewFont();
             fr.cloneStyleFrom(
                     source._workbook.getFontRecordAt(
-                            source.getFontIndexAsInt()
+                            source.getFontIndex()
                     )
             );
 

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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -348,7 +348,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.getFontIndexAsInt());
+        put(properties, FONT, style.getFontIndex());
         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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -156,7 +156,7 @@ public class SheetUtil {
         if (cellType == CellType.FORMULA)
             cellType = cell.getCachedFormulaResultType();
 
-        Font font = wb.getFontAt(style.getFontIndexAsInt());
+        Font font = wb.getFontAt(style.getFontIndex());
 
         double width = -1;
         if (cellType == CellType.STRING) {

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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -211,7 +211,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().getFontIndexAsInt());
+        Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
         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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -351,7 +351,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().getFontIndexAsInt());
+        Font font = workbook.getFontAt(cell.getCellStyle().getFontIndex());
         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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -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.getFontIndexAsInt());
+        assertEquals(1, cellStyle.getFontIndex());
 
         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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -2850,12 +2850,12 @@ public final class TestBugs extends Base
 
             Cell cell = row.getCell(1);
             CellStyle style = cell.getCellStyle();
-            assertEquals(26, style.getFontIndexAsInt());
+            assertEquals(26, style.getFontIndex());
 
             row = sheet.getRow(3);
             cell = row.getCell(1);
             style = cell.getCellStyle();
-            assertEquals(28, style.getFontIndexAsInt());
+            assertEquals(28, style.getFontIndex());
 
             // check the two fonts
             HSSFFont font = wb.getFontAt(26);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java?rev=1884259&r1=1884258&r2=1884259&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Wed Dec  9 16:59:51 2020
@@ -395,7 +395,7 @@ public abstract class BaseTestBugzillaIs
             cell0.setCellValue(longValue);
 
             // autoSize will fail if required fonts are not installed, skip this test then
-            Font font = wb.getFontAt(cell0.getCellStyle().getFontIndexAsInt());
+            Font font = wb.getFontAt(cell0.getCellStyle().getFontIndex());
             Assume.assumeTrue("Cannot verify autoSizeColumn() because the necessary Fonts are not installed on this machine: " + font,
                               SheetUtil.canComputeColumnWidth(font));
 

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java?rev=1884259&r1=1884258&r2=1884259&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java Wed Dec  9 16:59:51 2020
@@ -312,7 +312,7 @@ public abstract class BaseTestCell {
                 cs = c.getCellStyle();
 
                 assertNotNull("Formula Cell Style", cs);
-                assertEquals("Font Index Matches", f.getIndexAsInt(), cs.getFontIndexAsInt());
+                assertEquals("Font Index Matches", f.getIndexAsInt(), cs.getFontIndex());
                 assertEquals("Top Border", BorderStyle.THIN, cs.getBorderTop());
                 assertEquals("Left Border", BorderStyle.THIN, cs.getBorderLeft());
                 assertEquals("Right Border", BorderStyle.THIN, cs.getBorderRight());
@@ -731,7 +731,7 @@ public abstract class BaseTestCell {
             assertTrue(style.getLocked());
             assertFalse(style.getHidden());
             assertEquals(0, style.getIndention());
-            assertEquals(0, style.getFontIndexAsInt());
+            assertEquals(0, style.getFontIndex());
             assertEquals(HorizontalAlignment.GENERAL, style.getAlignment());
             assertEquals(0, style.getDataFormat());
             assertFalse(style.getWrapText());

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=1884259&r1=1884258&r2=1884259&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 Wed Dec  9 16:59:51 2020
@@ -121,7 +121,7 @@ public abstract class BaseTestFont {
         s1 = wb2.getSheetAt(0);
 
         assertEquals(num0 + 1, wb2.getNumberOfFonts());
-        int idx = s1.getRow(0).getCell(0).getCellStyle().getFontIndexAsInt();
+        int idx = s1.getRow(0).getCell(0).getCellStyle().getFontIndex();
         Font fnt = wb2.getFontAt(idx);
         assertNotNull(fnt);
         assertEquals(IndexedColors.YELLOW.getIndex(), fnt.getColor());

Modified: poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java?rev=1884259&r1=1884258&r2=1884259&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java Wed Dec  9 16:59:51 2020
@@ -313,17 +313,17 @@ public abstract class BaseTestCellUtil {
         // should be assertSame, but a new HSSFCellStyle is returned for each getCellStyle() call. 
         // HSSFCellStyle wraps an underlying style record, and the underlying
         // style record is the same between multiple getCellStyle() calls.
-        assertEquals(defaultFontIndex, A1.getCellStyle().getFontIndexAsInt());
-        assertEquals(defaultFontIndex, B1.getCellStyle().getFontIndexAsInt());
+        assertEquals(defaultFontIndex, A1.getCellStyle().getFontIndex());
+        assertEquals(defaultFontIndex, B1.getCellStyle().getFontIndex());
 
         // get/set alignment modifies the cell's style
         CellUtil.setFont(A1, font);
-        assertEquals(customFontIndex, A1.getCellStyle().getFontIndexAsInt());
+        assertEquals(customFontIndex, A1.getCellStyle().getFontIndex());
 
         // get/set alignment doesn't affect the style of cells with
         // the same style prior to modifying the style
         assertNotEquals(A1.getCellStyle(), B1.getCellStyle());
-        assertEquals(defaultFontIndex, B1.getCellStyle().getFontIndexAsInt());
+        assertEquals(defaultFontIndex, B1.getCellStyle().getFontIndex());
 
         wb.close();
     }



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