Class FormControllerListenerTag

  • All Implemented Interfaces:
    ConditionalTag, PropertySupport, org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.Tag

    public class FormControllerListenerTag
    extends UseBeanBaseTag

    A specialized tag handler class that can be used to register listeners at a FormController.

    FormController supports several types of event listeners that are notified when specific operations are performed. With this tag listeners can be defined and passed to a controller. Tags of this type can be placed in the body of a FormControllerTag. By inheriting from UseBeanBaseTag there are multiple ways of defining the listener bean. The listener is obtained and passed to the FormControllerTag which eventually performs the registration.

    Per default, the type of event listener to register is determined by inspecting the listener bean and the listener interfaces it implements. This is typically the desired behavior as listeners are automatically registered for the interfaces they support. However, there are some attributes that can be used to alter the default behavior:

    suppressValidationListener
    If this attribute is defined (with an arbitrary value), the listener bean will not be registered as a FormControllerValidationListener, even if it implements this interface.
    suppressFieldStatusListener
    If this attribute is defined (with an arbitrary value), the listener bean will not be registered as a FormControllerFieldStatusListener, even if it implements this interface.
    suppressFormListener
    If this attribute is defined (with an arbitrary value), the listener bean will not be registered as a FormControllerFormListener, even if it implements this interface.

    In addition to these attributes all standard attributes of UseBeanBaseTag are available of course. Using these attributes listener beans can either be created directly or referenced from a BeanContext. The following example code fragment shows how this tag can be used to register a ColorFieldMarker at a form controller:

     <!-- Definition of the field marker bean -->
     <di:bean name="fieldMarker" singleton="false"
       beanClass="net.sf.jguiraffe.gui.builder.window.ColorFieldMarker">
       <!-- Property definitions for the colors to use omitted -->
       ...
     </di:bean>
     <!-- The frame definition including the controller -->
     <w:frame title="Test frame">
       <!-- GUI definitions omitted -->
       ...
       <w:formController beanName="controller">
         <w:formControllerListener beanName="fieldMarker"/>
       </w:formController>
     </w:frame>
     

    Note that with the standard tags for registering event listeners the same effect can be achieved: arbitrary event listener objects could be registered manually at a form controller bean. However, using this tag can be more convenient, especially if the listener object implements multiple listener interfaces as is the case for field markers for example.

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

      • FormControllerListenerTag

        public FormControllerListenerTag()
    • Method Detail

      • passResults

        protected boolean passResults​(Object bean)
                               throws org.apache.commons.jelly.JellyTagException
        Passes the bean to the owning object. This implementation expects that this tag is nested inside a FormControllerTag. If this is the case, the listener bean is evaluated and registered for the corresponding listener interfaces.
        Overrides:
        passResults in class UseBeanBaseTag
        Parameters:
        bean - the listener bean
        Returns:
        a flag whether the bean could be processed
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs