public class ClientBrowseModel extends java.lang.Object implements BrowseModel
BrowseModel
used by
the Browse
widget. The implementation is just forwards all
requests to the remote side using ServerExports interface.Modifier and Type | Field and Description |
---|---|
private int |
browseId
ID of the associated browse widget.
|
private WidgetConfig[] |
editorConfigsCache
Cache of editing widgets' configurations.
|
Constructor and Description |
---|
ClientBrowseModel(int browseId)
Construct an instance of adapter class using specified query ID and
reference to server interface.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applyEnhancedConfig(EnhancedBrowseConfig config)
Apply the given enhanced browse configuration to this browse.
|
java.lang.String[] |
getColumnFiltersMappedDataTypes()
For enhanced filtering: get data types of the fields mapped using
DB-FILTER-FIELD-MAPPING . |
int |
getCurrentRow()
Get current row in the model.
|
WidgetConfig[] |
getEditorsConfigs()
Get configurations of editors (fill-ins, toggle-boxes or combo-boxes) used for in-browse
editing.
|
EnhancedBrowseSaveTarget[] |
getEnhancedBrowseResetTargets()
Get enhanced browse configuration reset targets available for the current browse and the
current user.
|
EnhancedBrowseSaveTarget[] |
getEnhancedBrowseSaveTargets()
Get save targets for an enhanced browse configuration, which are available for the current
user.
|
int |
getRowCount()
Get the number of rows iterated by the query (for preselect queries - matches result size,
for adaptive queries - matches the size of the part of the result set the query has already
iterated over).
|
int |
getRowCount(int startRow)
Get number of available rows starting from the given one.
|
BrowseRow[] |
getRows(char searchChar,
int searchColumn,
int viewportTopRow,
int viewportBottomRow,
int rowDisplayTriggerId,
ScreenBuffer[] sb)
This function is used when search by key is performed in a browse.
|
BrowseRow[] |
getRows(int startRowIndex,
int count,
boolean forward,
int rowDisplayTriggerId,
ScreenBuffer[] sb,
RowDisplayStrategy displayStrategy)
Retrieves several subsequent rows from the database.
|
boolean |
isRowAvailable(int rowIndex)
Determines if the specified browse row is "available", i.e.
|
void |
moveColumn(int src,
int dest)
Implements the MOVE-COLUMN() widget method.
|
void |
notifyBrowseLayoutPerformed()
Notify server that browse layout has been performed on the client side.
|
void |
resetEditorsConfigsCache()
Reset cache of editors configurations.
|
EhBrowseConfigKey |
resetEnhancedConfig(EnhancedBrowseSaveTarget resetTarget)
Reset (delete) an enhanced configuration at the certain level for this browse.
|
boolean |
runReport(java.lang.String outputFileName,
MediaType outputFormat)
Run browse report.
|
EnhancedBrowseConfig |
saveOrCacheEnhancedConfig(EnhancedBrowseSaveTarget saveTarget)
Save the current enhanced browse configuration using the specified save target.
|
int |
setCurrentRow(int rowIndex)
Inform server about current row in the browse.
|
void |
setDynamicFiltering(int[] columnOrdinals,
BaseDataType[] values)
Set dynamic filtering for the browse.
|
void |
setDynamicSorting(int[] columnOrdinals,
boolean[] ascending)
Set dynamic sorting for the browse.
|
void |
updateRow(int rowIndex,
int[] cellIndices,
BaseDataType[] cellValues,
boolean onlyNotifyRowReleased)
Updates selected cells in the given row.
|
private int browseId
private WidgetConfig[] editorConfigsCache
public ClientBrowseModel(int browseId)
browseId
- ID of the browse widget to forward request to.public WidgetConfig[] getEditorsConfigs()
getEditorsConfigs
in interface BrowseModel
null
if the
column is not editable. Return value is null
if the browse is
read-only.public void resetEditorsConfigsCache()
resetEditorsConfigsCache
in interface BrowseModel
public int getRowCount()
getRowCount
in interface BrowseModel
public int getRowCount(int startRow)
getRowCount
in interface BrowseModel
startRow
- Initial row to start count rows from.public BrowseRow[] getRows(int startRowIndex, int count, boolean forward, int rowDisplayTriggerId, ScreenBuffer[] sb, RowDisplayStrategy displayStrategy)
getRows
in interface BrowseModel
startRowIndex
- Index of the first row to retrieve (0-based).count
- Maximum count of rows to return. -1
for no limit.forward
- true
if rows are retrieved in the forward direction,
false
if rows are retrieved in the backward direction.rowDisplayTriggerId
- Trigger ID of the ROW-DISPLAY trigger. -1
if there is no ROW-DISPLAY
trigger for this browse.sb
- Screen buffer for the ROW-DISPLAY trigger. null
if there is no
ROW-DISPLAY trigger for this browse.displayStrategy
- Specifies type of action for which rows are fetched and defines how rows are
iterated / displayed.null
is returned.public BrowseRow[] getRows(char searchChar, int searchColumn, int viewportTopRow, int viewportBottomRow, int rowDisplayTriggerId, ScreenBuffer[] sb)
getRows
in interface BrowseModel
searchChar
- Character to be searched for. Search is performed using only the first character
(in the visual data representation) in the current column. Specifying a character
puts this function in the search mode. This parameter is null
for
non-search mode.searchColumn
- For search mode: 0-based index of the column to be searched.viewportTopRow
- For search mode: 0-based index (in the result set) of the top row in the current
view.viewportBottomRow
- For search mode: 0-based index (in the result set) of the bottom row in the
current view.rowDisplayTriggerId
- Trigger ID of the ROW-DISPLAY trigger. -1
if there is no ROW-DISPLAY
trigger for this browse.sb
- Screen buffer for the ROW-DISPLAY trigger. null
if there is no
ROW-DISPLAY trigger for this browse.null
is returned.public void updateRow(int rowIndex, int[] cellIndices, BaseDataType[] cellValues, boolean onlyNotifyRowReleased) throws DataValidationException
updateRow
in interface BrowseModel
rowIndex
- Index of the row to update.cellIndices
- Cells for update indexes.cellValues
- Cells for update new values.onlyNotifyRowReleased
- Only notify server that the row has been released. Data is not updated.DataValidationException
- New values don't passed database validation rules.public int setCurrentRow(int rowIndex)
setCurrentRow
in interface BrowseModel
rowIndex
- 0-based index of the current row.public int getCurrentRow()
getCurrentRow
in interface BrowseModel
public boolean isRowAvailable(int rowIndex)
isRowAvailable
in interface BrowseModel
rowIndex
- 0-base index of the target row in the browse model.true
if the row is "available", i.e. it is not deleted.public void moveColumn(int src, int dest)
Repositions a column in the browse widget.
moveColumn
in interface BrowseModel
src
- 0-based position of the column to be moved (column ordinal).dest
- 0-based position to which the column is moved (column ordinal).public void notifyBrowseLayoutPerformed()
notifyBrowseLayoutPerformed
in interface BrowseModel
public boolean runReport(java.lang.String outputFileName, MediaType outputFormat)
runReport
in interface BrowseModel
outputFileName
- Name of the output file.outputFormat
- Format of the output format.true
on success.public EnhancedBrowseSaveTarget[] getEnhancedBrowseSaveTargets()
getEnhancedBrowseSaveTargets
in interface BrowseModel
public java.lang.String[] getColumnFiltersMappedDataTypes()
DB-FILTER-FIELD-MAPPING
.
They are used in column filters. E.g. if a column has DB-FILTER-FIELD-MAPPING
set to
"some-table.some-date-field", data type from this column would be "date".getColumnFiltersMappedDataTypes
in interface BrowseModel
DB-FILTER-FIELD-MAPPING
set, corresponding array element is null
.public EnhancedBrowseSaveTarget[] getEnhancedBrowseResetTargets()
getEnhancedBrowseResetTargets
in interface BrowseModel
public EhBrowseConfigKey resetEnhancedConfig(EnhancedBrowseSaveTarget resetTarget)
resetEnhancedConfig
in interface BrowseModel
resetTarget
- Defines the level at which the configuration will be reset.null
if there is
no configuration at this level.public boolean applyEnhancedConfig(EnhancedBrowseConfig config)
applyEnhancedConfig
in interface BrowseModel
config
- Enhanced browse configuration to apply.true
on success.public EnhancedBrowseConfig saveOrCacheEnhancedConfig(EnhancedBrowseSaveTarget saveTarget)
saveOrCacheEnhancedConfig
in interface BrowseModel
saveTarget
- Save target (if configuration is applied to "all browses" / "specific browse" and
"all users" / "current user").null
on error.public void setDynamicSorting(int[] columnOrdinals, boolean[] ascending)
setDynamicSorting
in interface BrowseModel
columnOrdinals
- Array of the ordinals of the sort columns. Inside the array ordinals are positioned
from the column which defines the most coarse sorting to the most granular.ascending
- Array of the sorting directions of the sort columns. true
for ascending,
false
for descending. Inside the array directions are positioned
from the column which defines the most coarse sorting to the most granular.public void setDynamicFiltering(int[] columnOrdinals, BaseDataType[] values)
setDynamicFiltering
in interface BrowseModel
columnOrdinals
- Array of the ordinals of the filtered columns.values
- Array of the filter values for the filtered columns..