[seam-commits] Seam SVN: r10072 - in trunk: examples/excel/view and 2 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Sun Feb 22 16:37:47 EST 2009
Author: danielc.roth
Date: 2009-02-22 16:37:46 -0500 (Sun, 22 Feb 2009)
New Revision: 10072
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
trunk/examples/excel/view/home.xhtml
trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java
trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java
trunk/src/excel/org/jboss/seam/excel/css/Parser.java
trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java
trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java
Log:
Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2009-02-22 21:37:46 UTC (rev 10072)
@@ -2997,6 +2997,16 @@
</para>
</entry>
</row>
+ <row>
+ <entry valign="top">
+ <para>xls-column-export</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Should the column be shown in export? Valid values are "true" and "false". Default is "true".
+ </para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
Modified: trunk/examples/excel/view/home.xhtml
===================================================================
--- trunk/examples/excel/view/home.xhtml 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/examples/excel/view/home.xhtml 2009-02-22 21:37:46 UTC (rev 10072)
@@ -54,6 +54,12 @@
</f:facet>
<h:outputText value="#{person.task}" />
</rich:column>
+ <rich:column style="xls-column-export:false">
+ <f:facet name="header">
+ <h:outputText value="Hide in export" style="xls-font: red bold" />
+ </f:facet>
+ <h:outputText value="Details" />
+ </rich:column>
</rich:dataTable>
<h:commandLink value="Export table as Excel spreadsheet"
rendered="#{!empty excelTest.result}"
Modified: trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java 2009-02-22 21:37:46 UTC (rev 10072)
@@ -53,5 +53,6 @@
public static final String COLUMN_WIDTHS = "xls-column-widths";
public static final String COLUMN_AUTO_SIZE = "xls-column-autosize";
public static final String COLUMN_HIDDEN = "xls-column-hidden";
+ public static final String COLUMN_EXPORT = "xls-column-export";
}
Modified: trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java 2009-02-22 21:37:46 UTC (rev 10072)
@@ -12,10 +12,12 @@
public Boolean autoSize;
public Boolean hidden;
public Integer width;
+ public Boolean export;
public ColumnStyle(Map<String, Object> styleMap) {
autoSize = (Boolean) styleMap.get(CSSNames.COLUMN_AUTO_SIZE);
hidden = (Boolean) styleMap.get(CSSNames.COLUMN_HIDDEN);
width = (Integer) styleMap.get(CSSNames.COLUMN_WIDTH);
+ export = (Boolean) styleMap.get(CSSNames.COLUMN_EXPORT);
}
}
Modified: trunk/src/excel/org/jboss/seam/excel/css/Parser.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/Parser.java 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/src/excel/org/jboss/seam/excel/css/Parser.java 2009-02-22 21:37:46 UTC (rev 10072)
@@ -138,6 +138,7 @@
propertyBuilders.put(CSSNames.COLUMN_WIDTH, new PropertyBuilders.ColumnWidth());
propertyBuilders.put(CSSNames.COLUMN_AUTO_SIZE, new PropertyBuilders.ColumnAutoSize());
propertyBuilders.put(CSSNames.COLUMN_HIDDEN, new PropertyBuilders.ColumnHidden());
+ propertyBuilders.put(CSSNames.COLUMN_EXPORT, new PropertyBuilders.ColumnExport());
propertyBuilders.put(CSSNames.COLUMN_WIDTHS, new PropertyBuilders.ColumnWidths());
propertyBuilders.put(CSSNames.FORCE_TYPE, new PropertyBuilders.ForceType());
}
Modified: trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java 2009-02-22 21:37:46 UTC (rev 10072)
@@ -49,6 +49,10 @@
public static class ColumnHidden extends BooleanPropertyBuilder
{
}
+
+ public static class ColumnExport extends BooleanPropertyBuilder
+ {
+ }
public static class BorderBottomLineStyle extends StringPropertyBuilder
{
Modified: trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java 2009-02-22 18:52:29 UTC (rev 10071)
+++ trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java 2009-02-22 21:37:46 UTC (rev 10072)
@@ -13,6 +13,7 @@
import javax.faces.context.FacesContext;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
@@ -25,6 +26,7 @@
import org.jboss.seam.excel.ExcelWorkbook;
import org.jboss.seam.excel.ExcelWorkbookException;
import org.jboss.seam.excel.css.CSSNames;
+import org.jboss.seam.excel.css.ColumnStyle;
import org.jboss.seam.excel.css.Parser;
import org.jboss.seam.excel.css.StyleMap;
import org.jboss.seam.excel.ui.ExcelComponent;
@@ -43,6 +45,7 @@
*/
@Name("org.jboss.seam.excel.exporter.excelExporter")
@Scope(ScopeType.EVENT)
+ at Install(precedence = Install.BUILT_IN)
@BypassInterceptors
public class ExcelExporter
{
@@ -75,6 +78,8 @@
{
excelWorkbook = ExcelFactory.instance().getExcelWorkbook(type);
+ Parser parser = new Parser();
+
// Gets the datatable
UIData dataTable = (UIData) FacesContext.getCurrentInstance().getViewRoot().findComponent(dataTableId);
if (dataTable == null)
@@ -101,10 +106,15 @@
int col = 0;
for (javax.faces.component.UIColumn column : columns)
{
- uiWorksheet.getChildren().add(column);
- Iterator iterator = UIWorksheet.unwrapIterator(dataTable.getValue());
- processColumn(column, iterator, dataTableVar, col++);
- excelWorkbook.nextColumn();
+ ColumnStyle columnStyle = new ColumnStyle(parser.getCascadedStyleMap(column));
+ boolean cssExport = columnStyle.export == null || columnStyle.export;
+ if (column.isRendered() && cssExport)
+ {
+ uiWorksheet.getChildren().add(column);
+ Iterator iterator = UIWorksheet.unwrapIterator(dataTable.getValue());
+ processColumn(column, iterator, dataTableVar, col++);
+ excelWorkbook.nextColumn();
+ }
}
// Restores the data table var
More information about the seam-commits
mailing list