|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.rad.util.EventHandler<L>
L
- the Listener typepublic class EventHandler<L>
Platform and technology independent event handler.
It is designed for use with UI elements and non UI elements.
There can be used with any Listener Interface. and implicit forwarded
to any function.
button.eventAction().addListener(
new ActionListener()
{
public void actionPerformed(ActionEvent pEvent)
{
doSave();
}
});
button.eventAction().addListener(this, "doSave");
Constructor Summary | |
---|---|
EventHandler(Class<L> pListenerType,
Class... pParameterTypes)
Constructs a new EventHandler, the listener type may only have 1 method. |
|
EventHandler(Class<L> pListenerType,
String pListenerMethodName,
Class... pParameterTypes)
Constructs a new EventHandler. |
Method Summary | |
---|---|
void |
addListener(L pListener)
Adds a listener. |
void |
addListener(L pListener,
int pIndex)
Adds a listener at a given index. |
void |
addListener(Object pListener,
String pMethodName)
Adds a listener. |
void |
addListener(Object pListener,
String pMethodName,
int pIndex)
Adds a listener at a given position. |
L |
createListener(Object pListener,
String pMethodName)
Creates a new listener interface for calling the given method for the given object. |
Object |
dispatchEvent(Object... pEventParameter)
Dispatches the given events to all listeners. |
static Object |
getCurrentDispatchObject()
Gets the current dispatch object. |
L |
getDefaultListener()
Gets the default listener. |
static Object |
getLastDispatchedObject()
Gets the last dispatched object. |
L |
getListener(int pIndex)
Gets the listener at the position. |
int |
getListenerCount()
Gets the count of listeners. |
L[] |
getListeners()
Gets all listeners. |
static Throwable |
getWrappedException(Throwable pCause)
Gets the cause of an exception that is a wrapper exception, like InvocationTargetException . |
static Throwable |
getWrappedExceptionAllowSilent(Throwable pCause)
Gets the cause of an exception that is a wrapper exception, like InvocationTargetException . |
boolean |
isDispatchEventsEnabled()
Gets whether event dispatching is enabled. |
void |
removeAllListeners()
Removes all known listeners. |
void |
removeListener(int pIndex)
Removes the listener at the position. |
void |
removeListener(Object pListener)
Removes all listener methods added with the given object, or the listener, if an interface was added. |
void |
removeListener(Object pListener,
String pMethodName)
Removes the listener added with the method. |
void |
setDefaultListener(L pListener)
Sets the default listener. |
void |
setDefaultListener(Object pListener,
String pMethodName)
Sets the default listener. |
void |
setDispatchEventsEnabled(boolean pEnabled)
Sets whether event dispatching is en- or disabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventHandler(Class<L> pListenerType, Class... pParameterTypes)
pListenerType
- the listener type interface.pParameterTypes
- parameter types to check additional.public EventHandler(Class<L> pListenerType, String pListenerMethodName, Class... pParameterTypes)
pListenerType
- the listener type interface.pListenerMethodName
- the method to be called inside the interface.pParameterTypes
- parameter types to check additional.Method Detail |
---|
public void addListener(L pListener)
pListener
- the listener.public void addListener(L pListener, int pIndex)
pListener
- the listener.pIndex
- the index to add.public void addListener(Object pListener, String pMethodName)
pListener
- the listener object.pMethodName
- the method name.public void addListener(Object pListener, String pMethodName, int pIndex)
pListener
- the listener object.pMethodName
- the method name.pIndex
- the index to addpublic void removeListener(int pIndex)
pIndex
- the position.public void removeListener(Object pListener)
pListener
- the listener.public void removeListener(Object pListener, String pMethodName)
pListener
- the listener object.pMethodName
- the method name.public void removeAllListeners()
public int getListenerCount()
public L getListener(int pIndex)
pIndex
- the position.
public L[] getListeners()
public void setDefaultListener(L pListener)
pListener
- the listener.public void setDefaultListener(Object pListener, String pMethodName)
pListener
- the listener object.pMethodName
- the method name.public L getDefaultListener()
public Object dispatchEvent(Object... pEventParameter) throws Throwable
pEventParameter
- the event parameter.
Throwable
- if an exception occurs.public L createListener(Object pListener, String pMethodName)
pListener
- the object.pMethodName
- the method.
public void setDispatchEventsEnabled(boolean pEnabled)
pEnabled
- true
to enable dispatching, false
to ignore dispatchingpublic boolean isDispatchEventsEnabled()
true
if event dispatching is enabled, false
if it's disabledpublic static Object getLastDispatchedObject()
public static Object getCurrentDispatchObject()
null
if no object was foundpublic static Throwable getWrappedException(Throwable pCause)
InvocationTargetException
.
pCause
- the wrapper exception
public static Throwable getWrappedExceptionAllowSilent(Throwable pCause)
InvocationTargetException
.
This methods doesn't unwrap exception that were wrapped with SilentAbortException
.
pCause
- the wrapper exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |