com.plumtree.portaluiinfrastructure.tags.metadata
Class OptionalTagAttribute

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.tags.metadata.ATagAttribute
      extended by com.plumtree.portaluiinfrastructure.tags.metadata.OptionalTagAttribute

public class OptionalTagAttribute
extends ATagAttribute

This class provides programmatic access to the tag meta data for optional attributes, including name, description, type, and default values.

Tag classes need to have one public static final OptionalTagAttribute member variable for every attribute that this tag supports, but does not require.

E.G.
<pt:thistag pt:firstattribute="foo" pt:secondattribute="bar"/>
would need
public static final OptionalTagAttribute = new OptionalTagAttribute( "firstattribute", "This optional attribute is used to ...", AttributeType.STRING, "first default value");
public static final OptionalTagAttribute = new OptionalTagAttribute( "secondattribute", "This optional attribute is used to ...", AttributeType.STRING, "second default value");

The OptionalTagAttribute objects are used for programmatic access to tag meta data, as well as to pre-process tags for tag attributes (presence, correct type, and default values). If the attribute values are not correct, the default values will be used instead. An error will be logged, but the tag and its children will still be displayed.

See Also:
RequiredTagAttribute

Field Summary
protected  java.lang.String m_strDefaultValue
           
 
Fields inherited from class com.plumtree.portaluiinfrastructure.tags.metadata.ATagAttribute
m_strDescription, m_strName, m_Type
 
Constructor Summary
OptionalTagAttribute(java.lang.String _strName, java.lang.String _strDescription, AttributeType _type, java.lang.String _strDefaultValue)
          Creates a new optional tag attribute.
 
Method Summary
protected  void CheckDefaultValue()
          This method is used to ensure that default values are of the appropriate type.
 java.lang.String GetDefaultValue()
          The default value for an optional attribute if the attribute is not present or is of the incorrect type.
 boolean GetIsRequired()
          Gets whether or not this attribute is required to be present every time the tag is used.
 
Methods inherited from class com.plumtree.portaluiinfrastructure.tags.metadata.ATagAttribute
CheckNameSafety, GetDescription, GetName, GetType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_strDefaultValue

protected java.lang.String m_strDefaultValue
Constructor Detail

OptionalTagAttribute

public OptionalTagAttribute(java.lang.String _strName,
                            java.lang.String _strDescription,
                            AttributeType _type,
                            java.lang.String _strDefaultValue)
Creates a new optional tag attribute.

Parameters:
_strName - The attribute name.
_strDescription - The attribute description.
_type - The attribute type.
_strDefaultValue - The attribute default value.
Throws:
XPFormatException - if the name contains any whitespace or if the default value cannot be converted to the appropriate type.
XPIllegalArgumentException - if the AttributeType is null.
Method Detail

GetIsRequired

public boolean GetIsRequired()
Description copied from class: ATagAttribute
Gets whether or not this attribute is required to be present every time the tag is used. If it is required, the tag will fail if it is not present.

Specified by:
GetIsRequired in class ATagAttribute
Returns:
boolean True means that this attribute is required
See Also:
com.plumtree.portaluiinfrastructure.tags.metadat.ATagAttribute#GetIsRequired()

GetDefaultValue

public java.lang.String GetDefaultValue()
Description copied from class: ATagAttribute
The default value for an optional attribute if the attribute is not present or is of the incorrect type. This will return null for required attributes.

Specified by:
GetDefaultValue in class ATagAttribute
Returns:
String The default value for this attribute. Null implies there is no default value.
See Also:
com.plumtree.portaluiinfrastructure.tags.metadat.ATagAttribute#GetDefaultValue()

CheckDefaultValue

protected void CheckDefaultValue()
This method is used to ensure that default values are of the appropriate type.

Throws:
XPFormatException - if the default value cannot be converted to the appropriate type.



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.