Class PushButtonTag

  • All Implemented Interfaces:
    ConditionalTag, IconSupport, org.apache.commons.jelly.Tag
    Direct Known Subclasses:
    CheckboxTag, RadioButtonTag, StaticTextTag, ToggleButtonTag

    public abstract class PushButtonTag
    extends InputComponentTag
    implements IconSupport

    An abstract base class for tag handler classes that implement push buttons like checkboxes or radio buttons.

    Push buttons have multiple common attributes that are handled by this class, among them a text and an icon definition. These are implemented using the TextIconData class.

    This tag handler base class is the counterpart of TextIconTag for full featured input components.

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

      • PushButtonTag

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

      • getTextIconData

        public TextIconData getTextIconData()
        Returns the text icon data object associated with this tag.
        Returns:
        the text icon data object
      • setIcon

        public void setIcon​(Object icon)
        Setter method for the icon attribute.
        Specified by:
        setIcon in interface IconSupport
        Parameters:
        icon - the icon
      • setText

        public void setText​(String text)
        Setter method for the text attribute.
        Parameters:
        text - the text to set
      • setResgrp

        public void setResgrp​(String resgrp)
        Setter method for the resgrp attribute. Defines the group for resolving the resource for the component's text.
        Parameters:
        resgrp - the resource group
      • setTextres

        public void setTextres​(String textres)
        Setter method for the textres attribute. Specifies the resource ID for resolving the component's text
        Parameters:
        textres - the text resource ID
      • setAlignment

        public void setAlignment​(String al)
        Setter method of the alignment attribute.
        Parameters:
        al - the attribute value
      • setMnemonic

        public void setMnemonic​(String m)
        Setter method of the mnemonic attribute.
        Parameters:
        m - the attribute value
      • setMnemonicres

        public void setMnemonicres​(String resID)
        Setter method of the mnemonicres attribute.
        Parameters:
        resID - the attribute value
      • createComponentHandler

        protected ComponentHandler<?> createComponentHandler​(ComponentManager manager,
                                                             boolean create)
                                                      throws FormBuilderException,
                                                             org.apache.commons.jelly.JellyTagException
        Creates the component handler for the new input component. Performs parameter checks and invokes createPushButton() that really creates the component.
        Specified by:
        createComponentHandler in class InputComponentTag
        Parameters:
        manager - the component manager
        create - the create flag
        Returns:
        the new component handler
        Throws:
        FormBuilderException - if an error occurs
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
      • validateTag

        protected void validateTag()
                            throws FormBuilderException,
                                   org.apache.commons.jelly.JellyTagException
        Validates the attributes of this tag. This method is invoked before the push button is created. This implementation tests if either a text or an icon is provided. If both are undefined, an exception will be thrown.
        Throws:
        FormBuilderException - if an error occurs
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
      • createPushButton

        protected abstract ComponentHandler<?> createPushButton​(ComponentManager manager,
                                                                boolean create)
                                                         throws FormBuilderException
        Creates the push button component of the correct type. This method must be implemented in a concrete sub class. It has to invoke the proper creation method on the passed in ComponentManager object. The base class ensures that this method is called at the right time and that all required parameters have been provided.
        Parameters:
        manager - the component manager
        create - the create flag
        Returns:
        the new component handler
        Throws:
        FormBuilderException - if an error occurs