aa.gui
Class View

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byaa.gui.View
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.event.TreeSelectionListener, javax.swing.WindowConstants

public class View
extends javax.swing.JFrame
implements java.awt.event.ActionListener, javax.swing.event.TreeSelectionListener

This class creates a window for MAA (Multi-Actor Architecture) Platform.

History:

Version:
$Date: 2008/01/01 00:23:34 $ $Revision: 1.1 $
Author:
Myeong-Wuk Jang
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  ActorManager m_amActorManager
           
private  boolean m_bMsqHistory
           
private  javax.swing.tree.DefaultMutableTreeNode m_dmtnRoot
           
private  java.lang.Integer m_intPort
           
private  int m_iSizeOfMsgHistoryQueue
           
private  javax.swing.JCheckBoxMenuItem m_jcbmiEnableMsgHistory
           
private  javax.swing.JLabel m_jlStatusBar
           
private  javax.swing.JMenuItem m_jmiAbout
           
private  javax.swing.JMenuItem m_jmiChangePortNumber
           
private  javax.swing.JMenuItem m_jmiChangeSizeOfHistory
           
private  javax.swing.JMenuItem m_jmiClearMsgHistory
           
private  javax.swing.JMenuItem m_jmiClose
           
private  javax.swing.JMenuItem m_jmiCreate
           
private  javax.swing.JMenuItem m_jmiExit
           
private  javax.swing.JMenuItem m_jmiKill
           
private  javax.swing.JMenuItem m_jmiResume
           
private  javax.swing.JMenuItem m_jmiSaveMsgHistory
           
private  javax.swing.JMenuItem m_jmiSend
           
private  javax.swing.JMenuItem m_jmiShowMsgHistory
           
private  javax.swing.JMenuItem m_jmiSuspend
           
private  javax.swing.JMenuItem m_jmiSysInfo
           
private  javax.swing.JScrollPane m_jspLeft
           
private  javax.swing.JSplitPane m_jspMain
           
private  javax.swing.JScrollPane m_jspRight
           
private  javax.swing.JTree m_jtreeActor
           
private  Platform m_pPlatform
           
private  Queue m_qMsgQueue
           
private static java.lang.String m_strTitle
          Title of this interface window.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
View(java.lang.Integer p_intPort)
          Create the graphical user interface of this platform.
 
Method Summary
private  void actionAbout()
          Displays a dialog box to show information about this program.
private  void actionChangePortNumber()
          Shows a dialog box for changing server port number.
private  void actionChangeSizeOfMsgHistory()
          Shows a dialog box for changing the size of log messages.
private  void actionClearMsgHistory()
          Removes all log messages.
private  void actionClose()
          Closes this window.
private  void actionCreate()
          Creates a new actor.
private  void actionEnableMsgHistory()
          Change otpion for enabling actor message logging
private  void actionExit()
          Exits this program.
private  void actionKill()
          Kills the selected actor.
 void actionPerformed(java.awt.event.ActionEvent p_ae)
          Invoked when an action occurs.
private  void actionResume()
          Resumes the selected actor.
private  void actionSaveMsgHistory()
          Saves the message history.
private  void actionSend()
          Sends a message to the selected actor.
private  void actionShowMsgHistory()
          Shows a dialob box for actor messages delivered.
private  void actionSuspend()
          Suspends the selected actor.
private  void actionViewSysInfo()
          Shows a dialog box for the system information of this platform.
 void addNewActor(ActorName p_anActor)
          Adds a node for the new actor on the actor list.
 void changeSizeOfMsgHistory(int p_iHistorySize)
          Changes the size of actor message log queue.
 void checkPortNumber(java.lang.Object[] p_objaOptions)
          Sets new option parameters.
private  void clearInfo()
          Clears the information table.
private  void createMenu()
          Create a menu bar with menu items.
private  void createPane()
          Creates the main pane of this window.
private  void displayActorInfo(ActorName p_anActor)
          Displays information about one actor.
private  void displayActorInfo(java.lang.String[][] p_straData)
          Displays information about an actor on the information table.
private  void displayActorsInfo(java.lang.String[][] p_straData)
          Displays information about actors on the information table.
 void displayErrorMessage(java.lang.String p_strMsg)
          Displays an error message.
private  void displayInfo(java.lang.String[] p_straColName, java.lang.String[][] p_straData)
          Displays information on the jspRight pane.
 void exit()
          Exits this program.
private  javax.swing.tree.DefaultMutableTreeNode findNodeInTree(java.lang.String p_strNodeName)
          Finds a node matched with the given input string.
 void printOnStatusBar(java.lang.String p_strMsg)
          Prints a message on the status bar.
 void refreshWindow()
          Redraws the window.
 void removeActor(ActorName p_anActor)
          Removes an actor from the jtreeRoot.
 void reportMessage(ActorMessage p_amMsg)
          Reports a message.
 void setActorManager(ActorManager p_amActorManager)
          Sets the reference to the Actor Manager of this actor platform.
 void setPlatform(Platform p_pPlatform)
          Sets the pointer to this Platform.
 void valueChanged(javax.swing.event.TreeSelectionEvent p_tse)
          Invoked whenever the value of the selection changes.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

m_strTitle

private static final java.lang.String m_strTitle
Title of this interface window.


m_jmiClose

private javax.swing.JMenuItem m_jmiClose

m_jmiExit

private javax.swing.JMenuItem m_jmiExit

m_jmiCreate

private javax.swing.JMenuItem m_jmiCreate

m_jmiSend

private javax.swing.JMenuItem m_jmiSend

m_jmiSuspend

private javax.swing.JMenuItem m_jmiSuspend

m_jmiResume

private javax.swing.JMenuItem m_jmiResume

m_jmiKill

private javax.swing.JMenuItem m_jmiKill

m_jcbmiEnableMsgHistory

private javax.swing.JCheckBoxMenuItem m_jcbmiEnableMsgHistory

m_jmiShowMsgHistory

private javax.swing.JMenuItem m_jmiShowMsgHistory

m_jmiClearMsgHistory

private javax.swing.JMenuItem m_jmiClearMsgHistory

m_jmiChangeSizeOfHistory

private javax.swing.JMenuItem m_jmiChangeSizeOfHistory

m_jmiSaveMsgHistory

private javax.swing.JMenuItem m_jmiSaveMsgHistory

m_jmiSysInfo

private javax.swing.JMenuItem m_jmiSysInfo

m_jmiChangePortNumber

private javax.swing.JMenuItem m_jmiChangePortNumber

m_jmiAbout

private javax.swing.JMenuItem m_jmiAbout

m_dmtnRoot

private javax.swing.tree.DefaultMutableTreeNode m_dmtnRoot

m_jtreeActor

private javax.swing.JTree m_jtreeActor

m_jspLeft

private javax.swing.JScrollPane m_jspLeft

m_jspRight

private javax.swing.JScrollPane m_jspRight

m_jspMain

private javax.swing.JSplitPane m_jspMain

m_jlStatusBar

private javax.swing.JLabel m_jlStatusBar

m_pPlatform

private Platform m_pPlatform

m_amActorManager

private ActorManager m_amActorManager

m_iSizeOfMsgHistoryQueue

private int m_iSizeOfMsgHistoryQueue

m_bMsqHistory

private boolean m_bMsqHistory

m_qMsgQueue

private Queue m_qMsgQueue

m_intPort

private java.lang.Integer m_intPort
Constructor Detail

View

public View(java.lang.Integer p_intPort)
Create the graphical user interface of this platform.

Parameters:
p_intPort - the port number of a server socket for in-comming messages.
Method Detail

createMenu

private void createMenu()
Create a menu bar with menu items.


createPane

private void createPane()
Creates the main pane of this window.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent p_ae)
Invoked when an action occurs.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
p_ae - an action event to be invoked when an action occurs.

actionClose

private void actionClose()
Closes this window.


actionExit

private void actionExit()
Exits this program.


actionCreate

private void actionCreate()
Creates a new actor.


actionSend

private void actionSend()
Sends a message to the selected actor.


actionSuspend

private void actionSuspend()
Suspends the selected actor.


actionResume

private void actionResume()
Resumes the selected actor.


actionKill

private void actionKill()
Kills the selected actor.


actionViewSysInfo

private void actionViewSysInfo()
Shows a dialog box for the system information of this platform.


actionChangePortNumber

private void actionChangePortNumber()
Shows a dialog box for changing server port number.


actionEnableMsgHistory

private void actionEnableMsgHistory()
Change otpion for enabling actor message logging


actionChangeSizeOfMsgHistory

private void actionChangeSizeOfMsgHistory()
Shows a dialog box for changing the size of log messages.


actionClearMsgHistory

private void actionClearMsgHistory()
Removes all log messages.


actionSaveMsgHistory

private void actionSaveMsgHistory()
Saves the message history.


actionShowMsgHistory

private void actionShowMsgHistory()
Shows a dialob box for actor messages delivered.


actionAbout

private void actionAbout()
Displays a dialog box to show information about this program.


checkPortNumber

public void checkPortNumber(java.lang.Object[] p_objaOptions)
Sets new option parameters.
This method is called by the Options dialog.

Parameters:
p_objaOptions - arguments for new options.

printOnStatusBar

public void printOnStatusBar(java.lang.String p_strMsg)
Prints a message on the status bar.

Parameters:
p_strMsg - a message to be displayed on the status bar.

setPlatform

public void setPlatform(Platform p_pPlatform)
Sets the pointer to this Platform.

Parameters:
p_pPlatform - the reference to this platform.

setActorManager

public void setActorManager(ActorManager p_amActorManager)
Sets the reference to the Actor Manager of this actor platform.

Parameters:
p_amActorManager - the reference to the Actor Manager of this actor platform.

clearInfo

private void clearInfo()
Clears the information table.


displayActorInfo

private void displayActorInfo(java.lang.String[][] p_straData)
Displays information about an actor on the information table.

Parameters:
p_straData - contents of the information table.

displayActorsInfo

private void displayActorsInfo(java.lang.String[][] p_straData)
Displays information about actors on the information table.


displayInfo

private void displayInfo(java.lang.String[] p_straColName,
                         java.lang.String[][] p_straData)
Displays information on the jspRight pane.

Parameters:
p_straColName - names for columns of the information table.
p_straData - contents of the information table.

addNewActor

public void addNewActor(ActorName p_anActor)
Adds a node for the new actor on the actor list.

Parameters:
p_anActor - the name of an actor.

findNodeInTree

private javax.swing.tree.DefaultMutableTreeNode findNodeInTree(java.lang.String p_strNodeName)
Finds a node matched with the given input string.

Parameters:
p_strNodeName - the name of a tree node.
Returns:
a node matched matched with the given input string.

removeActor

public void removeActor(ActorName p_anActor)
Removes an actor from the jtreeRoot.
This method is (should be) called by the Actor Manager of this actor platform.
Note:

Parameters:
p_anActor - the name of an actor.

refreshWindow

public void refreshWindow()
Redraws the window.


displayActorInfo

private void displayActorInfo(ActorName p_anActor)
Displays information about one actor.

Parameters:
p_anActor - the name of an actor.

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent p_tse)
Invoked whenever the value of the selection changes.
This method is called because this class implements TreeSelectionListener.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
Parameters:
p_tse - an event to be invoked when any node of the tree is selected.

displayErrorMessage

public void displayErrorMessage(java.lang.String p_strMsg)
Displays an error message.

Parameters:
p_strMsg - an error message to be displayed.

reportMessage

public void reportMessage(ActorMessage p_amMsg)
Reports a message.
This method is called by the Message Manager of this actor platform.

Parameters:
p_amMsg - an actor communication message.

changeSizeOfMsgHistory

public void changeSizeOfMsgHistory(int p_iHistorySize)
Changes the size of actor message log queue.
This method is called by the View class.

Parameters:
p_iHistorySize - the new size of the actor message log queue.

exit

public void exit()
Exits this program.
This method is called by the Platform.