]> source.dussan.org Git - poi.git/commitdiff
removed deprecation warnings to keep javac quiet
authorYegor Kozlov <yegor@apache.org>
Sat, 29 May 2010 18:31:04 +0000 (18:31 +0000)
committerYegor Kozlov <yegor@apache.org>
Sat, 29 May 2010 18:31:04 +0000 (18:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@949434 13f79535-47bb-0310-9956-ffa450edef68

src/examples/src/org/apache/poi/hssf/usermodel/examples/CellComments.java
src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java

index 84efa9cd2d5a88a4a782dc87d1d4e5c73e3e39ae..c3a213d582ba15ef41bd63c06d4068f98ae5e83c 100644 (file)
@@ -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);
index b423afd73b2e67bff991a69b5cf0ff6159f2828a..57fcfb9b79ad0a4ab750d473623474af7643ea7a 100644 (file)
@@ -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);
index db4a26c493809e3f33462f737090e52a20a596b0..cb0839e821d58ea5ffed00bde98ae93598fc964d 100644 (file)
@@ -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()));
index e81bf50807335a02ef1cce739a8cf7d6ef1f23a1..747c90397063ff70b8fccb5ebe6b26b8fd9582c5 100644 (file)
@@ -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);
     }