templates.model
Class TemplateModelMessage

java.lang.Object
  extended by templates.model.TemplateModelMessage

public class TemplateModelMessage
extends java.lang.Object

Message sent by a TemplateModel to notify listeners of changes to the model.

Author:
Lenko Grigorov

Field Summary
static int ELEMENT_COMPONENT
          Concerning a TemplateComponent.
static int ELEMENT_LINK
          Concerning a TemplateLink.
protected  long elementId
          The id of the element (component or link).
protected  int elementType
          The type of the element (ELEMENT_COMPONENT or ELEMENT_LINK).
protected  java.lang.String message
          Text message.
static int OP_ADD
          Addition to the model.
static int OP_MODIFY
          Modification of the model which is not addition or removal.
static int OP_REMOVE
          Removal from the model.
protected  int operationType
          The type of the operation (OP_ADD, OP_REMOVE or OP_MODIFY).
protected  TemplateModel source
          The source of the message.
 
Constructor Summary
TemplateModelMessage(TemplateModel source, long elementId, int elementType, int operationType)
          Create a message with the given parameters and a null text message.
TemplateModelMessage(TemplateModel source, long elementId, int elementType, int operationType, java.lang.String message)
          Create a message with the given parameters.
 
Method Summary
 long getElementId()
          Retrieve the id of the element.
 int getElementType()
          Retrieve the type of the element.
 java.lang.String getMessage()
          Retrieve the text message.
 int getOperationType()
          Retrieve the type of the operation.
 TemplateModel getSource()
          Retrieve the source of the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OP_ADD

public static final int OP_ADD
Addition to the model.

See Also:
Constant Field Values

OP_REMOVE

public static final int OP_REMOVE
Removal from the model.

See Also:
Constant Field Values

OP_MODIFY

public static final int OP_MODIFY
Modification of the model which is not addition or removal.

See Also:
Constant Field Values

ELEMENT_COMPONENT

public static final int ELEMENT_COMPONENT
Concerning a TemplateComponent.

See Also:
Constant Field Values

ELEMENT_LINK

public static final int ELEMENT_LINK
Concerning a TemplateLink.

See Also:
Constant Field Values

source

protected TemplateModel source
The source of the message.


elementId

protected long elementId
The id of the element (component or link).


elementType

protected int elementType
The type of the element (ELEMENT_COMPONENT or ELEMENT_LINK).


operationType

protected int operationType
The type of the operation (OP_ADD, OP_REMOVE or OP_MODIFY).


message

protected java.lang.String message
Text message.

Constructor Detail

TemplateModelMessage

public TemplateModelMessage(TemplateModel source,
                            long elementId,
                            int elementType,
                            int operationType,
                            java.lang.String message)
Create a message with the given parameters.

Parameters:
source - the source of the message
elementId - the id of the element
elementType - the type of the element (ELEMENT_COMPONENT or ELEMENT_LINK)
operationType - the type of the operation (OP_ADD, OP_REMOVE or OP_MODIFY)
message - text message

TemplateModelMessage

public TemplateModelMessage(TemplateModel source,
                            long elementId,
                            int elementType,
                            int operationType)
Create a message with the given parameters and a null text message.

Parameters:
source - the source of the message
elementId - the id of the element
elementType - the type of the element (ELEMENT_COMPONENT or ELEMENT_LINK)
operationType - the type of the operation (OP_ADD, OP_REMOVE or OP_MODIFY)
Method Detail

getSource

public TemplateModel getSource()
Retrieve the source of the message.

Returns:
the source of the message

getElementId

public long getElementId()
Retrieve the id of the element.

Returns:
the id of the element

getElementType

public int getElementType()
Retrieve the type of the element.

Returns:
the type of the element (ELEMENT_COMPONENT or ELEMENT_LINK)

getOperationType

public int getOperationType()
Retrieve the type of the operation.

Returns:
the type of the operation (OP_ADD, OP_REMOVE or OP_MODIFY)

getMessage

public java.lang.String getMessage()
Retrieve the text message. May be null.

Returns:
the text message