Class FormEventListenerTag

  • All Implemented Interfaces:
    ConditionalTag, org.apache.commons.jelly.Tag
    Direct Known Subclasses:
    ActionListenerTag, ChangeListenerTag, FocusListenerTag, MouseListenerTag

    public class FormEventListenerTag
    extends EventListenerTag

    A base class for event listener tag handler classes that deal with event listeners for form events.

    This base class provides functionality for registering event listeners at input components (i.e. the typical form events like action events, focus events, or change events). It performs all necessary steps for locating the input component tag this tag is nested inside and registering the passed in listener object. Because the event listener can only be registered after the affected input component has been created, registration is performed by a ComponentBuilderCallBack object.

    By specifying EventListenerTypeTag objects in the body of this tag multiple event listeners for various event types can be added at once. This allows mapping an action to multiple event types. Concrete sub classes only have to provide the initial event listener type in the constructor call.

    This class can also be used directly as tag handler implementation. In this case there is no default event type. So EventListenerTypeTag tags must be placed in the body of this tag.

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

      • FormEventListenerTag

        public FormEventListenerTag()
        Creates a new instance of FormEventListenerTag. No event listener type is set. This has to be done by nested tags.
      • FormEventListenerTag

        public FormEventListenerTag​(FormListenerType type)
        Creates a new instance of FormEventListenerTag and sets the event listener type.
        Parameters:
        type - the FormListenerType
    • Method Detail

      • registerListener

        protected boolean registerListener​(EventListener listener)
                                    throws org.apache.commons.jelly.JellyTagException,
                                           FormBuilderException
        Registers the specified event listener. This implementation checks whether this tag is nested in an InputComponentTag tag. If this is the case, the listener is registered at the component handler of this component.
        Specified by:
        registerListener in class EventListenerTag
        Parameters:
        listener - the listener to be registered
        Returns:
        a flag whether registration was possible
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used
        FormBuilderException - if a tag-related error occurs
      • getActionBuilder

        protected ActionBuilder getActionBuilder()
        Returns a reference to the current ActionBuilder instance. This instance is expected to be placed in the Jelly context.
        Returns:
        the current action builder
      • getActionManager

        protected ActionManager getActionManager()
        Convenience method for obtaining a reference to the current ActionManager.
        Returns:
        the current action manager