Interface PageMessage
-
- All Superinterfaces:
Message
public interface PageMessage extends Message
An instance of
PageMessage
represents updates to a Page subject.An object implementing this interface cannot be instantiated directly, but can be constructed using the
MessageFactory
that is available on thePublisher
interface.Each update applies to a region of the page that starts at a specific column and row.
If you call
setContent(int, int, String)
more than once, and the page regions specified in successive calls overlap, the updates are still held separately in the message; they are not merged together.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearFields()
Removes all the fields previously added to thisPageMessage
boolean
containsField(String fieldName)
Determines whether the message contains the specified fieldString
getField(String fieldName)
Gets the value of the specified field.List<Field>
getFields()
Gets the fields within thisPageMessage
, in the order of which the fields were sent.int
getHeight()
Gets the height of the page, in text rows.String
getPageType()
Gets the type of the page.List<PageElement>
getUpdatedElements()
Gets a read-only list of the updated page elements.int
getWidth()
Gets the width of the page, in text columns.void
removeField(String fieldName)
Removes all occurrences given field from thisPageMessage
.void
setContent(int column, int row, String content)
Updates the contents of the page at the specified location.void
setField(String fieldName, String value)
Sets a field value.void
setHeight(int height)
Sets the height of the page, in text rows.void
setPageType(String pageType)
Sets the type of the page.void
setWidth(int width)
Sets the width of the page, in text columns.-
Methods inherited from interface com.caplin.datasource.messaging.Message
getMessageType, getSubject, isImage, setImage
-
-
-
-
Method Detail
-
setContent
void setContent(int column, int row, String content)
Updates the contents of the page at the specified location.
- Parameters:
column
- The column at which the content is to be updated. The leftmost column of the page is column 0.row
- The row at which the content is to be updated. The top row of the page is row 0.content
- The page content to be placed at the specified row and column.
-
getWidth
int getWidth()
Gets the width of the page, in text columns.
This value is valid on all
PageMessage
instances created using theMessageFactory
interface. However it may be undefined (and hence have a value of -1) on instances received by an implementation ofSubscriptionListener
The first character on a page is at column zero. Therefore the maximum modifiable column is at position (Width - 1).
- Returns:
- The width of the page, in text columns.
-
setWidth
void setWidth(int width)
Sets the width of the page, in text columns.
This value is valid on all
PageMessage
instances created using theMessageFactory
interface. However it may be undefined (and hence have a value of -1) on instances received by an implementation ofSubscriptionListener
.The first character on a page is at column zero. Therefore the maximum modifiable column is at position (Width - 1).
- Parameters:
width
- The width of the page, in text columns.
-
getHeight
int getHeight()
Gets the height of the page, in text rows.
This value is valid on all
PageMessage
instances created using theMessageFactory
interface, however it may be undefined (and hence have a value of -1) on instances received by an implementation ofSubscriptionListener
.The first character on a page is at row zero. Therefore the maximum modifiable row is at position (height - 1).
- Returns:
- The height of the page, in text rows.
-
setHeight
void setHeight(int height)
Sets the height of the page, in text rows.
The first character on a page is at row zero. Therefore the maximum modifiable row is at row (height - 1).
- Parameters:
height
- The height of the page, in text rows.
-
getPageType
String getPageType()
Gets the type of the page.
The type of the page is available to StreamLink clients and can be used to control the display of the page.
- Returns:
- The type of the page.
-
setPageType
void setPageType(String pageType)
Sets the type of the page.
The type of the page is available to StreamLink clients and can be used to control the display of the page.
- Parameters:
pageType
- The type of the page.
-
getUpdatedElements
List<PageElement> getUpdatedElements()
Gets a read-only list of the updated page elements.
- Returns:
- The updated page elements.
-
clearFields
void clearFields()
Removes all the fields previously added to thisPageMessage
-
containsField
boolean containsField(String fieldName)
Determines whether the message contains the specified field- Parameters:
fieldName
- Name of the field.- Returns:
true
if the message contains the field, otherwise,false
.
-
getFields
List<Field> getFields()
Gets the fields within thisPageMessage
, in the order of which the fields were sent. This can include duplicate field names for different values.- Returns:
- A read-only list of the fields.
-
setField
void setField(String fieldName, String value)
Sets a field value.
If the field does not exist in this
PageMessage
, the field is added to it. Otherwise the existing occurrence of the field is updated to the newvalue
.- Parameters:
fieldName
- The name of the field.value
- The new value of the field.- Throws:
IllegalArgumentException
- Raised when thefieldName
is not defined in the Fields configuration file.
-
getField
String getField(String fieldName)
Gets the value of the specified field. If the field does not exist in this
PageMessage
,null
is returned.- Parameters:
fieldName
- The name of the field to get.- Returns:
- The value of the field with the name
fieldName
, or null if there is no such field in thisPageMessage
. - Throws:
IllegalArgumentException
- Raised when thefieldName
is not defined in the Fields configuration file.
-
removeField
void removeField(String fieldName)
Removes all occurrences given field from thisPageMessage
.- Parameters:
fieldName
- The name of the field to remove.
-
-