Class TreeIconTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.TreeIconTag
-
- All Implemented Interfaces:
ConditionalTag,IconSupport,org.apache.commons.jelly.Tag
public class TreeIconTag extends FormBaseTag implements IconSupport
A tag for defining icons for tree components.
Tags of this type can be placed in the body of a
. ATreeTagTreeIconTagmust be passed an icon name and the corresponding icon (which is usually specified by a nested). It collects this data and invokes theIconTagaddIcon()method of the.TreeTagThe following fragment demonstrates how this tag can be used for changing the default icons of a tree component:
<f:tree model="myTreeModel" name="myTree"> <f:treeIcon name="LEAF"> <f:icon resource="myLeafIcon.gif"/> </f:treeIcon> <f:treeIcon name="BRANCH_EXPANDED"> <f:icon resource="myExpandedIcon.gif"/> </f:treeIcon> <f:treeIcon name="BRANCH_COLLAPSED"> <f:icon resource="myCollapsedIcon.gif"/> </f:treeIcon> </f:tree>The names of the icons must correspond with the
used by the tree component. The icon handler returns icon names for the nodes of the tree. These names must exactly match the icon names passed to theTreeIconHandlernameattribute of theTreeIconTag. In the example above the names used by the default icon handler are used. If a custom icon handler is used the names may have to be adapted.The following table displays the attributes supported by this tag:
Attribute Description Optional name Defines the name of the icon. Each icon is associated with a name. No Both an icon and an icon name must be provided otherwise an exception will be thrown.
- Version:
- $Id: TreeIconTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description TreeIconTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetIcon()Returns the icon.StringgetName()Returns the name of the icon.protected voidprocess()Executes this tag.voidsetIcon(Object icon)Sets the icon.voidsetName(String name)Sets the name of the icon.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
canProcess, canProcess, convertToClass, convertToNumberWithUnit, convertToNumberWithUnit, doTag, findContainer, getBuilderData, getBuilderData, getIfName, getResourceText, getResourceText, getUnlessName, processBeforeBody, setIfName, setUnlessName
-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
Method Detail
-
getName
public String getName()
Returns the name of the icon.- Returns:
- the icon name
-
setName
public void setName(String name)
Sets the name of the icon. This is the set method of the name attribute.- Parameters:
name- the icon name
-
getIcon
public Object getIcon()
Returns the icon.- Returns:
- the icon
-
setIcon
public void setIcon(Object icon)
Sets the icon. This method is intended to be called by tags in the body of this tag.- Specified by:
setIconin interfaceIconSupport- Parameters:
icon- the icon
-
process
protected void process() throws org.apache.commons.jelly.JellyTagException, FormBuilderExceptionExecutes this tag. This implementation tests whether all required properties are set. Then it adds the icon to the parent tree tag.- Specified by:
processin classFormBaseTag- Throws:
org.apache.commons.jelly.JellyTagException- if the tag is used incorrectlyFormBuilderException- if an error occurs
-
-