Class FieldTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag
-
- net.sf.jguiraffe.gui.builder.components.tags.FieldTag
-
- All Implemented Interfaces:
ConditionalTag
,org.apache.commons.jelly.Tag
- Direct Known Subclasses:
RadioGroupTag
,TableColumnTag
public class FieldTag extends InputComponentTag
A specific input component tag that allows to make use of custom input components.
The idea behind this tag is to support a custom implementation of the
ComponentHandler
interface that can be defined by a tag in the body of this tag. This component handler will then be added to theForm
object constructed during the builder process, and - if it contains a component - to the generated GUI.This mechanism can be used to add components to the generated GUI that are not supported per default by the form builder library. Therefore it is only necessary to provide a specific
ComponentHandler
implementation that makes the new component accessible for theForm
object.Another use case is to provide a different data model for some components generated by other tags. The default example for this is a group of radio buttons: Typically one would like to avoid storing the state of each button in the group; it is preferable to make a conversion, e.g. storing the index of the selected button as an int. This use case can be addressed by a concrete
CompositeComponentHandler
implementation, to which the associated component handlers can be added. The composite component handler can then be implemented in a way that it somehow transforms the data of the contained components and passes this transformed value to the owning form object.This tag handler class inherits from
InputComponentTag
and thus supports all attributes defined by its parent class. Especially the definition of transformers and validators is possible, which can play together with the component handler set for this tag.- Version:
- $Id: FieldTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
- See Also:
ComponentHandlerTag
-
-
Constructor Summary
Constructors Constructor Description FieldTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentHandler<?>
createComponentHandler(ComponentManager manager, boolean create)
Returns the component handler to be used by the component that is represented by this tag.void
setComponentHandler(ComponentHandler<?> componentHandler)
Sets the component handler to be used by this tag.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag
addToGroups, checkName, createFieldHandler, getComponent, getComponentHandler, getComponentType, getDisplayName, getFieldValidator, getFormValidator, getGroups, getPropertyName, getReadTransformer, getTypeName, getWriteTransformer, handleGroups, insertField, isNoField, process, processBeforeBody, setComponentType, setDisplayName, setDisplayNamegrp, setDisplayNameres, setFieldValidator, setFormValidator, setGroups, setNoField, setPropertyName, setReadTransformer, setTypeName, setWriteTransformer
-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag
getBackColor, getBackgroundColor, getConstraints, getFont, getFontRef, getForeColor, getForegroundColor, getName, getToolTipData, insertComponent, setBackColor, setConstraints, setFont, setFontRef, setForeColor, setName, setTooltip, setTooltipres, setTooltipresgrp
-
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
-
setComponentHandler
public void setComponentHandler(ComponentHandler<?> componentHandler)
Sets the component handler to be used by this tag. This method is intended to be called by tags in this tag's body. ThecreateComponentHandler()
method will then return the component handler passed to this method.- Parameters:
componentHandler
- the component handler to use
-
createComponentHandler
protected ComponentHandler<?> createComponentHandler(ComponentManager manager, boolean create) throws FormBuilderException
Returns the component handler to be used by the component that is represented by this tag. This implementation just returns the handler that was set using thesetComponentHandler(ComponentHandler)
method. So in this tag's body there must have been a component that has already set this data.- Specified by:
createComponentHandler
in classInputComponentTag
- Parameters:
manager
- the component managercreate
- the create flag- Returns:
- the new component handler
- Throws:
FormBuilderException
- if no component handler has been set
-
-