[seam-commits] Seam SVN: r8844 - in trunk/src/excel/org/jboss/seam/excel: csv and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Aug 28 18:03:51 EDT 2008


Author: nickarls
Date: 2008-08-28 18:03:50 -0400 (Thu, 28 Aug 2008)
New Revision: 8844

Modified:
   trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java
   trunk/src/excel/org/jboss/seam/excel/csv/CsvExcelWorkbook.java
   trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java
   trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java
Log:
Merge cells for worksheet headers and footers

Modified: trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java	2008-08-28 20:49:59 UTC (rev 8843)
+++ trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java	2008-08-28 22:03:50 UTC (rev 8844)
@@ -84,13 +84,15 @@
     * Places an item in the worksheet header
     * 
     * @param item The item to add
+    * @param colspan The number of columns to span
     */
-   public abstract void addWorksheetHeader(WorksheetItem item);
+   public abstract void addWorksheetHeader(WorksheetItem item, int colspan);
    
    /**
     * Places an item in the worksheet footer
     * 
     * @param item The item to add
+    * @param colspan The number of columns to span
     */
-   public abstract void addWorksheetFooter(WorksheetItem item);
+   public abstract void addWorksheetFooter(WorksheetItem item, int colspan);
 }
\ No newline at end of file

Modified: trunk/src/excel/org/jboss/seam/excel/csv/CsvExcelWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/csv/CsvExcelWorkbook.java	2008-08-28 20:49:59 UTC (rev 8843)
+++ trunk/src/excel/org/jboss/seam/excel/csv/CsvExcelWorkbook.java	2008-08-28 22:03:50 UTC (rev 8844)
@@ -159,13 +159,13 @@
       log.trace("executeCommand() is not supported by CSV exporter", new Object[0]);
    }
 
-   public void addWorksheetFooter(WorksheetItem item)
+   public void addWorksheetFooter(WorksheetItem item, int colspan)
    {
       // TODO Auto-generated method stub
       
    }
 
-   public void addWorksheetHeader(WorksheetItem item)
+   public void addWorksheetHeader(WorksheetItem item, int colspan)
    {
       // TODO Auto-generated method stub
       

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java	2008-08-28 20:49:59 UTC (rev 8843)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java	2008-08-28 22:03:50 UTC (rev 8844)
@@ -681,11 +681,18 @@
     * Places an item in the worksheet footer
     * 
     * @param item The item to add
+    * @param colspan The number of columns to span
     */
-   public void addWorksheetFooter(WorksheetItem item)
+   public void addWorksheetFooter(WorksheetItem item, int colspan)
    {
       currentColumnIndex = startColumnIndex;
       currentRowIndex = maxRowIndex;
+      UIMergeCells mergeCommand = new UIMergeCells();
+      mergeCommand.setStartColumn(currentColumnIndex);
+      mergeCommand.setStartRow(currentRowIndex);
+      mergeCommand.setEndColumn(currentColumnIndex + colspan - 1);
+      mergeCommand.setEndRow(currentRowIndex);
+      executeCommand(mergeCommand);
       addItem(item);
    }
 
@@ -693,9 +700,16 @@
     * Places an item in the worksheet header
     * 
     * @param item The item to add
+    * @param colspan The number of columns to span
     */
-   public void addWorksheetHeader(WorksheetItem item)
+   public void addWorksheetHeader(WorksheetItem item, int colspan)
    {
+      UIMergeCells mergeCommand = new UIMergeCells();
+      mergeCommand.setStartColumn(currentColumnIndex);
+      mergeCommand.setStartRow(currentRowIndex);
+      mergeCommand.setEndColumn(currentColumnIndex + colspan - 1);
+      mergeCommand.setEndRow(currentRowIndex);
+      executeCommand(mergeCommand);
       addItem(item);
       startRowIndex++;
    }

Modified: trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java	2008-08-28 20:49:59 UTC (rev 8843)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java	2008-08-28 22:03:50 UTC (rev 8844)
@@ -111,7 +111,8 @@
 
       WorksheetItem headerItem = (WorksheetItem) getFacet(HEADER_FACET_NAME);
       if (headerItem != null) {
-         excelWorkbook.addWorksheetHeader(headerItem);
+         int colspan = getChildrenOfType(getChildren(), UIColumn.class).size();
+         excelWorkbook.addWorksheetHeader(headerItem, colspan);
       }
       
       // Add worksheet level items
@@ -140,7 +141,8 @@
 
       WorksheetItem footerItem = (WorksheetItem) getFacet(FOOTER_FACET_NAME);
       if (footerItem != null) {
-         excelWorkbook.addWorksheetFooter(footerItem);
+         int colspan = getChildrenOfType(getChildren(), UIColumn.class).size();
+         excelWorkbook.addWorksheetFooter(footerItem, colspan);
       }
    }
    




More information about the seam-commits mailing list