agentland.gui
Class GuiMaker

java.lang.Object
  |
  +--agentland.gui.GuiMaker
All Implemented Interfaces:
GuiElement, Serializable
Direct Known Subclasses:
AgendaGuiMaker, CommonGuiMaker, FacilitatorGuiMaker, GuiAskerMaker, GuiBoggleClientMaker, GuiBoggleServerMaker, MeetingAgendaGuiMaker, PhoneGuiMaker, SecurityManagerGuiMaker, TestGuiMaker, TestGuiMaker, TextGuiMaker, ViewerMaker

public abstract class GuiMaker
extends Object
implements Serializable, GuiElement

This is the object that should be used for passing GUIs around (well, children of this object). On one hand, by passing gui maker rather than a gui object itself, you avoid serialization problems with awt elements in Java. On the other hand, this object provides the gui itself with many useful abstractions. Created: Sun Dec 10 13:26:16 2000

See Also:
Serialized Form

Field Summary
protected  Container container
           
protected  GuiFamily family
           
protected  String familyClassName
           
protected  String familyName
           
protected  GuiManagerAgent host
           
protected  String name
           
protected  AgentID parent
           
protected  boolean visible
           
 
Constructor Summary
GuiMaker()
           
GuiMaker(String name, AgentID parent)
          Creates a new GuiMaker instance.
 
Method Summary
 void addSpy(String name)
          Allows the gui to subscribe to secrets from the outside world
 boolean equals(Object o)
           
 Container getContainer()
          If a gui has been produced already, returns currently active Container.
 String getFamily()
           
 GuiFamily getFamilyObject()
           
abstract  Container getGui()
          Has to be overriden by children; this is where you produce the object to be displayed.
 String getName()
           
 AgentID getParent()
          Get the value of parent.
 int hashCode()
           
 void hideMe()
          Makes a call to the underlying GuiManger asking it to hide this gui
protected  void init()
          This method gets called when the GuiMaker arrives at the GuiManager and can start connecting itself to the rest of the world.
 void installed()
          Called when the container element is first installed by its owning family (so it can do things like have sub- components request focus.)
 void killMe()
          Causes this gui to be killed and discarded
 void log(int level, String msg)
           
 void log(String msg)
           
 void log(String level, String msg)
           
 void notify(String name, Serializable details)
          Allows the guis to send out notifications
 Agent reliesOn(AgentID aid)
          Uses the host to perform the reliesOn call
 Agent reliesOn(String occ)
          Uses the host to perform the reliesOn call
 void setFamily(String family)
           
 void setFamilyClass(String className)
           
 void setHost(GuiManagerAgent a, GuiFamily fam)
           
 void setName(String name)
           
 void setParent(AgentID v)
          Set the value of parent.
 void showMe()
          Makes a call to the underlying GuiManger asking it to make this gui visible
 void tell(Secret secret)
          Allows the gui to receive secrets from the outside world
 String toString()
           
 boolean visible()
          Returns true if the maker thinks its gui should be on display right now; false if the gui can be hidden.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

familyName

protected String familyName

host

protected GuiManagerAgent host

family

protected GuiFamily family

familyClassName

protected String familyClassName

parent

protected AgentID parent

container

protected Container container

visible

protected boolean visible
Constructor Detail

GuiMaker

public GuiMaker()

GuiMaker

public GuiMaker(String name,
                AgentID parent)
Creates a new GuiMaker instance.
Parameters:
name - the name of this gui object -- it will be used as a title for the window or frame that this gui object gets put in
parent - parent is the agent that this gui is controlling;
Method Detail

getParent

public AgentID getParent()
Get the value of parent.
Returns:
Value of parent.

setParent

public void setParent(AgentID v)
Set the value of parent.
Parameters:
v - Value to assign to parent.

getName

public String getName()
Specified by:
getName in interface GuiElement

setName

public void setName(String name)

getFamily

public String getFamily()

setFamily

public void setFamily(String family)

setFamilyClass

public void setFamilyClass(String className)

getFamilyObject

public GuiFamily getFamilyObject()

setHost

public final void setHost(GuiManagerAgent a,
                          GuiFamily fam)

init

protected void init()
This method gets called when the GuiMaker arrives at the GuiManager and can start connecting itself to the rest of the world. You should override this method and do all of your reliesOn and spy adding, etc, in here.

getGui

public abstract Container getGui()
Has to be overriden by children; this is where you produce the object to be displayed. You produce it in the vm of the GuiManger -- that way we avoid all the serialization issues with graphical elements in Java.
Returns:
something that can be displayed in a frame

getContainer

public Container getContainer()
If a gui has been produced already, returns currently active Container. Otherwise calls getGui() to create a new gui.
Specified by:
getContainer in interface GuiElement

installed

public void installed()
Called when the container element is first installed by its owning family (so it can do things like have sub- components request focus.)
Specified by:
installed in interface GuiElement

reliesOn

public Agent reliesOn(AgentID aid)
Uses the host to perform the reliesOn call

reliesOn

public Agent reliesOn(String occ)
Uses the host to perform the reliesOn call

log

public void log(String msg)

log

public void log(int level,
                String msg)

log

public void log(String level,
                String msg)

tell

public void tell(Secret secret)
Allows the gui to receive secrets from the outside world
Parameters:
secret - a Secret value

notify

public void notify(String name,
                   Serializable details)
Allows the guis to send out notifications

addSpy

public void addSpy(String name)
Allows the gui to subscribe to secrets from the outside world
Parameters:
name - name of the secret

showMe

public void showMe()
Makes a call to the underlying GuiManger asking it to make this gui visible

hideMe

public void hideMe()
Makes a call to the underlying GuiManger asking it to hide this gui

visible

public boolean visible()
Returns true if the maker thinks its gui should be on display right now; false if the gui can be hidden.

killMe

public void killMe()
Causes this gui to be killed and discarded

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object