From 4b5c9081808b5834568eda913d7e018c43685318 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sat, 23 Sep 2017 10:26:27 +0000 Subject: [PATCH] Fix compiling Examples after adding new interface-method, fix compiler warnings and adjust some broken Javadoc git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1809388 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hssf/view/SVRowHeader.java | 8 ++-- .../poi/ss/examples/ExcelComparator.java | 45 ++++++------------- .../poi/xssf/eventusermodel/XLSX2CSV.java | 4 ++ .../streaming/examples/HybridStreaming.java | 5 +++ 4 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/examples/src/org/apache/poi/hssf/view/SVRowHeader.java b/src/examples/src/org/apache/poi/hssf/view/SVRowHeader.java index 622f506430..484fc5b447 100644 --- a/src/examples/src/org/apache/poi/hssf/view/SVRowHeader.java +++ b/src/examples/src/org/apache/poi/hssf/view/SVRowHeader.java @@ -32,12 +32,12 @@ import org.apache.poi.hssf.usermodel.*; * * @author Jason Height */ -public class SVRowHeader extends JList { +public class SVRowHeader extends JList { /** This model simply returns an integer number up to the number of rows * that are present in the sheet. * */ - private class SVRowHeaderModel extends AbstractListModel { + private class SVRowHeaderModel extends AbstractListModel { private HSSFSheet sheet; public SVRowHeaderModel(HSSFSheet sheet) { @@ -55,7 +55,7 @@ public class SVRowHeader extends JList { } /** Renderes the row number*/ - private class RowHeaderRenderer extends JLabel implements ListCellRenderer { + private class RowHeaderRenderer extends JLabel implements ListCellRenderer { private HSSFSheet sheet; private int extraHeight; @@ -90,7 +90,7 @@ public class SVRowHeader extends JList { } public SVRowHeader(HSSFSheet sheet, JTable table, int extraHeight) { - ListModel lm = new SVRowHeaderModel(sheet); + ListModel lm = new SVRowHeaderModel(sheet); this.setModel(lm); setFixedCellWidth(50); diff --git a/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java b/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java index c64508a7be..ccfe6763e7 100644 --- a/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java +++ b/src/examples/src/org/apache/poi/ss/examples/ExcelComparator.java @@ -28,6 +28,8 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Color; import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; @@ -109,10 +111,9 @@ public class ExcelComparator { /** * Utility to compare Excel File Contents cell by cell for all sheets. * - * @param workbook1 the workbook1 - * @param workbook2 the workbook2 + * @param wb1 the workbook1 + * @param wb2 the workbook2 * @return the Excel file difference containing a flag and a list of differences - * @throws ExcelCompareException the excel compare exception */ public static List compare(Workbook wb1, Workbook wb2) { Locator loc1 = new Locator(); @@ -130,11 +131,6 @@ public class ExcelComparator { /** * Compare data in all sheets. - * - * @param workbook1 the workbook1 - * @param workbook2 the workbook2 - * @param listOfDifferences the list of differences - * @throws ExcelCompareException the excel compare exception */ private void compareDataInAllSheets(Locator loc1, Locator loc2) { for (int i = 0; i < loc1.workbook.getNumberOfSheets(); i++) { @@ -291,15 +287,6 @@ public class ExcelComparator { /** * Compare sheet data. - * - * @param workbook1 - * the workbook1 - * @param workbook2 - * the workbook2 - * @param listOfDifferences - * - * @throws ExcelCompareException - * the excel compare exception */ private void compareSheetData(Locator loc1, Locator loc2) { compareNumberOfRowsInSheets(loc1, loc2); @@ -343,13 +330,13 @@ public class ExcelComparator { */ private void isCellAlignmentMatches(Locator loc1, Locator loc2) { // TODO: check for NPE - short align1 = loc1.cell.getCellStyle().getAlignment(); - short align2 = loc2.cell.getCellStyle().getAlignment(); + HorizontalAlignment align1 = loc1.cell.getCellStyle().getAlignmentEnum(); + HorizontalAlignment align2 = loc2.cell.getCellStyle().getAlignmentEnum(); if (align1 != align2) { addMessage(loc1, loc2, "Cell Alignment does not Match ::", - Short.toString(align1), - Short.toString(align2) + align1.name(), + align2.name() ); } } @@ -424,7 +411,7 @@ public class ExcelComparator { Date date1 = loc1.cell.getDateCellValue(); Date date2 = loc2.cell.getDateCellValue(); if (!date1.equals(date2)) { - addMessage(loc1, loc2, CELL_DATA_DOES_NOT_MATCH, date1.toGMTString(), date2.toGMTString()); + addMessage(loc1, loc2, CELL_DATA_DOES_NOT_MATCH, date1.toString(), date2.toString()); } } @@ -473,13 +460,13 @@ public class ExcelComparator { */ private void isCellFillPatternMatches(Locator loc1, Locator loc2) { // TOOO: Check for NPE - short fill1 = loc1.cell.getCellStyle().getFillPattern(); - short fill2 = loc2.cell.getCellStyle().getFillPattern(); + FillPatternType fill1 = loc1.cell.getCellStyle().getFillPatternEnum(); + FillPatternType fill2 = loc2.cell.getCellStyle().getFillPatternEnum(); if (fill1 != fill2) { addMessage(loc1, loc2, "Cell Fill pattern does not Match ::", - Short.toString(fill1), - Short.toString(fill2) + fill1.name(), + fill2.name() ); } } @@ -591,12 +578,6 @@ public class ExcelComparator { /** * Checks if cell under line matches. - * - * @param cellWorkBook1 - * the cell work book1 - * @param cellWorkBook2 - * the cell work book2 - * @return true, if cell under line matches */ private void isCellUnderLineMatches(Locator loc1, Locator loc2) { // TOOO: distinguish underline type diff --git a/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java b/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java index 22ee013ccc..39b978a77d 100644 --- a/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java +++ b/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java @@ -140,6 +140,10 @@ public class XLSX2CSV { public void headerFooter(String text, boolean isHeader, String tagName) { // Skip, no headers or footers in CSV } + + @Override + public void endSheet() { + } } diff --git a/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java b/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java index 31b5e859fd..6de5f5f6cb 100644 --- a/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java +++ b/src/examples/src/org/apache/poi/xssf/streaming/examples/HybridStreaming.java @@ -75,6 +75,11 @@ public class HybridStreaming { @Override public void cell(String cellReference, String formattedValue, XSSFComment comment) { } + + @Override + public void endSheet() { + + } }; }