Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class TreeRows
- Object
- TreeRows
The open nodes of a TreeTableModel, flattened into rows in the order
they are shown: the row engine of a tree DataGrid, for any other view
of a tree that needs rows.
The rows are empty until refresh() reads the roots. Nodes are told
apart by equals and hashCode (see TreeTableModel). A row is a node
and its depth, 0 for a root; opening a row inserts the rows of its open
descendants after it, and closing it removes them.
Children are asked of the model the first time a node is opened and kept; opening a node inserts its rows and closing one removes them, so either costs what the node shows and not what the tree holds. A filter is the exception: deciding which paths lead to a match reads the whole tree.
Constructors
public TreeRows(TreeTableModel model) | Rows over a tree model, empty until refresh(). |
Methods
public TreeTableModel getModel() | The model the rows show. |
public int getRowCount() | How many rows there are. |
public Object getNode(int row) | The node a row shows. |
public int getDepth(int row) | How deep a row is: 0 for a root. |
public boolean isRowExpandable(int row) | Whether a row can open: its node is not a leaf. |
public boolean isRowExpanded(int row) | Whether a row is open. |
public int setRowExpanded(int row, boolean open) | Opens or closes a row. |
public int getRow(Object node) | The row showing a node, or -1 when it has none. |
public boolean isNodeExpanded(Object node) | Whether a node is open, shown or not. |
public int setNodeExpanded(Object node, boolean open) | Opens or closes a node whether it is shown or not; one that is not shown opens the next time it is. |
public void refresh() | Asks the model for the whole tree again and flattens it, keeping which nodes are open. |
public void refreshNode(Object node) | Asks the model again for the children of one node and flattens the tree, keeping which nodes are open. |
Inherited methods
Constructor details
TreeRows
public TreeRows(TreeTableModel model)refresh().Method details
getModel
public TreeTableModel getModel()getRowCount
public int getRowCount()getNode
public Object getNode(int row)getDepth
public int getDepth(int row)isRowExpandable
public boolean isRowExpandable(int row)isRowExpanded
public boolean isRowExpanded(int row)setRowExpanded
public int setRowExpanded(int row, boolean open)Returns
getRow
public int getRow(Object node)isNodeExpanded
public boolean isNodeExpanded(Object node)setNodeExpanded
public int setNodeExpanded(Object node, boolean open)Returns
refresh
public void refresh()refreshNode
public void refreshNode(Object node)