[seam-commits] Seam SVN: r13509 - in sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet: jsf and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 26 05:59:37 EDT 2010


Author: nickarls
Date: 2010-07-26 05:59:37 -0400 (Mon, 26 Jul 2010)
New Revision: 13509

Modified:
   sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/CSSNames.java
   sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/PropertyBuilders.java
   sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/StyleMap.java
   sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/CellFormatFactory.java
   sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/ComponentStyle.java
Log:
more CSS parsing

Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/CSSNames.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/CSSNames.java	2010-07-26 09:39:06 UTC (rev 13508)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/CSSNames.java	2010-07-26 09:59:37 UTC (rev 13509)
@@ -2,7 +2,7 @@
 
 public class CSSNames
 {
-   public static final String FONT_FAMILY = "xls-font-family";
+   public static final String FONT_NAME = "xls-font-name";
    public static final String FONT_SIZE = "xls-font-size";
    public static final String FONT_COLOR = "xls-font-color";
    public static final String FONT_ITALIC = "xls-font-italic";
@@ -35,14 +35,14 @@
    public static final String BORDER = "xls-border";
 
    public static final String ALIGNMENT = "xls-alignment";
-   public static final String FORMAT_MASK = "xls-format-mask";
+   public static final String MASK = "xls-mask";
    public static final String INDENTATION = "xls-indentation";
    public static final String LOCKED = "xls-locked";
    public static final String ORIENTATION = "xls-orientation";
    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 TYPE = "xls-type";
 
    public static final String COLUMN_WIDTH = "xls-column-width";
    public static final String COLUMN_WIDTHS = "xls-column-widths";

Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/PropertyBuilders.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/PropertyBuilders.java	2010-07-26 09:39:06 UTC (rev 13508)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/PropertyBuilders.java	2010-07-26 09:59:37 UTC (rev 13509)
@@ -17,7 +17,7 @@
    public static Map<String, PropertyBuilder> getPropertyBuilders()
    {
       Map<String, PropertyBuilder> propertyBuilders = new HashMap<String, PropertyBuilder>();
-      propertyBuilders.put(CSSNames.FONT_FAMILY, new PropertyBuilders.FontFamily());
+      propertyBuilders.put(CSSNames.FONT_NAME, new PropertyBuilders.FontFamily());
       propertyBuilders.put(CSSNames.FONT_SIZE, new PropertyBuilders.FontSize());
       propertyBuilders.put(CSSNames.FONT_COLOR, new PropertyBuilders.FontColor());
       propertyBuilders.put(CSSNames.FONT_ITALIC, new PropertyBuilders.FontItalic());
@@ -42,7 +42,7 @@
       propertyBuilders.put(CSSNames.BORDER_BOTTOM_LINE_STYLE, new PropertyBuilders.BorderBottomLineStyle());
       propertyBuilders.put(CSSNames.BORDER_BOTTOM, new PropertyBuilders.BorderBottomShorthand());
       propertyBuilders.put(CSSNames.BORDER, new PropertyBuilders.BorderShorthand());
-      propertyBuilders.put(CSSNames.FORMAT_MASK, new PropertyBuilders.FormatMask());
+      propertyBuilders.put(CSSNames.MASK, new PropertyBuilders.Mask());
       propertyBuilders.put(CSSNames.ALIGNMENT, new PropertyBuilders.Alignment());
       propertyBuilders.put(CSSNames.INDENTATION, new PropertyBuilders.Indentation());
       propertyBuilders.put(CSSNames.ORIENTATION, new PropertyBuilders.Orientation());
@@ -55,11 +55,11 @@
       propertyBuilders.put(CSSNames.COLUMN_HIDDEN, new PropertyBuilders.ColumnHidden());
       propertyBuilders.put(CSSNames.COLUMN_EXPORT, new PropertyBuilders.ColumnExport());
       propertyBuilders.put(CSSNames.COLUMN_WIDTHS, new PropertyBuilders.ColumnWidths());
-      propertyBuilders.put(CSSNames.FORCE_TYPE, new PropertyBuilders.ForceType());
+      propertyBuilders.put(CSSNames.TYPE, new PropertyBuilders.Type());
       return propertyBuilders;
    }
 
-   public static class ForceType extends StringPropertyBuilder
+   public static class Type extends StringPropertyBuilder
    {
    }
 
@@ -369,7 +369,7 @@
          if (firstQuote > 0 && lastQuote > 0 && firstQuote != lastQuote)
          {
             String fontName = valueString.substring(firstQuote, lastQuote);
-            styleMap.put(CSSNames.FONT_FAMILY, fontName);
+            styleMap.put(CSSNames.FONT_NAME, fontName);
             String pre = valueString.substring(0, firstQuote - 1).trim();
             String post = valueString.substring(lastQuote + 1).trim();
             valueString = pre + post;
@@ -409,7 +409,7 @@
             }
             else
             {
-               styleMap.put(CSSNames.FONT_FAMILY, value);
+               styleMap.put(CSSNames.FONT_NAME, value);
             }
          }
 
@@ -463,7 +463,7 @@
    {
    }
 
-   public static class FormatMask extends MergingStringPropertyBuilder
+   public static class Mask extends MergingStringPropertyBuilder
    {
    }
 

Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/StyleMap.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/StyleMap.java	2010-07-26 09:39:06 UTC (rev 13508)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/css/StyleMap.java	2010-07-26 09:59:37 UTC (rev 13509)
@@ -5,4 +5,327 @@
 public class StyleMap extends HashMap<String, Object>
 {
    private static final long serialVersionUID = 1L;
+
+   public boolean hasAlignment()
+   {
+      return super.containsKey(CSSNames.ALIGNMENT);
+   }
+
+   private boolean containsAnyOf(String[] keys)
+   {
+      for (String key : keys)
+      {
+         if (super.containsKey(key))
+         {
+            return true;
+         }
+      }
+      return false;
+   }
+
+   public boolean hasBackground()
+   {
+      return containsAnyOf(new String[] { CSSNames.BACKGROUND, CSSNames.BACKGROUND_COLOR, CSSNames.BACKGROUND_PATTERN });
+   }
+
+   public boolean hasBackgroundColour()
+   {
+      return super.containsKey(CSSNames.BACKGROUND_COLOR);
+   }
+
+   public boolean hasBackgroundPattern()
+   {
+      return super.containsKey(CSSNames.BACKGROUND_PATTERN);
+   }
+
+   public boolean hasIndentation()
+   {
+      return super.containsKey(CSSNames.INDENTATION);
+   }
+
+   public boolean hasLocked()
+   {
+      return super.containsKey(CSSNames.LOCKED);
+   }
+
+   public boolean hasMask()
+   {
+      return super.containsKey(CSSNames.MASK);
+   }
+
+   public boolean hasOrientation()
+   {
+      return super.containsKey(CSSNames.ORIENTATION);
+   }
+
+   public boolean hasShrinkToFit()
+   {
+      return super.containsKey(CSSNames.SHRINK_TO_FIT);
+   }
+
+   public boolean hasType()
+   {
+      return super.containsKey(CSSNames.TYPE);
+   }
+
+   public boolean hasVerticalAlignment()
+   {
+      return super.containsKey(CSSNames.VERICAL_ALIGNMENT);
+   }
+
+   public boolean hasWrap()
+   {
+      return super.containsKey(CSSNames.WRAP);
+   }
+
+   public boolean hasFont()
+   {
+      return containsAnyOf(new String[] { CSSNames.FONT, CSSNames.FONT_BOLD, CSSNames.FONT_COLOR, CSSNames.FONT_NAME, CSSNames.FONT_ITALIC, CSSNames.FONT_SCRIPT_STYLE, CSSNames.FONT_SIZE, CSSNames.FONT_STRUCK_OUT, CSSNames.FONT_UNDERLINE_STYLE });
+   }
+
+   public boolean hasFontBold()
+   {
+      return super.containsKey(CSSNames.FONT_BOLD);
+   }
+
+   public boolean hasFontColour()
+   {
+      return super.containsKey(CSSNames.FONT_COLOR);
+   }
+
+   public boolean hasFontName()
+   {
+      return super.containsKey(CSSNames.FONT_NAME);
+   }
+
+   public boolean hasFontItalic()
+   {
+      return super.containsKey(CSSNames.FONT_ITALIC);
+   }
+
+   public boolean hasFontPointSize()
+   {
+      return super.containsKey(CSSNames.FONT_SIZE);
+   }
+
+   private String getString(String key)
+   {
+      return (String) super.get(key);
+   }
+
+   public String getAlignment()
+   {
+      return getString(CSSNames.ALIGNMENT);
+   }
+
+   public String getBackgroundPattern()
+   {
+      return getString(CSSNames.BACKGROUND_PATTERN);
+   }
+
+   public String getBackgroundColour()
+   {
+      return getString(CSSNames.BACKGROUND_COLOR);
+   }
+
+   public Boolean getFontBold()
+   {
+      return Boolean.parseBoolean(getString(CSSNames.FONT_BOLD));
+   }
+
+   public String getFontName()
+   {
+      return getString(CSSNames.FONT_NAME);
+   }
+
+   public boolean getFontItalic()
+   {
+      return Boolean.parseBoolean(getString(CSSNames.FONT_ITALIC));
+   }
+
+   public int getFontPointSize()
+   {
+      return Integer.parseInt(getString(CSSNames.FONT_SIZE));
+   }
+
+   public String getFontColour()
+   {
+      return getString(CSSNames.FONT_COLOR);
+   }
+
+   public Integer getIndentation()
+   {
+      return Integer.parseInt(getString(CSSNames.INDENTATION));
+   }
+
+   public Boolean getLocked()
+   {
+      return Boolean.parseBoolean(getString(CSSNames.LOCKED));
+   }
+
+   public String getMask()
+   {
+      return getString(CSSNames.MASK);
+   }
+
+   public String getOrientation()
+   {
+      return getString(CSSNames.ORIENTATION);
+   }
+
+   public Boolean getShrinkToFit()
+   {
+      return Boolean.parseBoolean(getString(CSSNames.SHRINK_TO_FIT));
+   }
+
+   public String getType()
+   {
+      return getString(CSSNames.TYPE);
+   }
+
+   public String getVerticalAlignment()
+   {
+      return getString(CSSNames.VERICAL_ALIGNMENT);
+   }
+
+   public Boolean getWrap()
+   {
+      return Boolean.parseBoolean(getString(CSSNames.WRAP));
+   }
+
+   public boolean hasFontScriptStyle()
+   {
+      return super.containsKey(CSSNames.FONT_SCRIPT_STYLE);
+   }
+
+   public String getFontScriptStyle()
+   {
+      return getString(CSSNames.FONT_SCRIPT_STYLE);
+   }
+
+   public boolean hasFontStruckOut()
+   {
+      return super.containsKey(CSSNames.FONT_STRUCK_OUT);
+   }
+
+   public boolean getFontStruckOut()
+   {
+      return Boolean.parseBoolean(getString(CSSNames.FONT_STRUCK_OUT));
+   }
+
+   public boolean hasFontUnderlineStyle()
+   {
+      return super.containsKey(CSSNames.FONT_UNDERLINE_STYLE);
+   }
+
+   public String getFontUnderlineStyle()
+   {
+      return getString(CSSNames.FONT_UNDERLINE_STYLE);
+   }
+
+   public boolean hasBorders()
+   {
+      return containsAnyOf(new String[] { CSSNames.BORDER, CSSNames.BORDER_BOTTOM, CSSNames.BORDER_BOTTOM_COLOR, CSSNames.BORDER_BOTTOM_LINE_STYLE, CSSNames.BORDER_LEFT, CSSNames.BORDER_LEFT_COLOR, CSSNames.BORDER_LEFT_LINE_STYLE, CSSNames.BORDER_RIGHT, CSSNames.BORDER_RIGHT_COLOR, CSSNames.BORDER_RIGHT_LINE_STYLE, CSSNames.BORDER_TOP, CSSNames.BORDER_TOP_COLOR, CSSNames.BORDER_TOP_LINE_STYLE });
+   }
+
+   public boolean hasTopBorder()
+   {
+      return containsAnyOf(new String[] { CSSNames.BORDER_TOP, CSSNames.BORDER_TOP_COLOR, CSSNames.BORDER_TOP_LINE_STYLE });
+   }
+
+   public boolean hasBottomBorder()
+   {
+      return containsAnyOf(new String[] { CSSNames.BORDER_TOP, CSSNames.BORDER_BOTTOM_COLOR, CSSNames.BORDER_BOTTOM_LINE_STYLE });
+   }
+
+   public boolean hasRightBorder()
+   {
+      return containsAnyOf(new String[] { CSSNames.BORDER_RIGHT, CSSNames.BORDER_RIGHT_COLOR, CSSNames.BORDER_RIGHT_LINE_STYLE });
+   }
+
+   public boolean hasLeftBorder()
+   {
+      return containsAnyOf(new String[] { CSSNames.BORDER_LEFT, CSSNames.BORDER_LEFT_COLOR, CSSNames.BORDER_LEFT_LINE_STYLE });
+   }
+
+   public boolean hasBorderTopColour()
+   {
+      return super.containsKey(CSSNames.BORDER_TOP_COLOR);
+   }
+
+   public String getBorderTopColour()
+   {
+      return getString(CSSNames.BORDER_TOP_COLOR);
+   }
+
+   public boolean hasBorderTopLineStyle()
+   {
+      return super.containsKey(CSSNames.BORDER_TOP_LINE_STYLE);
+   }
+
+   public String getBorderTopLineStyle()
+   {
+      return getString(CSSNames.BORDER_TOP_LINE_STYLE);
+   }
+
+   public boolean hasBorderLeftColour()
+   {
+      return super.containsKey(CSSNames.BORDER_LEFT_COLOR);
+   }
+
+   public String getBorderLeftColour()
+   {
+      return getString(CSSNames.BORDER_LEFT_COLOR);
+   }
+
+   public boolean hasBorderLeftLineStyle()
+   {
+      return super.containsKey(CSSNames.BORDER_LEFT_LINE_STYLE);
+   }
+
+   public String getBorderLeftLineStyle()
+   {
+      return getString(CSSNames.BORDER_LEFT_LINE_STYLE);
+   }
+
+   public boolean hasBorderBottomColour()
+   {
+      return super.containsKey(CSSNames.BORDER_BOTTOM_COLOR);
+   }
+
+   public String getBorderBottomColour()
+   {
+      return getString(CSSNames.BORDER_BOTTOM_COLOR);
+   }
+
+   public boolean hasBorderBottomLineStyle()
+   {
+      return super.containsKey(CSSNames.BORDER_BOTTOM_LINE_STYLE);
+   }
+
+   public String getBorderBottomLineStyle()
+   {
+      return getString(CSSNames.BORDER_BOTTOM_LINE_STYLE);
+   }
+
+   public boolean hasBorderRightColour()
+   {
+      return super.containsKey(CSSNames.BORDER_RIGHT_COLOR);
+   }
+
+   public String getBorderRightColour()
+   {
+      return getString(CSSNames.BORDER_RIGHT_COLOR);
+   }
+
+   public boolean hasBorderRightLineStyle()
+   {
+      return super.containsKey(CSSNames.BORDER_RIGHT_LINE_STYLE);
+   }
+
+   public String getBorderRightLineStyle()
+   {
+      return getString(CSSNames.BORDER_RIGHT_LINE_STYLE);
+   }
+
 }

Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/CellFormatFactory.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/CellFormatFactory.java	2010-07-26 09:39:06 UTC (rev 13508)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/CellFormatFactory.java	2010-07-26 09:59:37 UTC (rev 13509)
@@ -1,15 +1,303 @@
 package org.jboss.seam.spreadsheet.jsf;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.seam.spreadsheet.SpreadsheetException;
 import org.jboss.seam.spreadsheet.css.StyleMap;
+import org.jboss.seam.spreadsheet.model.formatting.Background;
+import org.jboss.seam.spreadsheet.model.formatting.Background.Pattern;
+import org.jboss.seam.spreadsheet.model.formatting.Border;
+import org.jboss.seam.spreadsheet.model.formatting.Border.BorderLineStyle;
+import org.jboss.seam.spreadsheet.model.formatting.Border.BorderType;
 import org.jboss.seam.spreadsheet.model.formatting.CellFormat;
+import org.jboss.seam.spreadsheet.model.formatting.CellFormat.Alignment;
+import org.jboss.seam.spreadsheet.model.formatting.CellFormat.Orientation;
+import org.jboss.seam.spreadsheet.model.formatting.CellFormat.Type;
+import org.jboss.seam.spreadsheet.model.formatting.CellFormat.VerticalAlignment;
+import org.jboss.seam.spreadsheet.model.formatting.Colour;
+import org.jboss.seam.spreadsheet.model.formatting.Font;
+import org.jboss.seam.spreadsheet.model.formatting.Font.ScriptStyle;
+import org.jboss.seam.spreadsheet.model.formatting.Font.UnderlineStyle;
 
 public class CellFormatFactory
 {
 
-   public static CellFormat getCellFormat(StyleMap styleMap)
+   public static CellFormat createCellFormat(StyleMap styleMap)
    {
       CellFormat cellFormat = new CellFormat();
+      if (styleMap.hasAlignment())
+      {
+         cellFormat.setAlignment(createAlignment(styleMap));
+      }
+      if (styleMap.hasBackground())
+      {
+         cellFormat.setBackground(createBackground(styleMap));
+      }
+      if (styleMap.hasBorders())
+      {
+         cellFormat.setBorders(createBorders(styleMap));
+      }
+      if (styleMap.hasFont())
+      {
+         cellFormat.setFont(createFont(styleMap));
+      }
+      if (styleMap.hasIndentation())
+      {
+         cellFormat.setIndentation(createIndentation(styleMap));
+      }
+      if (styleMap.hasLocked())
+      {
+         cellFormat.setLocked(createLocked(styleMap));
+      }
+      if (styleMap.hasMask())
+      {
+         cellFormat.setMask(createMask(styleMap));
+      }
+      if (styleMap.hasOrientation())
+      {
+         cellFormat.setOrientation(createOrientation(styleMap));
+      }
+      if (styleMap.hasShrinkToFit())
+      {
+         cellFormat.setShrinkToFit(createShrinkToFit(styleMap));
+      }
+      if (styleMap.hasType())
+      {
+         cellFormat.setType(createType(styleMap));
+      }
+      if (styleMap.hasVerticalAlignment())
+      {
+         cellFormat.setVerticalAlignment(createVerticalAlignment(styleMap));
+      }
+      if (styleMap.hasWrap())
+      {
+         cellFormat.setWrap(createWrap(styleMap));
+      }
       return cellFormat;
    }
 
+   private static <T extends Enum<T>> T createEnum(Class<T> clazz, String value)
+   {
+      try
+      {
+         return Enum.valueOf(clazz, value);
+      }
+      catch (IllegalArgumentException e)
+      {
+         throw new SpreadsheetException(String.format("Could not create enum %s of %s", clazz, value));
+      }
+   }
+
+   private static Alignment createAlignment(StyleMap styleMap)
+   {
+      return createEnum(Alignment.class, styleMap.getAlignment());
+   }
+
+   private static Background createBackground(StyleMap styleMap)
+   {
+      Background background = new Background();
+      if (styleMap.hasBackgroundColour())
+      {
+         background.setColour(createBackgroundColour(styleMap));
+      }
+      if (styleMap.hasBackgroundPattern())
+      {
+         background.setPattern(createBackgroundPattern(styleMap));
+      }
+      return background;
+   }
+
+   private static Pattern createBackgroundPattern(StyleMap styleMap)
+   {
+      return createEnum(Pattern.class, styleMap.getBackgroundPattern());
+   }
+
+   private static Colour createBackgroundColour(StyleMap styleMap)
+   {
+      return createColour(styleMap.getBackgroundColour());
+   }
+
+   private static Colour createColour(String colour)
+   {
+      return createEnum(Colour.class, colour);
+   }
+
+   private static List<Border> createBorders(StyleMap styleMap)
+   {
+      List<Border> borders = new ArrayList<Border>();
+      if (styleMap.hasTopBorder())
+      {
+         borders.add(createTopBorder(styleMap));
+      }
+      if (styleMap.hasBottomBorder())
+      {
+         borders.add(createBottomBorder(styleMap));
+      }
+      if (styleMap.hasLeftBorder())
+      {
+         borders.add(createLeftBorder(styleMap));
+      }
+      if (styleMap.hasRightBorder())
+      {
+         borders.add(createRightBorder(styleMap));
+      }
+
+      return borders;
+   }
+
+   private static Border createTopBorder(StyleMap styleMap)
+   {
+      Border border = new Border(BorderType.TOP);
+      if (styleMap.hasBorderTopColour())
+      {
+         border.setColour(createColour(styleMap.getBorderTopColour()));
+      }
+      if (styleMap.hasBorderTopLineStyle())
+      {
+         border.setLineStyle(createLineStyle(styleMap.getBorderTopLineStyle()));
+      }
+      return border;
+   }
+
+   private static Border createBottomBorder(StyleMap styleMap)
+   {
+      Border border = new Border(BorderType.BOTTOM);
+      if (styleMap.hasBorderBottomColour())
+      {
+         border.setColour(createColour(styleMap.getBorderBottomColour()));
+      }
+      if (styleMap.hasBorderBottomLineStyle())
+      {
+         border.setLineStyle(createLineStyle(styleMap.getBorderBottomLineStyle()));
+      }
+      return border;
+   }
+
+   private static Border createLeftBorder(StyleMap styleMap)
+   {
+      Border border = new Border(BorderType.LEFT);
+      if (styleMap.hasBorderLeftColour())
+      {
+         border.setColour(createColour(styleMap.getBorderLeftColour()));
+      }
+      if (styleMap.hasBorderLeftLineStyle())
+      {
+         border.setLineStyle(createLineStyle(styleMap.getBorderLeftLineStyle()));
+      }
+      return border;
+   }
+
+   private static Border createRightBorder(StyleMap styleMap)
+   {
+      Border border = new Border(BorderType.RIGHT);
+      if (styleMap.hasBorderRightColour())
+      {
+         border.setColour(createColour(styleMap.getBorderRightColour()));
+      }
+      if (styleMap.hasBorderRightLineStyle())
+      {
+         border.setLineStyle(createLineStyle(styleMap.getBorderRightLineStyle()));
+      }
+      return border;
+   }
+
+   private static BorderLineStyle createLineStyle(String lineStyle)
+   {
+      return createEnum(BorderLineStyle.class, lineStyle);
+   }
+
+   private static Font createFont(StyleMap styleMap)
+   {
+      Font font = new Font();
+      if (styleMap.hasFontBold())
+      {
+         font.setBold(styleMap.getFontBold());
+      }
+      if (styleMap.hasFontColour())
+      {
+         font.setColour(createFontColour(styleMap));
+      }
+      if (styleMap.hasFontName())
+      {
+         font.setFontName(styleMap.getFontName());
+      }
+      if (styleMap.hasFontItalic())
+      {
+         font.setItalic(styleMap.getFontItalic());
+      }
+      if (styleMap.hasFontPointSize())
+      {
+         font.setPointSize(styleMap.getFontPointSize());
+      }
+      if (styleMap.hasFontScriptStyle())
+      {
+         font.setScriptStyle(createFontScriptStyle(styleMap.getFontScriptStyle()));
+      }
+      if (styleMap.hasFontStruckOut())
+      {
+         font.setStruckOut(styleMap.getFontStruckOut());
+      }
+      if (styleMap.hasFontUnderlineStyle())
+      {
+         font.setUnderlineStyle(createFontUnderlineStyle(styleMap.getFontUnderlineStyle()));
+      }
+      return font;
+   }
+
+   private static UnderlineStyle createFontUnderlineStyle(String underlineStyle)
+   {
+      return createEnum(UnderlineStyle.class, underlineStyle);
+   }
+
+   private static ScriptStyle createFontScriptStyle(String scriptStyle)
+   {
+      return createEnum(ScriptStyle.class, scriptStyle);
+   }
+
+   private static Colour createFontColour(StyleMap styleMap)
+   {
+      return createColour(styleMap.getFontColour());
+   }
+
+   private static Integer createIndentation(StyleMap styleMap)
+   {
+      return styleMap.getIndentation();
+   }
+
+   private static Boolean createLocked(StyleMap styleMap)
+   {
+      return styleMap.getLocked();
+   }
+
+   private static String createMask(StyleMap styleMap)
+   {
+      return styleMap.getMask();
+   }
+
+   private static Orientation createOrientation(StyleMap styleMap)
+   {
+      return createEnum(Orientation.class, styleMap.getOrientation());
+   }
+
+   private static Boolean createShrinkToFit(StyleMap styleMap)
+   {
+      return styleMap.getShrinkToFit();
+   }
+
+   private static Type createType(StyleMap styleMap)
+   {
+      return createEnum(Type.class, styleMap.getType());
+   }
+
+   private static VerticalAlignment createVerticalAlignment(StyleMap styleMap)
+   {
+      return createEnum(VerticalAlignment.class, styleMap.getVerticalAlignment());
+   }
+
+   private static Boolean createWrap(StyleMap styleMap)
+   {
+      return styleMap.getWrap();
+   }
+
 }

Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/ComponentStyle.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/ComponentStyle.java	2010-07-26 09:39:06 UTC (rev 13508)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jsf/ComponentStyle.java	2010-07-26 09:59:37 UTC (rev 13509)
@@ -54,7 +54,7 @@
       List<CellFormat> cellFormats = new ArrayList<CellFormat>();
       for (StyleMap styleMap : styleMaps)
       {
-         cellFormats.add(CellFormatFactory.getCellFormat(styleMap));
+         cellFormats.add(CellFormatFactory.createCellFormat(styleMap));
       }
       return cellFormats;
    }



More information about the seam-commits mailing list