|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.lwuit.util.EventDispatcher
public class EventDispatcher
Handles event dispatching while guaranteeing that all events would be fired properly on the EDT regardless of their source. This class handles listener registration/removal in a safe and uniform way.
Constructor Summary | |
---|---|
EventDispatcher()
|
Method Summary | |
---|---|
void |
addListener(java.lang.Object listener)
Add a listener to the dispatcher that would receive the events when they occurs |
void |
fireActionEvent(ActionEvent ev)
Fires the event safely on the EDT without risk of concurrency errors |
void |
fireDataChangeEvent(int index,
int type)
Fires the event safely on the EDT without risk of concurrency errors |
void |
fireFocus(Component c)
Fires the event safely on the EDT without risk of concurrency errors |
void |
fireSelectionEvent(int oldSelection,
int newSelection)
Fires the event safely on the EDT without risk of concurrency errors |
void |
fireStyleChangeEvent(java.lang.String property,
Style source)
Fires the style change even to the listeners |
java.util.Vector |
getListenerVector()
Returns the vector of the listeners |
boolean |
hasListeners()
Returns true if the event dispatcher has registered listeners |
boolean |
isBlocking()
Indicates whether this dispatcher blocks when firing events or not, normally a dispatcher uses callSeriallyAndWait() to be 100% synchronos with event delivery however this method is very slow. |
void |
removeListener(java.lang.Object listener)
Remove the listener from the dispatcher |
void |
setBlocking(boolean blocking)
Indicates whether this dispatcher blocks when firing events or not, normally a dispatcher uses callSeriallyAndWait() to be 100% synchronos with event delivery however this method is very slow. |
static void |
setFireStyleEventsOnNonEDT(boolean fire)
When set to true, style events will be dispatched even from non-EDT threads. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventDispatcher()
Method Detail |
---|
public static void setFireStyleEventsOnNonEDT(boolean fire)
fire
- true to fire on non-EDT, false otherwisepublic void addListener(java.lang.Object listener)
listener
- a dispatcher listener to addpublic java.util.Vector getListenerVector()
public void removeListener(java.lang.Object listener)
listener
- a dispatcher listener to removepublic void fireDataChangeEvent(int index, int type)
index
- the index of the eventtype
- the type of the eventpublic void fireStyleChangeEvent(java.lang.String property, Style source)
property
- the property name for the eventsource
- the style firing the eventpublic void fireActionEvent(ActionEvent ev)
ev
- the ActionEvent to fire to the listenerspublic void fireSelectionEvent(int oldSelection, int newSelection)
oldSelection
- old selectionnewSelection
- new selectionpublic void fireFocus(Component c)
c
- the Component that gets the focus eventpublic boolean hasListeners()
public boolean isBlocking()
public void setBlocking(boolean blocking)
blocking
- the blocking value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |