net.sf.freecol.client.control
Class InputHandler

java.lang.Object
  extended by net.sf.freecol.client.control.InputHandler
All Implemented Interfaces:
MessageHandler
Direct Known Subclasses:
InGameInputHandler, PreGameInputHandler

public abstract class InputHandler
extends java.lang.Object
implements MessageHandler

Provides common methods for input handlers.


Field Summary
private  FreeColClient freeColClient
           
protected  GUI gui
           
private static java.util.logging.Logger logger
           
 
Constructor Summary
InputHandler(FreeColClient freeColClient, GUI gui)
          The constructor to use.
 
Method Summary
protected  org.w3c.dom.Element disconnect(org.w3c.dom.Element disconnectElement)
          Handles a "disconnect"-message.
protected  FreeColClient getFreeColClient()
          Returns the main freecol client object.
protected  Game getGame()
          Returns the Game.
abstract  org.w3c.dom.Element handle(Connection connection, org.w3c.dom.Element element)
          Deals with incoming messages that have just been received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

freeColClient

private final FreeColClient freeColClient

gui

protected GUI gui
Constructor Detail

InputHandler

public InputHandler(FreeColClient freeColClient,
                    GUI gui)
The constructor to use.

Parameters:
freeColClient - The main freecol client object.
Method Detail

getFreeColClient

protected FreeColClient getFreeColClient()
Returns the main freecol client object.

Returns:
The main freecol client object.

getGame

protected Game getGame()
Returns the Game.

Returns:
a Game value

handle

public abstract org.w3c.dom.Element handle(Connection connection,
                                           org.w3c.dom.Element element)
Deals with incoming messages that have just been received.

Specified by:
handle in interface MessageHandler
Parameters:
connection - The Connection the message was received on.
element - The root element of the message.
Returns:
The reply.

disconnect

protected org.w3c.dom.Element disconnect(org.w3c.dom.Element disconnectElement)
Handles a "disconnect"-message.

Parameters:
disconnectElement - The element (root element in a DOM-parsed XML tree) that holds all the information.
Returns:
null.