|
|||||||||
| 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 | |
|---|---|
private boolean |
beenDisplayed
|
private java.lang.String[] |
data
|
private FreeColObject |
display
|
private Player |
owner
|
private FreeColGameObject |
source
|
private Location |
sourceLocation
|
private ModelMessage.MessageType |
type
|
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE |
| 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 | |
|---|---|
private static java.lang.String[] |
convertData(java.lang.String[][] data)
|
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. |
private static FreeColObject |
getDefaultDisplay(ModelMessage.MessageType type,
FreeColGameObject source)
Returns the default display object for the given type. |
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. |
private void |
verifyFields()
Checks that all the fields as they are set in the constructor are valid. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private Player owner
private FreeColGameObject source
private Location sourceLocation
private FreeColObject display
private ModelMessage.MessageType type
private java.lang.String[] data
private boolean beenDisplayed
| 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 |
|---|
private static java.lang.String[] convertData(java.lang.String[][] data)
private void verifyFields()
private static FreeColObject getDefaultDisplay(ModelMessage.MessageType type,
FreeColGameObject source)
type - the type for which to find the default display object.source - the source object
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.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String getXMLElementTagName()
public void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
FreeColObject
toXMLImpl in class FreeColObjectout - 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
readFromXMLImpl in class FreeColObjectin - 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 | ||||||||