javafx.scene.control.TreeItem.TreeModificationEvent Java Examples
The following examples show how to use
javafx.scene.control.TreeItem.TreeModificationEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TreeHelper.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Trigger a redraw of a tree item * * <p>Call when the model item's representation changed, * so tree item with existing value object needs to be * redrawn. * * @param item {@link TreeItem} */ public static <TV> void triggerTreeItemRefresh(final TreeItem<TV> item) { // TreeView has a refresh() for triggering a complete update. // TreeItem has no 'refresh()', update or redraw method to trigger a single-node update. // 'setValue' can trigger a refresh if value is different, for example by briefly // changing to null and back: // final TV value = item.getValue(); // item.setValue(null); // item.setValue(value); // The API does expose the valueChangedEvent(), so send that. // Checking in the debugger, the effect seems to be a redraw // of all visible tree nodes, not just the modified one. // Still, we use this as a best effort to limit updates. Event.fireEvent(item, new TreeModificationEvent<>(TreeItem.<TV>valueChangedEvent(), item, item.getValue())); }
Example #2
Source File: ResourceTree.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Handle changed count of expanded elements. */ @FxThread private void processChangedExpands(@NotNull TreeModificationEvent<?> event) { if (!(event.wasExpanded() || event.wasCollapsed())) { return; } if (isLazyMode()) { EXECUTOR_MANAGER.addFxTask(this::lazyLoadChildren); } getExpandHandler().ifPresent(handler -> handler.accept(getExpandedItemCount(), this)); repaint(); }
Example #3
Source File: ScenegraphTreeView.java From scenic-view with GNU General Public License v3.0 | 5 votes |
@Override public void handle(final TreeModificationEvent<Object> ev) { if (!root.isExpanded() && controller.isOpened()) { // Closing controller controller.close(); } else if (root.isExpanded() && !controller.isOpened()) { // Opening controller scenicView.openStage(controller); } }