Interface DSPage
- All Superinterfaces:
DSData
,DSPacket
,DSSerializable
,Iterable<DSField>
The interface that should be implemented by an instance of DSPage
of the type page. This interface extends DSData
, and provides an
additional method that allow text to be added by row and column.
The first packet for a page (the image) should include the
DSData.F_IMAGE
flag. This is more important for
pages than other data types as it allows the Liberator (or other DataSource) to
initialise the object to the correct page dimensions.
The DSPage views an object in terms of row and column values as opposed to field numbers and values.
Each unique row and column combination maps to a cell on this page. When text is
added to the page using addPageRow(int, int, java.lang.String)
the text is inserted at the specified
row / column position. To place text at the start of a page would require setting
both the row and column to 0.
For example, below shows what an existing page looks like before and after a DSPage instance is created, addPageRow(2, 11, "02") has been called, and the page is then sent with DSPage.send:
Before: After: FX Price Page FX Price Page GBP 1.7942/48 GBP 1.7942/48 EUR 1.2393/99 EUR 1.2393/02 JPY 110.44/49 JPY 110.44/49
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The pagetype String used to identify a standard 80x25 page.static final int
The offset applied to page fields added usingaddPageField(int, String)
.static final String
The pageType String used to identify a standard 64x16 page.Fields inherited from interface com.caplin.datasource.interfaces.DSData
CONTAINER_TYPE, F_AUTH_UPDATE, F_AUTHGLOBAL, F_CHANGEDFIELDS, F_CLEAR_PERMISSIONS, F_CLEAR_TYPE2, F_CLEAR_TYPE3, F_CREATEOBJECT, F_CREATEPARENT, F_DELETE_PERMISSION, F_FILTER_TYPE2, F_FILTER_TYPE3, F_IMAGE, F_NONACTIVE, GENERIC_TYPE, NEWS_TYPE, PAGE_TYPE, PERMISSION_TYPE, RECORD_TYPE, STORY_TYPE, TYPE2_RECORD_TYPE, TYPE3_RECORD_TYPE, UNKNOWN_TYPE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPageField
(int fieldNumber, String value) Adds field data to a page.void
addPageRow
(int x, int y, String text) Adds text data to thisDSPage
based on row and column.Methods inherited from interface com.caplin.datasource.interfaces.DSData
addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addBinaryData, addData, addData, addData, addData, addData, addData, addData, addData, clearFields, count, elements, getFieldByFieldNumber, getFieldByFieldNumber, getFlags, getKeys, getSubject, getType, getValues, iterator, removeField, setFlags, setSubject, setType, updateData, updateData
Methods inherited from interface com.caplin.datasource.interfaces.DSPacket
send, sendDirect, sendToPeer
Methods inherited from interface com.caplin.datasource.interfaces.DSSerializable
toBytes
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
BIGPAGE_TYPE
The pagetype String used to identify a standard 80x25 page.- See Also:
-
SMALLPAGE_TYPE
The pageType String used to identify a standard 64x16 page.- See Also:
-
FIELD_OFFSET
static final int FIELD_OFFSETThe offset applied to page fields added usingaddPageField(int, String)
. This offset will be present in any page fields (e.g. non-page data) contained in pages received by a DataSource.- See Also:
-
-
Method Details
-
addPageRow
Adds text data to this
DSPage
based on row and column. The latter two values indicate where the start of the text is placed.- Parameters:
x
- the row where the text begins - zero indexed.y
- the column where the text begins - zero indexed.text
- the text to be inserted into the page.
-
addPageField
Adds field data to a page. This is stored as additional information and not part of the page text itself. Useful for content-based permissioning or other metadata requirements.
- Parameters:
fieldNumber
- the field number for the page field to be added. N.B. This will be offset byFIELD_OFFSET
in the packet sent to peers so it is identified as a field not a page data update. Field range for page fields is 0-16383value
- the value to be stored in the page field.- Throws:
IllegalArgumentException
- if fieldNumber is outside the range 0-16383
-