unsw.cse.mica.agent
Class GUIAgent

java.lang.Object
  extended by unsw.cse.mica.agent.DefaultAgent2
      extended by unsw.cse.mica.agent.GUIAgent
All Implemented Interfaces:
Agent, MessageHandler
Direct Known Subclasses:
Debugger, LogDebugger, MobMaker, MobMaker2, MobSpawner

public abstract class GUIAgent
extends DefaultAgent2

The GUI Agent class encapsulates a SimpleAgentFrame into a DefaultAgent2 object. override the createComponents method to create and add content to the frame.

Author:
jhw

Field Summary
 
Fields inherited from class unsw.cse.mica.agent.DefaultAgent2
PARAM_NAME
 
Constructor Summary
GUIAgent()
           
GUIAgent(boolean synchronizeTransport)
           
 
Method Summary
abstract  void createComponents(MicaProperties args)
          Function that is called in the init method that should be overridden by subclasses.
 void init(MicaProperties args)
          Connect using the value given for param "name" in the args if the value exists, otherwise use the class name
 void terminate()
          Terminate the agent.
 
Methods inherited from class unsw.cse.mica.agent.DefaultAgent2
getTransport, handleDeletedMob, handleNewMob, handleReplacedMob, handleTypeManagerChanged, isATypeOf, setTransport
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GUIAgent

public GUIAgent()

GUIAgent

public GUIAgent(boolean synchronizeTransport)
Method Detail

init

public void init(MicaProperties args)
          throws MicaException
Description copied from class: DefaultAgent2
Connect using the value given for param "name" in the args if the value exists, otherwise use the class name

Specified by:
init in interface Agent
Overrides:
init in class DefaultAgent2
Parameters:
args - Additional arguments provided to the agent. If the agent is started from with the 'Runner' tool, the args array contains the values provided from within the runner's XML configuration file. Otherwise, the exact contents will depend on the calling method.
Throws:
MicaException

createComponents

public abstract void createComponents(MicaProperties args)
                               throws MicaException
Function that is called in the init method that should be overridden by subclasses. Subclasses should use this method to construct the elements for their GUIs and place the elements in frame.

Parameters:
args - the args passed to the init method
Throws:
MicaException - If any errors occur construction the GUI components.

terminate

public void terminate()
               throws MicaException
Description copied from interface: Agent
Terminate the agent.

The agent should perform any necessary cleaning up in preparation for the process shutting down. This will generally mean doing the reverse of whatever occurred within the init method.

The usual contents of the terminate method would be:

Specified by:
terminate in interface Agent
Overrides:
terminate in class DefaultAgent2
Throws:
MicaException