Class 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 the Form 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 the Form 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 Detail

      • FieldTag

        public FieldTag()
    • 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. The createComponentHandler() method will then return the component handler passed to this method.
        Parameters:
        componentHandler - the component handler to use