From 66d83f98d7d403875e2eaefe615624060e19157e Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 14 Sep 2017 23:09:08 +0000 Subject: remove some deprecated code slated for removal in 3.18 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808402 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/usermodel/HSSFWorkbook.java | 30 ----- .../org/apache/poi/hssf/util/HSSFRegionUtil.java | 13 +- src/java/org/apache/poi/ss/usermodel/Workbook.java | 77 +++-------- src/java/org/apache/poi/ss/util/RegionUtil.java | 85 ------------- src/java/org/apache/poi/ss/util/WorkbookUtil.java | 26 ---- .../org/apache/poi/xslf/usermodel/XSLFSheet.java | 34 +---- .../apache/poi/xssf/streaming/SXSSFWorkbook.java | 141 +++++++++------------ .../apache/poi/xssf/usermodel/XSSFWorkbook.java | 8 -- .../poi/ss/usermodel/BaseTestSheetHiding.java | 45 ------- 9 files changed, 95 insertions(+), 364 deletions(-) (limited to 'src') diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index c2e8fdd58c..a705dc86a9 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -118,7 +118,6 @@ import org.apache.poi.util.LittleEndianByteArrayInputStream; import org.apache.poi.util.LittleEndianByteArrayOutputStream; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; -import org.apache.poi.util.Removal; /** * High level representation of a workbook. This is the first object most users @@ -767,26 +766,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss setSheetVisibility(sheetIx, hidden ? SheetVisibility.HIDDEN : SheetVisibility.VISIBLE); } - @Removal(version="3.18") - @Deprecated - @Override - public void setSheetHidden(int sheetIx, int hidden) { - switch (hidden) { - case Workbook.SHEET_STATE_VISIBLE: - setSheetVisibility(sheetIx, SheetVisibility.VISIBLE); - break; - case Workbook.SHEET_STATE_HIDDEN: - setSheetVisibility(sheetIx, SheetVisibility.HIDDEN); - break; - case Workbook.SHEET_STATE_VERY_HIDDEN: - setSheetVisibility(sheetIx, SheetVisibility.VERY_HIDDEN); - break; - default: - throw new IllegalArgumentException("Invalid sheet state : " + hidden + "\n" + - "Sheet state must beone of the Workbook.SHEET_STATE_* constants"); - } - } - @Override public void setSheetVisibility(int sheetIx, SheetVisibility visibility) { validateSheetIndex(sheetIx); @@ -2257,15 +2236,6 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss public boolean changeExternalReference(String oldUrl, String newUrl) { return workbook.changeExternalReference(oldUrl, newUrl); } - - /** - * @deprecated POI 3.16 beta 1. use {@link POIDocument#getDirectory()} instead - */ - @Deprecated - @Removal(version="3.18") - public DirectoryNode getRootDirectory(){ - return getDirectory(); - } @Internal public InternalWorkbook getInternalWorkbook() { diff --git a/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java b/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java index 514c841fc4..3cef98c4de 100644 --- a/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java +++ b/src/java/org/apache/poi/hssf/util/HSSFRegionUtil.java @@ -19,12 +19,17 @@ package org.apache.poi.hssf.util; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.RegionUtil; +import org.apache.poi.util.Removal; /** * Various utility functions that make working with a region of cells easier. + * @deprecated POI 3.18 + * @see RegionUtil */ +@Removal(version="3.20") public final class HSSFRegionUtil { private HSSFRegionUtil() { @@ -42,7 +47,7 @@ public final class HSSFRegionUtil { */ public static void setBorderLeft(int border, CellRangeAddress region, HSSFSheet sheet, HSSFWorkbook workbook) { - RegionUtil.setBorderLeft(border, region, sheet); + RegionUtil.setBorderLeft(BorderStyle.valueOf((short)border), region, sheet); } /** @@ -68,7 +73,7 @@ public final class HSSFRegionUtil { */ public static void setBorderRight(int border, CellRangeAddress region, HSSFSheet sheet, HSSFWorkbook workbook) { - RegionUtil.setBorderRight(border, region, sheet); + RegionUtil.setBorderRight(BorderStyle.valueOf((short)border), region, sheet); } /** @@ -94,7 +99,7 @@ public final class HSSFRegionUtil { */ public static void setBorderBottom(int border, CellRangeAddress region, HSSFSheet sheet, HSSFWorkbook workbook) { - RegionUtil.setBorderBottom(border, region, sheet); + RegionUtil.setBorderBottom(BorderStyle.valueOf((short)border), region, sheet); } /** @@ -120,7 +125,7 @@ public final class HSSFRegionUtil { */ public static void setBorderTop(int border, CellRangeAddress region, HSSFSheet sheet, HSSFWorkbook workbook) { - RegionUtil.setBorderTop(border, region, sheet); + RegionUtil.setBorderTop(BorderStyle.valueOf((short)border), region, sheet); } /** diff --git a/src/java/org/apache/poi/ss/usermodel/Workbook.java b/src/java/org/apache/poi/ss/usermodel/Workbook.java index 036cf6c4f1..f8f5b28ee1 100644 --- a/src/java/org/apache/poi/ss/usermodel/Workbook.java +++ b/src/java/org/apache/poi/ss/usermodel/Workbook.java @@ -53,42 +53,6 @@ public interface Workbook extends Closeable, Iterable { /** Device independent bitmap */ int PICTURE_TYPE_DIB = 7; - - /** - * Indicates the sheet is visible. - * - * @see #setSheetHidden(int, int) - * @deprecated POI 3.16 beta 2. Use {@link SheetVisibility#VISIBLE} instead. - */ - @Deprecated - @Removal(version="3.18") - int SHEET_STATE_VISIBLE = 0; - - /** - * Indicates the book window is hidden, but can be shown by the user via the user interface. - * - * @see #setSheetHidden(int, int) - * @deprecated POI 3.16 beta 2. Use {@link SheetVisibility#HIDDEN} instead. - */ - @Deprecated - @Removal(version="3.18") - int SHEET_STATE_HIDDEN = 1; - - /** - * Indicates the sheet is hidden and cannot be shown in the user interface (UI). - * - *

- * In Excel this state is only available programmatically in VBA: - * ThisWorkbook.Sheets("MySheetName").Visible = xlSheetVeryHidden - *

- * - * @see #setSheetHidden(int, int) - * @deprecated POI 3.16 beta 2. Use {@link SheetVisibility#VERY_HIDDEN} instead. - */ - @Deprecated - @Removal(version="3.18") - int SHEET_STATE_VERY_HIDDEN = 2; - /** * Convenience method to get the active sheet. The active sheet is is the sheet * which is currently displayed when the workbook is viewed in Excel. @@ -384,7 +348,10 @@ public interface Workbook extends Closeable, Iterable { * @param nameIndex position of the named range (0-based) * @return the defined name at the specified index * @throws IllegalArgumentException if the supplied index is invalid + * @deprecated 3.18. New projects should avoid accessing named ranges by index. */ + @Deprecated + @Removal(version="3.20") Name getNameAt(int nameIndex); /** @@ -401,27 +368,38 @@ public interface Workbook extends Closeable, Iterable { * * @param name the name of the defined name * @return zero based index of the defined name. -1 if not found. + * @deprecated 3.18. New projects should avoid accessing named ranges by index. + * Use {@link #getName(String)} instead. */ + @Deprecated + @Removal(version="3.20") int getNameIndex(String name); /** * Remove the defined name at the specified index * * @param index named range index (0 based) + * + * @deprecated 3.18. New projects should use {@link #removeName(Name)}. */ + @Deprecated + @Removal(version="3.20") void removeName(int index); /** * Remove a defined name by name * - * @param name the name of the defined name + * @param name the name of the defined name + * @deprecated 3.18. New projects should use {@link #removeName(Name)}. */ + @Deprecated + @Removal(version="3.20") void removeName(String name); /** * Remove a defined name * - * @param name the name of the defined name + * @param name the name of the defined name */ void removeName(Name name); @@ -579,29 +557,6 @@ public interface Workbook extends Closeable, Iterable { */ void setSheetHidden(int sheetIx, boolean hidden); - /** - * Hide or unhide a sheet. - * - *
    - *
  • 0 - visible.
  • - *
  • 1 - hidden.
  • - *
  • 2 - very hidden.
  • - *
- * - * Please note that the sheet currently set as active sheet (sheet 0 in a newly - * created workbook or the one set via setActiveSheet()) cannot be hidden. - * - * @param sheetIx the sheet index (0-based) - * @param hidden one of the following Workbook constants: - * Workbook.SHEET_STATE_VISIBLE, - * Workbook.SHEET_STATE_HIDDEN, or - * Workbook.SHEET_STATE_VERY_HIDDEN. - * @throws IllegalArgumentException if the supplied sheet index or state is invalid - * @deprecated POI 3.16 beta 2. Use {@link #setSheetVisibility(int, SheetVisibility)} instead. - */ - @Removal(version="3.18") - void setSheetHidden(int sheetIx, int hidden); - /** * Get the visibility (visible, hidden, very hidden) of a sheet in this workbook * diff --git a/src/java/org/apache/poi/ss/util/RegionUtil.java b/src/java/org/apache/poi/ss/util/RegionUtil.java index 8e86dbf597..5434aa3806 100644 --- a/src/java/org/apache/poi/ss/util/RegionUtil.java +++ b/src/java/org/apache/poi/ss/util/RegionUtil.java @@ -21,7 +21,6 @@ import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.util.Removal; /** * Various utility functions that make working with a region of cells easier. @@ -57,27 +56,6 @@ public final class RegionUtil { } } - /** - * Sets the left border style for a region of cells by manipulating the cell style of the individual - * cells on the left - * - * @param border The new border - * @param region The region that should have the border - * @param sheet The sheet that the region is on. - * @since POI 3.15 beta 2 - * @deprecated 3.16 beta 1. Use {@link #setBorderLeft(BorderStyle, CellRangeAddress, Sheet)}. - */ - @Removal(version="3.18") - public static void setBorderLeft(int border, CellRangeAddress region, Sheet sheet) { - int rowStart = region.getFirstRow(); - int rowEnd = region.getLastRow(); - int column = region.getFirstColumn(); - - CellPropertySetter cps = new CellPropertySetter(CellUtil.BORDER_LEFT, border); - for (int i = rowStart; i <= rowEnd; i++) { - cps.setProperty(CellUtil.getRow(i, sheet), column); - } - } /** * Sets the left border style for a region of cells by manipulating the cell style of the individual * cells on the left @@ -118,27 +96,6 @@ public final class RegionUtil { } } - /** - * Sets the right border style for a region of cells by manipulating the cell style of the individual - * cells on the right - * - * @param border The new border - * @param region The region that should have the border - * @param sheet The sheet that the region is on. - * @since POI 3.15 beta 2 - * @deprecated POI 3.16 beta 1. Use {@link #setBorderRight(BorderStyle, CellRangeAddress, Sheet)}. - */ - @Removal(version="3.18") - public static void setBorderRight(int border, CellRangeAddress region, Sheet sheet) { - int rowStart = region.getFirstRow(); - int rowEnd = region.getLastRow(); - int column = region.getLastColumn(); - - CellPropertySetter cps = new CellPropertySetter(CellUtil.BORDER_RIGHT, border); - for (int i = rowStart; i <= rowEnd; i++) { - cps.setProperty(CellUtil.getRow(i, sheet), column); - } - } /** * Sets the right border style for a region of cells by manipulating the cell style of the individual * cells on the right @@ -179,27 +136,6 @@ public final class RegionUtil { } } - /** - * Sets the bottom border style for a region of cells by manipulating the cell style of the individual - * cells on the bottom - * - * @param border The new border - * @param region The region that should have the border - * @param sheet The sheet that the region is on. - * @since POI 3.15 beta 2 - * @deprecated POI 3.16 beta 1. Use {@link #setBorderBottom(BorderStyle, CellRangeAddress, Sheet)}. - */ - @Removal(version="3.18") - public static void setBorderBottom(int border, CellRangeAddress region, Sheet sheet) { - int colStart = region.getFirstColumn(); - int colEnd = region.getLastColumn(); - int rowIndex = region.getLastRow(); - CellPropertySetter cps = new CellPropertySetter(CellUtil.BORDER_BOTTOM, border); - Row row = CellUtil.getRow(rowIndex, sheet); - for (int i = colStart; i <= colEnd; i++) { - cps.setProperty(row, i); - } - } /** * Sets the bottom border style for a region of cells by manipulating the cell style of the individual * cells on the bottom @@ -240,27 +176,6 @@ public final class RegionUtil { } } - /** - * Sets the top border style for a region of cells by manipulating the cell style of the individual - * cells on the top - * - * @param border The new border - * @param region The region that should have the border - * @param sheet The sheet that the region is on. - * @since POI 3.15 beta 2 - * @deprecated 3.16 beta 1. Use {@link #setBorderTop(BorderStyle, CellRangeAddress, Sheet)}. - */ - @Removal(version="3.18") - public static void setBorderTop(int border, CellRangeAddress region, Sheet sheet) { - int colStart = region.getFirstColumn(); - int colEnd = region.getLastColumn(); - int rowIndex = region.getFirstRow(); - CellPropertySetter cps = new CellPropertySetter(CellUtil.BORDER_TOP, border); - Row row = CellUtil.getRow(rowIndex, sheet); - for (int i = colStart; i <= colEnd; i++) { - cps.setProperty(row, i); - } - } /** * Sets the top border style for a region of cells by manipulating the cell style of the individual * cells on the top diff --git a/src/java/org/apache/poi/ss/util/WorkbookUtil.java b/src/java/org/apache/poi/ss/util/WorkbookUtil.java index 721a90b27b..012312a9c6 100644 --- a/src/java/org/apache/poi/ss/util/WorkbookUtil.java +++ b/src/java/org/apache/poi/ss/util/WorkbookUtil.java @@ -17,10 +17,6 @@ package org.apache.poi.ss.util; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.util.Removal; - - /** * Helper methods for when working with Usermodel Workbooks */ @@ -161,26 +157,4 @@ public class WorkbookUtil { } } - - /** - * Validates sheet state - * - * @param state the state to validate - * @throws IllegalArgumentException if state is not one of - * {@link Workbook#SHEET_STATE_VISIBLE}, - * {@link Workbook#SHEET_STATE_HIDDEN} or - * {@link Workbook#SHEET_STATE_VERY_HIDDEN} - * @deprecated POI 3.16 beta 2. Use {@link org.apache.poi.ss.usermodel.SheetVisibility} instead. - */ - @Removal(version="3.18") - @Deprecated - public static void validateSheetState(int state) { - switch(state){ - case Workbook.SHEET_STATE_VISIBLE: break; - case Workbook.SHEET_STATE_HIDDEN: break; - case Workbook.SHEET_STATE_VERY_HIDDEN: break; - default: throw new IllegalArgumentException("Invalid sheet state : " + state + "\n" + - "Sheet state must be one of the Workbook.SHEET_STATE_* constants"); - } - } } diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java index e327238b72..d3af46bff7 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java @@ -45,24 +45,13 @@ import org.apache.poi.sl.draw.Drawable; import org.apache.poi.sl.usermodel.PictureData; import org.apache.poi.sl.usermodel.Placeholder; import org.apache.poi.sl.usermodel.Sheet; -import org.apache.poi.util.Beta; -import org.apache.poi.util.IOUtils; -import org.apache.poi.util.Internal; -import org.apache.poi.util.POILogFactory; -import org.apache.poi.util.POILogger; -import org.apache.poi.util.Removal; +import org.apache.poi.util.*; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlOptions; import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl; -import org.openxmlformats.schemas.presentationml.x2006.main.CTCommonSlideData; -import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector; -import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame; -import org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape; -import org.openxmlformats.schemas.presentationml.x2006.main.CTPicture; -import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder; -import org.openxmlformats.schemas.presentationml.x2006.main.CTShape; +import org.openxmlformats.schemas.presentationml.x2006.main.*; @Beta public abstract class XSLFSheet extends POIXMLDocumentPart @@ -152,25 +141,16 @@ implements XSLFShapeContainer, Sheet { */ public abstract XmlObject getXmlObject(); - /* - * @deprecated POI 3.16 beta 1. use {@link XSLFTable} instead - */ - @Removal(version="3.18") - @Internal - public XSLFCommonSlideData getCommonSlideData() { - return _commonSlideData; - } - /* * @deprecated POI 3.16 beta 1. use {@link XSLFTable} instead */ @Removal(version="3.18") protected void setCommonSlideData(CTCommonSlideData data) { - if(data == null) { - _commonSlideData = null; - } else { - _commonSlideData = new XSLFCommonSlideData(data); - } + if(data == null) { + _commonSlideData = null; + } else { + _commonSlideData = new XSLFCommonSlideData(data); + } } private XSLFDrawing getDrawing(){ diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java index 9dcf1eaa04..9cc402ba02 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -49,13 +49,7 @@ import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.SheetVisibility; import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.util.IOUtils; -import org.apache.poi.util.Internal; -import org.apache.poi.util.NotImplemented; -import org.apache.poi.util.POILogFactory; -import org.apache.poi.util.POILogger; -import org.apache.poi.util.Removal; -import org.apache.poi.util.TempFile; +import org.apache.poi.util.*; import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.usermodel.XSSFChartSheet; import org.apache.poi.xssf.usermodel.XSSFSheet; @@ -1010,20 +1004,6 @@ public class SXSSFWorkbook implements Workbook { return _wb.getAllNames(); } - /** - * @param nameIndex position of the named range (0-based) - * @return the defined name at the specified index - * @throws IllegalArgumentException if the supplied index is invalid - * @deprecated 3.16. New projects should avoid accessing named ranges by index. - */ - @Override - @Deprecated - @Removal(version="3.18") - public Name getNameAt(int nameIndex) { - //noinspection deprecation - return _wb.getNameAt(nameIndex); - } - /** * Creates a new (uninitialised) defined name in this workbook * @@ -1035,56 +1015,6 @@ public class SXSSFWorkbook implements Workbook { return _wb.createName(); } - /** - * Gets the defined name index by name - * - * Note: Excel defined names are case-insensitive and - * this method performs a case-insensitive search. - * - * @param name the name of the defined name - * @return zero based index of the defined name. -1 if not found. - * - * @deprecated 3.16. New projects should avoid accessing named ranges by index. - * Use {@link #getName(String)} instead. - */ - @Override - @Deprecated - @Removal(version="3.18") - public int getNameIndex(String name) { - //noinspection deprecation - return _wb.getNameIndex(name); - } - - /** - * Remove the defined name at the specified index - * - * @param index named range index (0 based) - * - * @deprecated 3.16. New projects should use {@link #removeName(Name)}. - */ - @Override - @Deprecated - @Removal(version="3.18") - public void removeName(int index) { - //noinspection deprecation - _wb.removeName(index); - } - - /** - * Remove a defined name by name - * - * @param name the name of the defined name - * - * @deprecated 3.16. New projects should use {@link #removeName(Name)}. - */ - @Override - @Deprecated - @Removal(version="3.18") - public void removeName(String name) { - //noinspection deprecation - _wb.removeName(name); - } - /** * Remove the given defined name * @@ -1269,17 +1199,72 @@ public class SXSSFWorkbook implements Workbook { _wb.setSheetHidden(sheetIx,hidden); } - @Removal(version="3.18") + @Override + public void setSheetVisibility(int sheetIx, SheetVisibility visibility) { + _wb.setSheetVisibility(sheetIx, visibility); + } + + /** + * @param nameIndex position of the named range (0-based) + * @return the defined name at the specified index + * @throws IllegalArgumentException if the supplied index is invalid + * @deprecated 3.16. New projects should avoid accessing named ranges by index. + */ + @Override @Deprecated + @Removal(version="3.20") + public Name getNameAt(int nameIndex) { + //noinspection deprecation + return _wb.getNameAt(nameIndex); + } + + /** + * Gets the defined name index by name + * + * Note: Excel defined names are case-insensitive and + * this method performs a case-insensitive search. + * + * @param name the name of the defined name + * @return zero based index of the defined name. -1 if not found. + * + * @deprecated 3.16. New projects should avoid accessing named ranges by index. + * Use {@link #getName(String)} instead. + */ @Override - public void setSheetHidden(int sheetIx, int hidden) - { - _wb.setSheetHidden(sheetIx,hidden); + @Deprecated + @Removal(version="3.20") + public int getNameIndex(String name) { + //noinspection deprecation + return _wb.getNameIndex(name); } - + + /** + * Remove the defined name at the specified index + * @param index named range index (0 based) + * + * @deprecated 3.16. New projects should use {@link #removeName(Name)}. + */ @Override - public void setSheetVisibility(int sheetIx, SheetVisibility visibility) { - _wb.setSheetVisibility(sheetIx, visibility); + @Deprecated + @Removal(version="3.20") + public void removeName(int index) { + //noinspection deprecation + _wb.removeName(index); + } + + /** + * Remove a defined name by name + * + * @param name the name of the defined name + * + * @deprecated 3.16. New projects should use {@link #removeName(Name)}. + */ + @Override + @Deprecated + @Removal(version="3.20") + public void removeName(String name) { + //noinspection deprecation + _wb.removeName(name); } /** diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index 1774932a4e..e3e8f56eb7 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -1906,14 +1906,6 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook { setSheetVisibility(sheetIx, hidden ? SheetVisibility.HIDDEN : SheetVisibility.VISIBLE); } - @Deprecated - @Removal(version="3.18") - @Override - public void setSheetHidden(int sheetIx, int state) { - WorkbookUtil.validateSheetState(state); - setSheetVisibility(sheetIx, SheetVisibility.values()[state]); - } - @Override public void setSheetVisibility(int sheetIx, SheetVisibility visibility) { validateSheetIndex(sheetIx); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetHiding.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetHiding.java index d7fe79c983..2bce1c05d9 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetHiding.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheetHiding.java @@ -20,12 +20,10 @@ package org.apache.poi.ss.usermodel; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.io.IOException; import org.apache.poi.ss.ITestDataProvider; -import org.apache.poi.util.Removal; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -60,49 +58,6 @@ public abstract class BaseTestSheetHiding { wbU.close(); } - /** - * @deprecated 3.16 beta 2. Use {@link #testSheetVisibility()} instead. - * - * @throws IOException - */ - @Removal(version="3.18") - @Deprecated - @Test - public final void testSheetHiddenOld() throws IOException { - Workbook wb = _testDataProvider.createWorkbook(); - wb.createSheet("MySheet"); - - assertFalse(wb.isSheetHidden(0)); - assertFalse(wb.isSheetVeryHidden(0)); - - wb.setSheetHidden(0, Workbook.SHEET_STATE_HIDDEN); - assertTrue(wb.isSheetHidden(0)); - assertFalse(wb.isSheetVeryHidden(0)); - - wb.setSheetHidden(0, Workbook.SHEET_STATE_VERY_HIDDEN); - assertFalse(wb.isSheetHidden(0)); - assertTrue(wb.isSheetVeryHidden(0)); - - wb.setSheetHidden(0, Workbook.SHEET_STATE_VISIBLE); - assertFalse(wb.isSheetHidden(0)); - assertFalse(wb.isSheetVeryHidden(0)); - - try { - wb.setSheetHidden(0, -1); - fail("expectd exception"); - } catch (IllegalArgumentException e){ - // ok - } - try { - wb.setSheetHidden(0, 3); - fail("expectd exception"); - } catch (IllegalArgumentException e){ - // ok - } - - wb.close(); - } - @Test public final void testSheetVisibility() throws IOException { Workbook wb = _testDataProvider.createWorkbook(); -- cgit v1.2.3