Class PropertiesTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.PropertiesTag
-
- All Implemented Interfaces:
ConditionalTag,PropertySupport,org.apache.commons.jelly.Tag
public class PropertiesTag extends FormBaseTag implements PropertySupport
A tag for creating a map with properties and passing it to a target tag.
This tag handler class constructs a map that can be populated with properties by tags in the body of this tag. The final map can then either be passed to the parent tag (which must implement the
interface) or stored as a variable in the Jelly context. The following attributes are supported:PropertiesSupportAttribute Description Optional var Here the name of a variable can be specified, under which the resulting map should be stored in the Jelly context. Yes ref With this attribute the name of a variable can be specified, which will be used for initializing the internally stored map. This variable must be of type java.util.Map. Newly added properties will be stored in this map. If this attribute is not specified, a new map will be created. Usage of this attribute allows to reuse a map that was created by anotherPropertiesTag.Yes If the
varattribute is not specified, the parent tag must implement theinterface. Otherwise an exception will be thrown because no target for the resulting map can be determined.PropertiesSupport- Version:
- $Id: PropertiesTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description PropertiesTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetRef()Returns the name of a variable, under which the initial map is stored.StringgetVar()Returns the name of a variable, under which the properties are to be stored.protected voidprocess()Processes this tag.protected voidprocessBeforeBody()Processes this tag before its body gets executed.voidsetProperty(String name, Object value)Sets a property.voidsetRef(String ref)Set method of the ref attribute.voidsetVar(String var)Set method of the var attribute.-
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, 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
-
getVar
public String getVar()
Returns the name of a variable, under which the properties are to be stored.- Returns:
- a variable name for the properties
-
setVar
public void setVar(String var)
Set method of the var attribute.- Parameters:
var- the attribute's value
-
getRef
public String getRef()
Returns the name of a variable, under which the initial map is stored.- Returns:
- a avariable with the initial properties map
-
setRef
public void setRef(String ref)
Set method of the ref attribute.- Parameters:
ref- the attribute's value
-
processBeforeBody
protected void processBeforeBody() throws org.apache.commons.jelly.JellyTagException, FormBuilderExceptionProcesses this tag before its body gets executed. This implementation will initialize the internal map with the properties.- Overrides:
processBeforeBodyin classFormBaseTag- Throws:
org.apache.commons.jelly.JellyTagException- if attributes have invalid valuesFormBuilderException- if an error occurs
-
process
protected void process() throws org.apache.commons.jelly.JellyTagException, FormBuilderExceptionProcesses this tag. This method does the major part of the required work. It locates the target and passes it the map with the properties. If no target can be determined, an exception will be thrown.- Specified by:
processin classFormBaseTag- Throws:
org.apache.commons.jelly.JellyTagException- if the tag is incorrectly usedFormBuilderException- if an error occurs
-
setProperty
public void setProperty(String name, Object value)
Sets a property. This method will be called by tags in the body.- Specified by:
setPropertyin interfacePropertySupport- Parameters:
name- the name of the propertyvalue- the value of the property
-
-