Enum FormListenerType
- java.lang.Object
-
- java.lang.Enum<FormListenerType>
-
- net.sf.jguiraffe.gui.builder.event.FormListenerType
-
- All Implemented Interfaces:
Serializable
,Comparable<FormListenerType>
public enum FormListenerType extends Enum<FormListenerType>
An enumeration class describing the supported event listener types.
This class is used internally in the implementation of the generic event handling layer provided by the form framework. Clients usually need not deal with it directly.
The enumeration literals defined by this class represent the supported event listener types. The class also provides functionality for firing events, i.e. calling listeners.
- Version:
- $Id: FormListenerType.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
callListener(FormEventListener l, FormEvent event)
Invokes an event listener.void
callListeners(EventListenerList listenerList, FormEvent event)
Invokes all listeners in the specified listener list that are of the listener type represented by this instance.static FormListenerType
fromString(String s)
Tries to find aFormListenerType
constant that matches the passed in string.Class<? extends EventListener>
getListenerClass()
Returns the event listener class that is handled by this instance.String
listenerTypeName()
Returns the listener type name.static FormListenerType
valueOf(String name)
Returns the enum constant of this type with the specified name.static FormListenerType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ACTION
public static final FormListenerType ACTION
The listener type Action.
-
CHANGE
public static final FormListenerType CHANGE
The listener type Change.
-
FOCUS
public static final FormListenerType FOCUS
The listener type Focus.
-
MOUSE
public static final FormListenerType MOUSE
The listener type Mouse.
-
-
Method Detail
-
values
public static FormListenerType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FormListenerType c : FormListenerType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FormListenerType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getListenerClass
public Class<? extends EventListener> getListenerClass()
Returns the event listener class that is handled by this instance.- Returns:
- the event listener class
-
callListeners
public void callListeners(EventListenerList listenerList, FormEvent event)
Invokes all listeners in the specified listener list that are of the listener type represented by this instance. The specified event will be passed to the listener, which is actually done by thecallListener()
method.- Parameters:
listenerList
- a list with event listenersevent
- the event object to pass to the listeners
-
listenerTypeName
public String listenerTypeName()
Returns the listener type name. This is the name to be used for registering listeners of the corresponding type via reflection, e.g. Action or Focus. If the listener type name is Foo, there must be a corresponding method on the target object named addFooListener() which will be called to register the listener.- Returns:
- the listener type name for this instance
-
fromString
public static FormListenerType fromString(String s)
Tries to find aFormListenerType
constant that matches the passed in string. The string is compared - ignoring case - with the names of all constants defined for this enumeration class. If a matching constant is found, it is returned. Otherwise the return value is null.- Parameters:
s
- the string to be tested- Returns:
- the corresponding type constant or null
-
callListener
public abstract void callListener(FormEventListener l, FormEvent event)
Invokes an event listener. This method must be defined in concrete sub classes to perform the necessary type casts and call the appropriate listener method.- Parameters:
l
- the event listenerevent
- the event- Throws:
ClassCastException
- if the listener object or the event are incompatible with the listener type
-
-