cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r707326 - in /cocoon/trunk: blocks/cocoon-poi/cocoon-poi-impl/src/changes/ blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/ parent/
Date Thu, 23 Oct 2008 09:32:46 GMT
Author: felixk
Date: Thu Oct 23 02:32:44 2008
New Revision: 707326

URL: http://svn.apache.org/viewvc?rev=707326&view=rev
Log:
Update to poi-3.2-FINAL

Modified:
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/changes/changes.xml
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Cell.java
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPSelection.java
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPStyleRegion.java
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
    cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Workbook.java
    cocoon/trunk/parent/pom.xml

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/changes/changes.xml?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/changes/changes.xml (original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/changes/changes.xml Thu Oct 23 02:32:44
2008
@@ -25,6 +25,9 @@
 <document>
   <body>
     <release version="1.0.0-M1" date="2008-??-??" description="unreleased">
+      <action dev="felixk" type="update">
+        Update to poi-3.2-FINAL.
+      </action>
       <action dev="antonio" type="fix" issue="COCOON-2209" due-to="Reynaldo Porras" due-to-email="rporras@agssa.net">
         Formatted style regions stop creating style at 2000 rows.
       </action>

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Cell.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Cell.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Cell.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Cell.java
Thu Oct 23 02:32:44 2008
@@ -52,7 +52,6 @@
     Cell(final HSSFCell cell, final int cellType) {
         _cell = cell;
         _celltype = cellType;
-        _cell.setEncoding(HSSFCell.ENCODING_UTF_16);
     }
 
     /**

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
Thu Oct 23 02:32:44 2008
@@ -26,7 +26,7 @@
 import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
 import org.apache.cocoon.components.elementprocessor.types.NumericResult;
 import org.apache.cocoon.components.elementprocessor.types.Validator;
-import org.apache.poi.hssf.util.Region;
+import org.apache.poi.hssf.util.CellRangeAddress;
 /**
  * Implementation of ElementProcessor to handle the "Cell" tag.
  * This element has several attributes and may contain other elements.
@@ -231,7 +231,7 @@
         }
         
         if(getColumns() != -1 && getRows() != -1) {
-            getSheet().addMergedRegion(new Region(getRow(),(short)getColumn(),getRow() +
getRows() - 1,(short)(getColumn() + getColumns() - 1)));
+            getSheet().addMergedRegion(new CellRangeAddress(getRow(),getColumn(),getRow()
+ getRows() - 1,(getColumn() + getColumns() - 1)));
         }
 
     }

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java
Thu Oct 23 02:32:44 2008
@@ -17,8 +17,8 @@
 
 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
 
+import org.apache.poi.hssf.util.CellRangeAddress;
 import org.apache.poi.hssf.util.RangeAddress;
-import org.apache.poi.hssf.util.Region;
 
 import java.io.IOException;
 
@@ -49,7 +49,7 @@
     }
 
     /**
-     * Setup the merged regions
+     * Setup the merged cellRangeAddresses
      * @exception IOException
      */
     public void endProcessing() throws IOException {
@@ -58,11 +58,9 @@
 
         //subtracting one since rangeaddress starts at 1,1 where rows/cols
         // start at 0,0
-        short fromCol =
-            (short) (rangeAddress.getXPosition(rangeAddress.getFromCell()) - 1);
+        int fromCol = rangeAddress.getXPosition(rangeAddress.getFromCell()) - 1;
         int fromRow = rangeAddress.getYPosition(rangeAddress.getFromCell()) - 1;
-        short toCol =
-            (short) (rangeAddress.getXPosition(rangeAddress.getToCell()) - 1);
+        int toCol = rangeAddress.getXPosition(rangeAddress.getToCell()) - 1;
         int toRow = rangeAddress.getYPosition(rangeAddress.getToCell()) - 1;
 
         if (getLogger().isDebugEnabled()) {
@@ -70,8 +68,8 @@
                     + fromCol + ")" + " to Row (" + toRow + ") Col (" + toCol
                     + ")");
         }
-        Region region = new Region(fromRow, fromCol, toRow, toCol);
-        sheet.addMergedRegion(region);
+        CellRangeAddress cellRangeAddress = new CellRangeAddress(fromRow, fromCol, toRow,
toCol);
+        sheet.addMergedRegion(cellRangeAddress);
     }
 
 } // end public class EPMerge

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPSelection.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPSelection.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPSelection.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPSelection.java
Thu Oct 23 02:32:44 2008
@@ -27,7 +27,7 @@
  * "Selection" tag
  *
  * This element is a container of other elements and has four
- * attributes that define the boundaries of the region.
+ * attributes that define the boundaries of the cellRangeAddress.
  *
  * This element is not used in HSSFSerializer 1.0
  *

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPStyleRegion.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPStyleRegion.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPStyleRegion.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPStyleRegion.java
Thu Oct 23 02:32:44 2008
@@ -25,7 +25,7 @@
 import org.apache.cocoon.components.elementprocessor.types.Attribute;
 
 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.util.Region;
+import org.apache.poi.hssf.util.CellRangeAddress;
 
 
 import java.io.IOException;
@@ -80,18 +80,18 @@
                 final ElementProcessor parent) throws IOException {
         super.initialize(attributes, parent);
 
-        Region region = new Region(getStartRow(), (short)getStartCol(),
-                getEndRow(), (short)getEndCol());
+        CellRangeAddress cellRangeAddress = new CellRangeAddress(getStartRow(), getStartCol(),
+                getEndRow(), getEndCol());
 
-        getLogger().debug("region area is " + region.getArea());
-        if (region.getArea() < MAX_AREA) {
+        getLogger().debug("region area is " + getArea(cellRangeAddress));
+        if (getArea(cellRangeAddress) < MAX_AREA) {
             //protect against stupid mega regions
             //of generally NOTHING and no real
-            //puprose created by gnumeric
+            //purpose created by gnumeric
             getLogger().debug("region added");
-            _style = getSheet().addStyleRegion(region); //test
+            _style = getSheet().addStyleRegion(cellRangeAddress); //test
         } else {
-            getLogger().debug("Region NOT added!. Reason: region.getArea() = " + region.getArea()
+ " > " + MAX_AREA);
+            getLogger().debug("Region NOT added!. Reason: getArea(cellRangeAddress) = " +
getArea(cellRangeAddress) + " > " + MAX_AREA);
             invalid = true;
         }
         colorhash = ((EPStyles)parent).getColorHash();
@@ -168,5 +168,10 @@
     public boolean isValid() {
         return (!invalid);
     }
+    
+    private int getArea(CellRangeAddress cellRangeAddress) {
+        return ((1 + (cellRangeAddress.getLastRow() - cellRangeAddress.getFirstRow()))
+                * (1 + (cellRangeAddress.getLastColumn() - cellRangeAddress.getFirstColumn())));
+    }
 
 } // end public class EPStyleRegion

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
Thu Oct 23 02:32:44 2008
@@ -30,8 +30,8 @@
 import org.apache.poi.hssf.usermodel.HSSFHeader;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.util.CellRangeAddress;
 import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.hssf.util.Region;
 
 /**
  * internal representation of a Sheet
@@ -51,13 +51,13 @@
     // keys are Shorts (row numbers), values are Row instances
     private Map _rows;
 
-    private Map regions;
+    private Map cellRangeAddresses;
 
     //optimization constant
     private final static int ROWS_CAPACITY = 200;
 
     //optimization constant
-    private final static int REGION_CAPACITY = 20;
+    private final static int CELLRANGEADDRESS_CAPACITY = 20;
 
     /**
      * Constructor Sheet
@@ -69,7 +69,7 @@
         _sheet = _workbook.createSheet(_name);
         _physical_index = _workbook.getPhysicalIndex(_name);
         _rows = new HashMap(ROWS_CAPACITY);
-        regions = new HashMap(REGION_CAPACITY);
+        cellRangeAddresses = new HashMap(CELLRANGEADDRESS_CAPACITY);
     }
 
     /**
@@ -97,7 +97,7 @@
         if (!isValidColumnPoints(points)) {
             throw new IOException("points " + points + " is out of range");
         }
-        _sheet.setColumnWidth((short)number, (short) ((points * 48) + .5));
+        _sheet.setColumnWidth((int)number, (short) ((points * 48) + .5));
     }
 
     /**
@@ -105,7 +105,7 @@
      * @param number the column number
      * @return column width in characters
      */
-    short getColumnWidth(short number) {
+    int getColumnWidth(int number) {
         return _sheet.getColumnWidth(number);
     }
 
@@ -118,13 +118,13 @@
         if (width < 0 || (width >= (4.8 * (0.5 + Short.MAX_VALUE)))) {
             throw new IOException("Invalid width (" + width + ")");
         } // 12 is being used as a "guessed" points for the font
-        _sheet.setDefaultColumnWidth((short) ((width / 4.8) + 0.5));
+        _sheet.setDefaultColumnWidth((int) ((width / 4.8) + 0.5));
     }
 
     /**
      * @return default column width (in 1/256ths of a character width)
      */
-    short getDefaultColumnWidth() {
+    int getDefaultColumnWidth() {
         return _sheet.getDefaultColumnWidth();
     }
 
@@ -184,9 +184,9 @@
         return rval;
     }
 
-    HSSFCellStyle addStyleRegion(Region region) {
+    HSSFCellStyle addStyleRegion(CellRangeAddress cellRangeAddress) {
         HSSFCellStyle style = _workbook.createStyle();
-        regions.put(region, style);
+        cellRangeAddresses.put(cellRangeAddress, style);
         return style;
     }
 
@@ -197,11 +197,12 @@
      * @return HSSFCellStyle
      */
     HSSFCellStyle getCellStyleForRegion(int row, short col) {
-        Iterator iregions = regions.keySet().iterator();
-        while (iregions.hasNext()) {
-            Region region = ((Region)iregions.next());
-            if (region.contains(row, col)) {
-                return (HSSFCellStyle)regions.get(region);
+        Iterator icellRangeAddresses = cellRangeAddresses.keySet().iterator();
+        while (icellRangeAddresses.hasNext()) {
+            CellRangeAddress cellRangeAddress = ((CellRangeAddress)icellRangeAddresses.next());
+            if ( row >= cellRangeAddress.getFirstRow() && row <= cellRangeAddress.getLastRow()
+              && col >= cellRangeAddress.getFirstColumn() && col <=
cellRangeAddress.getLastColumn()) {
+                return (HSSFCellStyle)cellRangeAddresses.get(cellRangeAddress);
             }
         }
         return null;
@@ -227,10 +228,10 @@
 
     /**
      * Flag a certain region of cells to be merged
-     * @param region the region to create as merged
+     * @param cellRangeAddress the region to create as merged
      */
-    void addMergedRegion(Region region) {
-        this._sheet.addMergedRegion(region);
+    void addMergedRegion(CellRangeAddress cellRangeAddress) {
+        this._sheet.addMergedRegion(cellRangeAddress);
     }
 
     /**
@@ -242,14 +243,14 @@
      * defined.
      */
     public void assignBlanksToRegions() {
-        Iterator iregions = regions.keySet().iterator();
+        Iterator iregions = cellRangeAddresses.keySet().iterator();
         while (iregions.hasNext()) {
-            Region region = ((Region)iregions.next());
-            for (int rownum = region.getRowFrom(); rownum < region.getRowTo() + 1; rownum++)
{
+            CellRangeAddress cellRangeAddress = ((CellRangeAddress)iregions.next());
+            for (int rownum = cellRangeAddress.getFirstRow(); rownum < cellRangeAddress.getLastColumn()
+ 1; rownum++) {
                 HSSFRow row = _sheet.getRow(rownum);
-                for (short colnum = region.getColumnFrom();
-                            colnum < region.getColumnTo() + 1; colnum++) {
-                    HSSFCellStyle style = (HSSFCellStyle)regions.get(region);
+                for (int colnum = cellRangeAddress.getFirstColumn();
+                            colnum < cellRangeAddress.getLastColumn() + 1; colnum++) {
+                    HSSFCellStyle style = (HSSFCellStyle)cellRangeAddresses.get(cellRangeAddress);
                     if (!isBlank(style)) {
                         //don't waste time with huge blocks of blankly styled cells
                         if (row == null) {
@@ -263,7 +264,7 @@
                             cell = row.createCell(colnum);
                             cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
                             cell.setCellStyle(
-                                (HSSFCellStyle)regions.get(region));
+                                (HSSFCellStyle)cellRangeAddresses.get(cellRangeAddress));
                         }
                     }
                 }

Modified: cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Workbook.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Workbook.java?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Workbook.java
(original)
+++ cocoon/trunk/blocks/cocoon-poi/cocoon-poi-impl/src/main/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Workbook.java
Thu Oct 23 02:32:44 2008
@@ -102,7 +102,7 @@
      * @param name the new name for the sheet
      */
     void renameSheet(final int index, final String name) {
-        _workbook.setSheetName(index, name, HSSFWorkbook.ENCODING_UTF_16);
+        _workbook.setSheetName(index, name);
     }
 
     /**

Modified: cocoon/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/parent/pom.xml?rev=707326&r1=707325&r2=707326&view=diff
==============================================================================
--- cocoon/trunk/parent/pom.xml (original)
+++ cocoon/trunk/parent/pom.xml Thu Oct 23 02:32:44 2008
@@ -1963,7 +1963,7 @@
       <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi</artifactId>
-        <version>3.0.2-FINAL</version>
+        <version>3.2-FINAL</version>
       </dependency>
       <dependency>
         <groupId>org.apache.portals.bridges</groupId>



Mime
View raw message