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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sun Oct 12 13:28:13 EDT 2008


Author: nickarls
Date: 2008-10-12 13:28:12 -0400 (Sun, 12 Oct 2008)
New Revision: 9273

Modified:
   trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
   trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java
   trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java
   trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java
   trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java
   trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java
   trunk/src/excel/org/jboss/seam/excel/ui/UICell.java
   trunk/src/excel/org/jboss/seam/excel/ui/UIFormula.java
Log:
complete migration of forceType attribute to css (partial commit broke build)

Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml	2008-10-12 17:28:12 UTC (rev 9273)
@@ -340,6 +340,14 @@
                               to some pattern, this file extension must also match.
                            </para>
                         </listitem>
+                        <listitem>
+                           <para>
+                              <literal>exportKey</literal>
+                              &#8212;A key under which to store the resulting data
+                              in a DocumentData object under the event scope. If used,
+                              there is no redirection.
+                           </para>
+                        </listitem>
                      </itemizedlist>
                      <para>
                         <emphasis>Child elemenents</emphasis>
@@ -983,16 +991,6 @@
                         </listitem>
                         <listitem>
                            <para>
-                              <literal>forceType</literal>
-                              &#8212;The forced type of the cell data. The value
-                              is a string that can be one of "general",
-                              "number", "text", "date", "formula" or "bool". The
-                              type is automatically detected so there is rarely
-                              any use for this attribute.
-                           </para>
-                        </listitem>
-                        <listitem>
-                           <para>
                               <literal>comment</literal>
                               &#8212;A comment to add to the cell. The value is
                               a string.
@@ -3043,6 +3041,18 @@
                   </row>
                   <row>
                      <entry valign="top">
+                        <para>xls-force-type</para>
+                     </entry>
+                     <entry valign="top">
+                        <para>
+                           The forced type of the cell data. The value is a string that can be one 
+                           of "general", "number", "text", "date", "formula" or "bool". The type 
+                           is automatically detected so there is rarely any use for this attribute.
+                        </para>
+                     </entry>
+                  </row>
+                  <row>
+                     <entry valign="top">
                         <para>xls-format-mask</para>
                      </entry>
                      <entry valign="top">

Modified: trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -47,12 +47,11 @@
    public static final String SHRINK_TO_FIT = "xls-shrink-to-fit";
    public static final String VERICAL_ALIGNMENT = "xls-vertical-alignment";
    public static final String WRAP = "xls-wrap";
+   public static final String FORCE_TYPE = "xls-force-type";
    
    public static final String COLUMN_WIDTH = "xls-column-width";
    public static final String COLUMN_WIDTHS = "xls-column-widths";
    public static final String COLUMN_AUTO_SIZE = "xls-column-autosize";
    public static final String COLUMN_HIDDEN = "xls-column-hidden";
 
-   public static final String FORCE_TYPE = "xls-force-type";
-
 }

Modified: trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -66,6 +66,7 @@
    public Boolean wrap;
    public String verticalAlignment;
    public String formatMask;
+   public String forceType;
 
    public CellStyle(Map<String, Object> styleMap)
    {
@@ -95,6 +96,7 @@
       wrap = (Boolean) styleMap.get(CSSNames.WRAP);
       verticalAlignment = (String) styleMap.get(CSSNames.VERICAL_ALIGNMENT);
       formatMask = (String) styleMap.get(CSSNames.FORMAT_MASK);
+      forceType = (String) styleMap.get(CSSNames.FORCE_TYPE);
    }
 
 }

Modified: trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -11,9 +11,12 @@
  */
 public class PropertyBuilders
 {
+
    // Wildcard symbol for column widths
    private static final String COLUMN_WIDTH_WILDCARD = "*";
-   
+
+   public static class ForceType extends StringPropertyBuilder {}
+
    public static class ColumnWidths implements PropertyBuilder
    {
       public StyleMap parseProperty(String key, String[] values)
@@ -54,12 +57,7 @@
    public static class BorderBottomColor extends StringPropertyBuilder
    {
    }
-
    
-   public static class ForceType extends StringPropertyBuilder
-   {
-   }
-   
    public static class BorderBottomShorthand implements PropertyBuilder
    {
       public StyleMap parseProperty(String key, String[] values)

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -54,10 +54,11 @@
 import org.jboss.seam.log.Logging;
 
 /**
- * A helper class for the JXLExcelWorkbook, caches cell info and holds CSS parser
+ * A helper class for the JXLExcelWorkbook, caches cell info and holds CSS
+ * parser
  * 
  * @author Nicklas Karlsson (nickarls at gmail.com)
- *
+ * 
  */
 public class JXLHelper
 {
@@ -66,10 +67,10 @@
 
    // The CSS parser
    private Parser parser = new Parser();
-   
+
    // A cache of cell info
    private CellInfoCache cellInfoCache = new CellInfoCache();
-      
+
    /**
     * Creates a cell format
     * 
@@ -82,7 +83,8 @@
       WritableCellFormat cellFormat = null;
       CellStyle cellStyle = new CellStyle(parser.getCascadedStyleMap(uiCell));
 
-      switch (uiCell.getDataType())
+      CellType cellType = cellStyle.forceType != null ? CellType.valueOf(cellStyle.forceType) : uiCell.getDataType();
+      switch (cellType)
       {
       case text:
          // Creates a basic text format
@@ -203,32 +205,23 @@
 
       if (cellStyle.leftBorder.isUsed())
       {
-         cellFormat.setBorder(JXLFactory.createBorder("left"), 
-               JXLFactory.createLineStyle(cellStyle.leftBorder.lineStyle), 
-               JXLFactory.createColor(cellStyle.leftBorder.color));
+         cellFormat.setBorder(JXLFactory.createBorder("left"), JXLFactory.createLineStyle(cellStyle.leftBorder.lineStyle), JXLFactory.createColor(cellStyle.leftBorder.color));
       }
       if (cellStyle.topBorder.isUsed())
       {
-         cellFormat.setBorder(JXLFactory.createBorder("top"), 
-               JXLFactory.createLineStyle(cellStyle.topBorder.lineStyle), 
-               JXLFactory.createColor(cellStyle.topBorder.color));
+         cellFormat.setBorder(JXLFactory.createBorder("top"), JXLFactory.createLineStyle(cellStyle.topBorder.lineStyle), JXLFactory.createColor(cellStyle.topBorder.color));
       }
       if (cellStyle.rightBorder.isUsed())
       {
-         cellFormat.setBorder(JXLFactory.createBorder("right"), 
-               JXLFactory.createLineStyle(cellStyle.rightBorder.lineStyle), 
-               JXLFactory.createColor(cellStyle.rightBorder.color));
+         cellFormat.setBorder(JXLFactory.createBorder("right"), JXLFactory.createLineStyle(cellStyle.rightBorder.lineStyle), JXLFactory.createColor(cellStyle.rightBorder.color));
       }
       if (cellStyle.bottomBorder.isUsed())
       {
-         cellFormat.setBorder(JXLFactory.createBorder("bottom"), 
-               JXLFactory.createLineStyle(cellStyle.bottomBorder.lineStyle), 
-               JXLFactory.createColor(cellStyle.bottomBorder.color));
+         cellFormat.setBorder(JXLFactory.createBorder("bottom"), JXLFactory.createLineStyle(cellStyle.bottomBorder.lineStyle), JXLFactory.createColor(cellStyle.bottomBorder.color));
       }
       if (cellStyle.background.isUsed())
       {
-         cellFormat.setBackground(JXLFactory.createColor(cellStyle.background.color), 
-               JXLFactory.createPattern(cellStyle.background.pattern));
+         cellFormat.setBackground(JXLFactory.createColor(cellStyle.background.color), JXLFactory.createPattern(cellStyle.background.pattern));
       }
       return cellFormat;
    }
@@ -246,7 +239,7 @@
    }
 
    /**
-    * Applied worksheet settings 
+    * Applied worksheet settings
     * 
     * @param worksheet The worksheet to apply the settings to
     * @param uiWorksheet The settings to set
@@ -416,10 +409,13 @@
             UIPrintTitles printTitles = (UIPrintTitles) child;
             settings.setPrintTitles(printTitles.getFirstCol(), printTitles.getFirstRow(), printTitles.getLastCol(), printTitles.getLastRow());
          }
-         else if (child.getClass() == UIHeader.class) {
+         else if (child.getClass() == UIHeader.class)
+         {
             UIHeader uiHeader = (UIHeader) child;
             settings.setHeader(JXLFactory.createHeaderFooter(uiHeader, settings.getHeader()));
-         } else if (child.getClass() == UIFooter.class) {
+         }
+         else if (child.getClass() == UIFooter.class)
+         {
             UIFooter uiFooter = (UIFooter) child;
             settings.setFooter(JXLFactory.createHeaderFooter(uiFooter, settings.getFooter()));
          }
@@ -628,8 +624,8 @@
     * @param data The contents of the cell
     * @param cellFormat The cell format settings of the cell
     * @return The prepared cell representation
-    * @see <a
-    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/write/WritableCell.html">WritableCell</a>
+    * @see <a * href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/write/WritableCell.html"
+    *      >WritableCell< /a>
     */
    public static WritableCell createCell(int column, int row, CellType type, Object data, WritableCellFormat cellFormat)
    {
@@ -758,7 +754,7 @@
    public void applyColumnSettings(UIColumn uiColumn, WritableSheet worksheet, int columnIndex)
    {
       ColumnStyle columnStyle = new ColumnStyle(parser.getCascadedStyleMap(uiColumn));
-      
+
       if (log.isTraceEnabled())
       {
          log.trace("Applying column settings #0 on column #1", columnStyle, columnIndex);

Modified: trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -28,7 +28,10 @@
    private static final String DEFAULT_CONTENT_TYPE = "text/html";
    private static final String DEFAULT_CHARACTER_ENCODING = "utf-8";
 
+   // The CSS style class
    private String styleClass;
+   
+   // The CSS style
    private String style;
    
    /**

Modified: trunk/src/excel/org/jboss/seam/excel/ui/UICell.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UICell.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UICell.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -20,7 +20,6 @@
       general, number, text, date, formula, bool
    }
 
-   private CellType forceType;
    private Object value;
    private Integer column;
    private Integer row;
@@ -65,16 +64,6 @@
       this.value = value;
    }
 
-   public CellType getForceType()
-   {
-      return (CellType) valueOf("forceType", forceType);
-   }
-
-   public void setForceType(CellType forceType)
-   {
-      this.forceType = forceType;
-   }
-
    @Override
    public String getFamily()
    {
@@ -95,10 +84,6 @@
       {
          return CellType.formula;
       }
-      if (forceType != null)
-      {
-         return forceType;
-      }
       Object value = getValue();
       if (value instanceof Integer || value instanceof Long || value instanceof Double || value instanceof Short || value instanceof BigDecimal || value instanceof BigInteger || value instanceof Byte || value instanceof Float)
       {

Modified: trunk/src/excel/org/jboss/seam/excel/ui/UIFormula.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIFormula.java	2008-10-12 17:00:37 UTC (rev 9272)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIFormula.java	2008-10-12 17:28:12 UTC (rev 9273)
@@ -1,5 +1,6 @@
 package org.jboss.seam.excel.ui;
 
+
 public class UIFormula extends UICell
 {
    public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIFormula";
@@ -9,11 +10,5 @@
    {
       return COMPONENT_TYPE;
    }
-
-   @Override
-   public CellType getForceType()
-   {
-      return CellType.formula;
-   }
-
+   
 }




More information about the seam-commits mailing list