Interface PageMessage
- All Superinterfaces:
Message
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 the
Publisher 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.
Note: After publishing a message, do not reuse the message (e.g. change the content, republish) as this can cause issues.
-
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all the fields previously added to thisPageMessagebooleancontainsField(String fieldName) Determines whether the message contains the specified fieldGets the value of the specified field.Gets the fields within thisPageMessage, in the order of which the fields were sent.intGets the height of the page, in text rows.Gets the type of the page.Gets a read-only list of the updated page elements.intgetWidth()Gets the width of the page, in text columns.voidremoveField(String fieldName) Removes all occurrences given field from thisPageMessage.voidsetContent(int column, int row, String content) Updates the contents of the page at the specified location.voidSets a field value.voidsetHeight(int height) Sets the height of the page, in text rows.voidsetPageType(String pageType) Sets the type of the page.voidsetWidth(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 Details
-
setContent
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
PageMessageinstances created using theMessageFactoryinterface. However it may be undefined (and hence have a value of -1) on instances received by an implementation ofSubscriptionListenerThe 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
PageMessageinstances created using theMessageFactoryinterface. 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
PageMessageinstances created using theMessageFactoryinterface, 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
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
Determines whether the message contains the specified field- Parameters:
fieldName- Name of the field.- Returns:
trueif the message contains the field, otherwise,false.
-
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
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 thefieldNameis not defined in the Fields configuration file.
-
getField
Gets the value of the specified field. If the field does not exist in thisPageMessage,nullis 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 thefieldNameis not defined in the Fields configuration file.
-
removeField
Removes all occurrences given field from thisPageMessage.- Parameters:
fieldName- The name of the field to remove.
-