diff options
author | PJ Fanning <fanningpj@apache.org> | 2017-09-14 23:09:08 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2017-09-14 23:09:08 +0000 |
commit | 66d83f98d7d403875e2eaefe615624060e19157e (patch) | |
tree | 6566a72c6edd5e2b305db8da0c6ce61d4d23755b /src/java/org/apache/poi/ss | |
parent | 03b4a49d9f36db6e8b91577db77661fffaee6e81 (diff) | |
download | poi-66d83f98d7d403875e2eaefe615624060e19157e.tar.gz poi-66d83f98d7d403875e2eaefe615624060e19157e.zip |
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
Diffstat (limited to 'src/java/org/apache/poi/ss')
-rw-r--r-- | src/java/org/apache/poi/ss/usermodel/Workbook.java | 77 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/util/RegionUtil.java | 85 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/util/WorkbookUtil.java | 26 |
3 files changed, 16 insertions, 172 deletions
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<Sheet> { /** 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). - * - * <p> - * In Excel this state is only available programmatically in VBA: - * <code>ThisWorkbook.Sheets("MySheetName").Visible = xlSheetVeryHidden </code> - * </p> - * - * @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<Sheet> { * @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<Sheet> { * * @param name the name of the defined name * @return zero based index of the defined name. <tt>-1</tt> 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); @@ -580,29 +558,6 @@ public interface Workbook extends Closeable, Iterable<Sheet> { void setSheetHidden(int sheetIx, boolean hidden); /** - * Hide or unhide a sheet. - * - * <ul> - * <li>0 - visible. </li> - * <li>1 - hidden. </li> - * <li>2 - very hidden.</li> - * </ul> - * - * 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 <code>Workbook</code> constants: - * <code>Workbook.SHEET_STATE_VISIBLE</code>, - * <code>Workbook.SHEET_STATE_HIDDEN</code>, or - * <code>Workbook.SHEET_STATE_VERY_HIDDEN</code>. - * @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 * * @param sheetIx the index of the sheet 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. @@ -64,27 +63,6 @@ public final class RegionUtil { * @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 - * - * @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.16 beta 1 */ public static void setBorderLeft(BorderStyle border, CellRangeAddress region, Sheet sheet) { @@ -125,27 +103,6 @@ public final class RegionUtil { * @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 - * - * @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.16 beta 1 */ public static void setBorderRight(BorderStyle border, CellRangeAddress region, Sheet sheet) { @@ -186,27 +143,6 @@ public final class RegionUtil { * @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 - * - * @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.16 beta 1 */ public static void setBorderBottom(BorderStyle border, CellRangeAddress region, Sheet sheet) { @@ -247,27 +183,6 @@ public final class RegionUtil { * @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 - * - * @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.16 beta 1 */ public static void setBorderTop(BorderStyle border, CellRangeAddress region, Sheet sheet) { 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"); - } - } } |