Class FormControllerListenerTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- org.apache.commons.jelly.DynaTagSupport
-
- org.apache.commons.jelly.MapTagSupport
-
- org.apache.commons.jelly.tags.core.UseBeanTag
-
- net.sf.jguiraffe.gui.builder.components.tags.UseBeanBaseTag
-
- net.sf.jguiraffe.gui.builder.window.tags.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 aFormControllerTag
. By inheriting fromUseBeanBaseTag
there are multiple ways of defining the listener bean. The listener is obtained and passed to theFormControllerTag
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 aBeanContext
. The following example code fragment shows how this tag can be used to register aColorFieldMarker
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
-
-
Field Summary
-
Fields inherited from class net.sf.jguiraffe.gui.builder.components.tags.UseBeanBaseTag
ATTR_BEAN_CLASS, ATTR_BEAN_NAME, ATTR_CLASS, ATTR_IF_NAME, ATTR_REF, ATTR_UNLESS_NAME, ATTR_VAR
-
-
Constructor Summary
Constructors Constructor Description FormControllerListenerTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
passResults(Object bean)
Passes the bean to the owning object.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.UseBeanBaseTag
addIgnoreProperties, doTag, fetchBean, getAdditionalProperties, getAttributeStr, getBaseClass, getIfName, getUnlessName, isOptional, processBean, setBaseClass, setProperty, useExistingBean
-
Methods inherited from class org.apache.commons.jelly.tags.core.UseBeanTag
addIgnoreProperty, convertToClass, getBean, getDefaultClass, getIgnorePropertySet, isIgnoreUnknownProperties, loadClass, newInstance, setBean, setBeanProperties, setIgnoreUnknownProperties, validateBeanProperties
-
Methods inherited from class org.apache.commons.jelly.MapTagSupport
createAttributes, getAttributes, setAttribute
-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
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 aFormControllerTag
. If this is the case, the listener bean is evaluated and registered for the corresponding listener interfaces.- Overrides:
passResults
in classUseBeanBaseTag
- Parameters:
bean
- the listener bean- Returns:
- a flag whether the bean could be processed
- Throws:
org.apache.commons.jelly.JellyTagException
- if an error occurs
-
-