com.cometway.swing
Class AbstractJFrameController

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

public abstract class AbstractJFrameController
extends AbstractJFrameAgent

This class acts as an agent-based proxy for a swing JFrame. It creates an inner class called ControlledFrame whose paint method is proxied to the drawFrame method which is intended to be overridden by subclasses of this class. The createFrame method can also be overridden if more control over the JFrame is needed. This agent registers itself with the Service Manager and calls createFrame upon starting.


Field Summary
 
Fields inherited from class com.cometway.swing.AbstractJFrameAgent
frame, menu, menuActionListener, menuBar, 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
AbstractJFrameController()
           
 
Method Summary
protected  javax.swing.JFrame createFrame()
          Creates a JFrame that is controlled by this agent.
abstract  void drawFrame(java.awt.Graphics g)
          Called by the JFrame controlled by this agent when its paint method is called.
 javax.swing.JFrame getFrame()
          Returns a reference to the JFrame instance controlled by this agent.
 void initProps()
          Initializes Props for this agent.
 void start()
          Opens a Frame and registers this agent with the Service Manager.
 void stop()
          Unregisters this agent with the Service Manager and closes the Frame.
 
Methods inherited from class com.cometway.swing.AbstractJFrameAgent
closeFrame, createMenu, createMenuActionListener, createWindowListener, openFrame, setLookAndFeel, setMenuBar
 
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
 

Constructor Detail

AbstractJFrameController

public AbstractJFrameController()
Method Detail

initProps

public void initProps()
Initializes Props for this agent.

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

start

public void start()
Opens a Frame and registers this agent with the Service Manager.

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

stop

public void stop()
Unregisters this agent with the Service Manager and closes the Frame.

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

createFrame

protected javax.swing.JFrame createFrame()
Creates a JFrame that is controlled by this agent. By default, the returned frame is a subclass of JFrame which has been overridden to call the drawFrame method of this agent whenever JFrame.paint is called.

Overrides:
createFrame in class AbstractJFrameAgent

drawFrame

public abstract void drawFrame(java.awt.Graphics g)
Called by the JFrame controlled by this agent when its paint method is called.


getFrame

public javax.swing.JFrame getFrame()
Returns a reference to the JFrame instance controlled by this agent.