类javafx.scene.control.TreeItem.TreeModificationEvent源码实例Demo

下面列出了怎么用javafx.scene.control.TreeItem.TreeModificationEvent的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: phoebus   文件: TreeHelper.java
/** 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()));
}
 
源代码2 项目: jmonkeybuilder   文件: ResourceTree.java
/**
 * 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();
}
 
源代码3 项目: scenic-view   文件: ScenegraphTreeView.java
@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);
    }
}
 
 类所在包
 类方法
 同包方法