All Packages Class Hierarchy This Package Previous Next Index
Class jcsp.awt.event.EventSourceFilter
java.lang.Object
|
+----jcsp.awt.event.EventSourceFilter
- public class EventSourceFilter
- extends Object
- implements CSProcess
Process Diagram
___________________
eventIn | | sourceOut
---->----| EventSourcefilter |----->-----
|___________________|
Description
The EventIDFilter is a process which has an infinite loop which waits
for Objects of type AWTEvent on the eventIn Channel. The process then
extracts the event Source from the AWTEvent Object and sends this down
the idOut Channel.
Channel Protocols
| Input Channels |
| eventIn |
java.awt.AWTEvent |
The event that the Source is required from |
| Any other Class |
If any other Object is sent down the eventIn Channel a
ClassCastException will be thrown by the Runtime system.
|
| Output Channels |
| sourceOut |
java.lang.Object |
The event Source of the AWTEvent Object sent down the eventIn Channel |
Example
import jcsp.awt.*;
import jcsp.awt.event.*;
import jcsp.lang.*;
:
:
{
final Channel event = new One2OneChannel();
final Channel source = new One2OneChannel();
ActiveButton c = new ActiveButton("Active");
add(c);
c.addFocusEventChannel(event);
new Parallel(new CSProcess[] {
c,
new EventSourceFilter(event, source),
new CSProcess() {
public void run() {
while (true) {
Object o = source.read();
System.out.println("FocusEvent source='" + o);
}
}
}
}).run();
}
}
- Author:
- P.D.Austin
-
EventSourceFilter(ChannelInput, ChannelOutput)
- Construct a new EventIDFilter with the specified Channels.
-
run()
- The main body of the process.
EventSourceFilter
public EventSourceFilter(ChannelInput eventIn,
ChannelOutput sourceOut)
- Construct a new EventIDFilter with the specified Channels.
- Parameters:
- eventIn - The Channel AWTEvents are received from
- sourceOut - The Channel the Events Source is sent down
run
public void run()
- The main body of the process. Executes the functionality described above.
All Packages Class Hierarchy This Package Previous Next Index