public final class InGameInputHandler extends InputHandler
Modifier and Type | Field and Description |
---|---|
private java.lang.Runnable |
closeMenusRunnable |
private java.lang.Runnable |
displayModelMessagesRunnable |
private static java.util.logging.Logger |
logger |
private java.lang.Runnable |
reconnectRunnable |
Constructor and Description |
---|
InGameInputHandler(FreeColClient freeColClient)
The constructor to use.
|
Modifier and Type | Method and Description |
---|---|
private org.w3c.dom.Element |
addObject(org.w3c.dom.Element element)
Add the objects which are the children of this Element.
|
private org.w3c.dom.Element |
addPlayer(org.w3c.dom.Element element)
Handle an "addPlayer"-message.
|
private org.w3c.dom.Element |
animateAttack(org.w3c.dom.Element element)
Handle an "animateAttack"-message.
|
private org.w3c.dom.Element |
animateMove(org.w3c.dom.Element element)
Handle an "animateMove"-message.
|
private org.w3c.dom.Element |
chat(org.w3c.dom.Element element)
Handle a "chat"-message.
|
private org.w3c.dom.Element |
chooseFoundingFather(org.w3c.dom.Element element)
Handle an "chooseFoundingFather"-request.
|
private org.w3c.dom.Element |
closeMenus()
Trivial handler to allow the server to signal to the client
that an offer that caused a popup (for example, a native demand
or diplomacy proposal) has not been answered quickly enough and
that the offering player has assumed this player has
refused-by-inaction, and therefore, the popup needs to be
closed.
|
private org.w3c.dom.Element |
diplomacy(org.w3c.dom.Element element)
Handle a "diplomacy"-request.
|
private org.w3c.dom.Element |
disposeUnits(org.w3c.dom.Element element)
Disposes of the
Unit s which are the children of this
Element. |
private org.w3c.dom.Element |
error(org.w3c.dom.Element element)
Handle an "error"-message.
|
private org.w3c.dom.Element |
featureChange(org.w3c.dom.Element element)
Adds a feature to or removes a feature from a FreeColGameObject.
|
private org.w3c.dom.Element |
firstContact(org.w3c.dom.Element element)
Handle a first contact with a native nation.
|
private org.w3c.dom.Element |
fountainOfYouth(org.w3c.dom.Element element)
Ask the player to choose migrants from a fountain of youth event.
|
private org.w3c.dom.Element |
gameEnded(org.w3c.dom.Element element)
Handle a "gameEnded"-message.
|
private static int |
getIntegerAttribute(org.w3c.dom.Element element,
java.lang.String attrib)
Get the integer value of an element attribute.
|
org.w3c.dom.Element |
handle(Connection connection,
org.w3c.dom.Element element)
Deals with incoming messages that have just been received.
|
private InGameController |
igc()
Shorthand to get the controller.
|
private org.w3c.dom.Element |
indianDemand(org.w3c.dom.Element element)
Handle an "indianDemand"-request.
|
private void |
invokeAndWait(java.lang.Runnable runnable)
Shorthand to run in the EDT and wait.
|
private void |
invokeLater(java.lang.Runnable runnable)
Shorthand to run in the EDT eventually.
|
private org.w3c.dom.Element |
lootCargo(org.w3c.dom.Element element)
Ask the player to choose something to loot.
|
private org.w3c.dom.Element |
monarchAction(org.w3c.dom.Element element)
Handle a "monarchAction"-request.
|
private org.w3c.dom.Element |
multiple(Connection connection,
org.w3c.dom.Element element)
Handle all the children of this element.
|
private org.w3c.dom.Element |
newLandName(org.w3c.dom.Element element)
Ask the player to name the new land.
|
private org.w3c.dom.Element |
newRegionName(org.w3c.dom.Element element)
Ask the player to name a new region.
|
private org.w3c.dom.Element |
newTurn(org.w3c.dom.Element element)
Handle a "newTurn"-message.
|
private org.w3c.dom.Element |
reconnect(org.w3c.dom.Element element)
Handle an "reconnect"-message.
|
private org.w3c.dom.Element |
remove(org.w3c.dom.Element element)
Handle a "remove"-message.
|
private static org.w3c.dom.Element |
selectElement(org.w3c.dom.Element parent,
java.lang.String key)
Select a child element with the given object identifier from a
parent element.
|
private static Unit |
selectUnitFromElement(Game game,
org.w3c.dom.Element element,
java.lang.String id)
Sometimes units appear which the client does not know about,
and are passed in as the children of the parent element.
|
private org.w3c.dom.Element |
setAI(org.w3c.dom.Element element)
Handle a "setAI"-message.
|
private org.w3c.dom.Element |
setCurrentPlayer(org.w3c.dom.Element element)
Handle a "setCurrentPlayer"-message.
|
private org.w3c.dom.Element |
setDead(org.w3c.dom.Element element)
Handle a "setDead"-message.
|
private org.w3c.dom.Element |
setStance(org.w3c.dom.Element element)
Handle a "setStance"-request.
|
private org.w3c.dom.Element |
spyResult(org.w3c.dom.Element element)
Handle a "spyResult" message.
|
private org.w3c.dom.Element |
update(org.w3c.dom.Element element)
Handle an "update"-message.
|
disconnect, getFreeColClient, getGame, getGUI, unknown
private static final java.util.logging.Logger logger
private final java.lang.Runnable closeMenusRunnable
private final java.lang.Runnable displayModelMessagesRunnable
private final java.lang.Runnable reconnectRunnable
public InGameInputHandler(FreeColClient freeColClient)
freeColClient
- The FreeColClient
for the game.private InGameController igc()
private void invokeAndWait(java.lang.Runnable runnable)
runnable
- The Runnable
to run.private void invokeLater(java.lang.Runnable runnable)
runnable
- The Runnable
to run.private static int getIntegerAttribute(org.w3c.dom.Element element, java.lang.String attrib)
element
- The Element
to query.attrib
- The attribute to use.private static org.w3c.dom.Element selectElement(org.w3c.dom.Element parent, java.lang.String key)
parent
- The parent Element
.key
- The key to search for.Element
with matching key,
or null if none found.private static Unit selectUnitFromElement(Game game, org.w3c.dom.Element element, java.lang.String id)
game
- The Game
to add the unit to.element
- The Element
to find a unit in.id
- The object identifier of the unit to find.public org.w3c.dom.Element handle(Connection connection, org.w3c.dom.Element element)
handle
in interface MessageHandler
handle
in class InputHandler
connection
- The Connection
the message was
received on.element
- The root Element
of the message.private org.w3c.dom.Element addObject(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element addPlayer(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element animateAttack(org.w3c.dom.Element element)
element
- An element (root element in a DOM-parsed XML
tree) that holds attributes for the old and new tiles and
an element for the unit that is moving (which are used
solely to operate the animation).private org.w3c.dom.Element animateMove(org.w3c.dom.Element element)
element
- An element (root element in a DOM-parsed XML
tree) that holds attributes for the old and new tiles and
an element for the unit that is moving (which are used
solely to operate the animation).private org.w3c.dom.Element chat(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element chooseFoundingFather(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element closeMenus()
private org.w3c.dom.Element diplomacy(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) containing a "diplomacy"-message.private org.w3c.dom.Element disposeUnits(org.w3c.dom.Element element)
Unit
s which are the children of this
Element.element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element error(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element featureChange(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element firstContact(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element fountainOfYouth(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element gameEnded(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element indianDemand(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.IndianDemand
message containing the response,
or null on error.private org.w3c.dom.Element lootCargo(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element monarchAction(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element multiple(Connection connection, org.w3c.dom.Element element)
connection
- The Connection
the element arrived on.element
- The Element
to process.Element
containing the response/s.private org.w3c.dom.Element newLandName(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element newRegionName(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element newTurn(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML tree)
that holds all the information.private org.w3c.dom.Element reconnect(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element remove(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element setAI(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element setCurrentPlayer(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element setDead(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element setStance(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element spyResult(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.private org.w3c.dom.Element update(org.w3c.dom.Element element)
element
- The element (root element in a DOM-parsed XML
tree) that holds all the information.