]> source.dussan.org Git - poi.git/commitdiff
remove more deprecated code
authorPJ Fanning <fanningpj@apache.org>
Wed, 9 Dec 2020 16:59:51 +0000 (16:59 +0000)
committerPJ Fanning <fanningpj@apache.org>
Wed, 9 Dec 2020 16:59:51 +0000 (16:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884259 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
src/examples/src/org/apache/poi/examples/ss/CellStyleDetails.java
src/examples/src/org/apache/poi/examples/ss/ExcelComparator.java
src/examples/src/org/apache/poi/examples/ss/html/ToHtml.java
src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
src/java/org/apache/poi/ss/util/CellUtil.java
src/java/org/apache/poi/ss/util/SheetUtil.java
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestAutoSizeColumnTracker.java
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheetAutoSizeColumn.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java
src/testcases/org/apache/poi/ss/util/BaseTestCellUtil.java

index 5081bfcd525a10eca8e7d01fc25ab5c88fe95457..6997a9e8fa92bdf888014193f27153aa87ab6a36 100644 (file)
@@ -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) {
index c09efaec1b48a91ed91c0c45de0b1376c34275b1..eb80d9286f1776e57225cadeb7a12ecfed26908d 100644 (file)
@@ -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) {
index f20604240f913ed1506da46738ae6cd7390cd825..65c887891616fbf106e04e7c7a8190c517cebfd8 100644 (file)
@@ -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");
index 894c194ba062fe39b9253f203ae3eb01f969af23..db18e0fc9beeb0fce8ffc4098551af860d764378 100644 (file)
@@ -214,11 +214,11 @@ public final class HSSFCellStyle implements CellStyle, Duplicatable {
     /**
      * 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 implements CellStyle, Duplicatable {
             FontRecord fr = _workbook.createNewFont();
             fr.cloneStyleFrom(
                     source._workbook.getFontRecordAt(
-                            source.getFontIndexAsInt()
+                            source.getFontIndex()
                     )
             );
 
index 24d9a5126a11b6febf825b6eac28a9ec4927ac1e..dfbbf04481c790908dd0749570082bf9f5b55f01 100644 (file)
@@ -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());
index 1fb06f98c1be996551b591d88eb4f3c642bee036..d26e2c2a2638ea6645cc1e7b7a5140bd0e7c96c3 100644 (file)
@@ -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) {
index a38a5c935520aa4948d9eadba55d4eab33c7c8ba..aac3e88324cdd02ed70316edef9615e8ec940805 100644 (file)
@@ -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));
     }
index 34e3a57e5e052d0ea7763540d7f9fae3049a9007..97b11553d90bdcdd49630b26a6f64ca8ea087a1e 100644 (file)
@@ -351,7 +351,7 @@ public class TestSXSSFSheetAutoSizeColumn {
     
     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));
     }
index 28239f47b3007e1a9549c9d351d8583a2a9acd27..1ed0273e359cc9f70d6b24702274e8aa058badf2 100644 (file)
@@ -324,7 +324,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
         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());
index 66657a0fd9d8187163501073113460e3de18e416..24c5bf4c920d5aa0f72d045e663ad234ac9b9c60 100644 (file)
@@ -2850,12 +2850,12 @@ public final class TestBugs extends BaseTestBugzillaIssues {
 
             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);
index 4579cefadde73c3183e3522c8f174ad6fb82afb9..1fa9580f556559d5f5373eea0e2d86db14fa422d 100644 (file)
@@ -395,7 +395,7 @@ public abstract class BaseTestBugzillaIssues {
             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));
 
index e2032de2df4700bc3378ecad6fcdf67e74251b33..43d33d3d3f2cf84ab53d014d35765afe94303495 100644 (file)
@@ -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());
index 30d80a73c71511141a8d77ca903c1b70120dbec2..92a566888fab5a93dee19d95d6aab74b4e0a35c3 100644 (file)
@@ -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());
index 416dd4d55b4875db3daacc63c38618a1c4729685..5523827cc533e507406b38714c95fb6de4e21f1c 100644 (file)
@@ -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();
     }