org.xistrat.gui
Class XiStratPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by org.xistrat.gui.XiStratPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.TextListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, ClickListener, ModalDialogOwner, PlayFieldListener, ClientUI

public class XiStratPanel
extends java.awt.Panel
implements ClientUI, PlayFieldListener, ModalDialogOwner, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.TextListener

XiStratPanel

Since:
0.5.42
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 java.util.LinkedList<FigurData[]> _allFig
           
 FigurData[] _figures
           
 java.util.LinkedList<StonesBean> allStones
           
 StonesBean stonesBean
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
XiStratPanel(F4ClientCore clientCore)
          Constructor of a F4 Panel from an Applet.
XiStratPanel(java.awt.Frame f, F4ClientCore clientCore, boolean hView)
          Constructor of a F4 Panel with default props
 
Method Summary
 void abort()
           
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void buildPlayField(java.lang.String positionID)
          clientCore calls this after loginAck by server
 void display(int id)
          PlayFieldListener Interface implementation
 void doBack()
           
 void doForward()
           
 void doMove(int from, int to)
          actually do the move, thereby keep track on preceding state, so copy the _figures' array by value (but the single objects are not by value, only by reference)
 void doPass()
          pass (in normal play as well as in Go remove dead stones phase)
 void doPut(int to, int cont)
           
 void doRemove(int loc, int cont)
           
 void doToEnd()
           
 void doToStart()
           
 void doUndo(int num)
           
 void endModal()
           
 F4ClientCore getClientCore()
           
 FigurData[] getFigures()
           
 StonesBean getStones()
           
 void handleNewGame(boolean ok, java.lang.String info)
          there has been a possible race condition between this method and setGameList()
 boolean isAcceptMove()
           
 void itemStateChanged(java.awt.event.ItemEvent e)
           
 boolean loadGame(java.lang.String fightID)
           
 void logout()
           
 void lose(java.lang.String winner)
           
 void pass()
          may be pass in the turn-based mode as well as indicating that my 'removing stones' is done from my point of view (the latter may be omitted again when GoRules and/or GoEngine can estimate status of dead stones itself)
 void popup()
           
 void processEvent(java.awt.AWTEvent evt)
          AWT EVENT HANDLING
 void put(int to)
           
 void refresh()
           
 void refresh(int from, int to)
           
 boolean savePosition(java.lang.String positionName, java.lang.String turnOfParty)
           
 void setData(java.lang.String positionID)
           
 void setGameList(java.lang.String[] list, java.lang.String[] position)
          interface ClientUI (called by F4ClientCore)
 void showErr(java.lang.String error)
           
 void showMsg(java.lang.String info)
           
 void startModal()
          ModalDialog Interface
 boolean startNewGame(java.lang.String name, java.lang.String positionID, java.lang.String komi)
           
 void textValueChanged(java.awt.event.TextEvent e)
           
 void unPut(int loc)
           
 void waitForUserMove(boolean waitForMe)
           
 void waitForUserRemove(boolean removeForMe)
          after game over, before game finish, dead stones must be removed manually
 void waitForUserUndo(boolean undoForMe)
          after victory, engine is nice and makes undo of last 2 elementar moves
 void walk(int from, int to)
           
 void win()
           
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, 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, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_figures

public FigurData[] _figures

_allFig

public java.util.LinkedList<FigurData[]> _allFig

stonesBean

public StonesBean stonesBean

allStones

public java.util.LinkedList<StonesBean> allStones
Constructor Detail

XiStratPanel

public XiStratPanel(java.awt.Frame f,
                    F4ClientCore clientCore,
                    boolean hView)
Constructor of a F4 Panel with default props

Parameters:
f - the containing Frame
clientCore - the underliying F4ClientCore

XiStratPanel

public XiStratPanel(F4ClientCore clientCore)
Constructor of a F4 Panel from an Applet. It does not need a parent Frame, since it creates one.

Parameters:
clientCore - the underliying F4ClientCore
Method Detail

processEvent

public void processEvent(java.awt.AWTEvent evt)
AWT EVENT HANDLING

Overrides:
processEvent in class java.awt.Container

textValueChanged

public void textValueChanged(java.awt.event.TextEvent e)
Specified by:
textValueChanged in interface java.awt.event.TextListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

display

public void display(int id)
PlayFieldListener Interface implementation

Specified by:
display in interface ClickListener

walk

public void walk(int from,
                 int to)
Specified by:
walk in interface PlayFieldListener

put

public void put(int to)
Specified by:
put in interface PlayFieldListener

pass

public void pass()
may be pass in the turn-based mode as well as indicating that my 'removing stones' is done from my point of view (the latter may be omitted again when GoRules and/or GoEngine can estimate status of dead stones itself)


unPut

public void unPut(int loc)
Specified by:
unPut in interface PlayFieldListener

isAcceptMove

public boolean isAcceptMove()
Specified by:
isAcceptMove in interface PlayFieldListener

getFigures

public FigurData[] getFigures()
Specified by:
getFigures in interface PlayFieldListener

getStones

public StonesBean getStones()
Specified by:
getStones in interface PlayFieldListener

startModal

public void startModal()
ModalDialog Interface

Specified by:
startModal in interface ModalDialogOwner

endModal

public void endModal()
Specified by:
endModal in interface ModalDialogOwner

popup

public void popup()
Specified by:
popup in interface ModalDialogOwner

setGameList

public void setGameList(java.lang.String[] list,
                        java.lang.String[] position)
interface ClientUI (called by F4ClientCore)

Specified by:
setGameList in interface ClientUI

handleNewGame

public void handleNewGame(boolean ok,
                          java.lang.String info)
there has been a possible race condition between this method and setGameList()

Specified by:
handleNewGame in interface ClientUI

showMsg

public void showMsg(java.lang.String info)
Specified by:
showMsg in interface ClientUI

showErr

public void showErr(java.lang.String error)
Specified by:
showErr in interface ClientUI

setData

public void setData(java.lang.String positionID)

buildPlayField

public void buildPlayField(java.lang.String positionID)
clientCore calls this after loginAck by server

Specified by:
buildPlayField in interface ClientUI

abort

public void abort()
Specified by:
abort in interface ClientUI

logout

public void logout()
Specified by:
logout in interface ClientUI

lose

public void lose(java.lang.String winner)
Specified by:
lose in interface ClientUI

win

public void win()
Specified by:
win in interface ClientUI

waitForUserMove

public void waitForUserMove(boolean waitForMe)
Specified by:
waitForUserMove in interface ClientUI

waitForUserUndo

public void waitForUserUndo(boolean undoForMe)
after victory, engine is nice and makes undo of last 2 elementar moves

Specified by:
waitForUserUndo in interface ClientUI

waitForUserRemove

public void waitForUserRemove(boolean removeForMe)
after game over, before game finish, dead stones must be removed manually

Specified by:
waitForUserRemove in interface ClientUI

refresh

public void refresh()

refresh

public void refresh(int from,
                    int to)

doMove

public void doMove(int from,
                   int to)
actually do the move, thereby keep track on preceding state, so copy the _figures' array by value (but the single objects are not by value, only by reference)

Specified by:
doMove in interface ClientUI
See Also:
doUndo(int), refresh()

doPut

public void doPut(int to,
                  int cont)
Specified by:
doPut in interface ClientUI

doPass

public void doPass()
pass (in normal play as well as in Go remove dead stones phase)

Specified by:
doPass in interface ClientUI

doUndo

public void doUndo(int num)
Specified by:
doUndo in interface ClientUI

doRemove

public void doRemove(int loc,
                     int cont)
Specified by:
doRemove in interface ClientUI

doToStart

public void doToStart()

doForward

public void doForward()

doBack

public void doBack()

doToEnd

public void doToEnd()

startNewGame

public boolean startNewGame(java.lang.String name,
                            java.lang.String positionID,
                            java.lang.String komi)

getClientCore

public F4ClientCore getClientCore()

loadGame

public boolean loadGame(java.lang.String fightID)

savePosition

public boolean savePosition(java.lang.String positionName,
                            java.lang.String turnOfParty)