removed deprecation warnings to keep javac quiet

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@949434 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2010-05-29 18:31:04 +00:00
parent 8c6e2767fa
commit 55c924c5d2
4 changed files with 12 additions and 10 deletions

View File

@ -89,7 +89,7 @@ public class CellComments {
* It works, the comment is visible. * It works, the comment is visible.
*/ */
comment2.setRow(6); comment2.setRow(6);
comment2.setColumn((short)1); comment2.setColumn(1);
FileOutputStream out = new FileOutputStream("poi_comment.xls"); FileOutputStream out = new FileOutputStream("poi_comment.xls");
wb.write(out); wb.write(out);

View File

@ -27,10 +27,7 @@ import junit.framework.TestCase;
import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.XSSFTestDataSamples; import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.usermodel.XSSFComment; import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCommentList; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCommentList;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments;
@ -131,7 +128,8 @@ public class TestCommentsTable extends TestCase {
Cell c1r2s2 = r2s2.createCell(1); Cell c1r2s2 = r2s2.createCell(1);
assertNull(c1r2s2.getCellComment()); assertNull(c1r2s2.getCellComment());
Comment cc2 = sheet2.createComment(); Drawing dg = sheet2.createDrawingPatriarch();
Comment cc2 = dg.createCellComment(new XSSFClientAnchor());
cc2.setAuthor("Also POI"); cc2.setAuthor("Also POI");
cc2.setString(new XSSFRichTextString("A new comment")); cc2.setString(new XSSFRichTextString("A new comment"));
c1r2s2.setCellComment(cc2); c1r2s2.setCellComment(cc2);

View File

@ -171,9 +171,11 @@ public final class TestXSSFSheet extends BaseTestSheet {
public void testGetCellComment() { public void testGetCellComment() {
XSSFWorkbook workbook = new XSSFWorkbook(); XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet(); 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"); comment.setAuthor("test C10 author");
sheet.setCellComment("C10", comment); cell.setCellComment(comment);
assertNotNull(sheet.getCellComment(9, 2)); assertNotNull(sheet.getCellComment(9, 2));
assertEquals("test C10 author", sheet.getCellComment(9, 2).getAuthor()); assertEquals("test C10 author", sheet.getCellComment(9, 2).getAuthor());
@ -183,13 +185,14 @@ public final class TestXSSFSheet extends BaseTestSheet {
XSSFWorkbook workbook = new XSSFWorkbook(); XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet(); 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); Cell cell = sheet.createRow(0).createCell(0);
CommentsTable comments = sheet.getCommentsTable(false); CommentsTable comments = sheet.getCommentsTable(false);
CTComments ctComments = comments.getCTComments(); CTComments ctComments = comments.getCTComments();
sheet.setCellComment("A1", comment); cell.setCellComment(comment);
assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef()); assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef());
comment.setAuthor("test A1 author"); comment.setAuthor("test A1 author");
assertEquals("test A1 author", comments.getAuthor((int) ctComments.getCommentList().getCommentArray(0).getAuthorId())); assertEquals("test A1 author", comments.getAuthor((int) ctComments.getCommentList().getCommentArray(0).getAuthorId()));

View File

@ -1655,6 +1655,7 @@ public final class PPGraphics2D extends Graphics2D implements Cloneable {
* @see java.awt.FontMetrics * @see java.awt.FontMetrics
* @see java.awt.Graphics#getFontMetrics() * @see java.awt.Graphics#getFontMetrics()
*/ */
@SuppressWarnings("deprecation")
public FontMetrics getFontMetrics(Font f) { public FontMetrics getFontMetrics(Font f) {
return Toolkit.getDefaultToolkit().getFontMetrics(f); return Toolkit.getDefaultToolkit().getFontMetrics(f);
} }