ks.client.gamefactory
Class GameWindow

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--ks.client.gamefactory.GameWindow
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, ITimerExpired, java.awt.MenuContainer, java.io.Serializable

public class GameWindow
extends java.awt.Frame
implements ITimerExpired

Primary Window for managing the Container within which the solitaire action takes place.

GameWindow can speak back to the primary connection through its helperClient (which it shares with KombatClient).

GameWindow receives TimerExpired events from its TimerPanel entity. Creation date: (9/25/01 9:19:21 PM)

See Also:
Serialized Form

Field Summary
protected  java.lang.String currentUser
          Name of the current user.
protected  int initialHeight
          Initial height for the window.
protected  int initialWidth
          Initial width for the window.
protected  Status keepStatus
          Maintain status information that will be sent on to the server in minorTick().
protected  int lastHeight
          Last height for the window.
protected  int lastWidth
          Last width for the window.
protected  ITableRequests requester
          When GameWindow needs to talk to the entity running the show, use this object.
protected  SolitaireSolver ss
          Since V1.6.2: The solver.
protected  Table table
          Table being played.
protected  Solitaire theSSGame
          Since V1.6.2: When a plugin is solvable, we keep track of it here for access in solving.
 
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.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
GameWindow()
          GameWindow constructor comment.
GameWindow(java.lang.String title)
          GameWindow constructor comment.
 
Method Summary
 void activate(boolean status)
          Activate/Deactivate this game.
 void addUserToTable(java.lang.String newUser)
          Adds the user to this table.
 void announceStatus(Status status)
          Process the updates coming from the internal container.
protected  void completeInitialization()
           
 void container_MouseClicked(java.awt.event.MouseEvent mouseEvent)
          Route the event into the container handler routines
 void container_MouseDragged(java.awt.event.MouseEvent mouseEvent)
          Route the event into the container handler routines
 void container_MouseMoved(java.awt.event.MouseEvent mouseEvent)
          Route the event into the container handler routines
 void container_MousePressed(java.awt.event.MouseEvent mouseEvent)
          Route the event into the container handler routines
 void container_MouseReleased(java.awt.event.MouseEvent mouseEvent)
          Route the event into the container handler routines
protected  java.awt.Image createBackgroundImage(java.net.URL u)
          Construct an image given the specified URL Creation date: (10/9/01 8:26:51 PM)
 void gameWindow_ComponentResized(java.awt.event.ComponentEvent componentEvent)
          Handle the window resize events here.
 void gameWindow_WindowEvents()
          Comment
 Container getGameContainer()
          Returns the Container in which solitaire games are being executed.
 int getGameLength()
          Return the time length of the table associated with this interface Creation date: (10/16/01 9:21:41 PM)
 Table getTable()
          Return the table for this window.
 java.lang.String getTableName()
          Knows info about table.
 java.lang.String getTableType()
          Knows info about table.
 void initialize(Solitaire game)
          Initialize game canvas using specific solitaire game.
 void inputField_ActionPerformed(java.awt.event.ActionEvent actionEvent)
          React to new text entered into the input field.
 void leaveGame_ActionPerformed(java.awt.event.ActionEvent actionEvent)
          Comment
 void leaveTable()
          must send this request on to the server.
 void minorTick()
          Send status information on to the server.
 void newGame_ActionPerformed(java.awt.event.ActionEvent actionEvent)
          Process 'new hand' requests.
 int offsetHeight()
          Return the height to offset our GUI elements (if any)
 int offsetWidth()
          Return the width to offset our GUI elements (if any)
 void processChat(java.lang.String msg)
          Send chat output to the output Field.
 void processMessage(Message msg)
          Ability process a message from the server is now added.
 void processStatusTick(java.lang.String player, int numWon, int numPoints)
          Update information for this user on the player rankings panel.
 void rejoinGame_ActionPerformed(java.awt.event.ActionEvent actionEvent)
          Ask helper to restart the game for us (same seed and all).
 void removeUserFromTable(java.lang.String exitingUser)
          Removes user from this table.
 void restart_ActionPerformed(java.awt.event.ActionEvent actionEvent)
          Process 'reset hand' requests.
 void sendCommand(Command com)
          This method enables the kombatSolitaire plugin (via Container) to deliver a command to the server.
 void setRequester(ITableRequests requester)
          Tell GameWindow who to turn to with specific game requests.
 void setSkin(java.lang.String skinChoice)
          Set the skin for this GameWindow...
 void setTable(Table newTable)
          Keep track of the table to be able to answer useful questions later.
 void setUser(java.lang.String user)
          Sets the name of the user for this Game.
 void startSolveButton1_ActionPerformed()
          Comment
 void startTimer()
          Have the timerPanel start counting down.
 void stopSolveButton_ActionPerformed()
          Comment
 void stopTimer()
          Have the timerPanel stop counting down.
 void terminateGame()
           
 void timerExpired()
          When timer expires, this method is invoked.
 void updateTitle(Solitaire game)
          Changes the title of the Frame to reflect the game name and type Creation date: (10/6/01 5:00:26 PM)
 void wonGame()
          Actions to process once the solitaire game has been won.
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, 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, processWindowEvent, 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, addImpl, 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, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, 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

currentUser

protected java.lang.String currentUser
Name of the current user. Needed to include this value within the Container.


requester

protected ITableRequests requester
When GameWindow needs to talk to the entity running the show, use this object.


initialWidth

protected int initialWidth
Initial width for the window. Must never shrink less than this.


initialHeight

protected int initialHeight
Initial height for the window. Must never shrink less than this.


lastHeight

protected int lastHeight
Last height for the window. Start with initial height.


lastWidth

protected int lastWidth
Last width for the window. Start with initial width.


theSSGame

protected Solitaire theSSGame
Since V1.6.2: When a plugin is solvable, we keep track of it here for access in solving.


ss

protected SolitaireSolver ss
Since V1.6.2: The solver.


table

protected Table table
Table being played.


keepStatus

protected Status keepStatus
Maintain status information that will be sent on to the server in minorTick().

Constructor Detail

GameWindow

public GameWindow()
GameWindow constructor comment.


GameWindow

public GameWindow(java.lang.String title)
GameWindow constructor comment.

Parameters:
title - java.lang.String
Method Detail

getTableName

public java.lang.String getTableName()
Knows info about table.


getTableType

public java.lang.String getTableType()
Knows info about table.


activate

public void activate(boolean status)
Activate/Deactivate this game. Note: To set this to false means the timer has run out (from within) and we must contact the server To set this to true means we are starting a new game. Creation date: (10/17/01 12:07:28 AM)


addUserToTable

public void addUserToTable(java.lang.String newUser)
Adds the user to this table. Must also impart this information on to the container b/c some solitaire variations need to be told when users leave the game. Creation date: (10/13/01 5:33:30 PM)

Parameters:
newUser - Status

announceStatus

public void announceStatus(Status status)
Process the updates coming from the internal container. This status entity is our record. Creation date: (10/13/01 5:29:18 PM)

Parameters:
status - ks.common.Status

container_MouseClicked

public void container_MouseClicked(java.awt.event.MouseEvent mouseEvent)
Route the event into the container handler routines


container_MouseDragged

public void container_MouseDragged(java.awt.event.MouseEvent mouseEvent)
Route the event into the container handler routines


container_MouseMoved

public void container_MouseMoved(java.awt.event.MouseEvent mouseEvent)
Route the event into the container handler routines


container_MousePressed

public void container_MousePressed(java.awt.event.MouseEvent mouseEvent)
Route the event into the container handler routines


container_MouseReleased

public void container_MouseReleased(java.awt.event.MouseEvent mouseEvent)
Route the event into the container handler routines


createBackgroundImage

protected java.awt.Image createBackgroundImage(java.net.URL u)
Construct an image given the specified URL Creation date: (10/9/01 8:26:51 PM)

Parameters:
u - java.net.URL
Returns:
java.awt.Image

gameWindow_ComponentResized

public void gameWindow_ComponentResized(java.awt.event.ComponentEvent componentEvent)
Handle the window resize events here. Resize Container and move control panel down a few pixels to make space.

Since:
V1.6.6

gameWindow_WindowEvents

public void gameWindow_WindowEvents()
Comment


getGameContainer

public Container getGameContainer()
Returns the Container in which solitaire games are being executed. Creation date: (10/3/01 1:12:29 AM)

Returns:
ks.common.view.Container

getGameLength

public int getGameLength()
Return the time length of the table associated with this interface Creation date: (10/16/01 9:21:41 PM)

Returns:
int

getTable

public Table getTable()
Return the table for this window. Creation date: (10/17/01 12:42:15 AM)

Returns:
ks.common.Table

initialize

public void initialize(Solitaire game)
Initialize game canvas using specific solitaire game. Note that nothing will actually become visible until activate(boolean) is called. Called by the entity that creates the GameWindow. Must be called before setting GameWindow to Visible.

since v1.6.2 this enables a button "Solve" if the solitaire game is an instance of SolvableSolitaire.

Creation date: (10/1/01 9:10:22 PM)

Parameters:
game - Solitaire

completeInitialization

protected void completeInitialization()

inputField_ActionPerformed

public void inputField_ActionPerformed(java.awt.event.ActionEvent actionEvent)
React to new text entered into the input field.


leaveGame_ActionPerformed

public void leaveGame_ActionPerformed(java.awt.event.ActionEvent actionEvent)
Comment


leaveTable

public void leaveTable()
must send this request on to the server.


minorTick

public void minorTick()
Send status information on to the server. Protocol: statusTickMessage:tableName:tableType:[Status] where [Status] = "user:numWon:numPoints" Creation date: (10/22/01 9:18:35 PM)

Specified by:
minorTick in interface ITimerExpired

newGame_ActionPerformed

public void newGame_ActionPerformed(java.awt.event.ActionEvent actionEvent)
Process 'new hand' requests.


offsetHeight

public int offsetHeight()
Return the height to offset our GUI elements (if any)


offsetWidth

public int offsetWidth()
Return the width to offset our GUI elements (if any)


processChat

public void processChat(java.lang.String msg)
Send chat output to the output Field. Creation date: (11/25/01 6:59:06 PM)

Parameters:
msg - java.lang.String

processStatusTick

public void processStatusTick(java.lang.String player,
                              int numWon,
                              int numPoints)
Update information for this user on the player rankings panel. Creation date: (10/22/01 9:34:58 PM)

Parameters:
player - java.lang.String
numWon - int
numPoints - int

rejoinGame_ActionPerformed

public void rejoinGame_ActionPerformed(java.awt.event.ActionEvent actionEvent)
Ask helper to restart the game for us (same seed and all). This must change (HACK)


removeUserFromTable

public void removeUserFromTable(java.lang.String exitingUser)
Removes user from this table.

Parameters:
exitingUser - Status

restart_ActionPerformed

public void restart_ActionPerformed(java.awt.event.ActionEvent actionEvent)
Process 'reset hand' requests.


setRequester

public void setRequester(ITableRequests requester)
Tell GameWindow who to turn to with specific game requests. Creation date: (10/17/01 12:36:44 AM)


setSkin

public void setSkin(java.lang.String skinChoice)
Set the skin for this GameWindow...


setTable

public void setTable(Table newTable)
Keep track of the table to be able to answer useful questions later. Creation date: (10/17/01 12:42:15 AM)

Parameters:
newTable - ks.common.Table

setUser

public void setUser(java.lang.String user)
Sets the name of the user for this Game. Creation date: (10/13/01 5:33:30 PM)


sendCommand

public void sendCommand(Command com)
This method enables the kombatSolitaire plugin (via Container) to deliver a command to the server.

Parameters:
com - Command to be sent.
Since:
v2.2

startSolveButton1_ActionPerformed

public void startSolveButton1_ActionPerformed()
Comment


startTimer

public void startTimer()
Have the timerPanel start counting down. Creation date: (10/17/01 12:01:38 AM)


stopSolveButton_ActionPerformed

public void stopSolveButton_ActionPerformed()
Comment


stopTimer

public void stopTimer()
Have the timerPanel stop counting down. Creation date: (10/17/01 12:01:38 AM)


timerExpired

public void timerExpired()
When timer expires, this method is invoked. Creation date: (10/21/01 4:08:37 PM)

Specified by:
timerExpired in interface ITimerExpired

updateTitle

public void updateTitle(Solitaire game)
Changes the title of the Frame to reflect the game name and type Creation date: (10/6/01 5:00:26 PM)

Parameters:
game - ks.games.Solitaire

wonGame

public void wonGame()
Actions to process once the solitaire game has been won. Creation date: (10/17/01 12:01:38 AM)


terminateGame

public void terminateGame()
Since:
V2.2.1

processMessage

public void processMessage(Message msg)
Ability process a message from the server is now added. This will enable the multi-solitaire playing that we demand.

Since:
V2.2