handlers.put(IntrospectionVocabulary.ADDEDBEHAVIOUR, new EventHandler() {
public void handle(Event ev) {
AddedBehaviour ab = (AddedBehaviour)ev;
AID agent = ab.getAgent();
MainWindow wnd = (MainWindow)windowMap.get(agent);
if(wnd != null)
myGUI.behaviourAdded(wnd, ab);
}
});
handlers.put(IntrospectionVocabulary.REMOVEDBEHAVIOUR, new EventHandler() {
public void handle(Event ev) {
RemovedBehaviour rb = (RemovedBehaviour)ev;
AID agent = rb.getAgent();
MainWindow wnd = (MainWindow)windowMap.get(agent);
if(wnd != null)
myGUI.behaviourRemoved(wnd, rb);
}
});
handlers.put(IntrospectionVocabulary.CHANGEDBEHAVIOURSTATE, new EventHandler() {
public void handle(Event ev) {
ChangedBehaviourState cs = (ChangedBehaviourState)ev;
AID agent = cs.getAgent();
MainWindow wnd = (MainWindow)windowMap.get(agent);
if(wnd != null) {
myGUI.behaviourChangeState(wnd, cs);
}
if (stepByStepAgents.contains(agent)) {
return;
}
if (slowAgents.contains(agent)) {
try {
Thread.sleep(500);
}
catch (InterruptedException ie) {
// The introspector is probably being killed
}
}
proceed(agent);
}
});
handlers.put(IntrospectionVocabulary.SENTMESSAGE, new EventHandler() {
public void handle(Event ev) {
SentMessage sm = (SentMessage)ev;
AID sender = sm.getSender();
MainWindow wnd = (MainWindow)windowMap.get(sender);
if(wnd != null)
myGUI.messageSent(wnd, sm);
}
});
handlers.put(IntrospectionVocabulary.RECEIVEDMESSAGE, new EventHandler() {
public void handle(Event ev) {
ReceivedMessage rm = (ReceivedMessage)ev;
AID receiver = rm.getReceiver();
MainWindow wnd = (MainWindow)windowMap.get(receiver);
if(wnd != null)
myGUI.messageReceived(wnd, rm);
}
});
handlers.put(IntrospectionVocabulary.POSTEDMESSAGE, new EventHandler() {
public void handle(Event ev) {
PostedMessage pm = (PostedMessage)ev;
AID receiver = pm.getReceiver();
MainWindow wnd = (MainWindow)windowMap.get(receiver);
if(wnd != null)
myGUI.messagePosted(wnd, pm);
}
});
handlers.put(IntrospectionVocabulary.CHANGEDAGENTSTATE, new EventHandler() {
public void handle(Event ev) {
ChangedAgentState cas = (ChangedAgentState)ev;
AID agent = cas.getAgent();
MainWindow wnd = (MainWindow)windowMap.get(agent);
if(wnd != null)
myGUI.changedAgentState(wnd, cas);
}
});