com.realtime.crossfire.jxclient.main
Class DefaultKeyHandler

java.lang.Object
  extended by com.realtime.crossfire.jxclient.main.DefaultKeyHandler
All Implemented Interfaces:
KeyHandlerListener

public class DefaultKeyHandler
extends java.lang.Object
implements KeyHandlerListener

A KeyHandlerListener which updates the state of a GuiManager.


Field Summary
private  ClientSocketListener clientSocketListener
          The ClientSocketListener used to detect connection state changes.
private  boolean connected
          Whether a server connection is active.
private  Exiter exiter
          The Exiter instance.
private  GuiManager guiManager
          The GuiManager instance.
private  GuiStateManager guiStateManager
          The GuiStateManager instance.
private  java.lang.Object semaphoreConnected
          The synchronization object for accesses to connected.
 
Constructor Summary
DefaultKeyHandler(Exiter exiter, GuiManager guiManager, ServerConnection server, GuiStateManager guiStateManager)
          Creates a new instance.
 
Method Summary
 void escPressed()
          The ESC key has been pressed.
private  boolean isConnected()
          Returns whether a server connection is active.
 void keyReleased()
          A key (but not ESC) has been released.
private  void setConnected(boolean connected)
          Records whether a server connection is active.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clientSocketListener

@NotNull
private final ClientSocketListener clientSocketListener
The ClientSocketListener used to detect connection state changes.


connected

private boolean connected
Whether a server connection is active.


exiter

@NotNull
private final Exiter exiter
The Exiter instance.


guiManager

@NotNull
private final GuiManager guiManager
The GuiManager instance.


guiStateManager

@NotNull
private final GuiStateManager guiStateManager
The GuiStateManager instance.


semaphoreConnected

@NotNull
private final java.lang.Object semaphoreConnected
The synchronization object for accesses to connected.

Constructor Detail

DefaultKeyHandler

public DefaultKeyHandler(@NotNull
                         Exiter exiter,
                         @NotNull
                         GuiManager guiManager,
                         @NotNull
                         ServerConnection server,
                         @NotNull
                         GuiStateManager guiStateManager)
Creates a new instance.

Parameters:
exiter - the exiter instance
guiManager - the gui manager instance
server - the server connection to track
guiStateManager - the gui state manager instance
Method Detail

escPressed

public void escPressed()
The ESC key has been pressed.

Specified by:
escPressed in interface KeyHandlerListener

isConnected

private boolean isConnected()
Returns whether a server connection is active.

Returns:
whether a server connection is active

keyReleased

public void keyReleased()
A key (but not ESC) has been released.

Specified by:
keyReleased in interface KeyHandlerListener

setConnected

private void setConnected(boolean connected)
Records whether a server connection is active.

Parameters:
connected - whether a server connection is active