|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.web3d.vrml.scripting.sai.FieldListenerMulticaster
public class FieldListenerMulticaster
A class which implements efficient and thread-safe multi-cast event dispatching for the events defined in this package.
This class will manage an immutable structure consisting of a chain of event listeners and will dispatch events to those listeners. Because the structure is immutable, it is safe to use this API to add/remove listeners during the process of an event dispatch operation.
An example of how this class could be used to implement a new component which fires "action" events:
public myComponent extends Component {
X3DFieldEventListener nodeListener = null;
public void addFieldListener(X3DFieldEventListener l) {
nodeListener = FieldListenerMulticaster.add(nodeListener, l);
}
public void removeFieldListener(X3DFieldEventListener l) {
nodeListener = FieldListenerMulticaster.remove(nodeListener, l);
}
public void fireFieldChanged(int index) {
if(nodeListener != null) {
nodeListener.fieldChanged(index);
}
}
| Constructor Summary | |
|---|---|
FieldListenerMulticaster(X3DFieldEventListener a,
X3DFieldEventListener b)
Creates an event multicaster instance which chains listener-a with listener-b. |
|
| Method Summary | |
|---|---|
static X3DFieldEventListener |
add(X3DFieldEventListener a,
X3DFieldEventListener b)
Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener. |
void |
readableFieldChanged(X3DFieldEvent evt)
Send a field change notification. |
X3DFieldEventListener |
remove(X3DFieldEventListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener. |
static X3DFieldEventListener |
remove(X3DFieldEventListener l,
X3DFieldEventListener oldl)
Removes the old component-listener from component-listener-l and returns the resulting multicast listener. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FieldListenerMulticaster(X3DFieldEventListener a,
X3DFieldEventListener b)
a and b
should not be null, though implementations may vary in
choosing whether or not to throw NullPointerException
in that case.
a - listener-ab - listener-b| Method Detail |
|---|
public X3DFieldEventListener remove(X3DFieldEventListener oldl)
oldl - the listener to be removed
public static X3DFieldEventListener add(X3DFieldEventListener a,
X3DFieldEventListener b)
a - input-method-listener-ab - input-method-listener-b
public static X3DFieldEventListener remove(X3DFieldEventListener l,
X3DFieldEventListener oldl)
l - component-listener-loldl - the component-listener being removedpublic void readableFieldChanged(X3DFieldEvent evt)
readableFieldChanged in interface X3DFieldEventListenerevt - An event describing what happened
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||