|
||||||||||
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.Simple
qx.ui.treevirtual.SimpleTreeDataModel
public class SimpleTreeDataModel
A simple tree data model used as the table model
The object structure of a single node of the tree is:
{ // USER-PROVIDED ATTRIBUTES // ------------------------ type : qx.ui.treevirtual.SimpleTreeDataModel.Type.LEAF, parentNodeId : 23, // index of the parent node in _nodeArr label : "My Documents", bSelected : true, // true if node is selected; false otherwise. bOpened : true, // true (-), false (+) bHideOpenClose : false, // whether to hide the open/close button icon : "images/folder.gif", iconSelected : "images/folder_selected.gif", cellStyle : "background-color:cyan" labelStyle : "background-color:red;color:white" // USER-PROVIDED COLUMN DATA columnData : [ null, // null at index of tree column (typically 0) "text of column 1", "text of column 2" ], // APPLICATION-, MIXIN-, and SUBCLASS-PROVIDED CUSTOM DATA data : { application : { // application-specific user data goes in here foo: "bar", ... }, MDragAndDropSupport : { // Data required for the Drag & Drop mixin. // When a mixin is included, its constructor // should create this object, named according // to the mixin or subclass name (empty or // otherwise) }, ... // Additional mixins or subclasses. }, // INTERNALLY-CALCULATED ATTRIBUTES // -------------------------------- // The following properties need not (and should not) be set by the // caller, but are automatically calculated. Some are used internally, // while others may be of use to event listeners. nodeId : 42, // The index in _nodeArr, useful to event listeners. children : [ ], // each value is an index into _nodeArr level : 2, // The indentation level of this tree node bFirstChild : true, lastChild : [ false ], // Array where the index is the column of // indentation, and the value is a boolean. // These are used to locate the // appropriate "tree line" icon. }
Constructor Summary | |
---|---|
SimpleTreeDataModel()
|
Method Summary | |
---|---|
java.lang.Integer |
_addNode(java.lang.Integer parentNodeId,
java.lang.String label,
java.lang.Integer bOpened,
boolean bHideOpenCloseButton,
java.lang.Integer type,
java.lang.String icon,
java.lang.String iconSelected)
Add a node to the tree. |
void |
_clearSelections()
Clear all selections in the data model. |
java.lang.Integer |
addBranch(java.lang.Integer parentNodeId,
java.lang.String label,
boolean bOpened,
boolean bHideOpenCloseButton,
java.lang.String icon,
java.lang.String iconSelected)
Add a branch to the tree. |
java.lang.Integer |
addLeaf(java.lang.Integer parentNodeId,
java.lang.String label,
java.lang.String icon,
java.lang.String iconSelected)
Add a leaf to the tree. |
void |
clearData()
Clears the tree of all nodes |
java.lang.Object |
getColumnData(java.lang.Integer nodeId,
java.lang.Integer columnIndex)
Retrieve the data from an additional column (a column other than the tree column) of the tree. |
java.lang.Object |
getData()
Return the array of node data. |
java.lang.Object |
getNodeFromRow(java.lang.Integer rowIndex)
This operation maps rowIndexes to nodes. |
java.lang.Object |
getNodeRowMap()
Return the mapping of nodes to rendered rows. |
java.lang.Integer |
getRowCount()
Returns the number of rows in the model. |
java.lang.Object |
getRowData(java.lang.Integer rowIndex)
Returns the data of one row. |
void |
getRowFromNodeId(java.lang.Integer nodeId)
This operation maps nodes to rowIndexes. |
java.lang.Object |
getSelectedNodes()
Return the nodes that are currently selected. |
java.lang.Integer |
getSortColumnIndex()
Returns the column index the model is sorted by. |
void |
getTree()
|
java.lang.Integer |
getTreeColumn()
Get the column in which the tree is to be displayed. |
java.lang.Object |
getValue(java.lang.Object columnIndex,
java.lang.Object rowIndex)
|
boolean |
isColumnSortable(java.lang.Integer columnIndex)
Returns whether a column is sortable. |
void |
prune(java.lang.Object nodeReference,
boolean bSelfAlso)
Prune the tree by removing, recursively, all of a node’s children. |
void |
setColumnData(java.lang.Integer nodeId,
java.lang.Integer columnIndex,
java.lang.Object data)
Add data to an additional column (a column other than the tree column) of the tree. |
void |
setColumnEditable(java.lang.Integer columnIndex,
boolean editable)
Sets whether a column is editable. |
void |
setData(java.lang.Object nodeArr)
Sets the whole data en bulk, or notifies the data model that node modifications are complete. |
void |
setState(java.lang.Object nodeReference,
java.lang.Object attributes)
Set state attributes of a node. |
void |
setTree(java.lang.Object tree)
|
void |
setTreeColumn(java.lang.Integer columnIndex)
Specifies which column the tree is to be displayed in. |
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. |
Methods inherited from class qx.ui.table.model.Simple |
---|
_clearSorting, _mapArray2RowArr, addRows, addRowsAsMapArray, getCaseSensitiveSorting, getRowDataAsMap, getValue, initCaseSensitiveSorting, isCaseSensitiveSorting, isColumnEditable, isSortAscending, removeRows, resetCaseSensitiveSorting, setCaseSensitiveSorting, setColumnSortable, setData, setDataAsMapArray, setEditable, setSortMethods, toggleCaseSensitiveSorting |
Methods inherited from class qx.ui.table.model.Abstract |
---|
getColumnCount, getColumnId, getColumnIndexById, getColumnName, getValueById, prefetchRows, 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 SimpleTreeDataModel()
Method Detail |
---|
public java.lang.Integer _addNode(java.lang.Integer parentNodeId, java.lang.String label, java.lang.Integer bOpened, boolean bHideOpenCloseButton, java.lang.Integer type, java.lang.String icon, java.lang.String iconSelected)
Add a node to the tree.
NOTE: This method is for internal use and should not be called by
users of this class. Instead, call addBranch(java.lang.Integer, java.lang.String, boolean, boolean, java.lang.String, java.lang.String)
or addLeaf(java.lang.Integer, java.lang.String, java.lang.String, java.lang.String)
. There is no guarantee that the interface to this
method will remain unchanged over time.
public void _clearSelections()
Clear all selections in the data model. This method does not clear selections displayed in the widget, and is intended for internal use, not by users of this class.
public java.lang.Integer addBranch(java.lang.Integer parentNodeId, java.lang.String label, boolean bOpened, boolean bHideOpenCloseButton, java.lang.String icon, java.lang.String iconSelected)
Add a branch to the tree.
public java.lang.Integer addLeaf(java.lang.Integer parentNodeId, java.lang.String label, java.lang.String icon, java.lang.String iconSelected)
Add a leaf to the tree.
public void clearData()
Clears the tree of all nodes
public java.lang.Object getColumnData(java.lang.Integer nodeId, java.lang.Integer columnIndex)
Retrieve the data from an additional column (a column other than the tree column) of the tree.
public java.lang.Object getData()
Return the array of node data.
getData
in class Simple
public java.lang.Object getNodeFromRow(java.lang.Integer rowIndex)
This operation maps rowIndexes to nodes. It does the opposite job to getRowFromNodeId(java.lang.Integer)
.
This function is useful to map selection (row based) to nodes.
public java.lang.Object getNodeRowMap()
Return the mapping of nodes to rendered rows. This function is intended for use by the cell renderer, not by users of this class. It is also useful to select a node.
public java.lang.Integer getRowCount()
ITableModel
Returns the number of rows in the model.
getRowCount
in interface ITableModel
getRowCount
in class Simple
public java.lang.Object getRowData(java.lang.Integer rowIndex)
ITableModel
Returns the data of one row. This function may be overriden by models which hold all data of a row in one object. By using this function, clients have a way of quickly retrieving the entire row data.
Important:Models which do not have their row data accessible in one object may return null.
getRowData
in interface ITableModel
getRowData
in class Simple
public void getRowFromNodeId(java.lang.Integer nodeId)
This operation maps nodes to rowIndexes. It does the opposite job to getNodeFromRow(java.lang.Integer)
.
public java.lang.Object getSelectedNodes()
Return the nodes that are currently selected.
public java.lang.Integer getSortColumnIndex()
Returns the column index the model is sorted by. This model is never sorted, so -1 is returned.
getSortColumnIndex
in interface ITableModel
getSortColumnIndex
in class Simple
public void getTree()
public java.lang.Integer getTreeColumn()
Get the column in which the tree is to be displayed.
public java.lang.Object getValue(java.lang.Object columnIndex, java.lang.Object rowIndex)
public boolean isColumnSortable(java.lang.Integer columnIndex)
ITableModel
Returns whether a column is sortable.
isColumnSortable
in interface ITableModel
isColumnSortable
in class Simple
public void prune(java.lang.Object nodeReference, boolean bSelfAlso)
Prune the tree by removing, recursively, all of a node’s children. If requested, also remove the node itself.
public void setColumnData(java.lang.Integer nodeId, java.lang.Integer columnIndex, java.lang.Object data)
Add data to an additional column (a column other than the tree column) of the tree.
public void setColumnEditable(java.lang.Integer columnIndex, boolean editable)
Simple
Sets whether a column is editable.
setColumnEditable
in class Simple
public void setData(java.lang.Object nodeArr)
Sets the whole data en bulk, or notifies the data model that node modifications are complete.
public void setState(java.lang.Object nodeReference, java.lang.Object attributes)
Set state attributes of a node.
public void setTree(java.lang.Object tree)
public void setTreeColumn(java.lang.Integer columnIndex)
Specifies which column the tree is to be displayed in. The tree is displayed using the SimpleTreeDataCellRenderer. Other columns may be provided which use different cell renderers.
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 Simple
public void sortByColumn(java.lang.Integer columnIndex, boolean ascending)
ITableModel
Sorts the model by a column.
sortByColumn
in interface ITableModel
sortByColumn
in class Simple
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |