org.moyoman.client.reference
Class Moyoman

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--org.moyoman.client.reference.Moyoman
All Implemented Interfaces:
Accessible, IGUIConstants, ImageObserver, IMoyoman, IMoyomanAdminOwner, MakeMoveListener, MenuContainer, RequestMoveListener, RootPaneContainer, Serializable, WindowConstants
Direct Known Subclasses:
CustomTest

public class Moyoman
extends JFrame
implements IMoyoman, IMoyomanAdminOwner, RequestMoveListener, MakeMoveListener

Provides a client GUI for Moyoman Go.

Developers wishing to extend this client will use:
addCustomMenuItem( Action ) Add an item to the custom menu.
startGame( PlayerManager ) Start a new game.

Since:
v0.01
Version:
v0.16
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  AdminManager _adminManager
          Admin manager.
private  Board _board
          Board.
private  CustomMenu _customMenu
          Custom menu.
private  DebugManager _debugManager
          Debug manager.
private  JMenu _debugMenu
          Debug menu.
private  GameManager _gameManager
          Game manager.
private  String _languageName
          The current language.
private  JPanel _mainPanel
          The main panel.
private  PrisonerCounter _prisonerCounter
          The prisoner counter.
private static int COORDINATE_AREA
          Index of the coordinate status area.
private static int MOVE_NUMBER_AREA
          Index of the move number status area.
private static int PRISONER_AREA
          Index of the prisoner status area.
 
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 org.moyoman.client.reference.util.IGUIConstants
DEBUG, DIRTY_PROPERTY, GAP, MARGIN, TRANSPARENT_COLOR
 
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
Moyoman()
          Construct this object.
 
Method Summary
 void aboutActionPerformed(ActionEvent event)
          Perform the about action.
protected  JMenuItem addCustomMenuItem(Action action)
          Add an item to the custom menu.
 void autoMoveActionPerformed(ActionEvent event)
          Perform the auto move action.
 void checkActions()
          Check the actions for their enabled status.
protected  AdminManager createAdminManager()
          Create the admin manager.
protected  DebugManager createDebugManager()
          Create the debug manager.
protected  GameManager createGameManager()
          Create the game manager.
protected  JPanel createMainPanel()
          Create the main panel.
protected  void fillMenuBar()
          Create the menu bar.
protected  void fillToolBar()
          Create the tool bar.
protected  Action getAutoMoveAction()
          Return the auto move action.
protected  JCheckBoxMenuItem getAutoMoveUI()
          Return the auto move widget.
 Board getBoard()
          Return the board.
 CommandExecutor getCommandExecutor()
          Return the command executor.
 GameEngineSwingWorker getEngine()
          Return the game engine.
 JFrame getFrame()
          Return this application's frame.
protected  Action getInteractiveAction()
          Return the interactive action.
protected  JCheckBoxMenuItem getInteractiveUI()
          Return the interactive widget.
protected  Action getLanguageAction()
          Return the language action.
protected  Action getNextMoveAction()
          Return the next move action.
protected  Action getShowToolBarAction()
          Return the show tool bar action.
protected  JCheckBoxMenuItem getShowToolBarUI()
          Return the show tool bar widget.
protected  Action getSoundAction()
          Return the sound action.
protected  JCheckBoxMenuItem getSoundUI()
          Return the sound widget.
protected  Action getUndoMoveAction()
          Return the undo move action.
protected  void informPlayerError(Exception e)
          Inform the user of a player error.
 void interactiveActionPerformed(ActionEvent event)
          Perform the interactive action.
 boolean isAutoMove()
          Return true if auto-move is selected.
 boolean isInteractive()
          Return true if interactive is selected.
protected  boolean isShowingToolBar()
          Return the show tool bar flag.
 void languageActionPerformed(ActionEvent event)
          Perform the language action.
static void main(String[] args)
          Run method.
 void makeMoveEventOccurred(MakeMoveEvent event)
          Respond to make move events.
 void nextMoveActionPerformed(ActionEvent event)
          Perform the next move action.
 void processMove(Move move)
          Process the given move.
 void processMove(Move move, boolean doMark)
          Process the given move.
 void processMoveDescriptor(MoveDescriptor moveDescriptor)
          Process the given move descriptor.
 void quitActionPerformed(ActionEvent event)
          Perform the quit action.
 void reconcileBoard(GameRecord gameRecord)
          Reconcile the board to the game record.
 void requestMoveEventOccurred(RequestMoveEvent event)
          Respond to request move events.
protected  void setLanguageName(String languageName)
          Perform the language action.
 void showToolBarActionPerformed(ActionEvent event)
          Perform the show tool bar action.
 void soundActionPerformed(ActionEvent event)
          Perform the sound action.
protected  void startGame(PlayerManager playerManager)
          Start a new game.
 void startGameSwingWorkerFinished(String statusMessage, PlayerManager playerManager)
          Perform final actions on the event-dispatching thread.
 void undoMoveActionPerformed(ActionEvent event)
          Perform the undo move action.
protected  void updateMoveDisplay(Move move)
          Update the move display.
protected  void updatePrisonerDisplay()
          Update the prisoner display.
 
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

MOVE_NUMBER_AREA

private static final int MOVE_NUMBER_AREA
Index of the move number status area.

See Also:
Constant Field Values

PRISONER_AREA

private static final int PRISONER_AREA
Index of the prisoner status area.

See Also:
Constant Field Values

COORDINATE_AREA

private static final int COORDINATE_AREA
Index of the coordinate status area.

See Also:
Constant Field Values

_adminManager

private AdminManager _adminManager
Admin manager.


_board

private Board _board
Board.


_customMenu

private CustomMenu _customMenu
Custom menu.


_debugManager

private DebugManager _debugManager
Debug manager.


_gameManager

private GameManager _gameManager
Game manager.


_debugMenu

private JMenu _debugMenu
Debug menu.


_mainPanel

private JPanel _mainPanel
The main panel.


_prisonerCounter

private PrisonerCounter _prisonerCounter
The prisoner counter.


_languageName

private String _languageName
The current language.

Constructor Detail

Moyoman

public Moyoman()
Construct this object.

Since:
v0.01
Method Detail

isAutoMove

public boolean isAutoMove()
Return true if auto-move is selected.

Specified by:
isAutoMove in interface IMoyoman
Since:
v0.03

getBoard

public Board getBoard()
Return the board.

Specified by:
getBoard in interface IMoyoman
Since:
v0.02

getCommandExecutor

public CommandExecutor getCommandExecutor()
Return the command executor.

Specified by:
getCommandExecutor in interface IMoyoman
Since:
v0.02

getEngine

public GameEngineSwingWorker getEngine()
Return the game engine.

Specified by:
getEngine in interface IMoyoman
Since:
v0.03

getFrame

public JFrame getFrame()
Return this application's frame.

Specified by:
getFrame in interface IMoyoman
Since:
v0.03

isInteractive

public boolean isInteractive()
Return true if interactive is selected.

Since:
v0.16

aboutActionPerformed

public void aboutActionPerformed(ActionEvent event)
Perform the about action.

Since:
v0.01

autoMoveActionPerformed

public void autoMoveActionPerformed(ActionEvent event)
Perform the auto move action.

Since:
v0.01

checkActions

public void checkActions()
Check the actions for their enabled status.

Specified by:
checkActions in interface IMoyoman
Since:
v0.01

interactiveActionPerformed

public void interactiveActionPerformed(ActionEvent event)
Perform the interactive action.

Since:
v0.15

languageActionPerformed

public void languageActionPerformed(ActionEvent event)
Perform the language action.

Since:
v0.01

main

public static void main(String[] args)
                 throws Exception
Run method.

Exception
Since:
v0.01

makeMoveEventOccurred

public void makeMoveEventOccurred(MakeMoveEvent event)
Respond to make move events. This event is sent by the opponent of the current player.

Specified by:
makeMoveEventOccurred in interface MakeMoveListener
Parameters:
event - The MakeMoveEvent object.
Since:
v0.02

nextMoveActionPerformed

public void nextMoveActionPerformed(ActionEvent event)
Perform the next move action. This is used when Auto Move is false.

Specified by:
nextMoveActionPerformed in interface IMoyoman
Since:
v0.01

processMove

public void processMove(Move move)
Process the given move.

Since:
v0.01

processMove

public void processMove(Move move,
                        boolean doMark)
Process the given move.

Since:
v0.01

processMoveDescriptor

public void processMoveDescriptor(MoveDescriptor moveDescriptor)
Process the given move descriptor.

Since:
v0.01

quitActionPerformed

public void quitActionPerformed(ActionEvent event)
Perform the quit action.

Since:
v0.01

reconcileBoard

public void reconcileBoard(GameRecord gameRecord)
Reconcile the board to the game record.

Specified by:
reconcileBoard in interface IMoyoman
Since:
v0.01

requestMoveEventOccurred

public void requestMoveEventOccurred(RequestMoveEvent event)
Respond to request move events.

Specified by:
requestMoveEventOccurred in interface RequestMoveListener
Parameters:
event - The RequestMovEvent object.
Since:
v0.02

showToolBarActionPerformed

public void showToolBarActionPerformed(ActionEvent event)
Perform the show tool bar action.

Since:
v0.01

soundActionPerformed

public void soundActionPerformed(ActionEvent event)
Perform the sound action.

Since:
v0.03

startGameSwingWorkerFinished

public void startGameSwingWorkerFinished(String statusMessage,
                                         PlayerManager playerManager)
Perform final actions on the event-dispatching thread.

Specified by:
startGameSwingWorkerFinished in interface IMoyoman
Since:
v0.01

undoMoveActionPerformed

public void undoMoveActionPerformed(ActionEvent event)
Perform the undo move action.

Since:
v0.01

getAutoMoveAction

protected Action getAutoMoveAction()
Return the auto move action.

Since:
v0.01

getAutoMoveUI

protected JCheckBoxMenuItem getAutoMoveUI()
Return the auto move widget.

Since:
v0.01

getInteractiveAction

protected Action getInteractiveAction()
Return the interactive action.

Since:
v0.15

getInteractiveUI

protected JCheckBoxMenuItem getInteractiveUI()
Return the interactive widget.

Since:
v0.15

getLanguageAction

protected Action getLanguageAction()
Return the language action.

Since:
v0.01

setLanguageName

protected void setLanguageName(String languageName)
Perform the language action.

Since:
v0.01

getNextMoveAction

protected Action getNextMoveAction()
Return the next move action.

Since:
v0.01

getShowToolBarAction

protected Action getShowToolBarAction()
Return the show tool bar action.

Since:
v0.01

getShowToolBarUI

protected JCheckBoxMenuItem getShowToolBarUI()
Return the show tool bar widget.

Since:
v0.01

isShowingToolBar

protected boolean isShowingToolBar()
Return the show tool bar flag.

Since:
v0.01

getSoundAction

protected Action getSoundAction()
Return the sound action.

Since:
v0.03

getSoundUI

protected JCheckBoxMenuItem getSoundUI()
Return the sound widget.

Since:
v0.03

getUndoMoveAction

protected Action getUndoMoveAction()
Return the undo move action.

Since:
v0.01

addCustomMenuItem

protected JMenuItem addCustomMenuItem(Action action)
Add an item to the custom menu.

Since:
v0.03

createAdminManager

protected AdminManager createAdminManager()
Create the admin manager.

Since:
v0.03

createDebugManager

protected DebugManager createDebugManager()
Create the debug manager.

Since:
v0.03

createGameManager

protected GameManager createGameManager()
Create the game manager.

Since:
v0.03

createMainPanel

protected JPanel createMainPanel()
Create the main panel.

Since:
v0.01

fillMenuBar

protected void fillMenuBar()
Create the menu bar.

Since:
v0.01

fillToolBar

protected void fillToolBar()
Create the tool bar.

Since:
v0.01

informPlayerError

protected void informPlayerError(Exception e)
Inform the user of a player error.

Since:
v0.01

startGame

protected void startGame(PlayerManager playerManager)
                  throws InternalErrorException
Start a new game.

InternalErrorException
Since:
v0.03

updateMoveDisplay

protected void updateMoveDisplay(Move move)
Update the move display.

Since:
v0.02

updatePrisonerDisplay

protected void updatePrisonerDisplay()
Update the prisoner display.

Since:
v0.01