本文整理匯總了Java中javafx.scene.control.TreeCell.getTreeItem方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeCell.getTreeItem方法的具體用法?Java TreeCell.getTreeItem怎麽用?Java TreeCell.getTreeItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.TreeCell
的用法示例。
在下文中一共展示了TreeCell.getTreeItem方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addDeleteMenuItem
import javafx.scene.control.TreeCell; //導入方法依賴的package包/類
private void addDeleteMenuItem(ContextMenu menu, TreeCell<NodeDraggable> currentTreeCell) {
TreeItem<NodeDraggable> currentTreeItem = currentTreeCell.getTreeItem();
MenuItem deleteMenuItem = new MenuItem("Delete");
deleteMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event)
{
if (QueryBuilderHelper.getUserConfirmToDeleteNodeIfNecessary(currentTreeItem)) {
if (currentTreeItem.getParent() == null) {
queryNodeTreeView.setRoot(null);
rootNodeTypeComboBox.getSelectionModel().clearSelection();
nodeEditorGridPane.getChildren().clear();
} else {
currentTreeItem.getParent().getChildren().remove(currentTreeItem);
nodeEditorGridPane.getChildren().clear();
}
}
}
});
menu.getItems().add(deleteMenuItem);
}
示例2: updateTreeItems
import javafx.scene.control.TreeCell; //導入方法依賴的package包/類
/**
* Updates all tree items above the current visible one, fetching new items
* if needed.
*/
private void updateTreeItems()
{
TreeCell<?> treeCell = virtualFlow.getLastVisibleCell();
if (treeCell != null)
{
TreeItem<?> treeItem = treeCell.getTreeItem();
TreeItem<?> parent = treeItem.getParent();
// Update all items above the current parent.
int indexAboveParent = treeCell.getIndex() - parent.getChildren().size();
updateTreeItemsAbove(indexAboveParent);
if (parent instanceof DataPageTreeItem)
{
DataPageTreeItem parentDataPageTreeItem = (DataPageTreeItem) parent;
int childrenRemaining = parentDataPageTreeItem.getChildren().size() - parentDataPageTreeItem.getChildren().indexOf(treeItem);
if (childrenRemaining <= 25)
{
if (parentDataPageTreeItem.fetchNextBatch())
{
// Notify the tree that it needs to rebuild its list.
fireEvent(new Event(TreeItem.expandedItemCountChangeEvent()));
}
}
}
}
}
示例3: handleDisclosureNode
import javafx.scene.control.TreeCell; //導入方法依賴的package包/類
@Override
protected boolean handleDisclosureNode(double x, double y) {
TreeCell<T> treeCell = getControl();
Node disclosureNode = treeCell.getDisclosureNode();
if (disclosureNode != null) {
if (disclosureNode.getBoundsInParent().contains(x, y)) {
if (treeCell.getTreeItem() != null) {
treeCell.getTreeItem().setExpanded(! treeCell.getTreeItem().isExpanded());
}
return true;
}
}
return false;
}
示例4: edit
import javafx.scene.control.TreeCell; //導入方法依賴的package包/類
@Override
protected void edit(TreeCell<T> cell) {
TreeItem<T> treeItem = cell == null ? null : cell.getTreeItem();
getCellContainer().edit(treeItem);
}