Author: nick Date: Fri Jul 2 21:29:32 2010 New Revision: 960111 URL: http://svn.apache.org/viewvc?rev=960111&view=rev Log: Fix deprecated warnings
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java?rev=960111&r1=960110&r2=960111&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java Fri Jul 2 21:29:32 2010 @@ -147,7 +147,9 @@ public class XSSFRichTextString implemen XSSFFont xssfFont = (XSSFFont)font; ArrayList<CTRElt> runs = new ArrayList<CTRElt>(); - CTRElt[] r = st.getRArray(); + CTRElt[] r = new CTRElt[st.getRList().size()]; + st.getRList().toArray(r); + int pos = 0; for (int i = 0; i < r.length; i++) { int rStart = pos; @@ -338,7 +340,7 @@ public class XSSFRichTextString implemen return st.getT(); } StringBuffer buf = new StringBuffer(); - for(CTRElt r : st.getRArray()){ + for(CTRElt r : st.getRList()){ buf.append(r.getT()); } return buf.toString(); @@ -425,7 +427,7 @@ public class XSSFRichTextString implemen protected void setStylesTableReference(StylesTable tbl){ styles = tbl; if(st.sizeOfRArray() > 0) { - for (CTRElt r : st.getRArray()) { + for (CTRElt r : st.getRList()) { CTRPrElt pr = r.getRPr(); if(pr != null){ String fontName = pr.getRFontArray(0).getVal(); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java?rev=960111&r1=960110&r2=960111&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java Fri Jul 2 21:29:32 2010 @@ -17,8 +17,6 @@ package org.apache.poi.xssf.usermodel; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.TreeMap; @@ -26,9 +24,9 @@ import org.apache.poi.ss.SpreadsheetVers import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.util.CellReference; +import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; -import org.apache.poi.util.Internal; import org.apache.poi.xssf.model.CalculationChain; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow; @@ -65,7 +63,7 @@ public class XSSFRow implements Row, Com _row = row; _sheet = sheet; _cells = new TreeMap<Integer, XSSFCell>(); - for (CTCell c : row.getCArray()) { + for (CTCell c : row.getCList()) { XSSFCell cell = new XSSFCell(this, c); _cells.put(cell.getColumnIndex(), cell); sheet.onReadCell(cell); @@ -394,10 +392,9 @@ public class XSSFRow implements Row, Com if(_row.sizeOfCArray() != _cells.size()) isOrdered = false; else { int i = 0; - CTCell[] xcell = _row.getCArray(); for (XSSFCell cell : _cells.values()) { CTCell c1 = cell.getCTCell(); - CTCell c2 = xcell[i++]; + CTCell c2 = _row.getCArray(i++); String r1 = c1.getR(); String r2 = c2.getR(); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=960111&r1=960110&r2=960111&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Fri Jul 2 21:29:32 2010 @@ -202,7 +202,7 @@ public class XSSFSheet extends POIXMLDoc _rows = new TreeMap<Integer, XSSFRow>(); sharedFormulas = new HashMap<Integer, XSSFCell>(); arrayFormulas = new ArrayList<CellRangeAddress>(); - for (CTRow row : worksheet.getSheetData().getRowArray()) { + for (CTRow row : worksheet.getSheetData().getRowList()) { XSSFRow r = new XSSFRow(row, this); _rows.put(r.getRowNum(), r); } @@ -222,7 +222,7 @@ public class XSSFSheet extends POIXMLDoc getPackagePart().getRelationshipsByType(XSSFRelation.SHEET_HYPERLINKS.getRelation()); // Turn each one into a XSSFHyperlink - for(CTHyperlink hyperlink : worksheet.getHyperlinks().getHyperlinkArray()) { + for(CTHyperlink hyperlink : worksheet.getHyperlinks().getHyperlinkList()) { PackageRelationship hyperRel = null; if(hyperlink.getId() != null) { hyperRel = hyperRels.getRelationshipByID(hyperlink.getId()); @@ -575,7 +575,9 @@ public class XSSFSheet extends POIXMLDoc return new int[0]; } - CTBreak[] brkArray = worksheet.getColBreaks().getBrkArray(); + CTBreak[] brkArray = new CTBreak[worksheet.getColBreaks().getBrkList().size()]; + worksheet.getColBreaks().getBrkList().toArray(brkArray); + int[] breaks = new int[brkArray.length]; for (int i = 0 ; i < brkArray.length ; i++) { CTBreak brk = brkArray[i]; @@ -996,7 +998,9 @@ public class XSSFSheet extends POIXMLDoc return new int[0]; } - CTBreak[] brkArray = worksheet.getRowBreaks().getBrkArray(); + CTBreak[] brkArray = new CTBreak[worksheet.getRowBreaks().getBrkList().size()]; + worksheet.getRowBreaks().getBrkList().toArray(brkArray); + int[] breaks = new int[brkArray.length]; for (int i = 0 ; i < brkArray.length ; i++) { CTBreak brk = brkArray[i]; @@ -1172,9 +1176,8 @@ public class XSSFSheet extends POIXMLDoc private short getMaxOutlineLevelCols(){ CTCols ctCols=worksheet.getColsArray(0); - CTCol[]colArray=ctCols.getColArray(); short outlineLevel=0; - for(CTCol col: colArray){ + for(CTCol col: ctCols.getColList()){ outlineLevel=col.getOutlineLevel()>outlineLevel? col.getOutlineLevel(): outlineLevel; } return outlineLevel; @@ -1319,7 +1322,9 @@ public class XSSFSheet extends POIXMLDoc * Removes a page break at the indicated column */ public void removeColumnBreak(int column) { - CTBreak[] brkArray = getSheetTypeColumnBreaks().getBrkArray(); + CTBreak[] brkArray = new CTBreak[getSheetTypeColumnBreaks().getBrkList().size()]; + getSheetTypeColumnBreaks().getBrkList().toArray(brkArray); + for (int i = 0 ; i < brkArray.length ; i++) { if (brkArray[i].getId() == column) { getSheetTypeColumnBreaks().removeBrk(i); @@ -1371,7 +1376,8 @@ public class XSSFSheet extends POIXMLDoc */ public void removeRowBreak(int row) { CTPageBreak pgBreak = worksheet.isSetRowBreaks() ? worksheet.getRowBreaks() : worksheet.addNewRowBreaks(); - CTBreak[] brkArray = pgBreak.getBrkArray(); + CTBreak[] brkArray = new CTBreak[pgBreak.getBrkList().size()]; + pgBreak.getBrkList().toArray(brkArray); for (int i = 0 ; i < brkArray.length ; i++) { if (brkArray[i].getId() == row) { pgBreak.removeBrk(i); @@ -2144,7 +2150,7 @@ public class XSSFSheet extends POIXMLDoc if(sheetComments != null){ //TODO shift Note's anchor in the associated /xl/drawing/vmlDrawings#.vml CTCommentList lst = sheetComments.getCTComments().getCommentList(); - for (CTComment comment : lst.getCommentArray()) { + for (CTComment comment : lst.getCommentList()) { CellReference ref = new CellReference(comment.getRef()); if(ref.getRow() == rownum){ ref = new CellReference(rownum + n, ref.getCol()); @@ -2270,7 +2276,7 @@ public class XSSFSheet extends POIXMLDoc */ public void setSelected(boolean value) { CTSheetViews views = getSheetTypeSheetViews(); - for (CTSheetView view : views.getSheetViewArray()) { + for (CTSheetView view : views.getSheetViewList()) { view.setTabSelected(value); } } @@ -2346,10 +2352,10 @@ public class XSSFSheet extends POIXMLDoc */ private CTSheetView getDefaultSheetView() { CTSheetViews views = getSheetTypeSheetViews(); - if (views == null || views.getSheetViewArray() == null || views.getSheetViewArray().length <= 0) { + if (views == null || views.getSheetViewList() == null || views.getSheetViewList().size() <= 0) { return null; } - return views.getSheetViewArray(views.getSheetViewArray().length - 1); + return views.getSheetViewArray(views.getSheetViewList().size() - 1); } /** @@ -2421,10 +2427,9 @@ public class XSSFSheet extends POIXMLDoc protected void write(OutputStream out) throws IOException { - if(worksheet.getColsArray().length == 1) { + if(worksheet.getColsList().size() == 1) { CTCols col = worksheet.getColsArray(0); - CTCol[] cols = col.getColArray(); - if(cols.length == 0) { + if(col.getColList().size() == 0) { worksheet.setColsArray(null); } } @@ -2473,10 +2478,9 @@ public class XSSFSheet extends POIXMLDoc if(sheetData.sizeOfRowArray() != _rows.size()) isOrdered = false; else { int i = 0; - CTRow[] xrow = sheetData.getRowArray(); for (XSSFRow row : _rows.values()) { CTRow c1 = row.getCTRow(); - CTRow c2 = xrow[i++]; + CTRow c2 = sheetData.getRowArray(i++); if (c1.getR() != c2.getR()){ isOrdered = false; break; @@ -2880,8 +2884,7 @@ public class XSSFSheet extends POIXMLDoc List<XSSFDataValidation> xssfValidations = new ArrayList<XSSFDataValidation>(); CTDataValidations dataValidations = this.worksheet.getDataValidations(); if( dataValidations!=null && dataValidations.getCount() > 0 ) { - CTDataValidation[] dataValidationList = dataValidations.getDataValidationArray(); - for (CTDataValidation ctDataValidation : dataValidationList) { + for (CTDataValidation ctDataValidation : dataValidations.getDataValidationList()) { CellRangeAddressList addressList = new CellRangeAddressList(); @SuppressWarnings("unchecked") @@ -2909,7 +2912,7 @@ public class XSSFSheet extends POIXMLDoc if( dataValidations==null ) { dataValidations = worksheet.addNewDataValidations(); } - int currentCount = dataValidations.getDataValidationArray().length; + int currentCount = dataValidations.getDataValidationList().size(); CTDataValidation newval = dataValidations.addNewDataValidation(); newval.set(xssfDataValidation.getCtDdataValidation()); dataValidations.setCount(currentCount + 1); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=960111&r1=960110&r2=960111&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Fri Jul 2 21:29:32 2010 @@ -217,7 +217,7 @@ public class XSSFWorkbook extends POIXML // Load individual sheets. The order of sheets is defined by the order of CTSheet elements in the workbook sheets = new ArrayList<XSSFSheet>(shIdMap.size()); - for (CTSheet ctSheet : this.workbook.getSheets().getSheetArray()) { + for (CTSheet ctSheet : this.workbook.getSheets().getSheetList()) { XSSFSheet sh = shIdMap.get(ctSheet.getId()); if(sh == null) { logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping"); @@ -231,7 +231,7 @@ public class XSSFWorkbook extends POIXML // Process the named ranges namedRanges = new ArrayList<XSSFName>(); if(workbook.isSetDefinedNames()) { - for(CTDefinedName ctName : workbook.getDefinedNames().getDefinedNameArray()) { + for(CTDefinedName ctName : workbook.getDefinedNames().getDefinedNameList()) { namedRanges.add(new XSSFName(ctName, this)); } } @@ -873,7 +873,9 @@ public class XSSFWorkbook extends POIXML validateSheetIndex(index); //activeTab (Active Sheet Index) Specifies an unsignedInt that contains the index to the active sheet in this book view. - CTBookView[] arrayBook = workbook.getBookViews().getWorkbookViewArray(); + CTBookView[] arrayBook = new CTBookView[workbook.getBookViews().getWorkbookViewList().size()]; + workbook.getBookViews().getWorkbookViewList().toArray(arrayBook); + for (int i = 0; i < arrayBook.length; i++) { workbook.getBookViews().getWorkbookViewArray(i).setActiveTab(index); } @@ -1153,7 +1155,7 @@ public class XSSFWorkbook extends POIXML private void saveCalculationChain(){ if(calcChain != null){ - int count = calcChain.getCTCalcChain().getCArray().length; + int count = calcChain.getCTCalcChain().getCList().size(); if(count == 0){ removeRelation(calcChain); calcChain = null; @@ -1220,7 +1222,9 @@ public class XSSFWorkbook extends POIXML * @return true if the sheet contains the name, false otherwise. */ private boolean containsSheet(String name, int excludeSheetIdx) { - CTSheet[] ctSheetArray = workbook.getSheets().getSheetArray(); + CTSheet[] ctSheetArray = new CTSheet[workbook.getSheets().getSheetList().size()]; + workbook.getSheets().getSheetList().toArray(ctSheetArray); + for (int i = 0; i < ctSheetArray.length; i++) { if (excludeSheetIdx != i && name.equalsIgnoreCase(ctSheetArray[i].getName())) return true; Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java?rev=960111&r1=960110&r2=960111&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/ColumnHelper.java Fri Jul 2 21:29:32 2010 @@ -55,11 +55,14 @@ public class ColumnHelper { public void cleanColumns() { this.newCols = CTCols.Factory.newInstance(); - CTCols[] colsArray = worksheet.getColsArray(); + CTCols[] colsArray = new CTCols[worksheet.getColsList().size()]; + worksheet.getColsList().toArray(colsArray); + int i = 0; for (i = 0; i < colsArray.length; i++) { CTCols cols = colsArray[i]; - CTCol[] colArray = cols.getColArray(); + CTCol[] colArray = new CTCol[cols.getColList().size()]; + cols.getColList().toArray(colArray); for (int y = 0; y < colArray.length; y++) { CTCol col = colArray[y]; newCols = addCleanColIntoCols(newCols, col); @@ -73,7 +76,8 @@ public class ColumnHelper { } public static void sortColumns(CTCols newCols) { - CTCol[] colArray = newCols.getColArray(); + CTCol[] colArray = new CTCol[newCols.getColList().size()]; + newCols.getColList().toArray(colArray); Arrays.sort(colArray, new CTColComparator()); newCols.setColArray(colArray); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org