Fix deprecated warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@960115 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-07-02 21:35:06 +00:00
parent 8f7d1e9a25
commit 14b89b8d6a
14 changed files with 32 additions and 36 deletions

View File

@ -39,7 +39,7 @@ public class XWPFCommentsDecorator extends XWPFParagraphDecorator {
XWPFComment comment;
commentText = new StringBuffer();
for(CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartArray())
for(CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartList())
{
if((comment = paragraph.getDocument().getCommentByID(anchor.getId().toString())) != null)
commentText.append("\tComment by " + comment.getAuthor()+": "+comment.getText());

View File

@ -242,8 +242,8 @@ public class XWPFHeaderFooterPolicy {
}
else {
CTP p = ftr.addNewP();
byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault();
byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
p.setRsidP(rsidr);
p.setRsidRDefault(rsidrdefault);
CTPPr pPr = p.addNewPPr();
@ -274,8 +274,8 @@ public class XWPFHeaderFooterPolicy {
}
else {
CTP p = ftr.addNewP();
byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault();
byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
p.setRsidP(rsidr);
p.setRsidRDefault(rsidrdefault);
CTPPr pPr = p.addNewPPr();
@ -400,8 +400,8 @@ public class XWPFHeaderFooterPolicy {
*/
private XWPFParagraph getWatermarkParagraph(String text, int idx) {
CTP p = CTP.Factory.newInstance();
byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault();
byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
p.setRsidP(rsidr);
p.setRsidRDefault(rsidrdefault);
CTPPr pPr = p.addNewPPr();

View File

@ -49,10 +49,10 @@ public class XWPFHyperlinkDecorator extends XWPFParagraphDecorator {
hyperlinkText = new StringBuffer();
// loop over hyperlink anchors
for(CTHyperlink link : paragraph.getCTP().getHyperlinkArray()){
for (CTR r : link.getRArray()) {
for(CTHyperlink link : paragraph.getCTP().getHyperlinkList()){
for (CTR r : link.getRList()) {
// Loop over text runs
for (CTText text : r.getTArray()){
for (CTText text : r.getTList()){
hyperlinkText.append(text.getStringValue());
}
}

View File

@ -37,7 +37,7 @@ public class XWPFComment
id = comment.getId().toString();
author = comment.getAuthor();
for(CTP ctp : comment.getPArray())
for(CTP ctp : comment.getPList())
{
XWPFParagraph p = new XWPFParagraph(ctp, null);
text.append(p.getText());

View File

@ -179,7 +179,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
else if(relation.equals(XWPFRelation.COMMENT.getRelation())){
CommentsDocument cmntdoc = CommentsDocument.Factory.parse(p.getPackagePart().getInputStream());
for(CTComment ctcomment : cmntdoc.getComments().getCommentArray()) {
for(CTComment ctcomment : cmntdoc.getComments().getCommentList()) {
comments.add(new XWPFComment(ctcomment));
}
}
@ -217,13 +217,13 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
if(relation.equals(XWPFRelation.FOOTNOTE.getRelation())){
FootnotesDocument footnotesDocument = FootnotesDocument.Factory.parse(p.getPackagePart().getInputStream());
for(CTFtnEdn ctFtnEdn : footnotesDocument.getFootnotes().getFootnoteArray()) {
for(CTFtnEdn ctFtnEdn : footnotesDocument.getFootnotes().getFootnoteList()) {
footnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn));
}
} else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())){
EndnotesDocument endnotesDocument = EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream());
for(CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteArray()) {
for(CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteList()) {
endnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn));
}
}
@ -944,7 +944,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
public void insertTable(int pos, XWPFTable table) {
bodyElements.add(pos, table);
int i;
for (i = 0; i < ctDocument.getBody().getTblArray().length; i++) {
for (i = 0; i < ctDocument.getBody().getTblList().size(); i++) {
CTTbl tbl = ctDocument.getBody().getTblArray(i);
if(tbl == table.getCTTbl()){
break;

View File

@ -27,7 +27,7 @@ public class XWPFFootnote implements Iterable<XWPFParagraph> {
private List<XWPFParagraph> paragraphs = new ArrayList<XWPFParagraph>();
public XWPFFootnote(XWPFDocument document, CTFtnEdn body) {
for (CTP p : body.getPArray()) {
for (CTP p : body.getPList()) {
paragraphs.add(new XWPFParagraph(p, document));
}
}

View File

@ -457,7 +457,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
public void insertTable(int pos, XWPFTable table) {
bodyElements.add(pos, table);
int i;
for (i = 0; i < headerFooter.getTblArray().length; i++) {
for (i = 0; i < headerFooter.getTblList().size(); i++) {
CTTbl tbl = headerFooter.getTblArray(i);
if(tbl == table.getCTTbl()){
break;

View File

@ -39,7 +39,7 @@ public class XWPFLatentStyles {
* checks wheter specific LatentStyleID is a latentStyle
*/
protected boolean isLatentStyle(String latentStyleID){
for ( CTLsdException lsd: latentStyles.getLsdExceptionArray()) {
for ( CTLsdException lsd: latentStyles.getLsdExceptionList()) {
if(lsd.getName().equals(latentStyleID));
return true;
}

View File

@ -72,10 +72,10 @@ public class XWPFNumbering extends POIXMLDocumentPart {
numberingDoc = NumberingDocument.Factory.parse(is);
ctNumbering = numberingDoc.getNumbering();
//get any Nums
for(CTNum ctNum : ctNumbering.getNumArray()) {
for(CTNum ctNum : ctNumbering.getNumList()) {
nums.add(new XWPFNum(ctNum, this));
}
for(CTAbstractNum ctAbstractNum : ctNumbering.getAbstractNumArray()){
for(CTAbstractNum ctAbstractNum : ctNumbering.getAbstractNumList()){
abstractNums.add(new XWPFAbstractNum(ctAbstractNum, this));
}
isNew = false;
@ -129,7 +129,7 @@ public class XWPFNumbering extends POIXMLDocumentPart {
*/
public BigInteger addNum(XWPFNum num){
ctNumbering.addNewNum();
int pos = (ctNumbering.getNumArray().length) - 1;
int pos = (ctNumbering.getNumList().size()) - 1;
ctNumbering.setNumArray(pos, num.getCTNum());
nums.add(num);
return num.getCTNum().getNumId();

View File

@ -18,12 +18,9 @@ package org.apache.poi.xwpf.usermodel;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
@ -46,7 +43,6 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtContentRun;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtRun;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSpacing;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTextAlignment;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder;
@ -1139,10 +1135,10 @@ public class XWPFParagraph implements IBodyElement{
*/
protected void addRun(CTR run){
int pos;
pos = paragraph.getRArray().length;
pos = paragraph.getRList().size();
paragraph.addNewR();
paragraph.setRArray(pos, run);
for (CTText ctText: paragraph.getRArray(pos).getTArray()) {
for (CTText ctText: paragraph.getRArray(pos).getTList()) {
this.text.append(ctText.getStringValue());
}
}
@ -1162,7 +1158,7 @@ public class XWPFParagraph implements IBodyElement{
startChar = startPos.getChar();
int beginRunPos = 0, candCharPos = 0;
boolean newList = false;
for (int runPos=startRun; runPos<paragraph.getRArray().length; runPos++) {
for (int runPos=startRun; runPos<paragraph.getRList().size(); runPos++) {
int beginTextPos = 0,beginCharPos = 0, textPos = 0, charPos = 0;
CTR ctRun = paragraph.getRArray(runPos);
XmlCursor c = ctRun.newCursor();
@ -1246,7 +1242,7 @@ public class XWPFParagraph implements IBodyElement{
int charEnd = segment.getEndChar();
StringBuffer out = new StringBuffer();
for(int i=runBegin; i<=runEnd;i++){
int startText=0, endText = paragraph.getRArray(i).getTArray().length-1;
int startText=0, endText = paragraph.getRArray(i).getTList().size()-1;
if(i==runBegin)
startText=textBegin;
if(i==runEnd)

View File

@ -127,7 +127,7 @@ public class XWPFRun {
* @param value the literal text which shall be displayed in the document
*/
public void setText(String value) {
setText(value,run.getTArray().length);
setText(value,run.getTList().size());
}
/**

View File

@ -75,7 +75,7 @@ public class XWPFStyles extends POIXMLDocumentPart{
throw new POIXMLException();
}
//get any Style
for(CTStyle style : ctStyles.getStyleArray()) {
for(CTStyle style : ctStyles.getStyleList()) {
listStyle.add(new XWPFStyle(style, this));
}
}
@ -117,7 +117,7 @@ public class XWPFStyles extends POIXMLDocumentPart{
public void addStyle(XWPFStyle style){
listStyle.add(style);
ctStyles.addNewStyle();
int pos = (ctStyles.getStyleArray().length) - 1;
int pos = (ctStyles.getStyleList().size()) - 1;
ctStyles.setStyleArray(pos, style.getCTStyle());
}
/**

View File

@ -71,12 +71,12 @@ public class XWPFTable implements IBodyElement{
if (table.sizeOfTrArray() == 0)
createEmptyTable(table);
for (CTRow row : table.getTrArray()) {
for (CTRow row : table.getTrList()) {
StringBuffer rowText = new StringBuffer();
XWPFTableRow tabRow = new XWPFTableRow(row, this);
tableRows.add(tabRow);
for (CTTc cell : row.getTcArray()) {
for (CTP ctp : cell.getPArray()) {
for (CTTc cell : row.getTcList()) {
for (CTP ctp : cell.getPList()) {
XWPFParagraph p = new XWPFParagraph(ctp, part);
if (rowText.length() > 0) {
rowText.append('\t');

View File

@ -127,7 +127,7 @@ public class XWPFTableRow {
public List<XWPFTableCell> getTableCells(){
if(tableCells == null){
List<XWPFTableCell> cells = new ArrayList<XWPFTableCell>();
for (CTTc tableCell : ctRow.getTcArray()) {
for (CTTc tableCell : ctRow.getTcList()) {
cells.add(new XWPFTableCell(tableCell, this, table.getPart()));
}
this.tableCells = cells;