Package jade.tools.introspector.gui

Examples of jade.tools.introspector.gui.MainWindow


   Adds an agent to the debugged agents map, and asks the AMS to
   start debugging mode on that agent.
   */
  public boolean addAgent(AID name) {
    if(!windowMap.containsKey(name)) {
      MainWindow m = new MainWindow(guiSensor, name);
      myGUI.addWindow(m);
      windowMap.put(name, m);
     
      // Enable the following instruction if you want STEP_BY_STEP to
      // be the default debug mode
View Full Code Here


   that agent.
   */
  public void removeAgent(final AID name) {
    if(windowMap.containsKey(name)) {
      try {
        final MainWindow m = (MainWindow)windowMap.get(name);
        myGUI.closeInternal(m);
        windowMap.remove(name);
       
        stepByStepAgents.remove(name);
        slowAgents.remove(name);
View Full Code Here

   */
  public void doDelete() {
    AID amsId = getAMS();
    if (windowMap.containsKey(amsId)) {
      try {
        final MainWindow m = (MainWindow)windowMap.get(amsId);
        myGUI.closeInternal(m);
        windowMap.remove(amsId);
       
        stepByStepAgents.remove(amsId);
        slowAgents.remove(amsId);
View Full Code Here

          DeadAgent da = (DeadAgent)ev;
          ContainerID cid = da.getWhere();
          String container = cid.getName();
          AID agent = da.getAgent();
          allAgents.remove(agent);
          MainWindow m = (MainWindow)windowMap.get(agent);
          if(m != null) {
            myGUI.closeInternal(m);
            windowMap.remove(agent);
          }
          myGUI.removeAgent(container, agent);
        }
      });
     
      handlersTable.put(IntrospectionVocabulary.MOVEDAGENT, new EventHandler() {
        public void handle(Event ev) {
          MovedAgent ma = (MovedAgent)ev;
          AID agent = ma.getAgent();
          ContainerID from = ma.getFrom();
          myGUI.removeAgent(from.getName(), agent);
          ContainerID to = ma.getTo();
          myGUI.addAgent(to.getName(), agent);
         
          if (windowMap.containsKey(agent)) {
            MainWindow m = (MainWindow)windowMap.get(agent);
            // FIXME: We should clean behaviours and pending messages here
            requestDebugOn(agent);
          }
        }
      });
View Full Code Here

     
      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);
        }
       
      });
View Full Code Here

TOP

Related Classes of jade.tools.introspector.gui.MainWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.