Package jadex.rules.state.javaimpl
Class OAVEventHandler
- java.lang.Object
-
- jadex.rules.state.javaimpl.OAVEventHandler
-
public class OAVEventHandler extends java.lang.Object
This class handles the collection and distribution OAV events to registered listeners.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set
added_objects
The objects that have been added in current change set.protected java.util.Set
beanevents
The collected bean events (may be added from external thread).protected java.util.List
directlisteners
The direct state listeners.protected java.util.List
listeners
The bunch state listeners.protected boolean
notifying
Flag that is only true, while listeners are being notified.protected java.util.Set
oavevents
The collected change events.protected java.util.Set
removed_objects
The objects that have been removed in current change set.protected IOAVState
state
The state.
-
Constructor Summary
Constructors Constructor Description OAVEventHandler(IOAVState state)
Create a new OAV event handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStateListener(IOAVStateListener listener, boolean bunch)
Add a new state listener.void
beanModified(java.lang.Object bean, OAVObjectType type, OAVAttributeType attr, java.lang.Object oldvalue, java.lang.Object newvalue)
Notification when an attribute value of a bean has been set.protected java.util.Set
createIdSet()
Create a set for holding object ids.void
notifyEventListeners()
Throw collected events and notify the listeners.protected void
notifyOneEvent(java.lang.Object evt)
Notify one event to all listeners.void
objectAdded(java.lang.Object id, OAVObjectType type, boolean root)
Notification when an object has been added to the state.void
objectModified(java.lang.Object id, OAVObjectType type, OAVAttributeType attr, java.lang.Object oldvalue, java.lang.Object newvalue)
Notification when an attribute value of an object has been set.void
objectRemoved(java.lang.Object id, OAVObjectType type)
Notification when an object has been removed from state.void
removeStateListener(IOAVStateListener listener)
Remove a state listener.
-
-
-
Field Detail
-
state
protected IOAVState state
The state.
-
listeners
protected java.util.List listeners
The bunch state listeners.
-
directlisteners
protected java.util.List directlisteners
The direct state listeners.
-
oavevents
protected java.util.Set oavevents
The collected change events.
-
beanevents
protected java.util.Set beanevents
The collected bean events (may be added from external thread).
-
removed_objects
protected java.util.Set removed_objects
The objects that have been removed in current change set.
-
added_objects
protected java.util.Set added_objects
The objects that have been added in current change set.
-
notifying
protected boolean notifying
Flag that is only true, while listeners are being notified.
-
-
Constructor Detail
-
OAVEventHandler
public OAVEventHandler(IOAVState state)
Create a new OAV event handler.
-
-
Method Detail
-
addStateListener
public void addStateListener(IOAVStateListener listener, boolean bunch)
Add a new state listener.- Parameters:
listener
- The state listener.
-
removeStateListener
public void removeStateListener(IOAVStateListener listener)
Remove a state listener.- Parameters:
listener
- The state listener.
-
notifyEventListeners
public void notifyEventListeners()
Throw collected events and notify the listeners.
-
notifyOneEvent
protected void notifyOneEvent(java.lang.Object evt)
Notify one event to all listeners.- Parameters:
evt
- The event.
-
objectModified
public void objectModified(java.lang.Object id, OAVObjectType type, OAVAttributeType attr, java.lang.Object oldvalue, java.lang.Object newvalue)
Notification when an attribute value of an object has been set.- Parameters:
id
- The object id.type
- The object type.attr
- The attribute type.oldvalue
- The oldvalue.newvalue
- The newvalue.
-
beanModified
public void beanModified(java.lang.Object bean, OAVObjectType type, OAVAttributeType attr, java.lang.Object oldvalue, java.lang.Object newvalue)
Notification when an attribute value of a bean has been set.- Parameters:
bean
- The bean.type
- The object type.attr
- The attribute type.oldvalue
- The oldvalue.newvalue
- The newvalue.
-
objectAdded
public void objectAdded(java.lang.Object id, OAVObjectType type, boolean root)
Notification when an object has been added to the state.- Parameters:
id
- The object id.type
- The object type.
-
objectRemoved
public void objectRemoved(java.lang.Object id, OAVObjectType type)
Notification when an object has been removed from state.- Parameters:
id
- The object id.type
- The object type.
-
createIdSet
protected java.util.Set createIdSet()
Create a set for holding object ids.
-
-