talx x1.0.5

talx.games.helpdesk
Class HelpDeskGame

java.lang.Object
  extended bytalx.games.Game
      extended bytalx.games.helpdesk.HelpDeskGame
All Implemented Interfaces:
java.util.EventListener, java.awt.event.KeyListener, java.io.Serializable

public class HelpDeskGame
extends Game
implements java.awt.event.KeyListener

Provides factory for HelpDeskViews and HelpDeskHandlers. This class automatically updates the game state as changes occur to the composer text in the view. This means that updates to the game state must be synchronized. This implies the following process for changing the game state:

  1. Aquire a lock on this game object.
  2. Read the current state with getState().
  3. Create a modified state.
  4. Write the modified state with setState().
  5. Release the lock on this game object. To prevent deadlock, any threads that synchronize on the controller must acquire that lock first, before acquiring a lock on this object.

    See Also:
    Serialized Form

    Field Summary
     
    Fields inherited from class talx.games.Game
    isSynchronized
     
    Constructor Summary
    HelpDeskGame(Player p, GameManager g, StringValueMap text)
              Creates a new help desk game for the given player.
     
    Method Summary
     GameHandler getHandler()
              Returns the handler for this Game.
     GameView getView(MailSystemDesktop ms, Settings settings)
              Returns the view associated with this Game.
     void keyPressed(java.awt.event.KeyEvent e)
               
     void keyReleased(java.awt.event.KeyEvent e)
               
     void keyTyped(java.awt.event.KeyEvent e)
               
     void release()
               
     void syncText()
               
     
    Methods inherited from class talx.games.Game
    addGameListener, equals, fireLocalModelChange, fireLocalModelChange, fireRemoteModelChange, fireRemoteModelChange, getGameManager, getPlayer, getState, removeGameListener, setState, toString
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    HelpDeskGame

    public HelpDeskGame(Player p,
                        GameManager g,
                        StringValueMap text)
    Creates a new help desk game for the given player.

    Parameters:
    p - the player.
    g - the system's game manager.
    text - a map from HelpDesk key constants to UI text samples.
    Method Detail

    getHandler

    public GameHandler getHandler()
    Description copied from class: Game
    Returns the handler for this Game. As with all ActionHandlers, the returned object should be stateless, and obtain all state information from the object returned by getState. For this reason, the game handler returned is usually a singleton.

    Specified by:
    getHandler in class Game

    getView

    public GameView getView(MailSystemDesktop ms,
                            Settings settings)
    Description copied from class: Game
    Returns the view associated with this Game. This method should just return a newly created implementation object of GameView that is capable of displaying this type of game. The parameters are included for the view to conform to the look and feel of the current system.

    Specified by:
    getView in class Game

    keyTyped

    public void keyTyped(java.awt.event.KeyEvent e)
    Specified by:
    keyTyped in interface java.awt.event.KeyListener

    keyPressed

    public void keyPressed(java.awt.event.KeyEvent e)
    Specified by:
    keyPressed in interface java.awt.event.KeyListener

    keyReleased

    public void keyReleased(java.awt.event.KeyEvent e)
    Specified by:
    keyReleased in interface java.awt.event.KeyListener

    release

    public void release()

    syncText

    public void syncText()

    talx x1.0.5

    © 2001-2005 University of Oregon.
    Eugene OR 97403, U.S.A. All Rights Reserved.