From: Yegor Kozlov Date: Sat, 29 May 2010 18:31:04 +0000 (+0000) Subject: removed deprecation warnings to keep javac quiet X-Git-Tag: REL_3_7_BETA1~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8768fde8d889f2a2a6043e903d4f6b3b77ebd2a3;p=poi.git removed deprecation warnings to keep javac quiet git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@949434 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java index 84efa9cd2d..c3a213d582 100644 --- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java @@ -89,7 +89,7 @@ public class CellComments { * It works, the comment is visible. */ comment2.setRow(6); - comment2.setColumn((short)1); + comment2.setColumn(1); FileOutputStream out = new FileOutputStream("poi_comment.xls"); wb.write(out); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java b/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java index b423afd73b..57fcfb9b79 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java @@ -27,10 +27,7 @@ import junit.framework.TestCase; import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.XSSFTestDataSamples; -import org.apache.poi.xssf.usermodel.XSSFComment; -import org.apache.poi.xssf.usermodel.XSSFRichTextString; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xssf.usermodel.*; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCommentList; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments; @@ -131,7 +128,8 @@ public class TestCommentsTable extends TestCase { Cell c1r2s2 = r2s2.createCell(1); assertNull(c1r2s2.getCellComment()); - Comment cc2 = sheet2.createComment(); + Drawing dg = sheet2.createDrawingPatriarch(); + Comment cc2 = dg.createCellComment(new XSSFClientAnchor()); cc2.setAuthor("Also POI"); cc2.setString(new XSSFRichTextString("A new comment")); c1r2s2.setCellComment(cc2); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java index db4a26c493..cb0839e821 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -171,9 +171,11 @@ public final class TestXSSFSheet extends BaseTestSheet { public void testGetCellComment() { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet(); - XSSFComment comment = sheet.createComment(); + XSSFDrawing dg = sheet.createDrawingPatriarch(); + XSSFComment comment = dg.createCellComment(new XSSFClientAnchor()); + XSSFCell cell = sheet.createRow(9).createCell(2); comment.setAuthor("test C10 author"); - sheet.setCellComment("C10", comment); + cell.setCellComment(comment); assertNotNull(sheet.getCellComment(9, 2)); assertEquals("test C10 author", sheet.getCellComment(9, 2).getAuthor()); @@ -183,13 +185,14 @@ public final class TestXSSFSheet extends BaseTestSheet { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet(); - XSSFComment comment = sheet.createComment(); + XSSFDrawing dg = sheet.createDrawingPatriarch(); + XSSFComment comment = dg.createCellComment(new XSSFClientAnchor()); Cell cell = sheet.createRow(0).createCell(0); CommentsTable comments = sheet.getCommentsTable(false); CTComments ctComments = comments.getCTComments(); - sheet.setCellComment("A1", comment); + cell.setCellComment(comment); assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef()); comment.setAuthor("test A1 author"); assertEquals("test A1 author", comments.getAuthor((int) ctComments.getCommentList().getCommentArray(0).getAuthorId())); diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java b/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java index e81bf50807..747c903970 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java @@ -1655,6 +1655,7 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable { * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ + @SuppressWarnings("deprecation") public FontMetrics getFontMetrics(Font f) { return Toolkit.getDefaultToolkit().getFontMetrics(f); }