Class EventListenerTypeTag

  • All Implemented Interfaces:
    ConditionalTag, org.apache.commons.jelly.Tag

    public class EventListenerTypeTag
    extends FormBaseTag

    A specialized tag handler implementation that allows adding another event listener type to a FormEventListenerTag.

    Per default, tags derived from FormEventListenerTag support only a single event listener interface. The tag implemented by this handler class can be placed in the body of a FormEventListenerTag to add another listener interface. The event listener produced by the outer tag will then support this new listener interface, too. This is useful if multiple event types fired by a component should be mapped to a single action.

    This tag handler class can deal with both standard and non-standard events. For non-standard events the class of the event listener interface must be specified. The following attributes are supported:

    Attribute Description Optional
    type Defines the name of the event listener type. This can be the name of a standard type (e.g. change or mouse - case is irrelevant) or a non-standard type. In the latter case the naming conventions used by the FormEventManager class apply. No
    listenerClass Here the class of the event listener interface can be provided. This is only needed for non-standard listener types. If the type attribute contains the name of a standard event type, this attribute is ignored. Yes

    The following example shows how this tag can be used to add an additional tree expansion listener to a change listener for a tree:

     <f:tree name="myTree" model="myTreeModel">
       <a:changeListener actionName="myAction">
         <a:listenerType type="Expansion"
           listenerClass="net.sf.jguiraffe.gui.builder.components.model.TreeExpansionLitener"/>
       </a:changeListener>
     </f:tree>
     

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

      • EventListenerTypeTag

        public EventListenerTypeTag()
    • Method Detail

      • getType

        public String getType()
        Returns the event listener type as a string.
        Returns:
        the event listener type
      • setType

        public void setType​(String type)
        Set method of the type attribute.
        Parameters:
        type - the attribute's value
      • getListenerClass

        public Object getListenerClass()
        Returns the event listener class as an object. This attribute accepts either a class object or the fully-qualified name of a class.
        Returns:
        the event listener class
      • setListenerClass

        public void setListenerClass​(Object listenerClass)
        Set method of the listenerClass attribute.
        Parameters:
        listenerClass - the attribute's value
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException,
                               FormBuilderException
        Executes this tag. This implementation checks whether the tag is contained in the body of a FormEventListenerTag. If this is the case, an additional event listener type is added to the parent tag. Otherwise, an exception is thrown.
        Specified by:
        process in class FormBaseTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is used incorrectly
        FormBuilderException - if an error occurs