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 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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearFields()
      Removes all the fields previously added to this PageMessage
      boolean containsField​(java.lang.String fieldName)
      Determines whether the message contains the specified field
      java.lang.String getField​(java.lang.String fieldName)
      Gets the value of the specified field.
      java.util.List<Field> getFields()
      Gets the fields within this PageMessage, in the order of which the fields were sent.
      int getHeight()
      Gets the height of the page, in text rows.
      java.lang.String getPageType()
      Gets the type of the page.
      java.util.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​(java.lang.String fieldName)
      Removes all occurrences given field from this PageMessage.
      void setContent​(int column, int row, java.lang.String content)
      Updates the contents of the page at the specified location.
      void setField​(java.lang.String fieldName, java.lang.String value)
      Sets a field value.
      void setHeight​(int height)
      Sets the height of the page, in text rows.
      void setPageType​(java.lang.String pageType)
      Sets the type of the page.
      void setWidth​(int width)
      Sets the width of the page, in text columns.
    • Method Detail

      • setContent

        void setContent​(int column,
                        int row,
                        java.lang.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 the MessageFactory interface. However it may be undefined (and hence have a value of -1) on instances received by an implementation of SubscriptionListener

         

        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 the MessageFactory interface. However it may be undefined (and hence have a value of -1) on instances received by an implementation of SubscriptionListener.

        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 the MessageFactory interface, however it may be undefined (and hence have a value of -1) on instances received by an implementation of SubscriptionListener.

         

        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

        java.lang.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​(java.lang.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

        java.util.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 this PageMessage
      • containsField

        boolean containsField​(java.lang.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

        java.util.List<Field> getFields()
        Gets the fields within this PageMessage, 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​(java.lang.String fieldName,
                      java.lang.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 new value.

        Parameters:
        fieldName - The name of the field.
        value - The new value of the field.
        Throws:
        java.lang.IllegalArgumentException - Raised when the fieldName is not defined in the Fields configuration file.
      • getField

        java.lang.String getField​(java.lang.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 this PageMessage.
        Throws:
        java.lang.IllegalArgumentException - Raised when the fieldName is not defined in the Fields configuration file.
      • removeField

        void removeField​(java.lang.String fieldName)
        Removes all occurrences given field from this PageMessage.
        Parameters:
        fieldName - The name of the field to remove.