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 2010/10/12 05:45:19 UTC

svn commit: r1021615 - in /myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons: exporter/ exporter/util/ renderOne/

Author: lu4242
Date: Tue Oct 12 03:45:18 2010
New Revision: 1021615

URL: http://svn.apache.org/viewvc?rev=1021615&view=rev
Log:
MFCOMMONS-18 Use myfaces builder annotations instead doclets (and synch with trunk)

Added:
    myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/FaceletsExporterActionListenerTag.java
Modified:
    myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java
    myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java
    myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java
    myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java
    myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/renderOne/AbstractUIRenderOne.java

Modified: 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=1021615&r1=1021614&r2=1021615&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListener.java Tue Oct 12 03:45:18 2010
@@ -33,52 +33,67 @@ import org.apache.myfaces.commons.export
 import org.apache.myfaces.commons.util.ComponentUtils;
 
 /**
- * 
+ *
  * This class is acting as the Exporter ActionListener.
  */
-public class ExporterActionListener implements ActionListener, StateHolder {
+public class ExporterActionListener implements ActionListener, StateHolder
+{
 
-    private static final Log   log                       = LogFactory
-                                                                 .getLog(ExporterActionListener.class);
+    private static final Log log = LogFactory
+            .getLog(ExporterActionListener.class);
 
-    public static final String FILENAME_KEY              = "filename";
+    public static final String FILENAME_KEY = "filename";
 
-    public static final String FILE_TYPE_KEY             = "fileType";
+    public static final String FILE_TYPE_KEY = "fileType";
 
-    public static final String FOR_KEY                   = "for";
+    public static final String FOR_KEY = "for";
 
-    private String             _fileType;
+    private String _fileType;
 
-    private String             _fileName;
+    private String _fileName;
 
-    private String             _for;
+    private String _for;
 
-    public void processAction(ActionEvent event) {
+    public ExporterActionListener() 
+    {
+    }
+
+    public ExporterActionListener(String _for, String _fileType,
+            String _fileName)
+    {
+        this._fileType = _fileType;
+        this._fileName = _fileName;
+        this._for = _for;
+    }
 
+    public void processAction(ActionEvent event)
+    {
         FacesContext facesContext = FacesContext.getCurrentInstance();
         Object response = facesContext.getExternalContext().getResponse();
 
-        if (!(response instanceof HttpServletResponse)) {
+        if (!(response instanceof HttpServletResponse))
+        {
             log.error("ExporteActionListener requires servlet");
         }
-        else {
-            try {
+        else
+        {
+            try
+            {
 
                 /* get the source dataTable component */
                 HtmlDataTable dataTable = (HtmlDataTable) ComponentUtils
                         .findComponentById(facesContext, facesContext
                                 .getViewRoot(), _for);
 
-                if (!(dataTable instanceof HtmlDataTable)) 
+                if (!(dataTable instanceof HtmlDataTable))
                 {
                     throw new RuntimeException(
                             "exporterActionListener for attribute should contain a "
                                     + "dataTable component id");
                 }
-                
-                
+
                 if (ExporterConstants.EXCEL_FILE_TYPE
-                        .equalsIgnoreCase(_fileType)) 
+                        .equalsIgnoreCase(_fileType))
                 {
 
                     /*
@@ -87,15 +102,15 @@ public class ExporterActionListener impl
                     Object contextResponse = facesContext.getExternalContext()
                             .getResponse();
 
-                    if (contextResponse instanceof HttpServletResponse) 
+                    if (contextResponse instanceof HttpServletResponse)
                     {
                         ExcelExporterUtil.generateEXCEL(facesContext,
                                 (HttpServletResponse) contextResponse,
-                                _fileName, dataTable); 
+                                _fileName, dataTable);
                     }
 
                 }
-                else 
+                else
                 {
 
                     /*
@@ -103,7 +118,6 @@ public class ExporterActionListener impl
                      */
                     HttpServletResponse httpResponse = (HttpServletResponse) facesContext
                             .getExternalContext().getResponse();
-                    
 
                     PDFExporterUtil.generatePDF(facesContext, httpResponse,
                             _fileName, dataTable);
@@ -114,7 +128,7 @@ public class ExporterActionListener impl
                         .saveSerializedView(facesContext);
                 facesContext.responseComplete();
             }
-            catch (Exception exception) 
+            catch (Exception exception)
             {
                 throw new RuntimeException(exception);
             }
@@ -124,31 +138,38 @@ public class ExporterActionListener impl
         facesContext.responseComplete();
     }
 
-    public String getFilename() {
+    public String getFilename()
+    {
         return _fileName;
     }
 
-    public void setFilename(String _filename) {
+    public void setFilename(String _filename)
+    {
         this._fileName = _filename;
     }
 
-    public String getFileType() {
+    public String getFileType()
+    {
         return _fileType;
     }
 
-    public void setFileType(String type) {
+    public void setFileType(String type)
+    {
         _fileType = type;
     }
 
-    public String getFor() {
+    public String getFor()
+    {
         return _for;
     }
 
-    public void setFor(String _for) {
+    public void setFor(String _for)
+    {
         this._for = _for;
     }
 
-    public void restoreState(FacesContext context, Object state) {
+    public void restoreState(FacesContext context, Object state)
+    {
         String values[] = (String[]) state;
 
         _for = values[0];
@@ -156,7 +177,8 @@ public class ExporterActionListener impl
         _fileType = values[2];
     }
 
-    public Object saveState(FacesContext context) {
+    public Object saveState(FacesContext context)
+    {
         String values[] = new String[3];
 
         values[0] = _for;
@@ -165,12 +187,15 @@ public class ExporterActionListener impl
         return ((String[]) values);
     }
 
-    public boolean isTransient() {
+    public boolean isTransient()
+    {
         return false;
     }
 
-    public void setTransient(boolean newTransientValue) {
-        if (newTransientValue == true) {
+    public void setTransient(boolean newTransientValue)
+    {
+        if (newTransientValue == true)
+        {
             throw new IllegalArgumentException();
         }
     }

Modified: 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=1021615&r1=1021614&r2=1021615&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/ExporterActionListenerTag.java Tue Oct 12 03:45:18 2010
@@ -25,15 +25,17 @@ import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.Tag;
 import javax.servlet.jsp.tagext.TagSupport;
 
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspTag;
+
 /**
  * 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.
  */
+@JSFJspTag(
+        name="mc:exporterActionListener",
+        bodyContent="JSP",
+        tagHandler="org.apache.myfaces.commons.exporter.FaceletsExporterActionListenerTag")
 public class ExporterActionListenerTag extends TagSupport {
 
     private static final long serialVersionUID = -1455677614701939262L;
@@ -53,6 +55,11 @@ public class ExporterActionListenerTag e
         {
             throw new JspException("fileType attribute not set");
         }
+        
+        if (_fileName == null) 
+        {
+            throw new JspException("fileName attribute not set");
+        }        
 
         // find the parent UIComponentTag which should be an ActionSource.
         UIComponentTag componentTag = UIComponentTag
@@ -135,4 +142,6 @@ public class ExporterActionListenerTag e
     public void setFor(String _for) {
         this._for = _for;
     }
+    
+    
 }

Added: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/FaceletsExporterActionListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/FaceletsExporterActionListenerTag.java?rev=1021615&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/FaceletsExporterActionListenerTag.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/FaceletsExporterActionListenerTag.java Tue Oct 12 03:45:18 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.IOException;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.tag.TagHandler;
+import com.sun.facelets.tag.jsf.ComponentSupport;
+
+/**
+ * The (FaceletsExporterActionListenerTag) is responsible for handling the 
+ * ExporterActionListener Tag in Facelets.
+ */
+public class FaceletsExporterActionListenerTag extends TagHandler
+{
+
+    private final TagAttribute _for;
+
+    private final TagAttribute _fileType;
+
+    private final TagAttribute _fileName;
+
+    public FaceletsExporterActionListenerTag(TagConfig tagConfig) 
+    {
+        super(tagConfig);
+        this._for = getRequiredAttribute(ExporterActionListener.FOR_KEY);
+        this._fileType = getRequiredAttribute(ExporterActionListener.FILE_TYPE_KEY);
+        this._fileName = getRequiredAttribute(ExporterActionListener.FILENAME_KEY);
+    }
+
+    public void apply(FaceletContext faceletContext, UIComponent parent)
+            throws IOException, FacesException, FaceletException, ELException
+    {
+        if (ComponentSupport.isNew(parent))
+        {
+            ValueExpression forVE = _for.getValueExpression(faceletContext,
+                    Object.class);
+            ValueExpression fileTypeVE = _fileType.getValueExpression(
+                    faceletContext, Object.class);
+            ValueExpression fileNameVE = _fileName.getValueExpression(
+                    faceletContext, Object.class);
+
+            ActionSource actionSource = (ActionSource) parent;
+            actionSource.addActionListener(new ExporterActionListener(
+                    (String) forVE.getValue(faceletContext),
+                    (String) fileTypeVE.getValue(faceletContext),
+                    (String) fileNameVE.getValue(faceletContext)));
+        }
+    }
+}

Modified: 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=1021615&r1=1021614&r2=1021615&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/ExcelExporterUtil.java Tue Oct 12 03:45:18 2010
@@ -38,22 +38,57 @@ import org.apache.poi.hssf.usermodel.HSS
 /**
  * This class is a utility class for serving excel exporting.
  */
-public class ExcelExporterUtil {
+public class ExcelExporterUtil 
+{
     
-    private static void addColumnHeaders(HSSFSheet sheet, List columns) {
+    /**
+     * 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);
+    }    
+
+    private static void addColumnHeaders(HSSFSheet sheet, List columns)
+    {
         HSSFRow rowHeader = sheet.createRow(0);
-        
-        for (int i = 0; i < columns.size(); i++) {
+
+        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) {
+    private static List getColumns(HtmlDataTable table)
+    {
         List columns = new ArrayList();
-        for (int i = 0; i < table.getChildCount(); i++) {
+        for (int i = 0; i < table.getChildCount(); i++)
+        {
             UIComponent child = (UIComponent) table.getChildren().get(i);
-            if (child instanceof UIColumn) {
+            if (child instanceof UIColumn)
+            {
                 columns.add(child);
             }
         }
@@ -61,47 +96,70 @@ public class ExcelExporterUtil {
     }
 
     private static void addColumnValue(HSSFRow rowHeader,
-            UIComponent component, int index) {
+            UIComponent component, int index)
+    {
         HSSFCell cell = rowHeader.createCell((short) index);
         cell.setEncoding(HSSFCell.ENCODING_UTF_16);
-        if (component instanceof ValueHolder) {
+        if (component instanceof ValueHolder)
+        {
             String stringValue = ComponentUtils.getStringValue(FacesContext
                     .getCurrentInstance(), component);
             cell.setCellValue(stringValue);
         }
     }
-    
+
+    private static void addColumnValue(HSSFRow rowHeader, String value,
+            int index)
+    {
+        HSSFCell cell = rowHeader.createCell((short) index);
+        cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+        cell.setCellValue(value);
+    }
+
     /*
      * This method is used for adding the columns values to the HSSFSheet.
      */
     private static void generateTableContent(FacesContext facesContext,
-            HSSFSheet sheet, List columns, HtmlDataTable dataTable) {
-        
+            HSSFSheet sheet, List columns, HtmlDataTable dataTable)
+    {
+
         int numberOfColumns = columns.size();
-        int numberOfRows = dataTable.getRowCount();        
+        int numberOfRows = dataTable.getRowCount();
         int startFrom = 0;
         int currentIndex = 1;
-        int endAt = numberOfRows;         
-    
+        int endAt = numberOfRows;
+
         /* fill the table with the data. */
-        for (int i = startFrom; i < endAt; ++i) {
+        for (int i = startFrom; i < endAt; ++i)
+        {
             dataTable.setRowIndex(i);
             HSSFRow row = sheet.createRow(currentIndex++);
-            for (int j = 0; j < numberOfColumns; ++j) {
+            for (int j = 0; j < numberOfColumns; ++j)
+            {
                 UIColumn column = (UIColumn) columns.get(j);
-                addColumnValue(row, (UIComponent) column.getChildren().get(0),
-                        j);
+                String cellValue = "";
+
+                for (int k = 0; k < column.getChildren().size(); ++k)
+                {
+                    if (column.getChildren().get(k) instanceof ValueHolder)
+                    {
+                        cellValue += ((ValueHolder) column.getChildren().get(k))
+                                .getValue();
+                    }
+                }
+                addColumnValue(row, cellValue, j);
             }
         }
-    }    
-    
+    }
+
     /*
      * This utility method is used for writing the excelModel (generatedExcel)
-     * to the response (response) and uses the (fileName) as the generated file 
+     * 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 {
+            HSSFWorkbook generatedExcel, String fileName) throws IOException
+    {
 
         /* write the model to the stream */
         response.setContentType("application/vnd.ms-excel");
@@ -114,7 +172,7 @@ public class ExcelExporterUtil {
 
         generatedExcel.write(response.getOutputStream());
     }
-    
+
     /*
      * This utility method is used for generating the (HSSFWorkbook) 
      * excel table model from the passed (HtmlDataTable).
@@ -123,9 +181,10 @@ public class ExcelExporterUtil {
      * @return the (HSSFWorkbook) object. 
      */
     private static HSSFWorkbook generateExcelTableModel(
-            FacesContext facesContext, HtmlDataTable dataTable) {
-  
-        HSSFWorkbook workbook = new HSSFWorkbook();       
+            FacesContext facesContext, HtmlDataTable dataTable)
+    {
+
+        HSSFWorkbook workbook = new HSSFWorkbook();
         HSSFSheet sheet = workbook.createSheet(dataTable.getId());
         List columns = getColumns(dataTable);
         int currentRowIndex = dataTable.getRowIndex();
@@ -135,33 +194,5 @@ public class ExcelExporterUtil {
 
         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);
     }
 }

Modified: 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=1021615&r1=1021614&r2=1021615&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/exporter/util/PDFExporterUtil.java Tue Oct 12 03:45:18 2010
@@ -39,14 +39,16 @@ import com.lowagie.text.pdf.PdfWriter;
 /**
  * This class is a utility class for serving PDF exporting.
  */
-public class PDFExporterUtil {
+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 {
+            throws IOException
+    {
 
         // setting response headers.
         response.setHeader("Expires", "0");
@@ -72,12 +74,14 @@ public class PDFExporterUtil {
     /*
      * 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++) {
+    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) {
+            if (columnHeaderCell instanceof ValueHolder)
+            {
                 String cellValue = ComponentUtils.getStringValue(FacesContext
                         .getCurrentInstance(), columnHeaderCell);
                 pdfTable.addCell(cellValue);
@@ -89,24 +93,32 @@ public class PDFExporterUtil {
      * This method is used for adding the columns values to the pdfTable.
      */
     private static void generateTableContent(FacesContext facesContext,
-            PdfPTable pdfTable, List columns, HtmlDataTable dataTable) {
-
+            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) {
+        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);
+            for (int j = 0; j < numberOfColumns; ++j)
+            {
+                String cellValue = "";
+                UIColumn currentColumn = (UIColumn) columns.get(j);
+
+                for (int k = 0; k < currentColumn.getChildren().size(); ++k)
+                {
+                    if (currentColumn.getChildren().get(k) instanceof ValueHolder)
+                    {
+                        cellValue += ((ValueHolder) currentColumn.getChildren()
+                                .get(k)).getValue();
+                    }
                 }
+
+                pdfTable.addCell(cellValue);
             }
         }
     }
@@ -115,20 +127,21 @@ public class PDFExporterUtil {
      * This method is used for creating the PDFTable model.
      */
     public static PdfPTable generatePDFTableModel(FacesContext facesContext,
-            HtmlDataTable dataTable) {
-
+            HtmlDataTable dataTable)
+    {
         int numberOfColumns;
         List columns = null;
         PdfPTable pdfTable = null;
 
-
         /* getting the HTMLDataTable Columns */
         columns = ComponentUtils.getHTMLDataTableColumns(dataTable);
 
-        if (columns.size() == 0) {
+        if (columns.size() == 0)
+        {
             return null;
         }
-        else {
+        else
+        {
             numberOfColumns = columns.size();
         }
 
@@ -137,14 +150,14 @@ public class PDFExporterUtil {
 
         generateTableHeader(pdfTable, columns);
 
-        generateTableContent(facesContext, pdfTable, columns,
-                dataTable);
+        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
@@ -152,22 +165,21 @@ public class PDFExporterUtil {
      */
     public static void generatePDF(FacesContext facesContext,
             HttpServletResponse response, String fileName,
-            HtmlDataTable dataTable) throws Exception {
-
+            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.
+         * By default if the fileName is not specified, then use the table id.
          */
-        if (fileName == null) 
+        if (fileName == null)
         {
             fileName = dataTable.getId();
-        }        
+        }
 
         currentRowIndex = dataTable.getRowIndex();
 

Modified: myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/renderOne/AbstractUIRenderOne.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/renderOne/AbstractUIRenderOne.java?rev=1021615&r1=1021614&r2=1021615&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/renderOne/AbstractUIRenderOne.java (original)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-components/src/main/java/org/apache/myfaces/commons/renderOne/AbstractUIRenderOne.java Tue Oct 12 03:45:18 2010
@@ -25,6 +25,9 @@ import javax.faces.component.UIComponent
 import javax.faces.component.UIComponentBase;
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
 /**
  * Tag that allows rendering the first child either by index or the first
  * rendered one.
@@ -32,12 +35,14 @@ import javax.faces.context.FacesContext;
  * A component that only renders the first child either by index or the first
  * visible one..
  * </p>
- * @JSFComponent name = "mc:renderOne"
- *  clazz = "org.apache.myfaces.commons.renderOne.UIRenderOne"
- *  tagClass = "org.apache.myfaces.commons.renderOne.UIRenderOneTag"
+ *   
  * @author Andrew Robinson (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
+@JSFComponent(
+        name = "mc:renderOne",
+        clazz = "org.apache.myfaces.commons.renderOne.UIRenderOne",
+        tagClass = "org.apache.myfaces.commons.renderOne.UIRenderOneTag")
 public abstract class AbstractUIRenderOne extends UIComponentBase
 {
     public static final String COMPONENT_FAMILY = "javax.faces.Data";
@@ -51,9 +56,9 @@ public abstract class AbstractUIRenderOn
      * or a value that can be parsed into an integer. index: A collection, 
      * array or comma-separated list of numbers. (Default: "first")
      * 
-     * @JSFProperty
      * @return the type
      */
+    @JSFProperty
     public abstract String getType();
 
     /**
@@ -68,9 +73,9 @@ public abstract class AbstractUIRenderOn
      *  renders the first rendered item. 
      *  If the type is "index", the value must be a number.      
      *   
-     * @JSFProperty
      * @return the value
      */
+    @JSFProperty
     public abstract Integer getValue();
 
     /**