|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectqx.core.Object
qx.core.Target
qx.ui.table.model.Abstract
qx.ui.table.model.Remote
public class Remote
A table model that loads its data from a backend.
Only those rows are loaded that are near the area the user is currently viewing. If the user scrolls, the rows he will see soon are loaded asynchroniously in the background. All loaded data is managed in a cache that automatically removes the last resently used rows when it gets full.
This class is abstract: The actual loading of row data must be done by subclasses.
Constructor Summary | |
---|---|
Remote()
|
Method Summary | |
---|---|
boolean |
_cancelCurrentRequest()
Cancels the current request if possible. |
void |
_loadRowCount()
Implementing classes have to call _onRowCountLoaded() when the
server response arrived. |
void |
_loadRowData(java.lang.Integer firstRow,
java.lang.Integer lastRow)
Loads some row data from the server. |
void |
_onRowCountLoaded(java.lang.Integer rowCount)
Sets the row count. |
void |
_onRowDataLoaded(java.lang.Object rowDataArr)
Sets row data. |
void |
_setRowBlockData(java.lang.Integer block,
java.lang.Object rowDataArr)
Sets the data of one block. |
void |
clearCache()
Clears the cache. |
java.lang.Integer |
getBlockSize()
Returns the (computed) value of the property blockSize . |
java.lang.Object |
getCacheContent()
Returns the current state of the cache. |
boolean |
getClearCacheOnRemove()
Returns the (computed) value of the property clearCacheOnRemove . |
java.lang.Integer |
getMaxCachedBlockCount()
Returns the (computed) value of the property maxCachedBlockCount . |
java.lang.Integer |
getRowCount()
Returns the number of rows in the model. |
java.lang.Object |
getRowData(java.lang.Integer rowIndex)
See overridden method for details. |
java.lang.Integer |
getSortColumnIndex()
Returns the column index the model is sorted by. |
java.lang.Object |
getValue(java.lang.Integer columnIndex,
java.lang.Integer rowIndex)
Returns a cell value by column index. |
void |
initBlockSize(java.lang.Integer arg)
Calls the apply method and dispatches the change event of the property blockSize
with the default value defined by the class developer. |
void |
initClearCacheOnRemove(boolean arg)
Calls the apply method and dispatches the change event of the property clearCacheOnRemove
with the default value defined by the class developer. |
void |
initMaxCachedBlockCount(java.lang.Integer arg)
Calls the apply method and dispatches the change event of the property maxCachedBlockCount
with the default value defined by the class developer. |
boolean |
isClearCacheOnRemove()
Check whether the (computed) value of the boolean property clearCacheOnRemove equals true . |
boolean |
isColumnSortable(java.lang.Integer columnIndex)
Returns whether a column is sortable. |
boolean |
isSortAscending()
Returns whether the model is sorted ascending. |
void |
iterateCachedRows(java.lang.Object iterator,
java.lang.Object object)
Iterates through all cached rows. |
void |
prefetchRows(java.lang.Integer firstRowIndex,
java.lang.Integer lastRowIndex)
Prefetches some rows. |
void |
reloadData()
Reloads the model and clears the local cache. |
void |
removeRow(java.lang.Integer rowIndex)
Removes a rows from the model. |
void |
resetBlockSize()
Resets the user value of the property blockSize . |
void |
resetClearCacheOnRemove()
Resets the user value of the property clearCacheOnRemove . |
void |
resetMaxCachedBlockCount()
Resets the user value of the property maxCachedBlockCount . |
void |
restoreCacheContent(java.lang.Object cacheContent)
Restores a cache state created by getCacheContent() . |
void |
setBlockSize(java.lang.Integer arg)
Sets the user value of the property blockSize . |
void |
setClearCacheOnRemove(boolean arg)
Sets the user value of the property clearCacheOnRemove . |
void |
setColumnSortable(java.lang.Integer columnIndex,
boolean sortable)
Sets whether a column is sortable. |
void |
setMaxCachedBlockCount(java.lang.Integer arg)
Sets the user value of the property maxCachedBlockCount . |
void |
setValue(java.lang.Integer columnIndex,
java.lang.Integer rowIndex,
java.lang.Object value)
Sets a cell value by column index. |
void |
sortByColumn(java.lang.Integer columnIndex,
boolean ascending)
Sorts the model by a column. |
boolean |
toggleClearCacheOnRemove()
Toggles the (computed) value of the boolean property clearCacheOnRemove . |
Methods inherited from class qx.ui.table.model.Abstract |
---|
getColumnCount, getColumnId, getColumnIndexById, getColumnName, getValueById, isColumnEditable, setColumnIds, setColumnNamesById, setColumnNamesByIndex, setColumns, setValueById |
Methods inherited from class qx.core.Target |
---|
_dispatchEvent, addChangeSelectionListener, addChangeValueListener, addEventListener, addExecuteListener, addJavaEventListener, createDispatchChangeEvent, createDispatchDataEvent, createDispatchEvent, dispatchEvent, hasEventListeners, removeEventListener |
Methods inherited from class qx.core.Object |
---|
_disposeFields, _disposeObjectDeep, _disposeObjects, base, dispose, get, getDisposed, isDisposed, reset, self, set, toHashCode, toString_ |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Remote()
Method Detail |
---|
public boolean _cancelCurrentRequest()
Cancels the current request if possible.
Should be overridden by subclasses if they are able to cancel requests. This
allows sending a new request directly after a call of reloadData()
.
public void _loadRowCount()
Implementing classes have to call _onRowCountLoaded()
when the
server response arrived. That method has to be called! Even when there
was an error.
public void _loadRowData(java.lang.Integer firstRow, java.lang.Integer lastRow)
Loads some row data from the server.
Implementing classes have to call _onRowDataLoaded()
when the server
response arrived. That method has to be called! Even when there was an error.
public void _onRowCountLoaded(java.lang.Integer rowCount)
Sets the row count.
Has to be called by _loadRowCount()
.
public void _onRowDataLoaded(java.lang.Object rowDataArr)
Sets row data.
Has to be called by _loadRowData()
.
public void _setRowBlockData(java.lang.Integer block, java.lang.Object rowDataArr)
Sets the data of one block.
public void clearCache()
Clears the cache.
public java.lang.Integer getBlockSize()
Returns the (computed) value of the property blockSize
.
For further details take a look at the property definition: blockSize
.
public java.lang.Object getCacheContent()
Returns the current state of the cache.
Do not change anything in the returned data. This breaks the model state.
Use this method only together with restoreCacheContent(java.lang.Object)
for backing
up state for a later restore.
public boolean getClearCacheOnRemove()
Returns the (computed) value of the property clearCacheOnRemove
.
For further details take a look at the property definition: clearCacheOnRemove
.
public java.lang.Integer getMaxCachedBlockCount()
Returns the (computed) value of the property maxCachedBlockCount
.
For further details take a look at the property definition: maxCachedBlockCount
.
public java.lang.Integer getRowCount()
ITableModel
Returns the number of rows in the model.
getRowCount
in interface ITableModel
getRowCount
in class Abstract
public java.lang.Object getRowData(java.lang.Integer rowIndex)
See overridden method for details.
getRowData
in interface ITableModel
getRowData
in class Abstract
public java.lang.Integer getSortColumnIndex()
ITableModel
Returns the column index the model is sorted by. If the model is not sorted -1 is returned.
getSortColumnIndex
in interface ITableModel
getSortColumnIndex
in class Abstract
public java.lang.Object getValue(java.lang.Integer columnIndex, java.lang.Integer rowIndex)
ITableModel
Returns a cell value by column index.
getValue
in interface ITableModel
getValue
in class Abstract
public void initBlockSize(java.lang.Integer arg)
Calls the apply method and dispatches the change event of the property blockSize
with the default value defined by the class developer. This function can
only be called from the constructor of a class.
For further details take a look at the property definition: blockSize
.
public void initClearCacheOnRemove(boolean arg)
Calls the apply method and dispatches the change event of the property clearCacheOnRemove
with the default value defined by the class developer. This function can
only be called from the constructor of a class.
For further details take a look at the property definition: clearCacheOnRemove
.
public void initMaxCachedBlockCount(java.lang.Integer arg)
Calls the apply method and dispatches the change event of the property maxCachedBlockCount
with the default value defined by the class developer. This function can
only be called from the constructor of a class.
For further details take a look at the property definition: maxCachedBlockCount
.
public boolean isClearCacheOnRemove()
Check whether the (computed) value of the boolean property clearCacheOnRemove
equals true
.
For further details take a look at the property definition: clearCacheOnRemove
.
public boolean isColumnSortable(java.lang.Integer columnIndex)
ITableModel
Returns whether a column is sortable.
isColumnSortable
in interface ITableModel
isColumnSortable
in class Abstract
public boolean isSortAscending()
ITableModel
Returns whether the model is sorted ascending.
isSortAscending
in interface ITableModel
isSortAscending
in class Abstract
public void iterateCachedRows(java.lang.Object iterator, java.lang.Object object)
Iterates through all cached rows.
The iterator will be called for each cached row with two parameters: The row index of the current row (Integer) and the row data of that row (var[]). If the iterator returns something this will be used as new row data.
The iterator is called in the same order as the rows are in the model (the row index is always ascending).
public void prefetchRows(java.lang.Integer firstRowIndex, java.lang.Integer lastRowIndex)
ITableModel
Prefetches some rows. This is a hint to the model that the specified rows will be read soon.
prefetchRows
in interface ITableModel
prefetchRows
in class Abstract
public void reloadData()
Reloads the model and clears the local cache.
public void removeRow(java.lang.Integer rowIndex)
Removes a rows from the model.
public void resetBlockSize()
Resets the user value of the property blockSize
.
The computed value falls back to the next available value e.g. appearance, init or inheritance value depeneding on the property configuration and value availability.
For further details take a look at the property definition: blockSize
.
public void resetClearCacheOnRemove()
Resets the user value of the property clearCacheOnRemove
.
The computed value falls back to the next available value e.g. appearance, init or inheritance value depeneding on the property configuration and value availability.
For further details take a look at the property definition: clearCacheOnRemove
.
public void resetMaxCachedBlockCount()
Resets the user value of the property maxCachedBlockCount
.
The computed value falls back to the next available value e.g. appearance, init or inheritance value depeneding on the property configuration and value availability.
For further details take a look at the property definition: maxCachedBlockCount
.
public void restoreCacheContent(java.lang.Object cacheContent)
Restores a cache state created by getCacheContent()
.
public void setBlockSize(java.lang.Integer arg)
Sets the user value of the property blockSize
.
For further details take a look at the property definition: blockSize
.
public void setClearCacheOnRemove(boolean arg)
Sets the user value of the property clearCacheOnRemove
.
For further details take a look at the property definition: clearCacheOnRemove
.
public void setColumnSortable(java.lang.Integer columnIndex, boolean sortable)
Sets whether a column is sortable.
public void setMaxCachedBlockCount(java.lang.Integer arg)
Sets the user value of the property maxCachedBlockCount
.
For further details take a look at the property definition: maxCachedBlockCount
.
public void setValue(java.lang.Integer columnIndex, java.lang.Integer rowIndex, java.lang.Object value)
ITableModel
Sets a cell value by column index.
setValue
in interface ITableModel
setValue
in class Abstract
public void sortByColumn(java.lang.Integer columnIndex, boolean ascending)
ITableModel
Sorts the model by a column.
sortByColumn
in interface ITableModel
sortByColumn
in class Abstract
public boolean toggleClearCacheOnRemove()
Toggles the (computed) value of the boolean property clearCacheOnRemove
.
For further details take a look at the property definition: clearCacheOnRemove
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |