|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.AWTEventMulticaster com.apelon.dts.client.events.DTSEventMulticaster
public class DTSEventMulticaster
A class which implements efficient and thread-safe multi-cast event dispatching for the DTS events defined in the com.apelon.dts'client.events 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. However, event listeners added during the process of an event dispatch operation will not be notified of the event currently being dispatched. An example of how this class is used to implement SubsetQuery which fires "subset action occured" events:
public SubsetQuery extends BasicQuery {
SubsetListener subsetListener = null;
public synchronized void addSubsetListener(SubsetListener sl) {
subsetListener = DTSEventMulticaster.add(subsetListener, sl);
}
public synchronized void removeSubsetListener(SubsetListener sl) {
subsetListener = DTSEventMulticaster.remove(subsetListener, sl);
}
protected void fireSubsetEvent(SubsetEvent e) {
if (subsetListener != null) {
subsetListener.subsetActionOccurred(e);
}
}
}
Any uncaught exception in the listeners during event multicast is logged as error.
Field Summary |
---|
Fields inherited from class java.awt.AWTEventMulticaster |
---|
a, b |
Constructor Summary | |
---|---|
protected |
DTSEventMulticaster(EventListener a,
EventListener b)
Creates an instance of the DTSEventMulticaster class
which chains listener-a with listener-b. |
Method Summary | |
---|---|
static ClassifyListener |
add(ClassifyListener a,
ClassifyListener b)
Adds classify-listener-a with classify-listener-b and returns the resulting multicast listener. |
static ConceptListener |
add(ConceptListener a,
ConceptListener b)
Adds concept-listener-a with concept-listener-b and returns the resulting multicast listener. |
static KBTypeListener |
add(KBTypeListener a,
KBTypeListener b)
Adds kbtype-listener-a with kbtype-listener-b and returns the resulting multicast listener. |
static NamespaceListener |
add(NamespaceListener a,
NamespaceListener b)
Adds namespace-listener-a with namespace-listener-b and returns the resulting multicast listener. |
static SubsetListener |
add(SubsetListener a,
SubsetListener b)
Adds subset-listener-a with subset-listener-b and returns the resulting multicast listener. |
static TermListener |
add(TermListener a,
TermListener b)
Adds term-listener-a with term-listener-b and returns the resulting multicast listener. |
protected static EventListener |
addInternal(EventListener a,
EventListener b)
Returns the resulting multicast listener from adding listener-a and listener-b together. |
void |
classifyActionOccurred(ClassifyEvent event)
Will chain the call to the classifyActionOccurred routine of all
registered listeners. |
void |
conceptActionOccurred(ConceptEvent event)
Will chain the call to the conceptActionOccurred routine of all
registered listeners. |
void |
kbtypeActionOccurred(KBTypeEvent event)
Will chain the call to the kbtypeActionOccurred routine of all
registered listeners. |
void |
namespaceActionOccurred(NamespaceEvent event)
Will chain the call to the namespaceActionOccurred routine of all
registered listeners. |
static ClassifyListener |
remove(ClassifyListener listener,
ClassifyListener oldListener)
Removes the old classify-listener from classify-listener-l and returns the resulting multicast listener. |
static ConceptListener |
remove(ConceptListener listener,
ConceptListener oldListener)
Removes the old concept-listener from concept-listener-l and returns the resulting multicast listener. |
protected EventListener |
remove(EventListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener. |
static KBTypeListener |
remove(KBTypeListener listener,
KBTypeListener oldListener)
Removes the old kbtype-listener from kbtype-listener-l and returns the resulting multicast listener. |
static NamespaceListener |
remove(NamespaceListener listener,
NamespaceListener oldListener)
Removes the old namespace-listener from namespace-listener-l and returns the resulting multicast listener. |
static SubsetListener |
remove(SubsetListener listener,
SubsetListener oldListener)
Removes the old subset-listener from subset-listener-l and returns the resulting multicast listener. |
static TermListener |
remove(TermListener listener,
TermListener oldListener)
Removes the old term-listener from term-listener-l and returns the resulting multicast listener. |
protected static EventListener |
removeInternal(EventListener l,
EventListener oldl)
Returns the resulting multicast listener after removing the old listener from listener-l. |
protected static void |
save(ObjectOutputStream s,
String k,
EventListener l)
|
void |
subsetActionOccurred(SubsetEvent event)
Will chain the call to the subsetActionOccurred routine of all
registered listeners. |
void |
termActionOccurred(TermEvent event)
Will chain the call to the termActionOccurred routine of all
registered listeners. |
Methods inherited from class java.awt.AWTEventMulticaster |
---|
actionPerformed, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, adjustmentValueChanged, ancestorMoved, ancestorResized, caretPositionChanged, componentAdded, componentHidden, componentMoved, componentRemoved, componentResized, componentShown, focusGained, focusLost, getListeners, hierarchyChanged, inputMethodTextChanged, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, saveInternal, textValueChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DTSEventMulticaster(EventListener a, EventListener b)
DTSEventMulticaster
class
which chains listener-a with listener-b.
a
- listener-ab
- listener-bEventListener
Method Detail |
---|
public static NamespaceListener add(NamespaceListener a, NamespaceListener b)
a
- namespace-listener-ab
- namespace-listener-b
NamespaceListener
public static KBTypeListener add(KBTypeListener a, KBTypeListener b)
a
- kbtype-listener-ab
- kbtype-listener-b
KBTypeListener
public static ConceptListener add(ConceptListener a, ConceptListener b)
a
- concept-listener-ab
- concept-listener-b
ConceptListener
public static TermListener add(TermListener a, TermListener b)
a
- term-listener-ab
- term-listener-b
TermListener
public static ClassifyListener add(ClassifyListener a, ClassifyListener b)
a
- classify-listener-ab
- classify-listener-b
ClassifyListener
public static SubsetListener add(SubsetListener a, SubsetListener b)
a
- subset-listener-ab
- subset-listener-b
SubsetListener
public static NamespaceListener remove(NamespaceListener listener, NamespaceListener oldListener)
listener
- namespace-listeneroldListener
- the namespace-listener being removed
NamespaceListener
public static KBTypeListener remove(KBTypeListener listener, KBTypeListener oldListener)
listener
- kbtype-listeneroldListener
- the kbtype-listener being removed
KBTypeListener
public static ConceptListener remove(ConceptListener listener, ConceptListener oldListener)
listener
- concept-listeneroldListener
- the concept-listener being removed
ConceptListener
public static TermListener remove(TermListener listener, TermListener oldListener)
listener
- term-listeneroldListener
- the term-listener being removed
TermListener
public static ClassifyListener remove(ClassifyListener listener, ClassifyListener oldListener)
listener
- classify-listeneroldListener
- the classify-listener being removed
ClassifyListener
public static SubsetListener remove(SubsetListener listener, SubsetListener oldListener)
listener
- subset-listeneroldListener
- the subset-listener being removed
SubsetListener
protected static EventListener addInternal(EventListener a, EventListener b)
a
- event listener-ab
- event listener-bprotected EventListener remove(EventListener oldl)
remove
in class AWTEventMulticaster
oldl
- the listener to be removedprotected static EventListener removeInternal(EventListener l, EventListener oldl)
l
- the listener being removed fromoldl
- the listener being removedprotected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException
IOException
public void namespaceActionOccurred(NamespaceEvent event)
namespaceActionOccurred
routine of all
registered listeners. Any unhandled exception will be caught and logged as error.
namespaceActionOccurred
in interface NamespaceListener
event
- NamespaceEvent
object.public void kbtypeActionOccurred(KBTypeEvent event)
kbtypeActionOccurred
routine of all
registered listeners. Any unhandled exception will be caught and logged as error.
kbtypeActionOccurred
in interface KBTypeListener
event
- KBTypeEvent
object.public void conceptActionOccurred(ConceptEvent event)
conceptActionOccurred
routine of all
registered listeners. Any unhandled exception will be caught and logged as error.
conceptActionOccurred
in interface ConceptListener
event
- ConceptEvent
object.public void termActionOccurred(TermEvent event)
termActionOccurred
routine of all
registered listeners. Any unhandled exception will be caught and logged as error.
termActionOccurred
in interface TermListener
event
- TermEvent
object.public void classifyActionOccurred(ClassifyEvent event)
classifyActionOccurred
routine of all
registered listeners. Any unhandled exception will be caught and logged as error.
classifyActionOccurred
in interface ClassifyListener
event
- ClassifyEvent
object.public void subsetActionOccurred(SubsetEvent event)
subsetActionOccurred
routine of all
registered listeners. Any unhandled exception will be caught and logged as error.
subsetActionOccurred
in interface SubsetListener
event
- SubsetEvent
object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |