|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.ModelMessage
public class ModelMessage
Contains a message about a change in the model.
Nested Class Summary | |
---|---|
static class |
ModelMessage.MessageType
Constants describing the type of message. |
Field Summary |
---|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
ModelMessage()
|
|
ModelMessage(FreeColGameObject source,
ModelMessage.MessageType type,
FreeColObject display,
java.lang.String id,
java.lang.String... data)
Creates a new ModelMessage . |
|
ModelMessage(FreeColGameObject source,
java.lang.String id,
java.lang.String[][] data)
Creates a new ModelMessage . |
|
ModelMessage(FreeColGameObject source,
java.lang.String id,
java.lang.String[][] data,
ModelMessage.MessageType type)
Creates a new ModelMessage . |
|
ModelMessage(FreeColGameObject source,
java.lang.String id,
java.lang.String[][] data,
ModelMessage.MessageType type,
FreeColObject display)
Deprecated. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Checks if this ModelMessage is equal to another ModelMessage . |
java.lang.String[] |
getData()
Returns the data to be displayed in the message. |
FreeColObject |
getDisplay()
Gets the Object to display. |
Player |
getOwner()
Returns the owner of this message. |
FreeColGameObject |
getSource()
Gets the source of the message. |
ModelMessage.MessageType |
getType()
Gets the type of the message to display. |
java.lang.String |
getTypeName()
|
static java.lang.String |
getXMLElementTagName()
|
boolean |
hasBeenDisplayed()
Checks if this ModelMessage has been displayed. |
int |
hashCode()
|
void |
readFromXML(javax.xml.stream.XMLStreamReader in,
Game game)
Initialize this object from an XML-representation of this object. |
void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
setBeenDisplayed(boolean beenDisplayed)
Sets the beenDisplayed value of this ModelMessage . |
void |
setDisplay(FreeColGameObject newDisplay)
Sets the Object to display. |
void |
setOwner(Player newOwner)
Set the owner of this message. |
void |
setSource(FreeColGameObject newSource)
Sets the source of the message. |
java.lang.String |
toString()
|
void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ModelMessage()
@Deprecated public ModelMessage(FreeColGameObject source, java.lang.String id, java.lang.String[][] data, ModelMessage.MessageType type, FreeColObject display)
ModelMessage
.
source
- The source of the message. This is what the message should be
associated with. In addition, the owner of the source is the
player getting the message.id
- The ID of the message to display.data
- Contains data to be displayed in the message or null.type
- The type of this model message.display
- The Object to display.public ModelMessage(FreeColGameObject source, ModelMessage.MessageType type, FreeColObject display, java.lang.String id, java.lang.String... data)
ModelMessage
.
source
- The source of the message. This is what the message should be
associated with. In addition, the owner of the source is the
player getting the message.type
- The type of this model message.display
- The Object to display.id
- The ID of the message to display.data
- Contains data to be displayed in the message or null.public ModelMessage(FreeColGameObject source, java.lang.String id, java.lang.String[][] data, ModelMessage.MessageType type)
ModelMessage
.
source
- The source of the message. This is what the message should be
associated with. In addition, the owner of the source is the
player getting the message.id
- The ID of the message to display.data
- Contains data to be displayed in the message or null.type
- The type of this model message.public ModelMessage(FreeColGameObject source, java.lang.String id, java.lang.String[][] data)
ModelMessage
.
source
- The source of the message. This is what the message should be
associated with. In addition, the owner of the source is the
player getting the message.id
- The ID of the message to display.data
- Contains data to be displayed in the message or null.Method Detail |
---|
public boolean hasBeenDisplayed()
ModelMessage
has been displayed.
ModelMessage
has been displayed.setBeenDisplayed(boolean)
public void setBeenDisplayed(boolean beenDisplayed)
beenDisplayed
value of this ModelMessage
.
This is used to avoid showing the same message twice.
beenDisplayed
- Should be set to true
after the
message has been displayed.public FreeColGameObject getSource()
getOwner()
public void setSource(FreeColGameObject newSource)
newSource
- a new source for this messagepublic java.lang.String[] getData()
String[]
or null
if no data applies.public ModelMessage.MessageType getType()
public java.lang.String getTypeName()
public FreeColObject getDisplay()
public void setDisplay(FreeColGameObject newDisplay)
newDisplay
- the new object to displaypublic Player getOwner()
source
.
Player
who should receive the message.public void setOwner(Player newOwner)
newOwner
- A Player
to own this message.public boolean equals(java.lang.Object o)
ModelMessage
is equal to another ModelMessage
.
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String getXMLElementTagName()
public void toXMLImpl(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException
FreeColObject
out
- The target stream.
javax.xml.stream.XMLStreamException
- if there are any problems writing
to the stream.public void readFromXMLImpl(javax.xml.stream.XMLStreamReader in) throws javax.xml.stream.XMLStreamException
in
- The input stream with the XML.
javax.xml.stream.XMLStreamException
- if a problem was encountered
during parsing.public void readFromXML(javax.xml.stream.XMLStreamReader in, Game game) throws javax.xml.stream.XMLStreamException
in
- The input stream with the XML.game
- a Game
value
javax.xml.stream.XMLStreamException
- if a problem was encountered
during parsing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |