net.sf.jett.tag
Class IfTag

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

public class IfTag
extends BaseTag

An IfTag represents a conditionally placed Block of Cells.


Attributes:

Author:
Randy Gettman

Field Summary
static java.lang.String ATTR_ELSE
          Attribute for specifying the value of the Cell if the condition is false (bodiless if-tag only).
static java.lang.String ATTR_ELSE_ACTION
          Attribute for specifying the action to be taken if the condition is false (if-tags with a body only).
static java.lang.String ATTR_TEST
          Attribute for specifying the boolean test condition.
static java.lang.String ATTR_THEN
          Attribute for specifying the value of the Cell if the condition is true (bodiless if-tag only).
static java.lang.String ELSE_ACTION_CLEAR
          Value for the "elseAction" attribute indicating to remove the block by clearing cell contents and not shifting cells, if the test condition is false.
static java.lang.String ELSE_ACTION_REMOVE
          Value for the "elseAction" attribute indicating to clear the block by remove the cells, but not shifting other cells, if the test condition is false.
static java.lang.String ELSE_ACTION_SHIFT_LEFT
          Value for the "elseAction" attribute indicating to remove the block by shifting cells left, if the test condition is false.
static java.lang.String ELSE_ACTION_SHIFT_UP
          Value for the "elseAction" attribute indicating to remove the block by shifting cells up, if the test condition is false.
 
Fields inherited from class net.sf.jett.tag.BaseTag
ATTR_ON_PROCESSED, SPEC_SEP
 
Constructor Summary
IfTag()
           
 
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 condition.
 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

ELSE_ACTION_SHIFT_UP

public static final java.lang.String ELSE_ACTION_SHIFT_UP
Value for the "elseAction" attribute indicating to remove the block by shifting cells up, if the test condition is false.

See Also:
Constant Field Values

ELSE_ACTION_SHIFT_LEFT

public static final java.lang.String ELSE_ACTION_SHIFT_LEFT
Value for the "elseAction" attribute indicating to remove the block by shifting cells left, if the test condition is false.

See Also:
Constant Field Values

ELSE_ACTION_CLEAR

public static final java.lang.String ELSE_ACTION_CLEAR
Value for the "elseAction" attribute indicating to remove the block by clearing cell contents and not shifting cells, if the test condition is false.

See Also:
Constant Field Values

ELSE_ACTION_REMOVE

public static final java.lang.String ELSE_ACTION_REMOVE
Value for the "elseAction" attribute indicating to clear the block by remove the cells, but not shifting other cells, if the test condition is false.

See Also:
Constant Field Values

ATTR_TEST

public static final java.lang.String ATTR_TEST
Attribute for specifying the boolean test condition.

See Also:
Constant Field Values

ATTR_THEN

public static final java.lang.String ATTR_THEN
Attribute for specifying the value of the Cell if the condition is true (bodiless if-tag only).

See Also:
Constant Field Values

ATTR_ELSE

public static final java.lang.String ATTR_ELSE
Attribute for specifying the value of the Cell if the condition is false (bodiless if-tag only).

See Also:
Constant Field Values

ATTR_ELSE_ACTION

public static final java.lang.String ATTR_ELSE_ACTION
Attribute for specifying the action to be taken if the condition is false (if-tags with a body only).

See Also:
Constant Field Values
Constructor Detail

IfTag

public IfTag()
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()
Validates the attributes for this Tag. Some optional attributes are only valid for bodiless tags, and others are only valid for tags without bodies.

Overrides:
validateAttributes in class BaseTag

process

public boolean process()

Evaluate the condition.

With Body: If it's true, transform the block of Cells. If it's false, take the "elseAction", which defaults to removing the block.

Bodiless: If it's true, evaluate the "then" condition. If it's false, evaluate the "else" condition, which defaults to a value of null.

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.