|
||||||||||
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");
Nested Class Summary | |
---|---|
protected class |
EventHandler.ListenerHandler
Generic Listener that calls reflective the given method. |
Constructor Summary | |
---|---|
EventHandler(java.lang.Class<L> pListenerType,
java.lang.Class... pParameterTypes)
Constructs a new EventHandler, the listener type may only have 1 method. |
|
EventHandler(java.lang.Class<L> pListenerType,
java.lang.String pListenerMethodName,
java.lang.Class... pParameterTypes)
Constructs a new EventHandler. |
Method Summary | |
---|---|
protected void |
addHandler(int pIndex,
EventHandler.ListenerHandler pHandler)
Adds a listener handler to the listener list. |
void |
addListener(IRunnable pListener)
Adds a listener. |
void |
addListener(L pListener)
Adds a listener. |
void |
addListener(L pListener,
int pIndex)
Adds a listener at a given index. |
void |
addListener(java.lang.Object pListener,
java.lang.String pMethodName)
Adds a listener. |
void |
addListener(java.lang.Object pListener,
java.lang.String pMethodName,
int pIndex)
Adds a listener at a given position. |
L |
createListener(java.lang.Object pListener,
java.lang.String pMethodName)
Creates a new listener interface for calling the given method for the given object. |
java.lang.Object |
dispatchEvent(java.lang.Object... pEventParameter)
Dispatches the given events to all listeners. |
static java.lang.Object |
getCurrentDispatchObject()
Gets the current dispatch object. |
L |
getDefaultListener()
Gets the default listener. |
static java.lang.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 java.lang.Throwable |
getWrappedException(java.lang.Throwable pCause)
Gets the cause of an exception that is a wrapper exception, like InvocationTargetException . |
static java.lang.Throwable |
getWrappedExceptionAllowSilent(java.lang.Throwable pCause)
Gets the cause of an exception that is a wrapper exception, like InvocationTargetException . |
boolean |
isDispatchable()
Returns true, if dispatch will invoke any listener. |
static boolean |
isDispatchable(EventHandler pEventHandler)
Returns true, if dispatch will invoke any listener. |
boolean |
isDispatchEventsEnabled()
Gets whether event dispatching is enabled. |
void |
removeAllListeners()
Removes all known listeners. |
protected EventHandler.ListenerHandler |
removeHandler(int pIndex)
Removes the handler with given index. |
void |
removeListener(int pIndex)
Removes the listener at the position. |
void |
removeListener(java.lang.Object pListener)
Removes all listener methods added with the given object, or the listener, if an interface was added. |
void |
removeListener(java.lang.Object pListener,
java.lang.String pMethodName)
Removes the listener added with the method. |
void |
setDefaultListener(L pListener)
Sets the default listener. |
void |
setDefaultListener(java.lang.Object pListener,
java.lang.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(java.lang.Class<L> pListenerType, java.lang.Class... pParameterTypes)
pListenerType
- the listener type interface.pParameterTypes
- parameter types to check additional.public EventHandler(java.lang.Class<L> pListenerType, java.lang.String pListenerMethodName, java.lang.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(java.lang.Object pListener, java.lang.String pMethodName)
pListener
- the listener object.pMethodName
- the method name.public void addListener(IRunnable pListener)
pListener
- the listener.public void addListener(java.lang.Object pListener, java.lang.String pMethodName, int pIndex)
pListener
- the listener object.pMethodName
- the method name.pIndex
- the index to addprotected void addHandler(int pIndex, EventHandler.ListenerHandler pHandler)
pIndex
- the index in the listpHandler
- the handler to addprotected EventHandler.ListenerHandler removeHandler(int pIndex)
pIndex
- the index
public void removeListener(int pIndex)
pIndex
- the position.public void removeListener(java.lang.Object pListener)
pListener
- the listener.public void removeListener(java.lang.Object pListener, java.lang.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(java.lang.Object pListener, java.lang.String pMethodName)
pListener
- the listener object.pMethodName
- the method name.public L getDefaultListener()
public boolean isDispatchable()
public static boolean isDispatchable(EventHandler pEventHandler)
pEventHandler
- the event handler to check, if it is dispatchable.
public java.lang.Object dispatchEvent(java.lang.Object... pEventParameter) throws java.lang.Throwable
pEventParameter
- the event parameter.
java.lang.Throwable
- if an exception occurs.public L createListener(java.lang.Object pListener, java.lang.String pMethodName)
pListener
- the object.pMethodName
- the method.
public boolean isDispatchEventsEnabled()
true
if event dispatching is enabled, false
if it's disabledpublic void setDispatchEventsEnabled(boolean pEnabled)
pEnabled
- true
to enable dispatching, false
to ignore dispatchingpublic static java.lang.Object getLastDispatchedObject()
public static java.lang.Object getCurrentDispatchObject()
null
if no object was foundpublic static java.lang.Throwable getWrappedException(java.lang.Throwable pCause)
InvocationTargetException
.
pCause
- the wrapper exception
public static java.lang.Throwable getWrappedExceptionAllowSilent(java.lang.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 |