net.sf.jett.tag
Class StyleTag

java.lang.Object
  extended by net.sf.jett.tag.BaseTag
      extended by net.sf.jett.tag.StyleTag
All Implemented Interfaces:
Tag

public class StyleTag
extends BaseTag

A StyleTag represents a dynamically determined style for a Cell. A StyleTag must have a body.

The style attribute works like the HTML "style" attribute, in that one can specify one or more style elements in a property: value; property: value style. If a property is specified, then it will override whatever value is already present in the Cell. If a property value is an empty string or the property is not present, then it will be ignored and it will not override whatever value is already present in the Cell. Unrecognized property names and unrecognized values for a property are ignored and do not override whatever value is already present in the Cell. Property names and values may be specified in a case insensitive-fashion, i.e. "CENTER" = "Center" = "center"..

The class attributes works like the HTML "class" attribute, in that one can specify one or more CSS-like style "classes" in a semicolon-delimited list. Register CSS-like files and/or CSS-like text with the ExcelTransformer prior to transformation. Subsequent class names override previous class names, and the style attribute overrides the class attribute.


Attributes:

For supported property names and values (plus explanations), please see TagParser.

Since:
0.4.0
Author:
Randy Gettman
See Also:
ExcelTransformer

Field Summary
static java.lang.String ATTR_CLASS
          Attribute that specifies the desired pre-defined style class to apply to the current Cell.
static java.lang.String ATTR_STYLE
          Attribute that specifies the desired style property(ies) to change in the current Cell.
 
Fields inherited from class net.sf.jett.tag.BaseTag
ATTR_ON_PROCESSED, SPEC_SEP
 
Constructor Summary
StyleTag()
           
 
Method Summary
 java.lang.String getName()
          Returns this Tag's name.
protected  java.util.List<java.lang.String> getOptionalAttributes()
          Returns a List of optional attribute names.
protected  java.util.List<java.lang.String> getRequiredAttributes()
          Returns a List of required attribute names.
 boolean process()
          Override the cells' current styles with any non-null style property values.
 void validateAttributes()
          Validates the attributes for this Tag.
 
Methods inherited from class net.sf.jett.tag.BaseTag
checkAttributes, clearBlock, deleteBlock, getAttributes, getContext, getWorkbookContext, isBodiless, processTag, removeBlock, setAttributes, setBodiless, setContext, setWorkbookContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_STYLE

public static final java.lang.String ATTR_STYLE
Attribute that specifies the desired style property(ies) to change in the current Cell. Properties are specified in a string with the following format: property1: value1; property2: value2; ...

See Also:
Constant Field Values

ATTR_CLASS

public static final java.lang.String ATTR_CLASS
Attribute that specifies the desired pre-defined style class to apply to the current Cell. Pre-defined styles are defined by registering styles with the ExcelTransformer prior to transformation.

Since:
0.5.0
See Also:
ExcelTransformer.addCssFile(String), ExcelTransformer.addCssText(String), Constant Field Values
Constructor Detail

StyleTag

public StyleTag()
Method Detail

getName

public java.lang.String getName()
Returns this Tag's name.

Returns:
This Tag's name.

getRequiredAttributes

protected java.util.List<java.lang.String> getRequiredAttributes()
Returns a List of required attribute names.

Overrides:
getRequiredAttributes in class BaseTag
Returns:
A List of required attribute names.

getOptionalAttributes

protected java.util.List<java.lang.String> getOptionalAttributes()
Returns a List of optional attribute names.

Overrides:
getOptionalAttributes in class BaseTag
Returns:
A List of optional attribute names.

validateAttributes

public void validateAttributes()
                        throws TagParseException
Validates the attributes for this Tag. This tag must have a body.

Overrides:
validateAttributes in class BaseTag
Throws:
TagParseException - If the attribute values are illegal or unacceptable.

process

public boolean process()

Override the cells' current styles with any non-null style property values.

Specified by:
process in class BaseTag
Returns:
Whether the first Cell in the Block associated with this Tag was processed.


Copyright © 2012-2013 Jett Team. All Rights Reserved.