[seam-commits] Seam SVN: r8859 - in trunk: examples/excel/resources/WEB-INF and 5 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Sat Aug 30 17:45:43 EDT 2008
Author: danielc.roth
Date: 2008-08-30 17:45:43 -0400 (Sat, 30 Aug 2008)
New Revision: 8859
Added:
trunk/examples/excel/view/people.xhtml
trunk/examples/excel/view/repeat.xhtml
trunk/examples/excel/view/vanilla-csv.xhtml
trunk/examples/excel/view/vanilla-jxl.xhtml
Removed:
trunk/examples/excel/view/csv.xhtml
trunk/examples/excel/view/jxl.xhtml
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
trunk/examples/excel/resources/WEB-INF/components.xml
trunk/examples/excel/resources/WEB-INF/web.xml
trunk/examples/excel/src/org/jboss/seam/excel/ExcelTest.java
trunk/examples/excel/view/css/screen.css
trunk/examples/excel/view/home.xhtml
trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java
trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java
trunk/src/excel/org/jboss/seam/excel/ui/UIExcelExport.java
trunk/src/excel/org/jboss/seam/excel/ui/UIWorkbook.java
trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java
Log:
JBSEAM-3238 and some minors
Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -1333,7 +1333,7 @@
<literal>pattern</literal>
—The pattern of the background. The value
is a string that can be one of "solid",
- "grey_25" etc (see
+ "gray_25" etc (see
<ulink
url="http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/format/Pattern.html">
jxl.format.Pattern
@@ -1381,14 +1381,14 @@
<e:worksheet>
<e:column value="#{personList}" var="person">
<e:cell value="#{person.age">
- <e:background color="green" pattern="grey_25"/>
+ <e:background color="green" pattern="gray_25"/>
</e:cell>
</e:column>
</e:worksheet>
</e:workbook>
]]>
</programlisting>
- <para>defined a green cell background with a 25% grey mask.</para>
+ <para>defined a green cell background with a 25% gray mask.</para>
</section>
<section id="excel.cells.borders">
<title>Borders</title>
Modified: trunk/examples/excel/resources/WEB-INF/components.xml
===================================================================
--- trunk/examples/excel/resources/WEB-INF/components.xml 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/resources/WEB-INF/components.xml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -2,21 +2,24 @@
xmlns:excel="http://jboss.com/products/seam/excel"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:framework="http://jboss.com/products/seam/framework"
+ xmlns:document="http://jboss.com/products/seam/document"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
- http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
+ http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
+ http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.1.xsd
http://jboss.com/products/seam/excel http://jboss.com/products/seam/excel-2.1.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
<core:init debug="true" jndi-pattern="@jndiPattern@" />
- <import>org.jboss.seam.excel.exporter</import>
+ <document:document-store use-extensions="true"></document:document-store>
- <!--
+ <!-- A sample on how a POI implementation could be added.
<excel:excelFactory>
<property name="implementations">
- <key>poi</key><value>org.jboss.seam.excel.poi.POIExcelWorkbook</value>
+ <key>poi</key>
+ <value>org.jboss.seam.excel.poi.POIExcelWorkbook</value>
</property>
</excel:excelFactory>
-->
Modified: trunk/examples/excel/resources/WEB-INF/web.xml
===================================================================
--- trunk/examples/excel/resources/WEB-INF/web.xml 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/resources/WEB-INF/web.xml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
@@ -22,11 +23,22 @@
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
<servlet>
+ <servlet-name>Document Store Servlet</servlet-name>
+ <servlet-class>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Document Store Servlet</servlet-name>
+ <url-pattern>*.csv</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Document Store Servlet</servlet-name>
+ <url-pattern>*.xls</url-pattern>
+ </servlet-mapping>
+ <servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
@@ -35,7 +47,7 @@
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
- <context-param>
+ <context-param>
<param-name>webAppRootKey</param-name>
<param-value>seam-excel</param-value>
</context-param>
Modified: trunk/examples/excel/src/org/jboss/seam/excel/ExcelTest.java
===================================================================
--- trunk/examples/excel/src/org/jboss/seam/excel/ExcelTest.java 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/src/org/jboss/seam/excel/ExcelTest.java 2008-08-30 21:45:43 UTC (rev 8859)
@@ -5,6 +5,7 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
@@ -15,74 +16,108 @@
{
private List<Person> people = new LinkedList<Person>();
+ private List<Person> result = new LinkedList<Person>();
+ private List<List<Person>> repeat = new LinkedList<List<Person>>();
+ private String searchWord;
- public List<Person> getPeople()
+
+ @Create
+ public void create()
{
- List<Person> ret = new LinkedList<Person>();
- for (int i = 0; i < 10; i++)
- {
- ret.add(new Person(i, "Janne" , "Andersson " + i));
- }
- return ret;
+ people.add(new Person("Gavin King", "Red Hat Inc.", "Project Lead"));
+ people.add(new Person("Pete Muir", "Red Hat Inc.", "Seam Core"));
+ people.add(new Person("Norman Richards", "Red Hat Inc.", "Seam Core"));
+ people.add(new Person("Shane Bryzak", "Red Hat Inc.", "Seam Security, Seam Remoting"));
+ people.add(new Person("Michael Yuan", "Individual", ""));
+ people.add(new Person("Mike Youngstrom", "Individual", "Spring Integration"));
+ people.add(new Person("Ales Justin", "Red Hat Inc.", "JBoss5/MC Integration"));
+ people.add(new Person("Christian Bauer", "Red Hat Inc.", "Seam Wiki, REST and GWT integration"));
+ people.add(new Person("Jay Balunas", "Red Hat Inc.", "Cross-platform testing"));
+ people.add(new Person("Dan Allen", "Individual", "Seam-gen, Bug fixes"));
+ people.add(new Person("Matt Drees", "Individual", "Seam Core"));
+ people.add(new Person("Jacob Orshalick", "Focus IT Solutions LLC", ""));
+ people.add(new Person("Nicklas Karlsson", "Individual", "Excel reporting"));
+ people.add(new Person("Daniel Roth", "Individual", "Excel reporting"));
+ people.add(new Person("Judy Guglielmin", "ICESoft Inc.", "ICEFaces integration"));
+ people.add(new Person("Max Rydahl Andersen", "Red Hat Inc.", "Lead developer JBoss Tools, Hibernate Tools, Seam Tools"));
+ people.add(new Person("Emmanuel Bernard", "Red Hat Inc.", "Lead developer Hibernate Annotations, EntityManager, Validator, Search"));
+ repeat.add(people.subList(0, 5));
+
+ }
+ public List<List<Person>> getRepeat()
+ {
+ return repeat;
}
+
+ public void setRepeat(List<List<Person>> repeat)
+ {
+ this.repeat = repeat;
+ }
- public List<Person> getResult()
+ public void setSearchWord(String searchWord)
{
+ this.searchWord = searchWord;
+ }
+
+ public String getSearchWord()
+ {
+ return searchWord;
+ }
+
+ public List<Person> getPeople()
+ {
return people;
}
-
- public void search() {
- this.people = getPeople();
+
+ public List<Person> getResult()
+ {
+ return result;
}
-
- public void clear() {
- this.people = new LinkedList<Person>();
+
+ public void search()
+ {
+ result = new LinkedList<Person>();
+ for (Person person : people)
+ {
+ if (person.getName().toLowerCase().contains(searchWord.toLowerCase()))
+ result.add(person);
+ }
}
+ public void clear()
+ {
+ this.result = new LinkedList<Person>();
+ }
+
public class Person
{
- int age;
String name;
- String lastName;
+ String company;
+ String task;
- public Person(int age, String name, String lastName)
+ public Person(String name, String company, String task)
{
- super();
- this.age = age;
+ this.company = company;
this.name = name;
- this.lastName = lastName;
+ this.task = task;
}
- public int getAge()
- {
- return age;
- }
-
- public void setAge(int age)
- {
- this.age = age;
- }
-
public String getName()
{
return name;
}
- public void setName(String name)
+ public String getTask()
{
- this.name = name;
+ return task;
}
- public String getLastName()
+ public String getCompany()
{
- return lastName;
+ return company;
}
- public void setLastName(String lastName)
- {
- this.lastName = lastName;
- }
}
}
Modified: trunk/examples/excel/view/css/screen.css
===================================================================
--- trunk/examples/excel/view/css/screen.css 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/view/css/screen.css 2008-08-30 21:45:43 UTC (rev 8859)
@@ -1,22 +1,43 @@
-body,div,dd,dt,dl,img,ul,ol,li,p,h1,h2,h3,h4,h5,form,hr,fieldset,span {
+/* Setup defaults since variable in browsers
+----------------------------------------------- */
+body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
margin: 0;
padding: 0;
- font-face: Verdana, Arial;
}
-
+/* Element Defaults
+----------------------------------------------- */
html {
height: 100%;
- background-color: #FFFFFF;
+ margin: 5px;
+
}
-
-span.header {
- font-size: 22px;
+img {
+ border: 0;
}
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: small;
+ line-height: 1.25em;
+ position: relative;
+ height: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
+input {
+ border: 1px solid #C3BBB6;
+ padding: 2px;
+ margin: 3px 0;
+}
+select {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+}
-td.left {
- text-align: left;
+.header {
+ font-size: 16px;
}
-td.right {
- text-align: right;
+.subheader {
+ font-size: 14px;
}
\ No newline at end of file
Deleted: trunk/examples/excel/view/csv.xhtml
===================================================================
--- trunk/examples/excel/view/csv.xhtml 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/view/csv.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -1,23 +0,0 @@
-<e:workbook type="csv" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:e="http://jboss.com/products/seam/excel"
- xmlns:f="http://java.sun.com/jsf/core">
- <e:worksheet name="People" value="#{excelTest.people}" var="person">
- <e:column>
- <f:facet name="header">
- <e:cell value="First name" />
- </f:facet>
- <e:cell value="#{person.name}" forceType="text" />
- </e:column>
- <e:column>
- <f:facet name="header">
- <e:cell value="Last name" />
- </f:facet>
- <e:cell value="#{person.lastName}" forceType="text" />
- </e:column>
- <e:column>
- <f:facet name="header">
- <e:cell value="Age" />
- </f:facet>
- <e:cell value="#{person.age}"/>
- </e:column>
- </e:worksheet>
-</e:workbook>
\ No newline at end of file
Modified: trunk/examples/excel/view/home.xhtml
===================================================================
--- trunk/examples/excel/view/home.xhtml 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/view/home.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -7,63 +7,95 @@
xmlns:e="http://jboss.com/products/seam/excel"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Microsoft® Excel® Export examples</title>
- <link href="css/screen.css" rel="stylesheet" type="text/css" />
- </head>
- <body id="excelHome">
- <f:view>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>Microsoft® Excel® Export examples</title>
+<link href="css/screen.css" rel="stylesheet" type="text/css" />
+</head>
+<body id="excelHome">
+<f:view>
- <h:outputText value="Microsoft® Excel® Export examples"
- style="header"></h:outputText>
- <br />
- <br />
-
- <h:outputLink value="jxl.seam">
- <h:outputText>Export as Excel® spreadsheet</h:outputText>
- </h:outputLink>
- <br />
+ <h:outputText value="Microsoft® Excel® Export examples"
+ styleClass="header"></h:outputText>
+ <br />
+ <br />
- <h:outputLink value="csv.seam">
- <h:outputText>Export as comma separated file</h:outputText>
- </h:outputLink>
+ <h:outputText value="Export ajax searchable Richfaces table"
+ styleClass="subheader"></h:outputText>
+ <br />
+ <h:form id="excelExport">
+ <h:inputText value="#{excelTest.searchWord}" />
+ <a4j:commandButton value="Search" reRender="searchResults"
+ action="#{excelTest.search}" />
+ <a4j:commandButton value="Clear" reRender="searchResults"
+ action="#{excelTest.clear}" />
+ <br />
+
+ <a4j:outputPanel id="searchResults">
+ <rich:dataTable value="#{excelTest.result}" var="person"
+ rendered="#{!empty excelTest.result}" id="excelTable"
+ columnClasses="left, right" width="500px">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Name" />
+ </f:facet>
+ <h:outputText value="#{person.name}" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Company" />
+ </f:facet>
+ <h:outputText value="#{person.company}" />
+ </rich:column>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Working on" />
+ </f:facet>
+ <h:outputText value="#{person.task}" />
+ </rich:column>
+ </rich:dataTable>
+ <h:commandLink value="Export table as Excel spreadsheet"
+ rendered="#{!empty excelTest.result}"
+ action="#{excelExporter.export('excelExport:excelTable')}" />
<br />
- <br />
+ <h:commandLink value="Export table as CSV"
+ rendered="#{!empty excelTest.result}"
+ action="#{excelExporter.export('excelExport:excelTable','csv')}" />
+ </a4j:outputPanel>
- <h:form id="excelExport">
- <a4j:commandButton value="Search" reRender="searchResults"
- action="#{excelTest.search}" />
- <a4j:commandButton value="Clear" reRender="searchResults"
- action="#{excelTest.clear}" />
+ </h:form>
- <a4j:outputPanel id="searchResults">
- <rich:dataTable value="#{excelTest.result}" var="person"
- id="excelTable" columnClasses="left, right">
- <rich:column>
- <f:facet name="header">
- <h:outputText value="First name"/>
- </f:facet>
- <h:outputText value="#{person.name}"/>
- </rich:column>
- <rich:column>
- <f:facet name="header">
- <h:outputText value="Last name"/>
- </f:facet>
- <h:outputText value="#{person.lastName}"/>
- </rich:column>
- <rich:column>
- <f:facet name="header">
- <h:outputText value="Age"/>
- </f:facet>
- <h:outputText value="#{person.age}"/>
- </rich:column>
- </rich:dataTable>
- <h:commandLink value="Export table"
- action="#{excelExporter.export('excelExport:excelTable')}" />
- </a4j:outputPanel>
- </h:form>
- </f:view>
- </body>
+ <br />
+ <br />
+ <br />
+
+ <h:outputText value="Export xhtml file, use-extension enabled."
+ styleClass="subheader"></h:outputText>
+ <br />
+ <h:outputLink value="vanilla-jxl.seam">
+ <h:outputText>Export as Excel® spreadsheet</h:outputText>
+ </h:outputLink>
+ <br />
+
+ <h:outputLink value="vanilla-csv.seam">
+ <h:outputText>Export as comma separated file</h:outputText>
+ </h:outputLink>
+ <br />
+ <br />
+ <br />
+
+ <h:outputText value="Repeat and inline value" styleClass="subheader"></h:outputText>
+ <br />
+
+ <h:outputLink value="repeat.seam">
+ <h:outputText>Export as Excel® spreadsheet</h:outputText>
+ </h:outputLink>
+ <br />
+ <br />
+ <br />
+
+
+</f:view>
+</body>
</html>
Deleted: trunk/examples/excel/view/jxl.xhtml
===================================================================
--- trunk/examples/excel/view/jxl.xhtml 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/examples/excel/view/jxl.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -1,32 +0,0 @@
-<e:workbook type="jxl" xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:e="http://jboss.com/products/seam/excel"
- xmlns:f="http://java.sun.com/jsf/core">
- <e:worksheetSettings>
- <e:headerFooter type="header">
- <f:facet name="left">
- <e:headerFooterCommands>
- <e:headerFooterCommand command="time"/>
- </e:headerFooterCommands>
- </f:facet>
- </e:headerFooter>
- </e:worksheetSettings>
- <e:worksheet name="People" value="#{excelTest.people}" var="person">
- <e:column>
- <f:facet name="header">
- <e:cell value="First name" />
- </f:facet>
- <e:cell value="#{person.name}" forceType="text" />
- </e:column>
- <e:column>
- <f:facet name="header">
- <e:cell value="Last name" />
- </f:facet>
- <e:cell value="#{person.lastName}" forceType="text" />
- </e:column>
- <e:column>
- <f:facet name="header">
- <e:cell value="Age" />
- </f:facet>
- <e:cell value="#{person.age}"/>
- </e:column>
- </e:worksheet>
-</e:workbook>
\ No newline at end of file
Added: trunk/examples/excel/view/people.xhtml
===================================================================
--- trunk/examples/excel/view/people.xhtml (rev 0)
+++ trunk/examples/excel/view/people.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -0,0 +1,32 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:e="http://jboss.com/products/seam/excel"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<e:workbook type="#{exportType}">
+ <e:cellTemplate name="header">
+ <e:font fontName="Times New Roman" color="red" bold="true" />
+ <e:background color="yellow" pattern="solid" />
+ </e:cellTemplate>
+ <e:worksheet name="People" value="#{people}" var="person">
+ <e:column autoSize="true">
+ <f:facet name="header">
+ <e:cell value="Name" templates="header" />
+ </f:facet>
+ <e:cell value="#{person.name}" forceType="text" />
+ </e:column>
+ <e:column autoSize="true">
+ <f:facet name="header">
+ <e:cell value="Company" templates="header" />
+ </f:facet>
+ <e:cell value="#{person.company}" />
+ </e:column>
+ <e:column autoSize="true">
+ <f:facet name="header">
+ <e:cell value="Working on" templates="header" />
+ </f:facet>
+ <e:cell value="#{person.task}" forceType="text" />
+ </e:column>
+ </e:worksheet>
+</e:workbook>
+</html>
\ No newline at end of file
Added: trunk/examples/excel/view/repeat.xhtml
===================================================================
--- trunk/examples/excel/view/repeat.xhtml (rev 0)
+++ trunk/examples/excel/view/repeat.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -0,0 +1,21 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:e="http://jboss.com/products/seam/excel"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<e:workbook type="jxl">
+ <e:worksheet name="Five first commiters" value="#{excelTest.repeat}"
+ var="list">
+ <e:column>
+ <f:facet name="header">
+ <e:cell value="Names of committers" />
+ </f:facet>
+ <e:cell>
+ <ui:repeat value="#{list}" var="person">
+ #{person.name},
+ </ui:repeat>
+ </e:cell>
+ </e:column>
+ </e:worksheet>
+</e:workbook>
+</html>
\ No newline at end of file
Copied: trunk/examples/excel/view/vanilla-csv.xhtml (from rev 8858, trunk/examples/excel/view/csv.xhtml)
===================================================================
--- trunk/examples/excel/view/vanilla-csv.xhtml (rev 0)
+++ trunk/examples/excel/view/vanilla-csv.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:include src="people.xhtml">
+ <ui:param name="exportType" value="csv" />
+ <ui:param name="people" value="#{excelTest.people}" />
+ </ui:include>
+
+</html>
\ No newline at end of file
Copied: trunk/examples/excel/view/vanilla-jxl.xhtml (from rev 8858, trunk/examples/excel/view/jxl.xhtml)
===================================================================
--- trunk/examples/excel/view/vanilla-jxl.xhtml (rev 0)
+++ trunk/examples/excel/view/vanilla-jxl.xhtml 2008-08-30 21:45:43 UTC (rev 8859)
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:include src="people.xhtml">
+ <ui:param name="exportType" value="jxl" />
+ <ui:param name="people" value="#{excelTest.people}" />
+ </ui:include>
+
+</html>
\ No newline at end of file
Modified: trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java 2008-08-30 21:45:43 UTC (rev 8859)
@@ -36,6 +36,7 @@
* Excel export class that exports a UIData component to an Excel workbook
*
* @author Nicklas Karlsson (nickarls at gmail.com)
+ * @author Daniel Roth (danielc.roth at gmail.com)
*
*/
@Name("org.jboss.seam.excel.exporter.excelExporter")
@@ -49,16 +50,26 @@
private List<Integer> columnWidths = new ArrayList<Integer>();
/**
+ * Helper method to call the exporter and use the default excel workbook implementation
+ * @param dataTableId
+ */
+ public void export(String dataTableId)
+ {
+ export(dataTableId, "");
+ }
+
+ /**
* Exports the UIData object to Excel workbook. Looks up the component, parse
* the templates, iterates the columns and the UIOutput elements within
*
- * @param dataTableId
+ * @param dataTableId id of data table to export
+ * @param type ExcelWorkbook implementation to use
*/
@SuppressWarnings("unchecked")
- public void export(String dataTableId)
+ public void export(String dataTableId, String type)
{
// TODO: support "type" ?
- excelWorkbook = ExcelFactory.instance().getExcelWorkbook("");
+ excelWorkbook = ExcelFactory.instance().getExcelWorkbook(type);
// Gets the datatable
UIData dataTable = (UIData) FacesContext.getCurrentInstance().getViewRoot().findComponent(dataTableId);
@@ -95,7 +106,7 @@
excelWorkbook.nextColumn();
}
- // Restores the datatable var
+ // Restores the data table var
if (oldValue == null)
{
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().remove(dataTableVar);
@@ -111,7 +122,7 @@
}
/**
- * Puts document to store and redirects
+ * Puts document in store and redirects
*/
private void redirectExport()
{
Modified: trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java 2008-08-30 21:45:43 UTC (rev 8859)
@@ -15,8 +15,6 @@
import org.jboss.seam.excel.ExcelWorkbook;
import org.jboss.seam.excel.Template;
import org.jboss.seam.excel.WorksheetItem;
-import org.jboss.seam.log.Log;
-import org.jboss.seam.log.Logging;
import org.jboss.seam.ui.util.JSF;
/**
Modified: trunk/src/excel/org/jboss/seam/excel/ui/UIExcelExport.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIExcelExport.java 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIExcelExport.java 2008-08-30 21:45:43 UTC (rev 8859)
@@ -6,6 +6,7 @@
import javax.faces.component.html.HtmlDataTable;
import javax.faces.context.FacesContext;
+import org.jboss.seam.Component;
import org.jboss.seam.core.Interpolator;
import org.jboss.seam.excel.ExcelWorkbookException;
import org.jboss.seam.excel.exporter.ExcelExporter;
@@ -15,7 +16,6 @@
public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIExcelExport";
- private ExcelExporter exporter = new ExcelExporter();
private String type;
private String forDataTable;
@@ -56,7 +56,8 @@
throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not find data table with id #0", getForDataTable()));
}
}
- exporter.export(dataTable.getId());
+ ExcelExporter exporter = (ExcelExporter) Component.getInstance(ExcelExporter.class);
+ exporter.export(dataTable.getId(), getType());
}
@Override
Modified: trunk/src/excel/org/jboss/seam/excel/ui/UIWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIWorkbook.java 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIWorkbook.java 2008-08-30 21:45:43 UTC (rev 8859)
@@ -1,7 +1,6 @@
package org.jboss.seam.excel.ui;
import java.io.IOException;
-import java.util.Date;
import javax.faces.component.UIComponent;
import javax.faces.component.ValueHolder;
@@ -10,18 +9,14 @@
import org.jboss.seam.core.Manager;
import org.jboss.seam.document.DocumentData;
import org.jboss.seam.document.DocumentStore;
+import org.jboss.seam.document.DocumentData.DocumentType;
import org.jboss.seam.excel.ExcelFactory;
import org.jboss.seam.excel.ExcelWorkbook;
import org.jboss.seam.excel.Template;
-import org.jboss.seam.document.DocumentData.DocumentType;
-import org.jboss.seam.log.Log;
-import org.jboss.seam.log.Logging;
import org.jboss.seam.navigation.Pages;
public class UIWorkbook extends ExcelComponent
{
- private Log log = Logging.getLog(getClass());
-
public enum CreationType
{
WITHOUT_SETTINGS_OR_TEMPLATE, WITHOUT_SETTINGS_WITH_TEMPLATE, WITH_SETTINGS_WITHOUT_TEMPLATE, WITH_SETTNGS_AND_TEMPLATE
@@ -288,7 +283,7 @@
public void encodeBegin(javax.faces.context.FacesContext facesContext) throws IOException
{
// Get workbook implementation
- excelWorkbook = ExcelFactory.instance().getExcelWorkbook(type);
+ excelWorkbook = ExcelFactory.instance().getExcelWorkbook(getType());
// Create a new workbook
excelWorkbook.createWorkbook(this);
@@ -363,7 +358,7 @@
public boolean isSendRedirect()
{
- return sendRedirect;
+ return (Boolean) valueOf("sendRedirect", sendRedirect);
}
public void setSendRedirect(boolean sendRedirect)
@@ -379,7 +374,7 @@
public String getType()
{
- return type;
+ return (String) valueOf("type", type);
}
public void setType(String type)
@@ -412,7 +407,7 @@
*/
public boolean hasSettings()
{
- return arrayGrowSize != null || autoFilterDisabled != null || cellValidationDisabled != null || characterSet != null || drawingsDisabled != null || encoding != null || excelDisplayLanguage != null || excelRegionalSettings != null || formulaAdjust != null || gcDisabled != null || ignoreBlanks != null || initialFileSize != null || locale != null || mergedCellCheckingDisabled != null || namesDisabled != null || propertySets != null || rationalization != null || supressWarnings != null || temporaryFileDuringWriteDirectory != null || useTemporaryFileDuringWrite != null;
+ return getArrayGrowSize() != null || getAutoFilterDisabled() != null || getCellValidationDisabled() != null || getCharacterSet() != null || getDrawingsDisabled() != null || getEncoding() != null || getExcelDisplayLanguage() != null || getExcelRegionalSettings() != null || getFormulaAdjust() != null || getGcDisabled() != null || getIgnoreBlanks() != null || getInitialFileSize() != null || getLocale() != null || getMergedCellCheckingDisabled() != null || getNamesDisabled() != null || getPropertySets() != null || getRationalization() != null || getSupressWarnings() != null || getTemporaryFileDuringWriteDirectory() != null || getUseTemporaryFileDuringWrite() != null;
}
public Boolean getWorkbookProtected()
Modified: trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java 2008-08-30 15:41:27 UTC (rev 8858)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIWorksheet.java 2008-08-30 21:45:43 UTC (rev 8859)
@@ -6,7 +6,6 @@
import java.util.Iterator;
import java.util.List;
-import javax.faces.component.UIComponent;
import javax.faces.model.DataModel;
import org.jboss.seam.excel.Command;
@@ -106,15 +105,17 @@
throw new ExcelWorkbookException("Could not find excel workbook");
}
- // Create new worksheet (or select an existing one) and apply settings (if any)
+ // Create new worksheet (or select an existing one) and apply settings (if
+ // any)
excelWorkbook.createOrSelectWorksheet(this);
WorksheetItem headerItem = (WorksheetItem) getFacet(HEADER_FACET_NAME);
- if (headerItem != null) {
+ if (headerItem != null)
+ {
int colspan = getChildrenOfType(getChildren(), UIColumn.class).size();
excelWorkbook.addWorksheetHeader(headerItem, colspan);
}
-
+
// Add worksheet level items
List<WorksheetItem> items = getItems(getChildren());
for (WorksheetItem item : items)
@@ -129,7 +130,7 @@
excelWorkbook.executeCommand(command);
}
}
-
+
@Override
public void encodeEnd(javax.faces.context.FacesContext facesContext) throws java.io.IOException
{
@@ -140,12 +141,13 @@
}
WorksheetItem footerItem = (WorksheetItem) getFacet(FOOTER_FACET_NAME);
- if (footerItem != null) {
+ if (footerItem != null)
+ {
int colspan = getChildrenOfType(getChildren(), UIColumn.class).size();
excelWorkbook.addWorksheetFooter(footerItem, colspan);
}
}
-
+
@SuppressWarnings("unchecked")
public static Iterator unwrapIterator(Object value)
{
More information about the seam-commits
mailing list