Class SimpleComponentTag

  • All Implemented Interfaces:
    ConditionalTag, org.apache.commons.jelly.Tag
    Direct Known Subclasses:
    ContainerTag, TextIconTag, ToolbarTag

    public abstract class SimpleComponentTag
    extends ComponentBaseTag

    An abstract base class for tags that create simple GUI components.

    This base class is intended to be used for components that are not inserted into a Form object. Derived tag classes create a component of a specific type. This class ensures that the new component is added to the next enclosing container element.

    Simple GUI component can be assigned a name using the name attribute. If this is done, they are stored in the component store of the current builder operation. This makes it possible to obtain a WidgetHandler and manipulate some of their properties later.

    Version:
    $Id: SimpleComponentTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • SimpleComponentTag

        public SimpleComponentTag()
    • Method Detail

      • getComponent

        public Object getComponent()
        Returns the component that was created by this tag.
        Specified by:
        getComponent in class ComponentBaseTag
        Returns:
        the component created by this tag
      • processBeforeBody

        protected void processBeforeBody()
                                  throws org.apache.commons.jelly.JellyTagException,
                                         FormBuilderException
        Callback before processing of the tag's body. Calls #createComponent(ComponentManager) for the first time with the create parameter set to true.
        Overrides:
        processBeforeBody in class FormBaseTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if a script related error occurs
        FormBuilderException - if an error occurs
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException,
                               FormBuilderException
        Executes this tag. Calls #createComponent(ComponentManager) for the second time with the boolean parameter create set to false . The new component is then added to the nesting container element.
        Overrides:
        process in class ComponentBaseTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if a script related error occurs
        FormBuilderException - if an error occurs
      • createComponent

        protected abstract Object createComponent​(ComponentManager manager,
                                                  boolean create)
                                           throws org.apache.commons.jelly.JellyTagException,
                                                  FormBuilderException
        Creates a specific component. This method must be implemented in derived classes. An implementation may use the passed in component manager to create an instance of a concrete GUI widget class. Note that this method is called twice during execution of this tag: Once before the tag's body is processed and once after that. The boolean argument can be used to distinguish between the two phases. This allows concrete implementations of the ComponentManager interface to use various strategies for creating a component hierarchy.
        Parameters:
        manager - the component manager
        create - a flag whether the component should be newly created
        Returns:
        the new GUI component
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
        FormBuilderException - if an error occurs creating the component