public abstract class TableRequestHandler extends RequestHandler
MAPPER
Constructor and Description |
---|
TableRequestHandler(java.lang.String reqType,
java.lang.String respType,
java.lang.String nodeName)
Constructs a table request handler for a specific table view.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addTableConfigAnnotations(TableModel tm,
com.fasterxml.jackson.databind.node.ObjectNode payload)
Adds table configuration specific annotations to table model.
|
protected TableModel |
createTableModel()
Creates the table model (devoid of data) using
getColumnIds()
to initialize it, ready to be populated. |
protected java.lang.String |
defaultColumnId()
Returns the default column ID to be used when one is not supplied in
the payload as the column on which to sort.
|
protected abstract java.lang.String[] |
getColumnIds()
Subclasses should return the array of column IDs with which
to initialize their table model.
|
protected abstract java.lang.String |
noRowsMessage(com.fasterxml.jackson.databind.node.ObjectNode payload)
Subclasses should return the message to display in the table when there
are no rows to display.
|
protected abstract void |
populateTable(TableModel tm,
com.fasterxml.jackson.databind.node.ObjectNode payload)
Subclasses should populate the table model by adding
rows . |
void |
process(com.fasterxml.jackson.databind.node.ObjectNode payload)
Processes the incoming message payload from the client.
|
bool, chain, eventType, get, number, sendMessage, sendMessage, string, string
public TableRequestHandler(java.lang.String reqType, java.lang.String respType, java.lang.String nodeName)
reqType
- type of the request eventrespType
- type of the response eventnodeName
- name of JSON node holding row datapublic void process(com.fasterxml.jackson.databind.node.ObjectNode payload)
RequestHandler
process
in class RequestHandler
payload
- request message payloadprotected TableModel createTableModel()
getColumnIds()
to initialize it, ready to be populated.
This default implementation returns a table model with default formatters and comparators for all columns.
protected void addTableConfigAnnotations(TableModel tm, com.fasterxml.jackson.databind.node.ObjectNode payload)
tm
- a table modelpayload
- the event payload from the clientprotected java.lang.String defaultColumnId()
This default implementation returns "id".
protected abstract java.lang.String[] getColumnIds()
protected abstract java.lang.String noRowsMessage(com.fasterxml.jackson.databind.node.ObjectNode payload)
payload
- request payloadprotected abstract void populateTable(TableModel tm, com.fasterxml.jackson.databind.node.ObjectNode payload)
rows
.
tm.addRow() .cell(COL_ONE, ...) .cell(COL_TWO, ...) ... ;The request payload is provided in case there are request filtering parameters (other than sort column and sort direction) that are required to generate the appropriate data.
tm
- the table modelpayload
- request payload