Class ColumnComponentTag

  • All Implemented Interfaces:
    Composite, ConditionalTag, org.apache.commons.jelly.Tag
    Direct Known Subclasses:
    ColumnEditorTag, ColumnRendererTag

    public abstract class ColumnComponentTag
    extends ContainerTag

    An abstract base class for tags that define renderers or editors for the columns of a table.

    This tag is a specialized container. By tags in its body a single component can be added (which can be a container component containing arbitrary other data). This component will then be added to either the column's render or edit form (concrete sub classes decide, which form is used).

    A concrete sub class has to implement the following functionality:

    • It must be able to obtain the correct form from the hosting table tag that is used for this kind of column component. For this purpose the getTableForm() method must be implemented.
    • The results of the processing of this tag must be passed to the hosting column tag. This is done in the initializeColumn() method.

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

      • ColumnComponentTag

        protected ColumnComponentTag()
        Creates a new instance of ColumnComponentTag.
    • Method Detail

      • getTableTag

        public TableTag getTableTag()
        Returns a reference to the table tag this tag is nested inside.
        Returns:
        the hosting table tag
      • processBeforeBody

        protected void processBeforeBody()
                                  throws org.apache.commons.jelly.JellyTagException,
                                         FormBuilderException
        Performs processing before this tag's body is evaluated. This implementation will do some checks.
        Overrides:
        processBeforeBody in class ContainerTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs
        FormBuilderException - if the tag is incorrectly used
      • createContainer

        protected Object createContainer​(ComponentManager manager,
                                         boolean create,
                                         Collection<Object[]> components)
                                  throws FormBuilderException,
                                         org.apache.commons.jelly.JellyTagException
        Creates the container represented by this tag. For this tag handler we only need a fake implementation because the returned object will never be added into a root container or content will be added to it. So simply a reference to this is returned. This also allows the table tag to check that only valid content is defined in its body.
        Specified by:
        createContainer in class ContainerTag
        Parameters:
        manager - the component manager
        create - the create flag
        components - a collection with the defined child components
        Returns:
        a reference to the new container
        Throws:
        FormBuilderException - if an error occurs
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
      • addComponents

        protected void addComponents​(ComponentManager manager,
                                     Object container,
                                     Collection<Object[]> comps)
                              throws FormBuilderException
        Adds the components defined by nested tags to this container tag. This implementation checks whether the tag's content is valid. If this is the case, the hosting column tag will be correctly initialized.
        Overrides:
        addComponents in class ContainerTag
        Parameters:
        manager - the component manager
        container - the created container
        comps - the created components
        Throws:
        FormBuilderException - if an error occurs
      • getTableForm

        protected abstract Form getTableForm​(TableTag tabTag)
        Returns the form of the hosting table that stores the components managed by this tag. This method is always called when access to this form is needed.
        Parameters:
        tabTag - the table tag
        Returns:
        the form for storing the components defined in this tag
      • initializeColumn

        protected abstract void initializeColumn​(TableColumnTag colTag,
                                                 Object bodyComponent,
                                                 Set<String> componentNames)
        Initializes the hosting column tag with the information gathered by this tag. This method is called once at the end of the processing of this tag. Its purpose is to initialize some of the fields required for the column.
        Parameters:
        colTag - a reference to the column tag this tag is nested inside
        bodyComponent - the component defined in the body of this tag
        componentNames - a set with the names of all components referred to by this tag