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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Sep 10 17:31:57 EDT 2008


Author: nickarls
Date: 2008-09-10 17:31:57 -0400 (Wed, 10 Sep 2008)
New Revision: 8931

Modified:
   trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java
   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/ColumnStyle.java
   trunk/src/excel/org/jboss/seam/excel/css/Parser.java
   trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilder.java
   trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java
   trunk/src/excel/org/jboss/seam/excel/css/StyleMap.java
   trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java
   trunk/src/excel/org/jboss/seam/excel/jxl/CellInfo.java
   trunk/src/excel/org/jboss/seam/excel/jxl/CellInfoCache.java
   trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java
   trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java
   trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java
   trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java
Log:
Minor. Javadocs for new stuff. Dropped @version and @since

Modified: trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/ExcelWorkbook.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -14,7 +14,6 @@
  * 
  * @author Nicklas Karlsson (nickarls at gmail.com)
  * @author Daniel Roth (danielc.roth at gmail.com)
- * @version 0.2
  */
 public interface ExcelWorkbook
 {
@@ -25,8 +24,6 @@
     * Moves the internal column pointer to the next column, called by the tag to
     * indicate that a new column has been started. If the pointer exceeds the
     * maximum allowed, throws an exception
-    * 
-    * @since 0.1
     */
    public abstract void nextColumn();
 
@@ -36,7 +33,6 @@
     * new worksheets if there are more than 65k rows.
     * 
     * @param uiWorksheet Worksheet to create or select
-    * @since 0.1
     */
    public abstract void createOrSelectWorksheet(UIWorksheet uiWorksheet);
 
@@ -44,15 +40,13 @@
     * Returns the binary data from the internal representation of the workbook
     * 
     * @return the bytes
-    * @since 0.1
     */
    public abstract byte[] getBytes();
 
    /**
-    * Intitializes a new workbook. Must be called first
+    * Initializes a new workbook. Must be called first
     * 
     * @param uiWorkbook the workbook UI item to create
-    * @since 0.1
     */
    public abstract void createWorkbook(UIWorkbook uiWorkbook);
 
@@ -93,5 +87,10 @@
     */
    public abstract void addWorksheetFooter(WorksheetItem item, int colspan);
 
+   /**
+    * Sets stylesheets for the workbook
+    * 
+    * @param stylesheets The stylesheets to set
+    */
    public abstract void setStylesheets(List<UILink> stylesheets);
 }
\ No newline at end of file

Modified: trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/CSSNames.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -1,5 +1,10 @@
 package org.jboss.seam.excel.css;
 
+/**
+ * Constant names for XLS-XSS attributes
+ * 
+ * @author Nicklas Karlsson (nickarls at gmail.com)
+ */
 public class CSSNames
 {
    public static final String FONT_FAMILY = "xls-font-family";

Modified: trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/CellStyle.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -2,6 +2,12 @@
 
 import java.util.Map;
 
+/**
+ * Helper class that collects font, border and background info with cell info into one package 
+ * from stylesheet data
+ * 
+ * @author Nicklas Karlsson (nickarls at gmail.com)
+ */
 public class CellStyle
 {
 

Modified: trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/ColumnStyle.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -2,6 +2,11 @@
 
 import java.util.Map;
 
+/**
+ * Helper class that collects column info into one package from stylesheet data
+ * 
+ * @author Nicklas Karlsson (nickarls at gmail.com)
+ */
 public class ColumnStyle
 {
    public Boolean autoSize;

Modified: trunk/src/excel/org/jboss/seam/excel/css/Parser.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/Parser.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/Parser.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -20,31 +20,67 @@
 import org.jboss.seam.log.Log;
 import org.jboss.seam.log.Logging;
 
+/**
+ * CSS parser for the XLS-CSS
+ * 
+ * @author Nicklas Karlsson (nickarls at gmail.com)
+ */
 public class Parser
 {
+   // Where to look for the style
    private static final String STYLE_ATTRIBUTE = "style";
+
+   // Where to look for the style class
    private static final String STYLE_CLASS_ATTRIBUTE = "styleClass";
+   
+   // What separates multiple XLS-CSS attributes in a style string
    private static final String STYLES_SEPARATOR = ";";
+   
+   // What separates the key and value in a XLS-CSS style
    private static final String STYLE_NAME_VALUE_SEPARATOR = ":";
+   
+   // What separates multiple style class references
    private static final String STYLE_SHORTHAND_SEPARATOR = " ";
 
+   // The style classes that have been read in from e:link referenced, mapped on style class name
    private Map<String, StyleMap> definedStyleClasses = new HashMap<String, StyleMap>();
+   
+   // The registered property builders, mapped on attribute name
    private Map<String, PropertyBuilder> propertyBuilders = new HashMap<String, PropertyBuilder>();
+   
+   // A cache of previously parsed css, mapped on component
    private Map<UIComponent, StyleMap> cellStyleCache = new HashMap<UIComponent, StyleMap>();
 
    private Log log = Logging.getLog(Parser.class);
 
+   /**
+    * Constructor, initializes the property builders
+    */
    public Parser()
    {
       initPropertyBuilders();
    }
 
+   /**
+    * Constructor with stylesheets
+    * 
+    * @param stylesheets The list of referenced stylesheets in UILink elements
+    * @throws MalformedURLException If the URL was bad
+    * @throws IOException If the URL could not be read
+    */
    public Parser(List<UILink> stylesheets) throws MalformedURLException, IOException
    {
       initPropertyBuilders();
       loadStylesheets(stylesheets);
    }
 
+   /**
+    * Loads stylesheets (merging by class name)
+    * 
+    * @param stylesheets The stylesheets to read/merge
+    * @throws MalformedURLException If the URL was bad
+    * @throws IOException If the URL could not be read
+    */
    private void loadStylesheets(List<UILink> stylesheets) throws MalformedURLException, IOException
    {
       for (UILink stylesheet : stylesheets)
@@ -53,6 +89,9 @@
       }
    }
 
+   /**
+    * Registers the property builders
+    */
    private void initPropertyBuilders()
    {
       propertyBuilders.put(CSSNames.FONT_FAMILY, new PropertyBuilders.FontFamily());
@@ -94,6 +133,14 @@
       propertyBuilders.put(CSSNames.COLUMN_WIDTHS, new PropertyBuilders.ColumnWidths());
    }
 
+   /**
+    * Parses a style sheet. Really crude. Assumes data is nicely formatted on one line per entry
+    * 
+    * @param URL The URL to read
+    * @return A map of style class names mapped to StyleMaps
+    * @throws MalformedURLException
+    * @throws IOException
+    */
    private Map<String, StyleMap> parseStylesheet(String URL) throws MalformedURLException, IOException
    {
       Map<String, StyleMap> styleClasses = new HashMap<String, StyleMap>();
@@ -122,14 +169,33 @@
       return styleClasses;
    }
 
+   /**
+    * Gets style from a component
+    * 
+    * @param component The component to examine
+    * @return null if not found, otherwise style string
+    */
    public static String getStyle(UIComponent component) {
       return getStyleProperty(component, STYLE_ATTRIBUTE);
    }
    
+   /**
+    * Gets style class from a component
+    * 
+    * @param component The component to examine
+    * @return null if not found, otherwise style class(es) string
+    */
    public static String getStyleClass(UIComponent component) {
       return getStyleProperty(component, STYLE_CLASS_ATTRIBUTE);
    }
    
+   /**
+    * Reads a property from a component
+    * 
+    * @param component The component to examine
+    * @param field The field to read
+    * @return The value from the field
+    */
    private static String getStyleProperty(UIComponent component, String field)
    {
       try
@@ -148,6 +214,13 @@
       }
    }
 
+   /**
+    * Cascades on parents, collecting them into list
+    * 
+    * @param component The component to examine
+    * @param styleMaps The list of collected style maps
+    * @return The list of style maps
+    */
    private List<StyleMap> cascadeStyleMap(UIComponent component, List<StyleMap> styleMaps) {
       styleMaps.add(getStyleMap(component));
       if (component.getParent() != null) {
@@ -156,6 +229,13 @@
       return styleMaps;
    }
    
+   /**
+    * Gets the cascaded style map for a component. Recurses on parents, collecting style maps.
+    * The reverses the list and merges the styles
+    * 
+    * @param component The component to examine
+    * @return The merged style map
+    */
    public StyleMap getCascadedStyleMap(UIComponent component) {
       List<StyleMap> styleMaps = cascadeStyleMap(component, new ArrayList<StyleMap>());
       Collections.reverse(styleMaps);
@@ -166,6 +246,11 @@
       return cascadedStyleMap;
    }
    
+   /**
+    * Gets a style map for a component (from cache if available)
+    * @param component The component to examine
+    * @return The style map of the component
+    */
    private StyleMap getStyleMap(UIComponent component)
    {
       if (cellStyleCache.containsKey(component))
@@ -200,6 +285,12 @@
       return styleMap;
    }
 
+   /**
+    * Parses a stringle style string
+    * 
+    * @param styleString The string to parse
+    * @return The parsed StyleMap
+    */
    private StyleMap parseStyleString(String styleString)
    {
       StyleMap styleMap = new StyleMap();
@@ -228,6 +319,12 @@
       return styleMap;
    }
 
+   /**
+    * Utility for trimming (lowercase & trim) an array of string values
+    * 
+    * @param array The array to trim
+    * @return The trimmed array
+    */
    private String[] trimArray(String[] array)
    {
       List<String> validValues = new ArrayList<String>();
@@ -241,6 +338,13 @@
       return validValues.toArray(new String[validValues.size()]);
    }
 
+   /**
+    * Setter for stylesheets. Loads them also.
+    * 
+    * @param stylesheets The stylesheets to load
+    * @throws MalformedURLException If the URL is bad
+    * @throws IOException If the URL cannot be read
+    */
    public void setStylesheets(List<UILink> stylesheets) throws MalformedURLException, IOException
    {
       loadStylesheets(stylesheets);

Modified: trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilder.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilder.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilder.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -1,5 +1,10 @@
 package org.jboss.seam.excel.css;
 
+/**
+ * Interface for parsing a style string array into a stylemap
+ * 
+ * @author karlsnic
+ */
 public interface PropertyBuilder
 {
    public StyleMap parseProperty(String key, String[] values);

Modified: trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/PropertyBuilders.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -4,11 +4,16 @@
 import org.jboss.seam.excel.ExcelWorkbookException;
 import org.jboss.seam.excel.jxl.JXLFactory;
 
+/**
+ * Property builder implementations for parsing css style arrays.
+ * @author karlsnic
+ *
+ */
 public class PropertyBuilders
 {
+   // Wildcard symbol for column widths
    private static final String COLUMN_WIDTH_WILDCARD = "*";
    
-   // "xls-column-widths: 100 200 * 300"
    public static class ColumnWidths implements PropertyBuilder
    {
       public StyleMap parseProperty(String key, String[] values)

Modified: trunk/src/excel/org/jboss/seam/excel/css/StyleMap.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/StyleMap.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/css/StyleMap.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -2,6 +2,11 @@
 
 import java.util.HashMap;
 
+/**
+ * Utility class. Not much here but makes nested Maps look prettier. Contains a key -> value CSS mapping
+ *
+ * @author karlsnic
+ */
 public class StyleMap extends HashMap<String, Object>
 {
 }

Modified: trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/exporter/ExcelExporter.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -51,6 +51,8 @@
    
    // The excel workbook implementation
    private ExcelWorkbook excelWorkbook = null;
+   
+   // A map of known column widths
    private Map<Integer, Integer> columnWidths = new HashMap<Integer, Integer>();
    
 
@@ -124,7 +126,12 @@
       redirectExport();
 
    }
-
+   
+   /**
+    * Parses column widths from a worksheet tag
+    * @param worksheet The worksheet to get the style from
+    * @return The map of column number -> column width
+    */
    private Map<Integer, Integer> parseColumnWidths(UIWorksheet worksheet)
    {
       Map<Integer, Integer> columnWidths = new HashMap<Integer, Integer>();

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/CellInfo.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/CellInfo.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/CellInfo.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -5,6 +5,11 @@
 
 import org.jboss.seam.excel.ui.UICell.CellType;
 
+/**
+ * Cell info that collects features and formats
+ * 
+ * @author karlsnic
+ */
 public class CellInfo
 {
    // Cell format of the cell

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/CellInfoCache.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/CellInfoCache.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/CellInfoCache.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -7,6 +7,11 @@
 
 import org.jboss.seam.excel.ui.UICell.CellType;
 
+/**
+ * A cache for parsed cell info
+ * 
+ * @author karlsnic
+ */
 public class CellInfoCache
 {
    // A cache for cell types, mapped by UIComponent ID

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -27,7 +27,6 @@
 import org.jboss.seam.excel.ExcelWorkbook;
 import org.jboss.seam.excel.ExcelWorkbookException;
 import org.jboss.seam.excel.WorksheetItem;
-import org.jboss.seam.excel.css.ColumnStyle;
 import org.jboss.seam.excel.ui.UICell;
 import org.jboss.seam.excel.ui.UIColumn;
 import org.jboss.seam.excel.ui.UIHyperlink;
@@ -49,7 +48,6 @@
  * 
  * @author Nicklas Karlsson (nickarls at gmail.com)
  * @author Daniel Roth (danielc.roth at gmail.com)
- * @version 0.2
  */
 public class JXLExcelWorkbook implements ExcelWorkbook
 {
@@ -119,7 +117,6 @@
    /**
     * Moves the row pointer to the next row. Used internally when adding data
     * 
-    * @since 0.1
     */
    private void nextRow()
    {
@@ -140,7 +137,6 @@
     * maximum allowed, throws an exception. Resets the styles and row indexes
     * etc.
     * 
-    * @since 0.1
     */
    public void nextColumn()
    {
@@ -198,7 +194,6 @@
     * (row- and column indexes, current styles etc)
     * 
     * @param uiWorksheet The worksheet to create or select in the workbook
-    * @since 0.1
     */
    public void createOrSelectWorksheet(UIWorksheet uiWorksheet)
    {
@@ -244,7 +239,6 @@
     * 
     * @param uiCell The cell to be created and added to the workbook
     * @param the type (header or data) of the cell
-    * @since 0.1
     */
    private void addCell(UICell uiCell)
    {
@@ -346,7 +340,6 @@
     * @param uiWorkbook UIn Workbook to create
     * @throws ExcelWorkbookException if there were any errors creating the
     *            workbook
-    * @since 0.1
     */
    public void createWorkbook(UIWorkbook uiWorkbook)
    {
@@ -405,7 +398,6 @@
     * Gets the document type of the data for the DocumentStore
     * 
     * @return the document type (Excel workbook)
-    * @since 0.1
     */
    public DocumentType getDocumentType()
    {
@@ -416,7 +408,6 @@
     * Applies column settings for the current column
     * 
     * @param uiColumn the UI column to inspect for settings
-    * @since 0.2
     */
    public void applyColumnSettings(UIColumn uiColumn)
    {
@@ -508,7 +499,6 @@
     * Adds an item (cell, image, hyperlink) to add to the worksheet
     * 
     * @param item The item to add
-    * @since 0.2
     */
    public void addItem(WorksheetItem item)
    {
@@ -704,6 +694,11 @@
       startRowIndex++;
    }
 
+   /**
+    * Sets stylesheets for the workbook
+    * 
+    * @param stylesheets The stylesheet to register
+    */
    public void setStylesheets(List<UILink> stylesheets)
    {
       try

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -32,8 +32,14 @@
 import org.jboss.seam.log.Log;
 import org.jboss.seam.log.Logging;
 
+/**
+ * Factory for creating JExcelAPI objects
+ *
+ * @author karlsnic
+ */
 public class JXLFactory
 {
+   // Class names for JExcelAPI objects
    private static final String DATEFORMATS_CLASSNAME = "jxl.write.DateFormats";
    private static final String NUMBERFORMATS_CLASSNAME = "jxl.write.NumberFormats";
    private static final String ALIGNMENT_CLASS_NAME = "jxl.format.Alignment";
@@ -51,38 +57,92 @@
    
    private static final Log log = Logging.getLog(JXLFactory.class);
 
+   /**
+    * Checks if text is a border line style
+    * 
+    * @param text The text to check
+    * @return True if border line style, false otherwise
+    */
    public static boolean isBorderLineStyle(String text) {
       return getValidContants(BORDER_LINE_STYLE_CLASS_NAME).contains(text.toLowerCase());
    }
    
+   /**
+    * Checks if text is a pattern
+    * 
+    * @param text The text to check
+    * @return True if pattern, false otherwise
+    */
    public static boolean isPattern(String text) {
       return getValidContants(PATTERN_CLASS_NAME).contains(text.toLowerCase());
    }
    
+   /**
+    * Checks if text is a color
+    * 
+    * @param text The text to check
+    * @return True if color, false otherwise
+    */
    public static boolean isColor(String text) {
       return getValidContants(COLOR_CLASS_NAME).contains(text.toLowerCase());
    }
 
+   /**
+    * Checks if text is an alignment
+    * 
+    * @param text The text to check
+    * @return True if alignment, false otherwise
+    */
    public static boolean isAlignment(String text) {
       return getValidContants(ALIGNMENT_CLASS_NAME).contains(text.toLowerCase());
    }
 
+   /**
+    * Checks if text is an orientation
+    * 
+    * @param text The text to check
+    * @return True if orientation, false otherwise
+    */
    public static boolean isOrientation(String text) {
       return getValidContants(ORIENTATION_CLASS_NAME).contains(text.toLowerCase());
    }
 
+   /**
+    * Checks if text is an vertical alignment
+    * 
+    * @param text The text to check
+    * @return True if vertical alignment, false otherwise
+    */
    public static boolean isVerticalAlignment(String text) {
       return getValidContants(VERTICAL_ALIGNMENT_CLASS_NAME).contains(text.toLowerCase());
    }
 
+   /**
+    * Checks if text is an underline style
+    * 
+    * @param text The text to check
+    * @return True if underline style, false otherwise
+    */
    public static boolean isUnderlineStyle(String text) {
       return getValidContants(UNDERLINE_STYLE_CLASS_NAME).contains(text.toLowerCase());
    }
 
+   /**
+    * Checks if text is a script style
+    * 
+    * @param text The text to check
+    * @return True if script style, false otherwise
+    */
    public static boolean isScriptStyle(String text) {
       return getValidContants(SCRIPT_STYLE_CLASS_NAME).contains(text.toLowerCase());
    }
 
+   /**
+    * Gets a list of constants from a class
+    * 
+    * @param className The class to examine
+    * @return A list of constants
+    */
    private static List<String> getValidContants(String className) {
       List<String> constants = new ArrayList<String>();
       
@@ -112,6 +172,12 @@
       return constants;
    }
    
+   /**
+    * Gets a suggestion string of available constants from a class.
+    * 
+    * @param className The class to examine
+    * @return The suggestion string
+    */
    public static String getValidConstantsSuggestion(String className)
    {
       List<String> constants = getValidContants(className);
@@ -125,6 +191,13 @@
       return Interpolator.instance().interpolate("[#0]", buffer.toString());
    }   
    
+   /**
+    * Gets a constant from a class
+    * @param className The class name to examine
+    * @param fieldName The field to read
+    * @return The constant
+    * @throws NoSuchFieldException If the field is not available
+    */
    private static Object getConstant(String className, String fieldName) throws NoSuchFieldException
    {
       if (log.isTraceEnabled())
@@ -145,6 +218,14 @@
       }
    }   
    
+   /**
+    * Creates a JExcelAPI representation of an alignment
+    * 
+    * @param alignment The requested alignment
+    * @return The alignment representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/Alignment.html">Alignment</a>
+    */
    public static Alignment createAlignment(String alignment)
    {
       if (log.isTraceEnabled())
@@ -169,7 +250,6 @@
     * @return The script style representation
     * @see <a
     *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/ScriptStyle.html">ScriptStyle</a>
-    * @since 0.1
     */
    private static ScriptStyle createScriptStyle(String scriptStyle)
    {
@@ -195,7 +275,6 @@
     * @return The underline style representation
     * @see <a
     *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/UnderlineStyle.html">UnderlineStyle</a>
-    * @since 0.1
     */
    private static UnderlineStyle createUnderlineStyle(String underlineStyle)
    {
@@ -214,6 +293,14 @@
       }
    }   
  
+   /**
+    * Creates a JExcelAPI representation of a font
+    * 
+    * @param fontspecs The font specifications
+    * @return The font
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/write/WritableFont.html">WritableFont</a>
+    */
    public static FontRecord createFont(CellStyle.Font fontspecs) throws WriteException
    {
       WritableFont font = null;
@@ -248,15 +335,23 @@
       return font;
    }
 
-   public static DisplayFormat createNumberFormat(String mask)
+   /**
+    * Creates a JExcelAPI number display format
+    * 
+    * @param formatMask The format mask
+    * @return The display format
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/write/NumberFormat.html">NumberFormat</a>
+    */
+   public static DisplayFormat createNumberFormat(String formatMask)
    {
       if (log.isTraceEnabled())
       {
-         log.trace("Creating number format for mask #0", mask);
+         log.trace("Creating number format for mask #0", formatMask);
       }
       try
       {
-         return (DisplayFormat) getConstant(NUMBERFORMATS_CLASSNAME, mask);
+         return (DisplayFormat) getConstant(NUMBERFORMATS_CLASSNAME, formatMask);
       }
       catch (NoSuchFieldException e)
       {
@@ -267,6 +362,15 @@
       }
    }
 
+
+   /**
+    * Creates a JExcelAPI date display format
+    * 
+    * @param The format mask
+    * @return The display format
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/write/DateFormat.html">DateFormat</a>
+    */
    public static DisplayFormat createDateFormat(String mask)
    {
       if (log.isTraceEnabled())
@@ -286,6 +390,14 @@
       }
    }
 
+   /**
+    * Creates a JExcelAPI representation of an color
+    * 
+    * @param color The requested color
+    * @return The color representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/Color.html">Color</a>
+    */
    public static Colour createColor(String color)
    {
       if (log.isTraceEnabled())
@@ -309,6 +421,14 @@
       }
    }
 
+   /**
+    * Creates a JExcelAPI representation of an orientation
+    * 
+    * @param orientation The requested orientation
+    * @return The orientation representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/Orientation.html">Orientation</a>
+    */
    public static Orientation createOrientation(String orientation)
    {
       if (log.isTraceEnabled())
@@ -326,6 +446,14 @@
       }
    }
 
+   /**
+    * Creates a JExcelAPI representation of a vertical alignment
+    * 
+    * @param color The requested alignment
+    * @return The alignment representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/VerticalAlignment.html">VerticalAlignment</a>
+    */
    public static VerticalAlignment createVerticalAlignment(String verticalAlignment)
    {
       if (log.isTraceEnabled())
@@ -343,6 +471,14 @@
       }
    }
 
+   /**
+    * Creates a JExcelAPI representation of a border
+    * 
+    * @param border The requested border
+    * @return border representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/Border.html">Border</a>
+    */
    public static Border createBorder(String border)
    {
       if (log.isTraceEnabled())
@@ -360,23 +496,39 @@
       }
    }
 
-   public static BorderLineStyle createLineStyle(String string)
+   /**
+    * Creates a JExcelAPI representation of a border line style
+    * 
+    * @param borderLineStyle The requested border line style
+    * @return The border line style representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/BorderLineStyle.html">BorderLineStyle</a>
+    */
+   public static BorderLineStyle createLineStyle(String borderLineStyle)
    {
       if (log.isTraceEnabled())
       {
-         log.trace("Creating border line style for #0", string);
+         log.trace("Creating border line style for #0", borderLineStyle);
       }
       try
       {
-         return string == null ? BorderLineStyle.NONE : (BorderLineStyle) getConstant(BORDER_LINE_STYLE_CLASS_NAME, string.toUpperCase());
+         return borderLineStyle == null ? BorderLineStyle.NONE : (BorderLineStyle) getConstant(BORDER_LINE_STYLE_CLASS_NAME, borderLineStyle.toUpperCase());
       }
       catch (NoSuchFieldException e)
       {
-         String message = Interpolator.instance().interpolate("Border line style {0} not supported, try {1}", string, getValidConstantsSuggestion(BORDER_LINE_STYLE_CLASS_NAME));
+         String message = Interpolator.instance().interpolate("Border line style {0} not supported, try {1}", borderLineStyle, getValidConstantsSuggestion(BORDER_LINE_STYLE_CLASS_NAME));
          throw new ExcelWorkbookException(message, e);
       }
    }
 
+   /**
+    * Creates a JExcelAPI representation of a pattern
+    * 
+    * @param pattern The requested pattern
+    * @return The pattern representation
+    * @see <a
+    *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/format/Pattern.html">Pattern</a>
+    */
    public static Pattern createPattern(String pattern)
    {
       if (log.isTraceEnabled())

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -52,14 +52,30 @@
 import org.jboss.seam.log.Log;
 import org.jboss.seam.log.Logging;
 
+/**
+ * A helper class for the JXLExcelWorkbook, caches cell info and holds CSS parser
+ * 
+ * @author Nicklas Karlsson (nickarls at gmail.com)
+ *
+ */
 public class JXLHelper
 {
 
    private static Log log = Logging.getLog(JXLHelper.class);
 
+   // The CSS parser
    private Parser parser = new Parser();
+   
+   // A cache of cell info
    private CellInfoCache cellInfoCache = new CellInfoCache();
       
+   /**
+    * Creates a cell format
+    * 
+    * @param uiCell The cell to model
+    * @return The cell format
+    * @throws WriteException if the creation failed
+    */
    public WritableCellFormat createCellFormat(UICell uiCell) throws WriteException
    {
       WritableCellFormat cellFormat = null;
@@ -216,11 +232,24 @@
       return cellFormat;
    }
 
+   /**
+    * Sets the stylesheets for the parser
+    * 
+    * @param stylesheets The stylesheets to set
+    * @throws MalformedURLException If the URL was bad
+    * @throws IOException If the URL could not be read
+    */
    public void setStylesheets(List<UILink> stylesheets) throws MalformedURLException, IOException
    {
       parser.setStylesheets(stylesheets);
    }
 
+   /**
+    * Applied worksheet settings 
+    * 
+    * @param worksheet The worksheet to apply the settings to
+    * @param uiWorksheet The settings to set
+    */
    protected void applyWorksheetSettings(WritableSheet worksheet, UIWorksheet uiWorksheet)
    {
       SheetSettings settings = worksheet.getSettings();
@@ -555,6 +584,12 @@
       cellFeatures.setDataValidationRange(validation.getStartColumn(), validation.getStartRow(), validation.getEndColumn(), validation.getEndRow());
    }
 
+   /**
+    * Adds numeric validation to a cell
+    * 
+    * @param cellFeatures Features to add validation to
+    * @param validation Validation to add
+    */
    private static void addNumericValidation(WritableCellFeatures cellFeatures, UINumericValidation validation)
    {
       if (validation.getValue() == null)
@@ -602,7 +637,6 @@
     * @return The prepared cell representation
     * @see <a
     *      href="http://jexcelapi.sourceforge.net/resources/javadocs/2_6/docs/jxl/write/WritableCell.html">WritableCell</a>
-    * @since 0.1
     */
    public static WritableCell createCell(int column, int row, CellType type, Object data, WritableCellFormat cellFormat)
    {

Modified: trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java	2008-09-10 20:41:17 UTC (rev 8930)
+++ trunk/src/excel/org/jboss/seam/excel/ui/ExcelComponent.java	2008-09-10 21:31:57 UTC (rev 8931)
@@ -22,7 +22,6 @@
  * 
  * @author Nicklas Karlsson (nickarls at gmail.com)
  * @author Daniel Roth (danielc.roth at gmail.com)
- * @version 0.2
  */
 public abstract class ExcelComponent extends UIComponentBase
 {
@@ -147,6 +146,13 @@
       }
    }
 
+   /**
+    * Gets a parent of a certain class
+    * 
+    * @param root The root where to start searching
+    * @param searchClass The class to search for
+    * @return The parent, if found.
+    */
    @SuppressWarnings("unchecked")
    protected UIComponent getParentByClass(UIComponent root, Class searchClass)
    {




More information about the seam-commits mailing list