com.cometway.swing
Class AbstractJFrameAgent

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.swing.AbstractJFrameAgent
All Implemented Interfaces:
AgentInterface, HasStateMachineModel
Direct Known Subclasses:
AbstractJFrameController, PropsEditor, StartupEditor

public abstract class AbstractJFrameAgent
extends Agent

This abstract Agent contains basic functionality useable by an agent that manages a JFrame. Methods in this abstract implementation can be overridden to create and manage any subclass of JFrame. Convenience methods are provided for handling menus and the menubar, as well as the Look and Feel used by Swing.


Field Summary
protected  javax.swing.JFrame frame
           
protected  javax.swing.JMenu[] menu
           
protected  java.awt.event.ActionListener menuActionListener
           
protected  javax.swing.JMenuBar menuBar
           
protected  java.awt.event.WindowListener windowListener
           
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
AbstractJFrameAgent()
           
 
Method Summary
protected  void closeFrame()
          Closes the JFrame managed by this agent.
protected  javax.swing.JFrame createFrame()
          Creates the JFrame instance managed by this agent.
protected  javax.swing.JMenu createMenu(java.lang.String[] menuData)
          Creates a JMenu from the specified String array of menu data.
protected  java.awt.event.ActionListener createMenuActionListener()
          Creates the ActionListener for handling menu events.
protected  java.awt.event.WindowListener createWindowListener()
          Creates the WindowListener for handling window events.
 void initProps()
          Initializes the Props for this agent.
protected  void openFrame()
          Creates, initializes, and opens a JFrame instance managed by this agent.
protected  void setLookAndFeel()
          The Look and Feel can be specified globally by specifying the lnf_classname Props.
protected  void setMenuBar(java.lang.String[][] menuBarDesc)
          Creates and sets the JMenuBar for this frame using an array of menu description String arrays.
 void start()
          Initializes this agent and pens the JFrame managed by this agent.
 void stop()
          Closes the JFrame managed by this agent, and stops this agent.
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

frame

protected javax.swing.JFrame frame

menuBar

protected javax.swing.JMenuBar menuBar

menu

protected javax.swing.JMenu[] menu

windowListener

protected java.awt.event.WindowListener windowListener

menuActionListener

protected java.awt.event.ActionListener menuActionListener
Constructor Detail

AbstractJFrameAgent

public AbstractJFrameAgent()
Method Detail

initProps

public void initProps()
Initializes the Props for this agent. The created JFrame will be given the attributes specified by the frame_title, frame_width, frame_height, and frame_visible properties.

Specified by:
initProps in interface AgentInterface
Overrides:
initProps in class Agent

start

public void start()
Initializes this agent and pens the JFrame managed by this agent.

Specified by:
start in interface AgentInterface
Overrides:
start in class Agent

stop

public void stop()
Closes the JFrame managed by this agent, and stops this agent.

Specified by:
stop in interface AgentInterface
Overrides:
stop in class Agent

closeFrame

protected void closeFrame()
Closes the JFrame managed by this agent.


createMenu

protected javax.swing.JMenu createMenu(java.lang.String[] menuData)
Creates a JMenu from the specified String array of menu data. The first item is the menu title, the following items are menu items. Items that are set to "-" are interpreted as menu item separators.


createMenuActionListener

protected java.awt.event.ActionListener createMenuActionListener()
Creates the ActionListener for handling menu events.


createWindowListener

protected java.awt.event.WindowListener createWindowListener()
Creates the WindowListener for handling window events.


createFrame

protected javax.swing.JFrame createFrame()
Creates the JFrame instance managed by this agent.


openFrame

protected void openFrame()
Creates, initializes, and opens a JFrame instance managed by this agent. The frame_title, frame_width, frame_height, and frame_visible Props are used accordingly by this method.


setMenuBar

protected void setMenuBar(java.lang.String[][] menuBarDesc)
Creates and sets the JMenuBar for this frame using an array of menu description String arrays. See createMenu for a description of the menu String array.


setLookAndFeel

protected void setLookAndFeel()
The Look and Feel can be specified globally by specifying the lnf_classname Props. If lnf_classname is set to "java", the standard cross-platform look and feel (Metal) will be used. If lnf_classname is set to "system", the system native look and feel will be used.