ix.ip2
Class Ip2

java.lang.Object
  extended by ix.icore.IXAgent
      extended by ix.ip2.Ip2
Direct Known Subclasses:
Ip2Applet.AppletIp2, Ip2Example, Ip2Test, IPlan, IServe, ISim, MultiAgentIp2, PlainIp2, Postix, SimpleExpandingSimulator

public class Ip2
extends IXAgent

The generic I-P2 class and application main program


Nested Class Summary
 class Ip2.AddExtensionsHandler
           
 class Ip2.AddHandlersHandler
           
 
Field Summary
protected  AgendaViewer activityViewer
           
protected  java.lang.String agentTypeName
           
protected  AnnotationViewer annotationViewer
           
(package private)  boolean classic
           
protected  PanelController controller
           
protected  Domain domain
           
protected  Ip2Frame frame
           
protected  AgendaViewer issueViewer
           
protected  java.lang.String logoImage
           
protected  java.lang.String logoLine1
           
protected  java.lang.String logoLine2
           
protected  ProcessModelManager modelManager
           
protected  IPlanOptionManager optionManager
           
protected  java.util.List<java.lang.Runnable> resetHooks
           
protected  boolean showOptions
           
protected  StateViewer stateViewer
           
 
Fields inherited from class ix.icore.IXAgent
contactManager, displayName, eventLogger, exitHooks, initialDisplayName, ipcName, ipcStrategyName, iSimTimer, mainAgent, nameListeners, startupDate, startupHooks, symbolName, textFrame
 
Constructor Summary
  Ip2()
           
protected Ip2(boolean setAgent)
          Constructor for subclasses that need to creat a second agent.
 
Method Summary
 void addAboutInfo(java.util.List about)
          Called to add "About" information.
 void addForwardingHandler(java.lang.String verb, AgentRelationship rel, boolean reportBack)
           
protected  void addHandlers()
          Install any built-in issue and activity handlers.
protected  void addHandlers(java.util.List classNames)
          Add one instance of each of the specified classes as a handler for issues, activities, or both, as appropriate.
 void addResetHook(java.lang.Runnable hook)
          Records an object that will be run when this panel is asked to reset.
 void addTest(TestElement test)
          Adds the specified test to the main frame's "Test" menu.
protected  void addTestMenuItems()
          Called when the main frame is set up to add items to the frame menu bar's "Test" menu.
 void addTool(ToolController tc)
          Records the tool and adds an entry to the main frame's "Tools" menu.
 void clearAllButState()
           
 void clearModel()
          Remove everything in the model in the current context.
protected  void completeStartup()
          Called in the AWT event thread to make the main GUI frame visible and perform any additional setup that ought to be done in that thread.
protected  void do_reloadViewers()
           
 java.lang.Object ensureTool(java.lang.String toolName)
          Returns the tool of the specified name, causing it to be created if it does not already exist.
 java.util.SortedSet getActivityPatternSyntaxes()
           
 java.lang.String getAgentTypeName()
           
 PanelController getController()
           
 Domain getDomain()
           
 Ip2Frame getFrame()
           
 Ip2ModelManager getIp2ModelManager()
           
 ProcessModelManager getModelManager()
           
 IPlanOptionManager getOptionManager()
           
 Plan getPlan()
           
 void handleInput(IPC.InputMessage message)
          Handles external input in the form of an IPC.InputMessage that contains an object such as an Issue, Activity, or Report.
 void handleInputDirectly(IPC.InputMessage message)
           
 void handleNewActivity(Activity activity)
          Handles new activities from external sources.
 void handleNewChatMessage(ChatMessage message)
          Handles new chat messages.
 void handleNewConstraint(Constraint constraint)
          Handles new constraints from external sources.
 void handleNewIssue(Issue issue)
          Handles new issues from external sources.
 void handleNewReport(Report report)
          Handles new reports from external sources.
protected  void initOptions()
           
 boolean isReloadingViewers()
           
 void loadDomain(Domain dom)
           
protected  void loadInitialPlan()
           
 void loadPlan()
           
 void loadPlan(Plan plan)
           
 void loadPlan(java.lang.String resourceName)
           
static void main(java.lang.String[] argv)
          Main program.
protected  AgendaViewer makeActivityViewer()
          Called to create the activity viewer.
protected  AnnotationViewer makeAnnotationViewer()
          Called to create the annotation viewer.
protected  PanelController makeController()
          Called to create this agent's controller.
protected  Ip2Frame makeIp2Frame()
          Called to make the main user interface frame.
protected  AgendaViewer makeIssueViewer()
          Called to create the issue viewer.
 javax.swing.JPanel makeLogoPanel()
          Makes the LogoPanel for the application's main frame.
protected  ProcessModelManager makeModelManager()
          Called to create this agent's model-manager.
protected  StateViewer makeStateViewer()
          Called to create the state viewer.
protected  java.lang.Object makeViewer(java.lang.String parameterName, java.lang.Class defaultClass)
          Utility use to construct viewers.
protected  void processCommandLineArguments()
          Command-line argument processing for arguments used by all versions of I-P2.
protected  void readDomain(Domain domain)
          Read in any initial domain descriptions.
 void readDomain(Domain domain, java.lang.String resourceName)
          Adds definitions to a domain.
 void reloadViewers()
           
 void reset()
          Called to restore the initial state.
 void resetAllButState()
           
 void resetViewers()
           
 void savePlanAs()
           
 void startup()
          Completes basic I-P2 setup and initialization.
 
Methods inherited from class ix.icore.IXAgent
addAgentNameListener, addExitHook, addStartupHook, adjustLookAndFeel, displayMessage, do_mainStartup, exit, fireSymbolNameChanged, getAgent, getAgentDisplayName, getAgentIPCName, getAgentStartupDate, getAgentSymbolName, getContactManager, getEventLogger, getISimTimer, getKnownAgents, handleReceivedReport, installAgentExtensions, installAgentExtensions, isMainAgent, log, mainStartup, notePossibleNewContact, pre_handleInput, preprocessInput, reportInputException, setAgentSymbolName, setEventLogger, setupISimTimer, startServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domain

protected Domain domain

modelManager

protected ProcessModelManager modelManager

controller

protected PanelController controller

optionManager

protected IPlanOptionManager optionManager

resetHooks

protected java.util.List<java.lang.Runnable> resetHooks

frame

protected Ip2Frame frame

classic

boolean classic

activityViewer

protected AgendaViewer activityViewer

issueViewer

protected AgendaViewer issueViewer

stateViewer

protected StateViewer stateViewer

annotationViewer

protected AnnotationViewer annotationViewer

agentTypeName

protected java.lang.String agentTypeName

logoLine1

protected java.lang.String logoLine1

logoLine2

protected java.lang.String logoLine2

logoImage

protected java.lang.String logoImage

showOptions

protected boolean showOptions
Constructor Detail

Ip2

public Ip2()

Ip2

protected Ip2(boolean setAgent)
Constructor for subclasses that need to creat a second agent.

Method Detail

main

public static void main(java.lang.String[] argv)
Main program.


getAgentTypeName

public java.lang.String getAgentTypeName()

getController

public PanelController getController()

getModelManager

public ProcessModelManager getModelManager()

getIp2ModelManager

public Ip2ModelManager getIp2ModelManager()

getDomain

public Domain getDomain()

getPlan

public Plan getPlan()

getOptionManager

public IPlanOptionManager getOptionManager()

getFrame

public Ip2Frame getFrame()

getActivityPatternSyntaxes

public java.util.SortedSet getActivityPatternSyntaxes()

makeModelManager

protected ProcessModelManager makeModelManager()
Called to create this agent's model-manager.


makeController

protected PanelController makeController()
Called to create this agent's controller.


processCommandLineArguments

protected void processCommandLineArguments()
Command-line argument processing for arguments used by all versions of I-P2.

Overrides:
processCommandLineArguments in class IXAgent
See Also:
IFUtil.adjustLookAndFeel(), IPC.makeCommunicationStrategy(String methodName), ContactManager.processCommandLineArguments(), Debug.on, Parameters

startup

public void startup()
Completes basic I-P2 setup and initialization.

Overrides:
startup in class IXAgent

completeStartup

protected void completeStartup()
Called in the AWT event thread to make the main GUI frame visible and perform any additional setup that ought to be done in that thread.

See Also:
Ip2Frame.becomeVisible()

initOptions

protected void initOptions()

reset

public void reset()
Called to restore the initial state.


resetViewers

public void resetViewers()

resetAllButState

public void resetAllButState()

clearModel

public void clearModel()
Remove everything in the model in the current context.


clearAllButState

public void clearAllButState()

addResetHook

public void addResetHook(java.lang.Runnable hook)
Records an object that will be run when this panel is asked to reset. The reset hooks run after other things have been reset.


makeIp2Frame

protected Ip2Frame makeIp2Frame()
Called to make the main user interface frame. This merely creates the frame, with almost nothing filled in. The frame's Ip2Frame.setUp() is later called to do most of the work.


addAboutInfo

public void addAboutInfo(java.util.List about)
Called to add "About" information. The method provided by the Ip2 class does nothing; it should be overridden in subclasses that have something to add.


makeActivityViewer

protected AgendaViewer makeActivityViewer()
Called to create the activity viewer.


makeIssueViewer

protected AgendaViewer makeIssueViewer()
Called to create the issue viewer.


makeStateViewer

protected StateViewer makeStateViewer()
Called to create the state viewer.


makeAnnotationViewer

protected AnnotationViewer makeAnnotationViewer()
Called to create the annotation viewer.


makeViewer

protected java.lang.Object makeViewer(java.lang.String parameterName,
                                      java.lang.Class defaultClass)
Utility use to construct viewers.

Parameters:
parameterName - the name of a paramter whose value, if given, is a class name.
defaultClass - the class to use if the parameter was not given.
Returns:
an instance of the specified class obtained by calling its 1-argument (Ip2) constructor.
See Also:
Parameters.getClass(String, Class)

reloadViewers

public void reloadViewers()

isReloadingViewers

public boolean isReloadingViewers()

do_reloadViewers

protected void do_reloadViewers()

readDomain

protected void readDomain(Domain domain)
Read in any initial domain descriptions.


readDomain

public void readDomain(Domain domain,
                       java.lang.String resourceName)
Adds definitions to a domain.


loadDomain

public void loadDomain(Domain dom)

makeLogoPanel

public javax.swing.JPanel makeLogoPanel()
Makes the LogoPanel for the application's main frame. This method is in this class to make it easier to define versions that have a different logo panel.


loadInitialPlan

protected void loadInitialPlan()

loadPlan

public void loadPlan()

loadPlan

public void loadPlan(java.lang.String resourceName)

loadPlan

public void loadPlan(Plan plan)

savePlanAs

public void savePlanAs()

handleInput

public void handleInput(IPC.InputMessage message)
Description copied from class: IXAgent
Handles external input in the form of an IPC.InputMessage that contains an object such as an Issue, Activity, or Report. It calls one of handleNewIssue, handleNewReport, etc as appropriate.

Overrides:
handleInput in class IXAgent

handleInputDirectly

public void handleInputDirectly(IPC.InputMessage message)

handleNewIssue

public void handleNewIssue(Issue issue)
Handles new issues from external sources.

Overrides:
handleNewIssue in class IXAgent

handleNewActivity

public void handleNewActivity(Activity activity)
Handles new activities from external sources.

Overrides:
handleNewActivity in class IXAgent

handleNewConstraint

public void handleNewConstraint(Constraint constraint)
Handles new constraints from external sources.

Overrides:
handleNewConstraint in class IXAgent

handleNewReport

public void handleNewReport(Report report)
Handles new reports from external sources.

Overrides:
handleNewReport in class IXAgent

handleNewChatMessage

public void handleNewChatMessage(ChatMessage message)
Handles new chat messages.

Overrides:
handleNewChatMessage in class IXAgent

addTool

public void addTool(ToolController tc)
Records the tool and adds an entry to the main frame's "Tools" menu.

Overrides:
addTool in class IXAgent
See Also:
PanelFrame.addTool(ToolController)

ensureTool

public java.lang.Object ensureTool(java.lang.String toolName)
Returns the tool of the specified name, causing it to be created if it does not already exist. Note that it returns the tool, not its tool-controller, and that it does not change the tool's visibility.

Overrides:
ensureTool in class IXAgent
Throws:
java.lang.IllegalArgumentException - if there's no tool of the specified name.

addTestMenuItems

protected void addTestMenuItems()
Called when the main frame is set up to add items to the frame menu bar's "Test" menu. The method is in this class, rather than in the frame class, to make it easier to define versions that have different test items. This method adds tests from the resources specified by the "test-menu" parameter, if one was given; otherwise it does nothing.

See Also:
Parameters, PanelFrame.addTests(String)

addTest

public void addTest(TestElement test)
Adds the specified test to the main frame's "Test" menu.


addHandlers

protected void addHandlers(java.util.List classNames)
Add one instance of each of the specified classes as a handler for issues, activities, or both, as appropriate.

See Also:
PanelController.addHandler(ItemHandler handler)

addHandlers

protected void addHandlers()
Install any built-in issue and activity handlers. Note that the order in which handlers are added here is also the order in which they are asked to add handler-actions.


addForwardingHandler

public void addForwardingHandler(java.lang.String verb,
                                 AgentRelationship rel,
                                 boolean reportBack)