You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/11/24 21:26:27 UTC
svn commit: r720278 - in /myfaces/commons/branches/jsf_11: ./
myfaces-commons-components/
myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/
myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/
m...
Author: lu4242
Date: Mon Nov 24 12:26:26 2008
New Revision: 720278
URL: http://svn.apache.org/viewvc?rev=720278&view=rev
Log:
move exporter to 1.1 branch and some pom.xml enhancements
Added:
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/
myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp (with props)
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp (with props)
Modified:
myfaces/commons/branches/jsf_11/myfaces-commons-components/pom.xml
myfaces/commons/branches/jsf_11/myfaces-commons-converters/pom.xml
myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp
myfaces/commons/branches/jsf_11/myfaces-commons-validators/pom.xml
myfaces/commons/branches/jsf_11/pom.xml
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-components/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/pom.xml?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/pom.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/pom.xml Mon Nov 24 12:26:26 2008
@@ -126,6 +126,26 @@
</dependency>
<dependency>
+ <groupId>poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>2.5.1-final-20040804</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>1.4.8</version>
+ </dependency>
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter;
+
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.servlet.http.HttpServletResponse;
+import javax.faces.component.html.HtmlDataTable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.commons.exporter.util.ExcelExporterUtil;
+import org.apache.myfaces.commons.exporter.util.ExporterConstants;
+import org.apache.myfaces.commons.exporter.util.PDFExporterUtil;
+import org.apache.myfaces.commons.util.ComponentUtils;
+
+/**
+ *
+ * This class is acting as the Exporter ActionListener.
+ */
+public class ExporterActionListener implements ActionListener, StateHolder {
+
+ private static final Log log = LogFactory
+ .getLog(ExporterActionListener.class);
+
+ public static final String FILENAME_KEY = "filename";
+
+ public static final String FILE_TYPE_KEY = "fileType";
+
+ public static final String FOR_KEY = "for";
+
+ private String _fileType;
+
+ private String _fileName;
+
+ private String _for;
+
+ public void processAction(ActionEvent event) {
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Object response = facesContext.getExternalContext().getResponse();
+
+ if (!(response instanceof HttpServletResponse)) {
+ log.error("ExporteActionListener requires servlet");
+ }
+ else {
+ try {
+
+ /* get the source dataTable component */
+ HtmlDataTable dataTable = (HtmlDataTable) ComponentUtils
+ .findComponentById(facesContext, facesContext
+ .getViewRoot(), _for);
+
+ if (!(dataTable instanceof HtmlDataTable))
+ {
+ throw new RuntimeException(
+ "exporterActionListener for attribute should contain a "
+ + "dataTable component id");
+ }
+
+
+ if (ExporterConstants.EXCEL_FILE_TYPE
+ .equalsIgnoreCase(_fileType))
+ {
+
+ /*
+ * Excel case. Generate the XLS to the response stream.
+ */
+ Object contextResponse = facesContext.getExternalContext()
+ .getResponse();
+
+ if (contextResponse instanceof HttpServletResponse)
+ {
+ ExcelExporterUtil.generateEXCEL(facesContext,
+ (HttpServletResponse) contextResponse,
+ _fileName, dataTable);
+ }
+
+ }
+ else
+ {
+
+ /*
+ * PDF case. Generate the PDF to the response stream.
+ */
+ HttpServletResponse httpResponse = (HttpServletResponse) facesContext
+ .getExternalContext().getResponse();
+
+
+ PDFExporterUtil.generatePDF(facesContext, httpResponse,
+ _fileName, dataTable);
+ }
+
+ /* save the seralized view and complete the response. */
+ facesContext.getApplication().getStateManager()
+ .saveSerializedView(facesContext);
+ facesContext.responseComplete();
+ }
+ catch (Exception exception)
+ {
+ throw new RuntimeException(exception);
+ }
+
+ }
+
+ facesContext.responseComplete();
+ }
+
+ public String getFilename() {
+ return _fileName;
+ }
+
+ public void setFilename(String _filename) {
+ this._fileName = _filename;
+ }
+
+ public String getFileType() {
+ return _fileType;
+ }
+
+ public void setFileType(String type) {
+ _fileType = type;
+ }
+
+ public String getFor() {
+ return _for;
+ }
+
+ public void setFor(String _for) {
+ this._for = _for;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ String values[] = (String[]) state;
+
+ _for = values[0];
+ _fileName = values[1];
+ _fileType = values[2];
+ }
+
+ public Object saveState(FacesContext context) {
+ String values[] = new String[3];
+
+ values[0] = _for;
+ values[1] = _fileName;
+ values[2] = _fileType;
+ return ((String[]) values);
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ if (newTransientValue == true) {
+ throw new IllegalArgumentException();
+ }
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.webapp.UIComponentTag;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * Export datatable contents to an excel file or a pdf file.
+ *
+ * @JSFJspTag
+ * name="mc:exporterActionListener"
+ * bodyContent="JSP"
+ *
+ * This class is acting as the tag handler for the Exporter ActionListener.
+ */
+public class ExporterActionListenerTag extends TagSupport {
+
+ private static final long serialVersionUID = -1455677614701939262L;
+ private String _fileType;
+ private String _fileName;
+ private String _for;
+
+ public int doStartTag() throws JspException {
+
+ // check whether the attributes are not null
+ if (_for == null)
+ {
+ throw new JspException("for attribute not set");
+ }
+
+ if (_fileType == null)
+ {
+ throw new JspException("fileType attribute not set");
+ }
+
+ // find the parent UIComponentTag which should be an ActionSource.
+ UIComponentTag componentTag = UIComponentTag
+ .getParentUIComponentTag(pageContext);
+
+ if (componentTag == null)
+ {
+ throw new JspException("ExporterActionListenerTag has no UIComponentTag ancestor");
+ }
+
+ if (componentTag.getCreated())
+ {
+
+ // if the component was just created, so we add the Listener.
+ UIComponent component = componentTag.getComponentInstance();
+
+ if (component instanceof ActionSource)
+ {
+ ExporterActionListener exporterActionListener = new ExporterActionListener();
+
+ exporterActionListener.setFor(_for);
+ exporterActionListener.setFileType(_fileType);
+ exporterActionListener.setFilename(_fileName);
+
+ ((ActionSource) component)
+ .addActionListener(exporterActionListener);
+ }
+ else
+ {
+ throw new JspException("Component " + component.getId()
+ + " is no ActionSource");
+ }
+ }
+
+ return Tag.SKIP_BODY;
+ }
+
+ public void release() {
+ super.release();
+ _fileType = null;
+ _fileName = null;
+ _for = null;
+ }
+
+ public String getFilename() {
+ return _fileName;
+ }
+
+ /**
+ * Default name of the generated excel or pdf file, if not specified value of the "for" attribute will be used
+ *
+ * @JSFJspAttribute
+ */
+ public void setFilename(String _filename) {
+ this._fileName = _filename;
+ }
+
+ public String getFileType() {
+ return _fileType;
+ }
+
+ /**
+ * "PDF" or "XLS"
+ *
+ * @JSFJspAttribute
+ */
+ public void setFileType(String type) {
+ _fileType = type;
+ }
+
+ public String getFor() {
+ return _for;
+ }
+
+ /**
+ * Id of the datatable component whose values to be exported
+ *
+ * @JSFJspAttribute
+ */
+ public void setFor(String _for) {
+ this._for = _for;
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.myfaces.commons.util.ComponentUtils;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+/**
+ * This class is a utility class for serving excel exporting.
+ */
+public class ExcelExporterUtil {
+
+ private static void addColumnHeaders(HSSFSheet sheet, List columns) {
+ HSSFRow rowHeader = sheet.createRow(0);
+
+ for (int i = 0; i < columns.size(); i++) {
+ UIColumn column = (UIColumn) columns.get(i);
+ addColumnValue(rowHeader, column.getHeader(), i);
+ }
+ }
+
+ private static List getColumns(HtmlDataTable table) {
+ List columns = new ArrayList();
+ for (int i = 0; i < table.getChildCount(); i++) {
+ UIComponent child = (UIComponent) table.getChildren().get(i);
+ if (child instanceof UIColumn) {
+ columns.add(child);
+ }
+ }
+ return columns;
+ }
+
+ private static void addColumnValue(HSSFRow rowHeader,
+ UIComponent component, int index) {
+ HSSFCell cell = rowHeader.createCell((short) index);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ if (component instanceof ValueHolder) {
+ String stringValue = ComponentUtils.getStringValue(FacesContext
+ .getCurrentInstance(), component);
+ cell.setCellValue(stringValue);
+ }
+ }
+
+ /*
+ * This method is used for adding the columns values to the HSSFSheet.
+ */
+ private static void generateTableContent(FacesContext facesContext,
+ HSSFSheet sheet, List columns, HtmlDataTable dataTable) {
+
+ int numberOfColumns = columns.size();
+ int numberOfRows = dataTable.getRowCount();
+ int startFrom = 0;
+ int currentIndex = 1;
+ int endAt = numberOfRows;
+
+ /* fill the table with the data. */
+ for (int i = startFrom; i < endAt; ++i) {
+ dataTable.setRowIndex(i);
+ HSSFRow row = sheet.createRow(currentIndex++);
+ for (int j = 0; j < numberOfColumns; ++j) {
+ UIColumn column = (UIColumn) columns.get(j);
+ addColumnValue(row, (UIComponent) column.getChildren().get(0),
+ j);
+ }
+ }
+ }
+
+ /*
+ * This utility method is used for writing the excelModel (generatedExcel)
+ * to the response (response) and uses the (fileName) as the generated file
+ * name.
+ */
+ private static void writeExcelToResponse(HttpServletResponse response,
+ HSSFWorkbook generatedExcel, String fileName) throws IOException {
+
+ /* write the model to the stream */
+ response.setContentType("application/vnd.ms-excel");
+ response.setHeader("Expires", "0");
+ response.setHeader("Cache-Control",
+ "must-revalidate, post-check=0, pre-check=0");
+ response.setHeader("Pragma", "public");
+ response.setHeader("Content-disposition", "attachment;filename="
+ + fileName + ".xls");
+
+ generatedExcel.write(response.getOutputStream());
+ }
+
+ /*
+ * This utility method is used for generating the (HSSFWorkbook)
+ * excel table model from the passed (HtmlDataTable).
+ * @param facesContext
+ * @param table the passed (HtmlDataTable).
+ * @return the (HSSFWorkbook) object.
+ */
+ private static HSSFWorkbook generateExcelTableModel(
+ FacesContext facesContext, HtmlDataTable dataTable) {
+
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet(dataTable.getId());
+ List columns = getColumns(dataTable);
+ int currentRowIndex = dataTable.getRowIndex();
+
+ addColumnHeaders(sheet, columns);
+ generateTableContent(facesContext, sheet, columns, dataTable);
+
+ dataTable.setRowIndex(currentRowIndex);
+ return workbook;
+ }
+
+ /**
+ * This utility method is used for generating the excel
+ * table to the HttpServletResponse object.
+ * @param workBook
+ * @param response
+ * @param fileName
+ * @throws IOException
+ */
+ public static void generateEXCEL(FacesContext facesContext,
+ HttpServletResponse response, String fileName, HtmlDataTable dataTable)
+ throws IOException {
+
+ /*
+ * By default if the fileName is not specified, then use the
+ * table id.
+ */
+ if (fileName == null)
+ {
+ fileName = dataTable.getId();
+ }
+
+ /* generate the excel model */
+ HSSFWorkbook generatedExcel = ExcelExporterUtil
+ .generateExcelTableModel(facesContext, dataTable);
+
+ writeExcelToResponse(response, generatedExcel, fileName);
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter.util;
+
+public interface ExporterConstants {
+ public static String EXPORTER_TABLE_ID = "exporterTableId";
+ public static String EXPORTER_FILE_NAME = "exporterFileName";
+ public static String EXPORTER_FILE_TYPE = "exporterFileType";
+ public static String PDF_FILE_TYPE = "PDF";
+ public static String EXCEL_FILE_TYPE = "XLS";
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExporterConstants.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.List;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.myfaces.commons.util.ComponentUtils;
+
+import com.lowagie.text.Document;
+import com.lowagie.text.pdf.PdfPTable;
+import com.lowagie.text.pdf.PdfWriter;
+
+/**
+ * This class is a utility class for serving PDF exporting.
+ */
+public class PDFExporterUtil {
+
+ /*
+ * This method is used for setting the response headers of the pdf.
+ */
+ private static void setPDFResponseHeaders(HttpServletResponse response,
+ ByteArrayOutputStream byteArrayStream, String fileName)
+ throws IOException {
+
+ // setting response headers.
+ response.setHeader("Expires", "0");
+ response.setHeader("Cache-Control",
+ "must-revalidate, post-check=0, pre-check=0");
+ response.setHeader("Pragma", "public");
+ response.setHeader("Content-disposition", "attachment;filename="
+ + fileName + ".pdf");
+
+ // setting the content type.
+ response.setContentType("application/pdf");
+
+ // the contentlength is needed for MSIE.
+ response.setContentLength(byteArrayStream.size());
+
+ // write ByteArrayOutputStream to the ServletOutputStream.
+ ServletOutputStream outputStream = response.getOutputStream();
+
+ byteArrayStream.writeTo(outputStream);
+ outputStream.flush();
+ }
+
+ /*
+ * This method is used for adding the columns headers to the pdfTable.
+ */
+ private static void generateTableHeader(PdfPTable pdfTable, List columns) {
+
+ for (int i = 0; i < columns.size(); i++) {
+ UIColumn column = (UIColumn) columns.get(i);
+ UIComponent columnHeaderCell = column.getHeader();
+ if (columnHeaderCell instanceof ValueHolder) {
+ String cellValue = ComponentUtils.getStringValue(FacesContext
+ .getCurrentInstance(), columnHeaderCell);
+ pdfTable.addCell(cellValue);
+ }
+ }
+ }
+
+ /*
+ * This method is used for adding the columns values to the pdfTable.
+ */
+ private static void generateTableContent(FacesContext facesContext,
+ PdfPTable pdfTable, List columns, HtmlDataTable dataTable) {
+
+ int numberOfColumns = columns.size();
+ int numberOfRows = dataTable.getRowCount();
+ int startFrom = 0;
+ int endAt = numberOfRows;
+
+ /* fill the table with the data. */
+ for (int i = startFrom; i < endAt; ++i) {
+ dataTable.setRowIndex(i);
+ for (int j = 0; j < numberOfColumns; ++j) {
+ UIComponent valueHolder = (UIComponent) ((UIColumn) columns
+ .get(j)).getChildren().get(0);
+ if (valueHolder instanceof ValueHolder) {
+ String cellValue = ComponentUtils.getStringValue(
+ FacesContext.getCurrentInstance(), valueHolder);
+ pdfTable.addCell(cellValue);
+ }
+ }
+ }
+ }
+
+ /*
+ * This method is used for creating the PDFTable model.
+ */
+ public static PdfPTable generatePDFTableModel(FacesContext facesContext,
+ HtmlDataTable dataTable) {
+
+ int numberOfColumns;
+ List columns = null;
+ PdfPTable pdfTable = null;
+
+
+ /* getting the HTMLDataTable Columns */
+ columns = ComponentUtils.getHTMLDataTableColumns(dataTable);
+
+ if (columns.size() == 0) {
+ return null;
+ }
+ else {
+ numberOfColumns = columns.size();
+ }
+
+ /* creating the PDF Table */
+ pdfTable = new PdfPTable(numberOfColumns);
+
+ generateTableHeader(pdfTable, columns);
+
+ generateTableContent(facesContext, pdfTable, columns,
+ dataTable);
+
+ return pdfTable;
+ }
+
+ /**
+ * This method is responsible for writing the PDF to the response stream.
+ * @param facesContext
+ * @param response
+ * @param fileName
+ * @param dataTable
+ */
+ public static void generatePDF(FacesContext facesContext,
+ HttpServletResponse response, String fileName,
+ HtmlDataTable dataTable) throws Exception {
+
+ int currentRowIndex;
+ Document document = new Document();
+ ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
+ PdfWriter.getInstance(document, byteArrayStream);
+ PdfPTable pdfTable = null;
+
+ /*
+ * By default if the fileName is not specified, then use the
+ * table id.
+ */
+ if (fileName == null)
+ {
+ fileName = dataTable.getId();
+ }
+
+ currentRowIndex = dataTable.getRowIndex();
+
+ // generate the PDF table model.
+ pdfTable = generatePDFTableModel(facesContext, dataTable);
+
+ // open the document and write the generated PDF.
+ document.open();
+ document.add(pdfTable);
+ document.close();
+
+ // write the response headers.
+ setPDFResponseHeaders(response, byteArrayStream, fileName);
+
+ dataTable.setRowIndex(currentRowIndex);
+
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.FacesException;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.ValueHolder;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.PropertyNotFoundException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+public final class ComponentUtils
+{
+
+ private static final Log log = LogFactory.getLog(ComponentUtils.class);
+
+ public static UIComponent findComponentById(FacesContext context,
+ UIComponent root, String id) {
+
+ UIComponent component = null;
+
+ for (int i = 0; i < root.getChildCount() && component == null; i++)
+ {
+ UIComponent child = (UIComponent) root.getChildren().get(i);
+ component = findComponentById(context, child, id);
+ }
+
+ if (root.getId() != null)
+ {
+ if (component == null && root.getId().equals(id))
+ {
+ component = root;
+ }
+ }
+ return component;
+ }
+
+ public static String getPathToComponent(UIComponent component) {
+ StringBuffer buf = new StringBuffer();
+
+ if (component == null)
+ {
+ buf.append("{Component-Path : ");
+ buf.append("[null]}");
+ return buf.toString();
+ }
+
+ getPathToComponent(component, buf);
+
+ buf.insert(0, "{Component-Path : ");
+ buf.append("}");
+
+ return buf.toString();
+ }
+
+ private static void getPathToComponent(UIComponent component,
+ StringBuffer buf) {
+
+ if (component == null)
+ return;
+
+ StringBuffer intBuf = new StringBuffer();
+
+ intBuf.append("[Class: ");
+ intBuf.append(component.getClass().getName());
+ if (component instanceof UIViewRoot)
+ {
+ intBuf.append(",ViewId: ");
+ intBuf.append(((UIViewRoot) component).getViewId());
+ }
+ else
+ {
+ intBuf.append(",Id: ");
+ intBuf.append(component.getId());
+ }
+ intBuf.append("]");
+
+ buf.insert(0, intBuf.toString());
+
+ getPathToComponent(component.getParent(), buf);
+ }
+
+ private static Object getValue(UIComponent component) {
+ Object value;
+ try
+ {
+ value = ((ValueHolder) component).getValue();
+ }
+ catch (Exception ex)
+ {
+ throw new FacesException(
+ "Could not retrieve value of component with path : "
+ + getPathToComponent(component), ex);
+ }
+ return value;
+ }
+
+ public static String getStringValue(FacesContext facesContext,
+ UIComponent component) {
+ try
+ {
+ if (!(component instanceof ValueHolder))
+ {
+ throw new IllegalArgumentException("Component : "
+ + getPathToComponent(component)
+ + "is not a ValueHolder");
+ }
+
+ if (component instanceof EditableValueHolder)
+ {
+ Object submittedValue = ((EditableValueHolder) component)
+ .getSubmittedValue();
+ if (submittedValue != null)
+ {
+ if (submittedValue instanceof String)
+ {
+ if (log.isDebugEnabled())
+ log.debug("returning 1 '" + submittedValue + "'");
+ return (String) submittedValue;
+ }
+
+ throw new IllegalArgumentException(
+ "Expected submitted value of type String for component : "
+ + getPathToComponent(component));
+ }
+ }
+
+ Object value;
+
+ if (component instanceof EditableValueHolder)
+ {
+
+ EditableValueHolder holder = (EditableValueHolder) component;
+
+ if (holder.isLocalValueSet())
+ {
+ value = holder.getLocalValue();
+ }
+ else
+ {
+ value = getValue(component);
+ }
+ }
+ else
+ {
+ value = getValue(component);
+ }
+
+ Converter converter = ((ValueHolder) component).getConverter();
+ if (converter == null && value != null)
+ {
+
+ try
+ {
+ converter = facesContext.getApplication().createConverter(
+ value.getClass());
+ if (log.isDebugEnabled())
+ log.debug("the created converter is " + converter);
+ }
+ catch (FacesException e)
+ {
+ log.error("No converter for class "
+ + value.getClass().getName()
+ + " found (component id=" + component.getId()
+ + ").");
+ // converter stays null
+ }
+ }
+
+ if (converter == null)
+ {
+ if (value == null)
+ {
+ if (log.isDebugEnabled())
+ log.debug("returning an empty string");
+ return "";
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("returning an .toString");
+ return value.toString();
+
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("returning converter get as string " + converter);
+ return converter.getAsString(facesContext, component, value);
+
+ }
+ catch (PropertyNotFoundException ex)
+ {
+ log.error("Property not found - called by component : "
+ + getPathToComponent(component), ex);
+
+ throw ex;
+ }
+ }
+
+ public static List getHTMLDataTableColumns(HtmlDataTable table) {
+ List columns = new ArrayList();
+
+ for (int i = 0; i < table.getChildCount(); i++)
+ {
+ UIComponent child = (UIComponent) table.getChildren().get(i);
+ if (child instanceof UIColumn)
+ {
+ columns.add(child);
+ }
+ }
+ return columns;
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/util/ComponentUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-converters/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/pom.xml?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/pom.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/pom.xml Mon Nov 24 12:26:26 2008
@@ -22,7 +22,6 @@
<plugin>
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
- <version>1.0.1</version>
<executions>
<execution>
<goals>
@@ -219,7 +218,6 @@
<!-- Generate content for custom tagdoc report -->
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
- <version>1.0.1</version>
<configuration>
<taglibs>
<mcc>http://myfaces.apache.org/commons/converters</mcc>
@@ -249,7 +247,6 @@
<!-- which goal is run here? -->
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
- <version>1.0.1</version>
<configuration>
<taglibs>
<mcc>http://myfaces.apache.org/commons/converters</mcc>
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/pom.xml Mon Nov 24 12:26:26 2008
@@ -60,8 +60,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.3</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
@@ -74,6 +72,12 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.myfaces.commons</groupId>
<artifactId>myfaces-validators11</artifactId>
<version>${project.version}</version>
@@ -84,6 +88,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.myfaces.commons</groupId>
+ <artifactId>myfaces-components11</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author cagatay (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class ExporterBean implements Serializable {
+
+ private List carsList;
+
+ public List getCarsList() {
+ if( carsList == null)
+ carsList = createCarsList();
+ return carsList;
+ }
+
+ public void setCarsList(List carsList) {
+ this.carsList = carsList;
+ }
+
+ private List createCarsList() {
+ List list = new ArrayList();
+
+ for(int i = 0; i < 10; ++i) {
+ list.add( new SimpleCar(i, "row" + i, "value" + i));
+ }
+ return list;
+ }
+
+ public String export() {
+ return null;
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/ExporterBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.exporter;
+
+import java.io.Serializable;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class SimpleCar
+ implements Serializable
+{
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private int _id;
+ private String _type;
+ private String _color;
+
+ public SimpleCar(int id, String type, String color)
+ {
+ _id = id;
+ _type = type;
+ _color = color;
+ }
+
+ public int getId()
+ {
+ return _id;
+ }
+
+ public void setId(int id)
+ {
+ _id = id;
+ }
+
+ public String getType()
+ {
+ return _type;
+ }
+
+ public void setType(String type)
+ {
+ _type = type;
+ }
+
+ public String getColor()
+ {
+ return _color;
+ }
+
+ public void setColor(String color)
+ {
+ _color = color;
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/exporter/SimpleCar.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java Mon Nov 24 12:26:26 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.commons.renderone;
+
+import java.io.Serializable;
+
+/**
+ * @author Andrew Robinson (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class RenderOneBean implements Serializable
+{
+ private boolean aRendered = false;
+ private boolean cRendered = true;
+ private boolean dRendered = true;
+ private boolean bRendered = true;
+
+ private Integer index = new Integer("2");
+
+ /**
+ * @return the index
+ */
+ public Integer getIndex()
+ {
+ return this.index;
+ }
+
+ /**
+ * @return the aRendered
+ */
+ public boolean isARendered()
+ {
+ return this.aRendered;
+ }
+
+ /**
+ * @param rendered the aRendered to set
+ */
+ public void setARendered(boolean rendered)
+ {
+ this.aRendered = rendered;
+ }
+
+ /**
+ * @return the cRendered
+ */
+ public boolean isCRendered()
+ {
+ return this.cRendered;
+ }
+
+ /**
+ * @param rendered the cRendered to set
+ */
+ public void setCRendered(boolean rendered)
+ {
+ this.cRendered = rendered;
+ }
+
+ /**
+ * @return the dRendered
+ */
+ public boolean isDRendered()
+ {
+ return this.dRendered;
+ }
+
+ /**
+ * @param rendered the dRendered to set
+ */
+ public void setDRendered(boolean rendered)
+ {
+ this.dRendered = rendered;
+ }
+
+ /**
+ * @return the bRendered
+ */
+ public boolean isBRendered()
+ {
+ return this.bRendered;
+ }
+
+ /**
+ * @param rendered the bRendered to set
+ */
+ public void setBRendered(boolean rendered)
+ {
+ this.bRendered = rendered;
+ }
+}
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/java/org/apache/myfaces/commons/renderone/RenderOneBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/WEB-INF/faces-config.xml Mon Nov 24 12:26:26 2008
@@ -20,4 +20,14 @@
<managed-bean-class>org.apache.myfaces.examples.validate.ValidateEnum</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>exporterBean</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.commons.exporter.ExporterBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>renderOne</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.commons.renderone.RenderOneBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
</faces-config>
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css Mon Nov 24 12:26:26 2008
@@ -0,0 +1,646 @@
+body {
+ font-family : arial, verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size : 12px;
+}
+
+.standard {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+}
+
+.standard_bold {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ font-weight: bold;
+}
+
+.scrollerTable {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: solid;
+ border-width: 1px;
+ width: 400px;
+}
+
+.scroller {
+ padding-left:20px;
+}
+
+.paginator {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+}
+
+
+.standardTable {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: solid;
+ border-width: 1px;
+}
+
+.standardTable_Header {
+ color: #000000;
+ background-color: #FFDD00;
+ padding: 3;
+ text-align: center;
+ border: none;
+}
+
+.standardTable_SortHeader {
+ background-color: #FFDD00;
+ color: #000000;
+ padding: 3;
+ text-align: center;
+ border: none;
+ font-weight: bold;
+}
+
+.standardTable_Footer {
+ background-color: #FFFFE0;
+}
+
+.standardTable_Row1 {
+ background-color: #FFFFE0;
+}
+
+.standardTable_Row2 {
+ background-color: #FFFFE0;
+}
+
+.standardTable_Column {
+}
+
+.standardTable_ColumnCentered {
+ text-align: center
+}
+
+a
+{
+ color: #333366;
+ text-decoration: underline;
+ font-size: 12px;
+}
+
+a:hover
+{
+ color: #333366;
+ text-decoration: underline;
+}
+
+.error {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ color: #FF0000;
+}
+
+.sortLink {
+ color: #333366;
+ text-decoration: none;
+}
+
+
+.pageLayout {
+ width:760px;
+ height:100%;
+}
+
+.pageHeader {
+ background-color: #6392C6;
+ text-align: center;
+ vertical-align: middle;
+ height:1px;
+ overflow:visible;
+ color: #FFFFFF;
+ padding: 0px;
+ margin: 0px;
+}
+
+.pageHeader1 {
+}
+.pageHeader2 {
+ width:100%;
+}
+.pageHeader2col1 {
+ background-color: #FFFFFF;
+}
+
+.pageNavigation {
+ text-align: left;
+ vertical-align: top;
+ width: 200px;
+ background-color: #E7EFF7;
+ border: 1px solid #6392C6;
+ padding: 10px;
+}
+
+.pageBody {
+ text-align: left;
+ vertical-align: top;
+ width: 560px;
+ padding: 20px;
+ background-color: #FFFFFF;
+}
+
+.pageFooter {
+ text-align: right;
+ font-size: xx-small;
+ height:1px;
+ overflow:visible;
+ background-color: #6392C6;
+ color: #FFFFFF;
+}
+
+
+
+.navigation {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ width: 100%;
+}
+
+.navitem {
+ white-space : nowrap;
+ text-decoration : none;
+}
+
+a.navitem:hover,active {
+ white-space : nowrap;
+ text-decoration: none;
+ color: #6392C6;
+}
+
+.navitem_open {
+ white-space : nowrap;
+ text-decoration: none;
+ font-weight : bold;
+}
+
+a.navitem_open:hover,active {
+ white-space : nowrap;
+ text-decoration: none;
+ font-weight : bold;
+ color: #6392C6;
+}
+
+.navitem_active {
+ white-space : nowrap;
+ text-decoration: none;
+ font-weight : bold;
+ background-color: #6392C6;
+ width: 100%;
+ color: #FFFFFF;
+}
+
+a.navitem_active:hover,active {
+ white-space : nowrap;
+ text-decoration: none;
+ font-weight : bold;
+ background-color: #6392C6;
+ width: 100%;
+ color: #FFFFFF;
+}
+
+
+.navseparator {
+ line-height: 12px;
+ border-bottom: 1px solid #A2B7C5;
+}
+
+
+
+.fileUploadInput {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ width: 250px;
+}
+
+
+
+
+.emptyHeader {
+ background-color: #FFFFFF;
+ border-top: 0px none;
+ border-right: 0px none;
+ border-bottom: 0px none;
+ border-left: 0px none;
+}
+
+
+
+div.titlebar {
+ background: #C7D0D9;
+ color: black;
+ border: 1px solid #8CACBB;
+ padding-left: 1px;
+ padding-right: 1px;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ margin: 1px 1px;
+ clear: both;
+}
+
+/*
+ ------------------------------------------------------------
+ Calendar component
+ ------------------------------------------------------------
+*/
+
+.yearMonthHeader {
+ background-color: #DDDDDD;
+ color: #000000;
+ text-align: center;
+ border: none;
+ font-weight: bold;
+}
+
+.weekHeader {
+ background-color: #E7E7E7;
+ color: #000000;
+ text-align: center;
+ border: none;
+}
+
+.currentDayCell {
+ background-color: #DDDDDD;
+ color: #000000;
+ border: none;
+}
+
+
+/*
+ ------------------------------------------------------------
+ End Calendar component
+ ------------------------------------------------------------
+*/
+
+/*
+ ------------------------------------------------------------
+ Popup component
+ ------------------------------------------------------------
+*/
+
+.popup {
+ background-color:rgb(255,255,255);
+ color: #000000;
+ border: 1px solid #CCCCCC;
+ font-size:smaller;
+ padding: 5px;
+}
+
+.popup table {
+ font-size:smaller;
+}
+
+
+/*
+ ------------------------------------------------------------
+ End popup component
+ ------------------------------------------------------------
+*/
+
+
+.countryFormTable {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: solid;
+ border-width: 1px;
+}
+
+.countryFormHeader {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: none;
+ background-color: #FFDD00;
+ text-align: center;
+ font-weight : normal;
+}
+
+.countryFormFooter {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: none;
+ background-color: #FFDD00;
+ text-align: center;
+ font-weight : normal;
+}
+
+.countryFormLabels {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: none;
+ text-align: right;
+ font-weight : bold;
+}
+
+.countryFormInputs {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ padding: 2;
+ border-style: none;
+}
+
+/*
+ ------------------------------------------------------------
+ Tree component
+ ------------------------------------------------------------
+*/
+
+.nodeFolder
+{
+ font-size: 10px;
+ font-family: Verdana, Geneva, sans-serif;
+ text-decoration: none
+}
+.document
+{
+ color: blue;
+ font-size: 10px;
+ font-family: Verdana, Geneva, sans-serif;
+ text-decoration: none
+}
+.documentSelected
+{
+ color: blue;
+ font-size: 10px;
+ font-family: Verdana, Geneva, sans-serif;
+ text-decoration: none;
+ font-weight: bold
+}
+
+.childCount
+{
+ color: blue;
+ font-size: 10px;
+ font-family: Verdana, Geneva, sans-serif;
+ text-decoration: none
+}
+
+/*
+ ------------------------------------------------------------
+ Panelnavigation
+ ------------------------------------------------------------
+*/
+#subnavigation {
+margin-left: 0px;
+margin-right: 20px;
+padding: 0px 0px 20px 0px;
+border: 1px solid #546359;
+background-color: #EAF4F4;
+}
+
+#subnavigation_outer {
+float: left;
+width: 220px;
+padding: 0px;
+margin: 0px 0px 0px 0px;
+}
+#subnavigation_outer h1 {
+font-size: 1.5em;
+margin: 0px;
+padding: 0px 0px 15px 0px;
+}
+
+/*
+ --------------------------------------------------------------
+ Horizontal Panelnavigation
+ --------------------------------------------------------------
+*/
+#hNav_outer {
+ margin: 0;
+ padding: 0;
+ height: 60px;
+ width: 800px;
+}
+#hNav_outer ul {
+ padding: 0;
+ margin: 0;
+}
+#hNav_outer ul li ul {
+ margin: 0;
+ padding: 0;
+}
+#hNav_outer ul a {
+ text-decoration: none;
+}
+#hNav_outer ul li { /*float the main list items*/
+ margin: 0;
+ float: left;
+ display: block;
+ padding: 5px;
+}
+#hNav_outer ul li ul {
+ display: none;
+}
+#hNav_outer ul li.off ul, #hNav_outer ul li.on ul { /*put the subnav below*/
+ position: absolute;
+ top: 36px;
+ *top: 44px;/*reposition for IE*/
+ background: #224d6f;
+ left: 13px;
+ *left: 15px;
+ width: 740px;
+}
+#hNav_outer ul li.on ul {
+ display: block;
+ background: #f90;
+}
+#hNav_outer ul li.on:hover ul, #hNav_outer ul li.over ul { /*for ie*/
+ background: #224d6f;
+}
+#hNav_outer ul li a {
+ color: #224d6f;
+ font-weight: bold;
+ display: block;
+ padding: 5;
+}
+#hNav_outer ul li.on a {
+ color: #fff;
+ background: #f90;
+}
+#hNav_outer ul li.on ul a, #hNav_outer ul li.off ul a {
+ float: left; /*ie doesn't inherit the float*/
+ border: 0;
+ color: #f90;
+ width: auto;
+}
+#hNav_outer ul li.on:hover ul a, #hNav_outer ul li.over ul li a { /*for ie - the specificity is necessary*/
+ background: #224d6f;
+}
+#hNav_outer ul li.off:hover ul, #hNav_outer ul li.over ul {
+ display: block;
+ z-index: 6000;
+}
+#hNav_outer ul li.off a:hover, #hNav_outer ul li:hover a, #hNav_outer ul li.over a {
+ background: #29497b;
+ color: #f90;
+}
+#hNav_outer ul li.off a:hover, #hNav_outer ul li.on a:hover {
+ color: #f90;
+}
+/*subnav formatting*/
+#hNav_outer ul li.off ul a {
+ display: block;
+ background: #224d6f;
+ color: #fff;
+}
+#hNav_outer ul li.on ul a {
+ display: block;
+ background: #f90;
+ color: #fff;
+}
+
+/**************************************************
+ * css layers and classes for list navigation list
+ **************************************************/
+#subnavigation ul li a {
+display:block;
+background-color: #D1E4E4;
+color: #294747;
+text-decoration: none;
+border-bottom: 1px solid #87A8A8;
+padding: 2px 20px;
+margin: 0px;
+}
+
+#subnavigation ul li a:visited {color:#294747;}
+#subnavigation ul li a:hover {color: #FFFFFF; background-color: #87A8A8;}
+#subnavigation ul li a:active { color:#294747;}
+
+#subnavigation ul li a.selected {
+font-weight: bold;
+color:#294747;
+background-color: #FFFFFF;
+}
+
+#subnavigation ul ul li a {
+padding: 2px 20px 2px 25px;
+margin: 0px;
+background-color: #FFFFFF;}
+
+#subnavigation ul ul li ul li a {
+padding: 2px 20px 2px 30px;
+margin: 0px;
+}
+
+#subnavigation ul {
+list-style-type: none;
+padding: 0px;
+margin: 0px;
+}
+
+#subnavigation li{
+margin: 0px;
+padding: 0px;
+display:inline;
+}
+
+#subnavigation ul.mypage li a {
+padding: 2px 20px 2px 20px;
+margin: 0px;
+background-color: #EAF4F4;
+}
+
+#subnavigation ul.mypage ul li a:hover {color: #FFFFFF; background-color: #87A8A8;}
+/*
+ body, th, td, input, select {
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ }
+
+ table, th, td {
+ font-size: small;
+ border: none;
+ }
+
+ .treeHeader {
+ background-color: #bbb;
+ border: 0.75px solid #fff;
+ padding: 2px 3px;
+ text-align: left;
+ }
+
+ .treeFooter {
+ padding: 5px;
+ margin: .67em 2px;
+ margin-top: 0;
+ background-color: #ddd;
+ background-image: url(../images/sw_med_rond.gif);
+ background-repeat: no-repeat;
+ background-position: bottom left;
+ }
+
+ input, .treeFooter {
+ font-size: xx-small;
+ font-size: x-small;
+ }
+
+ .a td {
+ background: #ddd;
+ border-bottom: 1px solid #fff;
+ }
+
+ .b td {
+ background: #efefef;
+ border-bottom: 1px solid #fff;
+ }
+
+ .col1 {
+ border-right: 1px solid #fff;
+ padding: 2px 15px 2px 5px;
+ }
+
+ .col2 {
+ border-left: 1px solid #fff;
+ padding: 2px 15px 2px 5px;
+ }
+
+ .tree {
+ lineheight: 18px;
+ font-family: arial, sans-serif;
+ }
+
+ .treenode {
+ padding: 2px 15px 2px 5px;
+ }
+
+ .treenode a {
+ text-decoration: none;
+ }
+
+ .treenodeSelected {
+ padding: 2px 15px 2px 5px;
+ }
+
+ .treenodeSelected a {
+ text-decoration: none;
+ font-weight: bold;
+ }
+
+ table .selectOneRadio {
+ font-weight: bold;
+ }
+
+
+ .standardList {
+ font-family : verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+ color: #000000;
+ }
+
+ */
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/css/basic.css
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp Mon Nov 24 12:26:26 2008
@@ -0,0 +1,90 @@
+<%@ page session="false" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/commons/components" prefix="mc" %>
+<html>
+
+<%@ include file="inc/head.inc" %>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//-->
+
+<body>
+
+<f:view>
+
+ <h:form>
+ <p>This component allows to export the datatable contents to an excel or pdf file.</p>
+
+ <br>
+
+ <h:dataTable id="tbl_cars"
+ styleClass="scrollerTable"
+ headerClass="standardTable_Header"
+ footerClass="standardTable_Header"
+ rowClasses="standardTable_Row1,standardTable_Row2"
+ columnClasses="standardTable_Column,standardTable_ColumnCentered,standardTable_Column"
+ var="car"
+ value="#{exporterBean.carsList}">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Id" />
+ </f:facet>
+ <h:outputText value="#{car.id}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Type" />
+ </f:facet>
+ <h:outputText value="#{car.type}" />
+ </h:column>
+
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Color" />
+ </f:facet>
+ <h:outputText value="#{car.color}" />
+ </h:column>
+
+ </h:dataTable>
+
+ <br>
+
+ <h:commandButton action="#{exporterBean.export}" value="Export as excel">
+ <mc:exporterActionListener for="tbl_cars" fileType="XLS"/>
+ </h:commandButton>
+
+ <br>
+
+ <h:commandButton action="#{exporterBean.export}" value="Export as pdf">
+ <mc:exporterActionListener for="tbl_cars" fileType="PDF"/>
+ </h:commandButton>
+
+
+ </h:form>
+</f:view>
+
+<%@ include file="inc/page_footer.jsp" %>
+
+</body>
+
+</html>
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/exporter.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/home.jsp Mon Nov 24 12:26:26 2008
@@ -53,6 +53,12 @@
<h:outputLink value="convertEnum.jsf">
<f:verbatim>ConvertEnum</f:verbatim>
</h:outputLink>
+ <h:outputLink value="renderOne.jsf">
+ <f:verbatim>renderOne - render the first child component by order or by index</f:verbatim>
+ </h:outputLink>
+ <h:outputLink value="exporter.jsf">
+ <f:verbatim>Exporter - Export datatable contents as an excel file or as a pdf file</f:verbatim>
+ </h:outputLink>
</h:panelGrid>
</h:form>
Added: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp?rev=720278&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp Mon Nov 24 12:26:26 2008
@@ -0,0 +1,60 @@
+<%@ page session="false" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://myfaces.apache.org/commons/components" prefix="mc" %>
+<html>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//-->
+
+<%@include file="inc/head.inc" %>
+
+<body>
+<f:view>
+ <h:form>
+
+ <h:outputText value="Output:" />
+ <h:panelGrid columns="2">
+ <h:outputText value="'first' will display the first rendered child component only (will render only B):" />
+ <mc:renderOne>
+ <h:outputText value="<b>A - FirstItem</b>" rendered="#{renderOne.ARendered}" escape="false"/>
+ <h:outputText value="<b>B - SecondItem</b>" rendered="#{renderOne.BRendered}" escape="false"/>
+ <h:outputText value="<b>C - ThirdItem</b>" rendered="#{renderOne.CRendered}" escape="false"/>
+ <h:outputText value="<b>D - FourthItem</b>" rendered="#{renderOne.DRendered}" escape="false"/>
+ </mc:renderOne>
+
+ <h:outputText value="'index' will display the third component only (will render only C):" />
+ <mc:renderOne type="index" value="#{renderOne.index}">
+ <h:outputText value="<b>A - FirstItem</b>" rendered="#{renderOne.ARendered}" escape="false"/>
+ <h:outputText value="<b>B - SecondItem</b>" rendered="#{renderOne.BRendered}" escape="false"/>
+ <h:outputText value="<b>C - ThirdItem</b>" rendered="#{renderOne.CRendered}" escape="false"/>
+ <h:outputText value="<b>D - FourthItem</b>" rendered="#{renderOne.DRendered}" escape="false"/>
+ </mc:renderOne>
+
+ </h:panelGrid>
+
+ </h:form>
+</f:view>
+
+<%@include file="inc/page_footer.jsp" %>
+
+</body>
+</html>
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-examples/src/main/webapp/renderOne.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/commons/branches/jsf_11/myfaces-commons-validators/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/pom.xml?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/pom.xml (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/pom.xml Mon Nov 24 12:26:26 2008
@@ -39,7 +39,6 @@
<plugin>
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
- <version>1.0.1</version>
<executions>
<execution>
<goals>
@@ -256,7 +255,6 @@
<!-- Generate content for custom tagdoc report -->
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
- <version>1.0.1</version>
<configuration>
<taglibs>
<mcv>http://myfaces.apache.org/commons/validators</mcv>
@@ -286,7 +284,6 @@
<!-- which goal is run here? -->
<groupId>org.apache.myfaces.buildtools</groupId>
<artifactId>myfaces-builder-plugin</artifactId>
- <version>1.0.1</version>
<configuration>
<taglibs>
<mcv>http://myfaces.apache.org/commons/validators</mcv>
Modified: myfaces/commons/branches/jsf_11/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/pom.xml?rev=720278&r1=720277&r2=720278&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/pom.xml (original)
+++ myfaces/commons/branches/jsf_11/pom.xml Mon Nov 24 12:26:26 2008
@@ -105,6 +105,11 @@
<pluginManagement>
<plugins>
<plugin>
+ <groupId>org.apache.myfaces.buildtools</groupId>
+ <artifactId>myfaces-builder-plugin</artifactId>
+ <version>1.0.2</version>
+ </plugin>
+ <plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
@@ -139,6 +144,17 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>poi</groupId>
+ <artifactId>poi</artifactId>
+ <version>2.5.1-final-20040804</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>1.4.8</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.6</version>
@@ -147,10 +163,15 @@
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
-
<version>1.1.6</version>
</dependency>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>