net.sf.freecol.client.control
Class InGameInputHandler

java.lang.Object
  extended by net.sf.freecol.client.control.InputHandler
      extended by net.sf.freecol.client.control.InGameInputHandler
All Implemented Interfaces:
MessageHandler

public final class InGameInputHandler
extends InputHandler

Handles the network messages that arrives while in the getGame().


Nested Class Summary
(package private)  class InGameInputHandler.NoResultCanvasSwingTask
          Base class for Swing tasks that need to do a simple update without return value using the canvas.
(package private)  class InGameInputHandler.ReconnectSwingTask
          This task reconnects to the server.
(package private)  class InGameInputHandler.RefreshCanvasSwingTask
          This task refreshes the entire canvas.
(package private)  class InGameInputHandler.RefreshTilesSwingTask
           
(package private)  class InGameInputHandler.ShowConfirmDialogSwingTask
          This class shows a dialog and saves the answer (ok/cancel).
(package private)  class InGameInputHandler.ShowErrorMessageSwingTask
          This class shows an error dialog.
(package private)  class InGameInputHandler.ShowInformationMessageSwingTask
          This class shows an informational dialog.
(package private)  class InGameInputHandler.ShowMessageSwingTask
          Base class for dialog SwingTasks.
(package private)  class InGameInputHandler.ShowModelMessageSwingTask
          This class shows a model message.
(package private)  class InGameInputHandler.ShowMonarchPanelSwingTask
          This class shows the monarch panel.
(package private)  class InGameInputHandler.ShowNegotiationDialogSwingTask
          This class displays a negotiation dialog.
(package private)  class InGameInputHandler.ShowSelectFoundingFatherSwingTask
          This class displays a dialog that lets the player pick a Founding Father.
(package private)  class InGameInputHandler.ShowSelectSwingTask
          This class displays a dialog that lets the player pick a Founding Father.
(package private)  class InGameInputHandler.ShowVictoryPanelSwingTask
          This task shows the victory panel.
(package private) static class InGameInputHandler.SwingTask
          This utility class is the base class for tasks that need to run in the event dispatch thread.
(package private)  class InGameInputHandler.UnitMoveAnimationCanvasSwingTask
          This task plays an unit movement animation in the Canvas.
(package private)  class InGameInputHandler.UpdateMenuBarSwingTask
          This task updates the menu bar.
 
Field Summary
private static java.util.logging.Logger logger
           
 
Constructor Summary
InGameInputHandler(FreeColClient freeColClient)
          The constructor to use.
 
Method Summary
 org.w3c.dom.Element addHistory(org.w3c.dom.Element element)
          Add the HistoryEvents which are the children of this Element.
 org.w3c.dom.Element addMessages(org.w3c.dom.Element element)
          Add the ModelMessages which are the children of this Element.
private  org.w3c.dom.Element addPlayer(org.w3c.dom.Element element)
          Handles an "addPlayer"-message.
private  org.w3c.dom.Element chat(org.w3c.dom.Element element)
          Handles a "chat"-message.
private  org.w3c.dom.Element chooseFoundingFather(org.w3c.dom.Element element)
          Handles an "chooseFoundingFather"-request.
private  org.w3c.dom.Element diplomacy(org.w3c.dom.Element element)
          Handles a "diplomacy"-request.
 org.w3c.dom.Element disposeUnits(org.w3c.dom.Element element)
          Disposes of the Units which are the children of this Element.
private  org.w3c.dom.Element error(org.w3c.dom.Element element)
          Handles an "error"-message.
private  org.w3c.dom.Element gameEnded(org.w3c.dom.Element element)
          Handles a "gameEnded"-message.
 org.w3c.dom.Element handle(Connection connection, org.w3c.dom.Element element)
          Deals with incoming messages that have just been received.
private  org.w3c.dom.Element indianDemand(org.w3c.dom.Element element)
          Handles an "indianDemand"-request.
private  org.w3c.dom.Element lostCityRumour(org.w3c.dom.Element element)
          Handles a "lostCityRumour"-request.
private  org.w3c.dom.Element marketElement(org.w3c.dom.Element element)
          Handles a "marketElement"-request.
private  org.w3c.dom.Element monarchAction(org.w3c.dom.Element element)
          Handles a "monarchAction"-request.
 org.w3c.dom.Element multiple(Connection connection, org.w3c.dom.Element element)
          Handle all the children of this element.
private  org.w3c.dom.Element newConvert(org.w3c.dom.Element element)
          Handles a "newConvert"-request.
private  org.w3c.dom.Element newTurn(org.w3c.dom.Element newTurnElement)
          Handles a "newTurn"-message.
private  org.w3c.dom.Element opponentAttack(org.w3c.dom.Element opponentAttackElement)
          Handles an "opponentAttack"-message.
private  org.w3c.dom.Element opponentMove(org.w3c.dom.Element opponentMoveElement)
          Handles an "opponentMove"-message.
private  org.w3c.dom.Element reconnect(org.w3c.dom.Element element)
          Handles an "reconnect"-message.
private  org.w3c.dom.Element remove(org.w3c.dom.Element removeElement)
          Handles a "remove"-message.
private  org.w3c.dom.Element removeGoods(org.w3c.dom.Element element)
          Handles a "removeGoods"-request.
private  org.w3c.dom.Element setAI(org.w3c.dom.Element element)
          Handles a "setAI"-message.
private  org.w3c.dom.Element setCurrentPlayer(org.w3c.dom.Element setCurrentPlayerElement)
          Handles a "setCurrentPlayer"-message.
private  org.w3c.dom.Element setDead(org.w3c.dom.Element element)
          Handles a "setDead"-message.
private  org.w3c.dom.Element setStance(org.w3c.dom.Element element)
          Handles a "setStance"-request.
private  org.w3c.dom.Element spanishSuccession(org.w3c.dom.Element element)
          Handles a "spanishSuccession" message
 org.w3c.dom.Element update(org.w3c.dom.Element updateElement)
          Handles an "update"-message.
private  void updateGameObjects(org.w3c.dom.NodeList nodeList)
          Updates all FreeColGameObjects from the childNodes of the message
 
Methods inherited from class net.sf.freecol.client.control.InputHandler
disconnect, getFreeColClient, getGame
 
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
Constructor Detail

InGameInputHandler

public InGameInputHandler(FreeColClient freeColClient)
The constructor to use.

Parameters:
freeColClient - The main controller.
Method Detail

handle

public 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
Specified by:
handle in class InputHandler
Parameters:
connection - The Connection the message was received on.
element - The root element of the message.
Returns:
The reply.

reconnect

private org.w3c.dom.Element reconnect(org.w3c.dom.Element element)
Handles an "reconnect"-message.

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

update

public org.w3c.dom.Element update(org.w3c.dom.Element updateElement)
Handles an "update"-message.

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

updateGameObjects

private void updateGameObjects(org.w3c.dom.NodeList nodeList)
Updates all FreeColGameObjects from the childNodes of the message

Parameters:
nodeList - The list of nodes from the message

remove

private org.w3c.dom.Element remove(org.w3c.dom.Element removeElement)
Handles a "remove"-message.

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

opponentMove

private org.w3c.dom.Element opponentMove(org.w3c.dom.Element opponentMoveElement)
Handles an "opponentMove"-message.

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

opponentAttack

private org.w3c.dom.Element opponentAttack(org.w3c.dom.Element opponentAttackElement)
Handles an "opponentAttack"-message.

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

setCurrentPlayer

private org.w3c.dom.Element setCurrentPlayer(org.w3c.dom.Element setCurrentPlayerElement)
Handles a "setCurrentPlayer"-message.

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

newTurn

private org.w3c.dom.Element newTurn(org.w3c.dom.Element newTurnElement)
Handles a "newTurn"-message.

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

setDead

private org.w3c.dom.Element setDead(org.w3c.dom.Element element)
Handles a "setDead"-message.

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

gameEnded

private org.w3c.dom.Element gameEnded(org.w3c.dom.Element element)
Handles a "gameEnded"-message.

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

chat

private org.w3c.dom.Element chat(org.w3c.dom.Element element)
Handles a "chat"-message.

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

error

private org.w3c.dom.Element error(org.w3c.dom.Element element)
Handles an "error"-message.

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

setAI

private org.w3c.dom.Element setAI(org.w3c.dom.Element element)
Handles a "setAI"-message.

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

chooseFoundingFather

private org.w3c.dom.Element chooseFoundingFather(org.w3c.dom.Element element)
Handles an "chooseFoundingFather"-request.

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

newConvert

private org.w3c.dom.Element newConvert(org.w3c.dom.Element element)
Handles a "newConvert"-request.

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

diplomacy

private org.w3c.dom.Element diplomacy(org.w3c.dom.Element element)
Handles a "diplomacy"-request. If the message informs of an acceptance or rejection then display the result and return null. If the message is a proposal, then ask the user about it and return the response with appropriate response set.

Parameters:
element - The element (root element in a DOM-parsed XML tree) containing a "diplomacy"-message.
Returns:
A diplomacy response, or null if none required.

indianDemand

private org.w3c.dom.Element indianDemand(org.w3c.dom.Element element)
Handles an "indianDemand"-request.

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

monarchAction

private org.w3c.dom.Element monarchAction(org.w3c.dom.Element element)
Handles a "monarchAction"-request.

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

setStance

private org.w3c.dom.Element setStance(org.w3c.dom.Element element)
Handles a "setStance"-request.

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

addPlayer

private org.w3c.dom.Element addPlayer(org.w3c.dom.Element element)
Handles an "addPlayer"-message.

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

marketElement

private org.w3c.dom.Element marketElement(org.w3c.dom.Element element)
Handles a "marketElement"-request.

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

removeGoods

private org.w3c.dom.Element removeGoods(org.w3c.dom.Element element)
Handles a "removeGoods"-request.

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

lostCityRumour

private org.w3c.dom.Element lostCityRumour(org.w3c.dom.Element element)
Handles a "lostCityRumour"-request.

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

spanishSuccession

private org.w3c.dom.Element spanishSuccession(org.w3c.dom.Element element)
Handles a "spanishSuccession" message

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

disposeUnits

public org.w3c.dom.Element disposeUnits(org.w3c.dom.Element element)
Disposes of the Units which are the children of this Element.

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

addMessages

public org.w3c.dom.Element addMessages(org.w3c.dom.Element element)
Add the ModelMessages which are the children of this Element.

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

addHistory

public org.w3c.dom.Element addHistory(org.w3c.dom.Element element)
Add the HistoryEvents which are the children of this Element.

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

multiple

public org.w3c.dom.Element multiple(Connection connection,
                                    org.w3c.dom.Element element)
Handle all the children of this element.

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