net.sf.freecol.common.networking
Class MonarchActionMessage

java.lang.Object
  extended by net.sf.freecol.common.networking.DOMMessage
      extended by net.sf.freecol.common.networking.MonarchActionMessage

public class MonarchActionMessage
extends DOMMessage

The message sent when doing a monarch action.


Field Summary
private  Monarch.MonarchAction action
           
private  java.lang.String resultString
           
private  java.lang.String tax
           
private  StringTemplate template
           
 
Fields inherited from class net.sf.freecol.common.networking.DOMMessage
document, logger
 
Constructor Summary
MonarchActionMessage(Game game, org.w3c.dom.Element element)
          Create a new MonarchActionMessage from a supplied element.
MonarchActionMessage(Monarch.MonarchAction action, StringTemplate template)
          Create a new MonarchActionMessage with the given action.
 
Method Summary
 Monarch.MonarchAction getAction()
          Gets the monarch action type of this message.
 boolean getResult()
          Gets the result.
 int getTax()
          Gets the tax amount attached to this message.
 StringTemplate getTemplate()
          Gets the template of this message.
static java.lang.String getXMLElementTagName()
          The tag name of the root element representing this object.
 org.w3c.dom.Element handle(FreeColServer server, Player player, Connection connection)
          Handles a "monarchAction"-message.
 void setResult(boolean accepted)
          Sets the result.
 void setTax(int tax)
          Sets the tax amount attached to this message.
 org.w3c.dom.Element toXMLElement()
          Convert this MonarchMessage to XML.
 
Methods inherited from class net.sf.freecol.common.networking.DOMMessage
clientError, collapseElements, createError, createError, createNewDocument, createNewRootElement, elementToString, getAttribute, getChildElement, getDocument, getFreeColProtocolVersion, getType, hasAttribute, insertAsRoot, isType, setAttribute, setAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

action

private Monarch.MonarchAction action

template

private StringTemplate template

tax

private java.lang.String tax

resultString

private java.lang.String resultString
Constructor Detail

MonarchActionMessage

public MonarchActionMessage(Monarch.MonarchAction action,
                            StringTemplate template)
Create a new MonarchActionMessage with the given action.

Parameters:
action - The MonarchAction to do.

MonarchActionMessage

public MonarchActionMessage(Game game,
                            org.w3c.dom.Element element)
Create a new MonarchActionMessage from a supplied element.

Parameters:
game - The Game this message belongs to.
element - The Element to use to create the message.
Method Detail

getAction

public Monarch.MonarchAction getAction()
Gets the monarch action type of this message.

Returns:
The monarch action type.

getTemplate

public StringTemplate getTemplate()
Gets the template of this message.

Returns:
The template.

getTax

public int getTax()
Gets the tax amount attached to this message.

Returns:
The tax amount, or negative if none present.

setTax

public void setTax(int tax)
Sets the tax amount attached to this message.

Parameters:
tax - The tax amount.

getResult

public boolean getResult()
Gets the result.

Returns:
The result.

setResult

public void setResult(boolean accepted)
Sets the result.

Parameters:
accept - The new result.

handle

public org.w3c.dom.Element handle(FreeColServer server,
                                  Player player,
                                  Connection connection)
Handles a "monarchAction"-message.

Parameters:
server - The FreeColServer handling the message.
player - The Player the message applies to.
connection - The Connection message was received on.
Returns:
Null. This should not be called.

toXMLElement

public org.w3c.dom.Element toXMLElement()
Convert this MonarchMessage to XML.

Overrides:
toXMLElement in class DOMMessage
Returns:
The XML representation of this message.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
The tag name of the root element representing this object.

Returns:
"monarchAction".