net.sf.jett.tag
Class FormulaTag

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

public class FormulaTag
extends BaseTag

A FormulaTag represents a dynamically generated Excel Formula. The text attribute contains formula text that may contain Expressions that are dynamically evaluated. JETT does not verify that the dynamically generated expression is a valid Excel Formula. A FormulaTag must be bodiless.


Attributes:

Either "text" or "bean" must be specified, but not both.

Since:
0.4.0
Author:
Randy Gettman

Field Summary
static java.lang.String ATTR_BEAN
          Attribute that specifies the bean name that contains the Expression string to be evaluated by JETT that results in formula creation in the cell.
static java.lang.String ATTR_IF_ERROR
          Attribute that specifies the Expression string to be evaluated by JETT to be used as alternative text in case an Excel error results.
static java.lang.String ATTR_TEXT
          Attribute that specifies the Expression string to be evaluated by JETT that results in formula creation in the cell.
 
Fields inherited from class net.sf.jett.tag.BaseTag
ATTR_ON_PROCESSED, SPEC_SEP
 
Constructor Summary
FormulaTag()
           
 
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()
          Evaluate the "text" attribute, and place the resultant text in an Excel Formula.
 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_BEAN

public static final java.lang.String ATTR_BEAN
Attribute that specifies the bean name that contains the Expression string to be evaluated by JETT that results in formula creation in the cell. I.e. bean="beanName" => "${beanName}" => "formula". Then the value is used as the formula expression, i.e. formula => "${wins} + ${losses}" => "A2 + B2", which is used as the formula text. Either "bean" or "text" must be specified, but not both.

See Also:
Constant Field Values

ATTR_TEXT

public static final java.lang.String ATTR_TEXT
Attribute that specifies the Expression string to be evaluated by JETT that results in formula creation in the cell. I.e. text="${wins} + ${losses}" => "A2 + B2", which is used as the formula text. Either "bean" or "text" must be specified, but not both.

See Also:
Constant Field Values

ATTR_IF_ERROR

public static final java.lang.String ATTR_IF_ERROR
Attribute that specifies the Expression string to be evaluated by JETT to be used as alternative text in case an Excel error results.

See Also:
Constant Field Values
Constructor Detail

FormulaTag

public FormulaTag()
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 be bodiless.

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

process

public boolean process()

Evaluate the "text" attribute, and place the resultant text in an Excel Formula. If the "ifError" attribute is supplied, then wrap the formula in an "IF(ISERROR(formula), ifError, formula)" formula.

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.