edu.turtlekit2.ui
Class BoardAgent

java.lang.Object
  extended by madkit.kernel.AbstractAgent
      extended by madkit.kernel.Agent
          extended by edu.turtlekit2.ui.BoardAgent
All Implemented Interfaces:
Serializable, Runnable

public class BoardAgent
extends madkit.kernel.Agent

An agent that handles the graphics management. It connects agents with a GUI with the Simulation Board. To display a graphical component, an agent has to send a GUIMessage to its group "UIManager": sendMessage(Tk2Launcher.COMMUNITY, getSimulationGroup(), "UIManager", new GUIMessage<Component>(ComponentToDisplay, SimulationBoard.ZONE, "NameOfTheComponent")); or sendMessage(Tk2Launcher.COMMUNITY, getSimulationGroup(), "UIManager", new GUIMessage<Component>(ComponentToDisplay, "NameOfTheComponent")); ZONES are disabled except for SimulationBoard.BUTTON_ZONE

Version:
0.9 - 4/2010
Author:
G. Beurier
See Also:
SimulationBoard, GUIMessage.GUIMessage(Object, int, String), GUIMessage.GUIMessage(Object, String), Serialized Form

Field Summary
 SimulationBoard myGUI
           
 
Constructor Summary
BoardAgent(String simulationName)
           
 
Method Summary
 void activate()
           
 void computeMessage(GUIMessage<JComponent> msg)
          Checks mailBox and forwards message to the Simulation Board.
 void live()
          Life cycle of the Board Agent.
 
Methods inherited from class madkit.kernel.Agent
connectAgencyToAgency, createPlace, createPlace, enableMobility, enableMobility, exitImmediatlyOnKill, getAgencyNamed, joinPlace, joinPlace, joinPlace, pause, receiveMessage, run, waitNextMessage, waitNextMessage
 
Methods inherited from class madkit.kernel.AbstractAgent
broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, debug, disposeMyGUI, end, foundGroup, getAddress, getAgentInformation, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getCurrentKernelAddress, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, hashCode, initGUI, isBelongingToGroup, isBelongingToGroup, isCommunity, isGroup, isGroup, isMemberOf, isMemberOf, isMessageBoxEmpty, isRole, isRole, joinGroup, killAgent, launchAgent, launchAgent, leaveGroup, leaveGroup, leaveRole, leaveRole, nextMessage, print, println, redisplayMyGUI, requestRole, requestRole, requestRole, restoreAgent, sendMessage, sendMessage, sendMessage, setBean, setController, setDebug, setGUIObject, setName, setOutput, setOutputWriter, toString, windowClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myGUI

public SimulationBoard myGUI
Constructor Detail

BoardAgent

public BoardAgent(String simulationName)
Method Detail

activate

public void activate()
Overrides:
activate in class madkit.kernel.AbstractAgent

live

public void live()
Life cycle of the Board Agent. Only computes messages.

Overrides:
live in class madkit.kernel.Agent

computeMessage

public final void computeMessage(GUIMessage<JComponent> msg)
Checks mailBox and forwards message to the Simulation Board.

Parameters:
msg - - the graphical message