|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--CiaoJava.PLEventListener
This class listens events directly from the system event queue. Keeps a list of Prolog listeners associated with objects and event Ids. A key element of this implementation is that the Prolog listeners will be evaluated when the event raises, so the arguments of the listeners will be updated correctly in the Prolog side.
Field Summary | |
private static float |
FACTOR
|
private PLInterpreter |
interpreter
Interpreter to evaluate goal arguments. |
private java.util.Hashtable |
objTable
Object/event Hashtable. |
private PLConnection |
pl
Prolog connection for the goals to be launched when an event occurs. |
private java.awt.EventQueue |
queue
System queue |
private static int |
STARTING_CAPACITY
Internal constants. |
Constructor Summary | |
PLEventListener(PLConnection pl,
PLInterpreter interpreter)
Creates a new event listener. |
Method Summary | |
void |
addListener(java.lang.Object obj,
java.lang.Class ec,
PLTerm goal)
Inserts a new listener. |
void |
eventDispatched(java.awt.AWTEvent eventRaised)
Method called on each event queued on the system queue. |
void |
removeListener(java.lang.Object obj,
java.lang.Class ec,
PLTerm goal)
Removes a listener. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int STARTING_CAPACITY
private static final float FACTOR
private java.awt.EventQueue queue
private java.util.Hashtable objTable
private PLInterpreter interpreter
private PLConnection pl
Constructor Detail |
public PLEventListener(PLConnection pl, PLInterpreter interpreter)
AWTEventListener
class.pl
- Connection to the Prolog processinterpreter
- The PLInterpreter
object to be
used for the goal argument calculation.Method Detail |
public void addListener(java.lang.Object obj, java.lang.Class ec, PLTerm goal)
obj
- object on which the listener listens.ec
- event class that will be listened.goal
- Prolog goal that will be evaluated when the
event raises.public void removeListener(java.lang.Object obj, java.lang.Class ec, PLTerm goal)
obj
- object on which the listener listens.ec
- event class that is being listened.goal
- Prolog goal that will be evaluated when the
event raises.public void eventDispatched(java.awt.AWTEvent eventRaised)
ev
- AWTEvent
object representing the
event raised.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |