Class FxTreeTableEditContext<S>
java.lang.Object
org.tentackle.fx.table.edit.AbstractTableEditContext<S>
org.tentackle.fx.table.edit.FxTreeTableEditContext<S>
- Type Parameters:
S- type of the objects contained within the treetable's items
- All Implemented Interfaces:
TableEditContext<S>, TreeTableEditContext<S>
public class FxTreeTableEditContext<S>
extends AbstractTableEditContext<S>
implements TreeTableEditContext<S>
The edit context of an
Rows are located among the displayed tree items, i.e. those whose parents are expanded. Tree items loading their children lazily are never forced to do so just to find a row. Rows added by this context are found even if they are not displayed yet.
FxTreeTableView.Rows are located among the displayed tree items, i.e. those whose parents are expanded. Tree items loading their children lazily are never forced to do so just to find a row. Rows added by this context are found even if they are not displayed yet.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionFxTreeTableEditContext(FxTreeTableView<S> treeTable) Creates the edit context. -
Method Summary
Modifier and TypeMethodDescriptionvoidAppends a child to a row.
The expansion state of the parent is not changed.voidAppends a row.
In a sorted table, the row is displayed according to the sort order.protected javafx.scene.control.TreeItem<S> createTreeItem(S row) Creates the tree item for a new row.voidedit(TableCellRef<S> cell) Selects a cell and starts editing it.
The row is scrolled into view if necessary.protected javafx.scene.control.TreeItem<S> findTreeItem(S row) Finds the tree item of a row.getChildren(S row) Gets the row's children.
Tree items that load their children lazily will do so.Gets the visible columns in the order they are displayed.Gets the table configuration.Gets the parent of a row.getRow(int index) Gets a displayed row.intGets the number of displayed rows.Gets the treetable view.voidinsertRowAfter(S sibling, S row) Inserts a row after another row.
In a sorted table, the row is displayed according to the sort order.voidinsertRowBefore(S sibling, S row) Inserts a row before another row.
In a sorted table, the row is displayed according to the sort order.voidrefresh()Refreshes the view to show the current values of the row objects.
Invoked automatically after the methods of theTableEditHandlerreturned.booleanRemoves a row.
In a treetable, the row is removed along with its children.protected voidscrollTo(int index) Scrolls a row into view, unless it is already visible.voidselect(TableCellRef<S> cell) Selects a cell.
Does nothing if the row is not displayed.voidsetExpanded(S row, boolean expanded) Expands or collapses a row.Methods inherited from class AbstractTableEditContext
above, below, cell, firstEditable, firstEditableBelow, getEditHandler, getRows, indexOf, isEditable, lastEditable, lastEditableAbove, next, previousMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TableEditContext
above, below, cell, firstEditable, firstEditableBelow, getEditHandler, getRows, indexOf, isEditable, lastEditable, lastEditableAbove, next, previous
-
Constructor Details
-
FxTreeTableEditContext
Creates the edit context.- Parameters:
treeTable- the treetable view
-
-
Method Details
-
getTreeTable
-
getConfiguration
Description copied from interface:TableEditContextGets the table configuration.- Specified by:
getConfigurationin interfaceTableEditContext<S>- Returns:
- the configuration
-
getColumns
Description copied from interface:TableEditContextGets the visible columns in the order they are displayed.- Specified by:
getColumnsin interfaceTableEditContext<S>- Returns:
- the column configurations
-
getRowCount
public int getRowCount()Description copied from interface:TableEditContextGets the number of displayed rows.- Specified by:
getRowCountin interfaceTableEditContext<S>- Returns:
- the number of rows
-
getRow
Description copied from interface:TableEditContextGets a displayed row.- Specified by:
getRowin interfaceTableEditContext<S>- Parameters:
index- the row index- Returns:
- the row object
-
addRow
Description copied from interface:TableEditContextAppends a row.
In a sorted table, the row is displayed according to the sort order. In a treetable, the row is appended to the children of the root.- Specified by:
addRowin interfaceTableEditContext<S>- Parameters:
row- the row object
-
insertRowAfter
Description copied from interface:TableEditContextInserts a row after another row.
In a sorted table, the row is displayed according to the sort order. In a treetable, the row becomes the next sibling.- Specified by:
insertRowAfterin interfaceTableEditContext<S>- Parameters:
sibling- the existing rowrow- the row object to insert
-
insertRowBefore
Description copied from interface:TableEditContextInserts a row before another row.
In a sorted table, the row is displayed according to the sort order. In a treetable, the row becomes the previous sibling.- Specified by:
insertRowBeforein interfaceTableEditContext<S>- Parameters:
sibling- the existing rowrow- the row object to insert
-
removeRow
Description copied from interface:TableEditContextRemoves a row.
In a treetable, the row is removed along with its children.- Specified by:
removeRowin interfaceTableEditContext<S>- Parameters:
row- the row object- Returns:
- true if removed, false if there is no such row
-
getParent
Description copied from interface:TreeTableEditContextGets the parent of a row.- Specified by:
getParentin interfaceTreeTableEditContext<S>- Parameters:
row- the row object- Returns:
- the parent row object, null if the row is the root, a child of a hidden root, or not found
-
getChildren
Description copied from interface:TreeTableEditContextGets the row's children.
Tree items that load their children lazily will do so.- Specified by:
getChildrenin interfaceTreeTableEditContext<S>- Parameters:
row- the row object, null for the root- Returns:
- the row objects of the children, empty if none or the row is not found
-
addChild
Description copied from interface:TreeTableEditContextAppends a child to a row.
The expansion state of the parent is not changed. However,editinga cell of the child expands its parents.- Specified by:
addChildin interfaceTreeTableEditContext<S>- Parameters:
parent- the row object of the parent, null for the rootrow- the row object to add
-
setExpanded
Description copied from interface:TreeTableEditContextExpands or collapses a row.- Specified by:
setExpandedin interfaceTreeTableEditContext<S>- Parameters:
row- the row objectexpanded- true to expand, false to collapse
-
edit
Description copied from interface:TableEditContextSelects a cell and starts editing it.
The row is scrolled into view if necessary. In a treetable, the parents of the row are expanded. Does nothing if the row is not displayed, for example, because it is hidden by a column filter.- Specified by:
editin interfaceTableEditContext<S>- Parameters:
cell- the cell, null to do nothing
-
select
Description copied from interface:TableEditContextSelects a cell.
Does nothing if the row is not displayed.- Specified by:
selectin interfaceTableEditContext<S>- Parameters:
cell- the cell, null to do nothing
-
refresh
public void refresh()Description copied from interface:TableEditContextRefreshes the view to show the current values of the row objects.
Invoked automatically after the methods of theTableEditHandlerreturned.- Specified by:
refreshin interfaceTableEditContext<S>
-
scrollTo
protected void scrollTo(int index) Scrolls a row into view, unless it is already visible.- Parameters:
index- the row index
-
findTreeItem
-
createTreeItem
-