|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.AbstractSignal
eu.webtoolkit.jwt.AbstractEventSignal
public abstract class AbstractEventSignal
Abstract base class for event signals.
Event signals are signals that may be triggered from the browser. Listeners that are added to this signal may be implemented in Java only or in JavaScript only or have both Java and JavaScript implementations.
| Nested Class Summary | |
|---|---|
static class |
AbstractEventSignal.AutoLearnListener
A listener whose JavaScript behavior is learned on its first invocation. |
static class |
AbstractEventSignal.JavaScriptListener
A JavaScript-only listener. |
static class |
AbstractEventSignal.LearningListener
An abstract base class for a listener with (learned) JavaScript behavior. |
static class |
AbstractEventSignal.PreLearnListener
A listener whose JavaScript behavior is learned in advance. |
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.AbstractSignal |
|---|
AbstractSignal.Connection |
| Method Summary | |
|---|---|
void |
addListener(JSlot slot)
Adds a JavaScript event listener. |
void |
addListener(java.lang.String javascript)
Adds a JavaScript event listener. |
void |
addListener(WObject listenerOwner,
AbstractEventSignal.AutoLearnListener listener)
Adds a learning listener to this signal. |
void |
addListener(WObject listenerOwner,
AbstractEventSignal.JavaScriptListener listener)
Adds a learning listener to this signal. |
void |
addListener(WObject listenerOwner,
AbstractEventSignal.LearningListener listener)
Adds a learning listener to this signal. |
void |
addListener(WObject listenerOwner,
AbstractEventSignal.PreLearnListener listener)
Adds a learning listener to this signal. |
protected java.lang.String |
createUserEventCall(java.lang.String jsObject,
java.lang.String jsEvent,
java.lang.String name,
java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3,
java.lang.String arg4,
java.lang.String arg5,
java.lang.String arg6)
|
void |
disconnect(AbstractSignal.Connection connection)
|
protected int |
getListenerCount()
Returns the number of connected listeners. |
boolean |
isConnected()
Returns whether at least one event listener has been connected to this signal. |
boolean |
isDefaultActionPrevented()
Returns whether propagation of the event is prevented. |
boolean |
isPropagationPrevented()
Returns whether the default action is prevented. |
void |
preventDefaultAction()
Prevents the default action associated with this event. |
void |
preventDefaultAction(boolean prevent)
Prevents the default action associated with this event. |
void |
preventPropagation()
Prevents the default action associated with this event. |
void |
preventPropagation(boolean prevent)
Prevents the default action associated with this event. |
void |
removeListener(AbstractEventSignal.LearningListener listener)
Remove a learning listener from this signal. |
void |
trigger()
Triggers the signal. |
| Methods inherited from class eu.webtoolkit.jwt.AbstractSignal |
|---|
addListener, getListeners, isBlocked, removeListener, setBlocked |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void addListener(WObject listenerOwner,
AbstractEventSignal.LearningListener listener)
An owner object may be passed when the listener is implemented using an
anonymous inner class. In that case the owner object should be the
enclosing object of the listener object, and this is used to bind the
lifetime of the listener: when the owner object is garbage collected, the
listener will be freed as well. This avoids the most common reason for
memory leaks in Java implementations of the Observer pattern: the owner
object will not get garbage collected because of the (anonymous) listener
object having a reference to it, even if the receiver object is no longer
referenced from anywhere. When the owner object is not null,
the listener is stored using a strong reference in the owner object, and
using a weak reference in the signal.
Note: The receiver is currently not yet used.
listenerOwner - if not null, the enclosing object for an
anonymous listenerlistener - the listener
public void addListener(WObject listenerOwner,
AbstractEventSignal.AutoLearnListener listener)
addListener(WObject, LearningListener)
public void addListener(WObject listenerOwner,
AbstractEventSignal.PreLearnListener listener)
addListener(WObject, LearningListener)
public void addListener(WObject listenerOwner,
AbstractEventSignal.JavaScriptListener listener)
addListener(WObject, LearningListener)public void removeListener(AbstractEventSignal.LearningListener listener)
listener - a learning listener that was previously addedprotected int getListenerCount()
AbstractSignal
getListenerCount in class AbstractSignalpublic boolean isConnected()
AbstractSignal
isConnected in class AbstractSignalpublic boolean isPropagationPrevented()
preventPropagation(boolean)public boolean isDefaultActionPrevented()
preventDefaultAction(boolean)public void trigger()
The AbstractEventSignal.LearningListener.trigger() method of all listeners added to this signal are triggered.
public void addListener(JSlot slot)
slot - the JavaScript event listenerpublic void addListener(java.lang.String javascript)
function(element, event)
{
...
}
javascript - the JavaScript function.public void preventDefaultAction(boolean prevent)
This prevents the default browser action associated with this event.
prevent - whether the default action should be prevented.public void preventDefaultAction()
This prevents the default browser action associated with this event.
public void preventPropagation(boolean prevent)
This prevents the event propagation to ancestors.
prevent - whether the default action should be prevented.public final void preventPropagation()
This prevents both the default browser action associated with this event as well as the event bubbling up or cascading its hierarchy.
public void disconnect(AbstractSignal.Connection connection)
protected java.lang.String createUserEventCall(java.lang.String jsObject,
java.lang.String jsEvent,
java.lang.String name,
java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3,
java.lang.String arg4,
java.lang.String arg5,
java.lang.String arg6)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||