Java 类javafx.scene.control.TreeCell 实例源码

项目:ariADDna    文件:TreeViewFactory.java   
/**
 * Customizing treeView
 *
 * @param tree treeView
 */
private void setTreeCellFactory(TreeView<SimpleTreeElement> tree) {
    tree.setCellFactory(param -> new TreeCell<SimpleTreeElement>() {
        @Override
        public void updateItem(SimpleTreeElement item, boolean empty) {
            super.updateItem(item, empty);
            //setDisclosureNode(null);

            if (empty) {
                setText("");
                setGraphic(null);
            } else {
                setText(item.getName());
            }
        }

    });

    tree.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            System.out.println(newValue.getValue());
        }
    });
}
项目:marathonv5    文件:MarathonFileChooser.java   
private void initTreeView() {
    parentTreeView.setCellFactory(new Callback<TreeView<File>, TreeCell<File>>() {
        @Override public TreeCell<File> call(TreeView<File> param) {
            return new ParentFileCell();
        }
    });
    parentTreeView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newVlaue) -> {
        TreeItem<File> selectedItem = parentTreeView.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            newFolderButton.setDisable(false);
            fileNameBox.setEditable(true);
            File selectedFile = selectedItem.getValue();
            fillUpChildren(selectedFile);
        } else {
            fileNameBox.setEditable(false);
            newFolderButton.setDisable(true);
            childrenListView.getItems().clear();
        }
    });
    File root = fileChooserInfo.getRoot();
    TreeItem<File> rootItem = new TreeItem<>(root);
    parentTreeView.setRoot(rootItem);
    rootItem.setExpanded(true);
    parentTreeView.getSelectionModel().select(0);
    populateChildren(root, rootItem);
}
项目:marathonv5    文件:FunctionStage.java   
private Node createTree() {
    VBox treeContentBox = new VBox();
    tree.setRoot(functionInfo.getRoot(true));
    tree.setShowRoot(false);
    tree.getSelectionModel().selectedItemProperty().addListener(new TreeViewSelectionChangeListener());
    tree.setCellFactory(new Callback<TreeView<Object>, TreeCell<Object>>() {
        @Override public TreeCell<Object> call(TreeView<Object> param) {
            return new FunctionTreeCell();
        }
    });
    filterByName.setOnAction((e) -> {
        tree.setRoot(functionInfo.refreshNode(filterByName.isSelected()));
        expandAll();
    });
    filterByName.setSelected(true);
    expandAll();
    treeContentBox.getChildren().addAll(topButtonBar, tree, filterByName);
    VBox.setVgrow(tree, Priority.ALWAYS);
    return treeContentBox;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public int getRowAt(TreeView<?> treeView, Point2D point) {
    if (point == null) {
        return treeView.getSelectionModel().getSelectedIndex();
    }
    point = treeView.localToScene(point);
    int itemCount = treeView.getExpandedItemCount();
    @SuppressWarnings("rawtypes")
    List<TreeCell> cells = new ArrayList<>();
    for (int i = 0; i < itemCount; i++) {
        cells.add(getCellAt(treeView, i));
    }
    TreeCell<?> selected = null;
    for (Node cellNode : cells) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (TreeCell<?>) cellNode;
            break;
        }
    }
    if (selected == null) {
        return -1;
    }
    return selected.getIndex();
}
项目:Coconut-IDE    文件:HighlightCell.java   
public static void highlight() {
    if (diagnostics != null) {
        Set<Node> treeCells = treeView.lookupAll(".tree-cell");
        cells = new ArrayList<>(treeCells);
        cells = cells.parallelStream().filter(c -> ((TreeCell) c).getTreeItem() != null).collect(Collectors.toList());
        treeItems = getAllTreeItems(treeView.getRoot());

        diagnostics.stream()
                .filter(JavaCompilerSyntax::isErrorKind)
                .map(HighlightCell::isCurrTreeItem)
                .forEach(HighlightCell::highlightCells);

        cells.parallelStream()
                .forEach(c -> c.setStyle(null));
    }
}
项目:Gargoyle    文件:FxTreeViewClipboardUtil.java   
private static StringConverter getConverter(TreeCell cell) {
    StringConverter converter = null;
    try {
        Method m = cell.getClass().getMethod("converterProperty");
        if (m != null) {
            Object object = m.invoke(cell);
            if (object != null && object instanceof ObjectProperty) {
                ObjectProperty<StringConverter> convert = (ObjectProperty<StringConverter>) object;
                converter = convert.get();
            }
        }
    } catch (Exception e) {
        // Nothing...
    }
    return converter;
}
项目:Gargoyle    文件:MacroFavorTreeView.java   
protected TreeCell<MacroItemVO> createTreeCell() {
    return new TreeCell<MacroItemVO>() {

        @Override
        protected void updateItem(MacroItemVO item, boolean empty) {
            super.updateItem(item, empty);

            if (!empty) {
                String apply = stringConverter.apply(item);
                setText(apply);
            } else {
                setText("");
            }

        }
    };
}
项目:Gargoyle    文件:FilesAnalysisComposite.java   
@Override
public TreeCell<V> call(TreeView<V> param) {
    TextFieldTreeCell<V> textFieldTreeCell = new TextFieldTreeCell<V>(treeItemStringConverter) {

        @Override
        public void updateItem(V item, boolean empty) {
            super.updateItem(item, empty);
            if (empty) {
                setGraphic(null);
            } else {
                ObservableList<File> items = item.getItems();
                if (!items.isEmpty()) {
                    File file = items.get(0);
                    setGraphic(new FileIconImageView(file));
                }

            }
        }

    };

    return textFieldTreeCell;
}
项目:Gargoyle    文件:FxControlsTreeItem.java   
public FxControlsTreeItem(TreeView<Node> tv) {
    this.tv = tv;

    tv.setCellFactory(param -> {
        TreeCell<Node> treeCell = new TextFieldTreeCell<Node>(new StringConverter<Node>() {
            @Override
            public String toString(Node n) {
                return getName(n);
            }

            @Override
            public Node fromString(String string) {
                return null;
            }

        });
        return treeCell;
    });

}
项目:openjfx-8u-dev-tests    文件:TreeViewTest.java   
@Override
public boolean check(IndexedCell control) {
    if (control.isVisible() && control.getOpacity() == 1.0) {
        if (isTreeViewTests) {
            if (control instanceof TreeCell) {
                if ((((TreeCell) control).getTreeItem() != null) && ((TreeCell) control).getTreeItem().equals(item)) {
                    return true;
                }
            }
        } else {
            if (control instanceof TreeTableCell) {
                if ((((TreeTableCell) control).getTreeTableRow().getTreeItem() != null) && ((TreeTableCell) control).getTreeTableRow().getTreeItem().equals(item)) {
                    return true;
                }
            }
        }
    }
    return false;
}
项目:reduxfx    文件:TreeViewCellFactoryAccessor.java   
@Override
protected void updateItem(Object data, boolean empty) {
    super.updateItem(data, empty);

    if (empty || data == null) {
        setText(null);
        setGraphic(null);
    } else {
        final Object item = mapping.apply(data);

        if (item instanceof VNode) {
            final VNode newVNode = VScenegraphFactory
                .customNode(TreeCell.class).child("graphic", (VNode) item);
            final Option<VNode> oldVNode = Option.of(getGraphic())
                .flatMap(node -> Option.of((VNode) node.getUserData()));

            final Map<Phase, Vector<Patch>> patches = Differ.diff(oldVNode, Option.of(newVNode));
            Patcher.patch(dispatcher, this, oldVNode, patches);

            Option.of(getGraphic()).forEach(node -> node.setUserData(newVNode));
        } else {
            this.setText(String.valueOf(item));
            this.setGraphic(null);
        }
    }
}
项目:sgf4j-gui    文件:FileTreeView.java   
public FileTreeView() {
  super();

  getSelectionModel().setSelectionMode(SelectionMode.SINGLE);

  setCellFactory(new Callback<TreeView<File>, TreeCell<File>>() {
    @Override
    public TreeCell<File> call(TreeView<File> param) {
      return new FileFormatCell();
    }
  });

  final TreeItem<File> fakeRoot = new TreeItem<File>();
  setRoot(fakeRoot);
  setShowRoot(false);

  List<File> rootDevices = Sgf4jGuiUtil.getRootDevices();
  TreeItem<File>[] treeItems = new FileTreeItem[rootDevices.size()];
  for (int i = 0; i < rootDevices.size(); i++) {
    treeItems[i] = new FileTreeItem(rootDevices.get(i));
  }

  fakeRoot.getChildren().addAll(treeItems);

  openTreeAtRightLocation(fakeRoot);
}
项目:JVx.javafx    文件:JavaFXTree.java   
/**
 * Checks if the given {@link MouseEvent} is on the selected cell.
 * 
 * @param pMouseEvent the {@link MouseEvent}.
 * @return {@code true} if the given event is on the selected cell.
 */
private boolean isOnSelectedCell(MouseEvent pMouseEvent)
{
    EventTarget target = pMouseEvent.getTarget();

    if (target instanceof Node)
    {
        Node targetNode = (Node)target;

        while (targetNode != null && !(targetNode instanceof FXDataBooksTree))
        {
            if (targetNode instanceof TreeCell<?>)
            {
                return ((TreeCell<?>)targetNode).isSelected();
            }

            targetNode = targetNode.getParent();
        }
    }

    return false;
}
项目:speedment    文件:ToggleExpandedActionImpl.java   
private <DOC extends DocumentProperty> Stream<MenuItem>
installForDocumentType(TreeCell<DocumentProperty> treeCell, DOC node) {
    final MenuItem expandAll   = new MenuItem("Expand All", ProjectTreeIcon.BOOK_OPEN.view());
    final MenuItem collapseAll = new MenuItem("Collapse All", ProjectTreeIcon.BOOK.view());

    expandAll.setOnAction(ev ->
        DocumentUtil.traverseOver(node)
            .filter(HasExpandedProperty.class::isInstance)
            .forEach(doc -> ((HasExpandedProperty) doc).expandedProperty().setValue(true))
    );

    collapseAll.setOnAction(ev ->
        DocumentUtil.traverseOver(node)
            .filter(HasExpandedProperty.class::isInstance)
            .forEach(doc -> ((HasExpandedProperty) doc).expandedProperty().setValue(false))
    );

    return Stream.of(expandAll, collapseAll);
}
项目:ISAAC    文件:RefsetSpecSearchTypeModel.java   
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);
}
项目:ISAAC    文件:LegoListTreeView.java   
public LegoListTreeView()
{
    getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
    setCellFactory(new Callback<TreeView<String>, TreeCell<String>>()
    {
        @Override
        public TreeCell<String> call(TreeView<String> arg0)
        {
            return new LegoListTreeCell<String>(LegoListTreeView.this);
        }
    });
    // Not going to use the edit API, not reliable. Just detect doubleclick instead.
    setEditable(false);
    LegoListTreeItem treeRoot = new LegoListTreeItem();
    setShowRoot(false);
    setRoot(treeRoot);
}
项目:erlyberly    文件:ModFuncTreeCellFactory.java   
@Override
public TreeCell<ModFunc> call(TreeView<ModFunc> tree) {
    ModFuncGraphic mfg;

    mfg = new ModFuncGraphic(
        dbgController::toggleTraceModFunc,
        dbgController::isTraced
    );
    mfg.setShowModuleName(isShowModuleName());

    dbgController.addTraceListener((Observable o) -> {
        mfg.onTracesChange();
    });

    return new FXTreeCell<ModFunc>(mfg, mfg);
}
项目:tokentool    文件:TokenTool_Controller.java   
private void addPseudoClassToLeafs(TreeView<Path> tree) {
    PseudoClass leaf = PseudoClass.getPseudoClass("leaf");

    tree.setCellFactory(tv -> {
        TreeCell<Path> cell = new TreeCell<>();
        cell.itemProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue == null) {
                cell.setText("");
                cell.setGraphic(null);
            } else {
                cell.setText(newValue.toFile().getName());
                cell.setGraphic(cell.getTreeItem().getGraphic());
            }
        });
        cell.treeItemProperty().addListener((obs, oldTreeItem, newTreeItem) -> cell.pseudoClassStateChanged(leaf,
                newTreeItem != null && newTreeItem.isLeaf()));
        return cell;
    });
}
项目:tokentool    文件:ManageOverlays_Controller.java   
public void displayTreeView() {
    TreeItem<Path> root = new OverlayTreeItem(AppConstants.OVERLAY_DIR);
    root.setExpanded(true);
    overlayTreeView.setRoot(root);

    overlayTreeView.setCellFactory(treeView -> new TreeCell<Path>() {
        @Override
        public void updateItem(Path path, boolean empty) {
            super.updateItem(path, empty);
            if (empty) {
                setText(null);
            } else {
                setText(path.getFileName().toString());
            }
        }
    });
}
项目:PeerWasp    文件:Synchronization.java   
private void createTreeView(FileNode fileNode){
        PathItem pathItem = new PathItem(userConfig.getRootPath(), false, fileNode.getUserPermissions());
        SyncTreeItem invisibleRoot = new SyncTreeItem(pathItem);
//      invisibleRoot.setIndependent(true);
        fileTreeView.setRoot(invisibleRoot);
        fileTreeView.setEditable(false);

        fileTreeView.setCellFactory(new Callback<TreeView<PathItem>, TreeCell<PathItem>>(){
            @Override
            public TreeCell<PathItem> call(TreeView<PathItem> p) {
                return new CustomizedTreeCell(getFileEventManager(),
                        recoverFileHandlerProvider,
                        shareFolderHandlerProvider,
                        forceSyncHandlerProvider);
            }
        });

        fileTreeView.setShowRoot(false);


        addChildrensToTreeView(fileNode);
    }
项目:closurefx-builder    文件:FolderDialogController.java   
/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    filewalker = new Filewalker();
    controlTree.setShowRoot(false);
    controlTree.setEditable(true);
    controlTree
            .setCellFactory(new Callback<TreeView<File>, TreeCell<File>>() {
                @Override
                public TreeCell<File> call(TreeView<File> p) {
                    return new FolderCell();
                }
            });
    controlTree.getSelectionModel().selectedItemProperty()
            .addListener(new ChangeListener<TreeItem<File>>() {
                @Override
                public void changed(
                        ObservableValue<? extends TreeItem<File>> paramObservableValue,
                        TreeItem<File> paramT1, TreeItem<File> paramT2) {
                    if (paramT2 != null) {
                        controlOk.setDisable(paramT2.getValue()
                                .isDirectory() && !allowFolders);
                    }
                }
            });
}
项目:Matcher    文件:HierarchyTab.java   
private void init() {
    VBox vBox = new VBox();
    vBox.getChildren().add(classHierarchyTree);
    vBox.getChildren().add(ifaceList);

    Callback<TreeView<ClassInstance>, TreeCell<ClassInstance>> cellFactory = tree -> new TreeCell<ClassInstance>() { // makes entries in highLights bold
        @Override
        protected void updateItem(ClassInstance item, boolean empty) {
            super.updateItem(item, empty);

            if (empty || item == null) {
                setText(null);
                setStyle("");
            } else {
                setText(item.toString());

                if (highLights.contains(item)) {
                    setStyle("-fx-font-weight: bold;");
                } else {
                    setStyle("");
                }
            }
        }
    };

    classHierarchyTree.setCellFactory(cellFactory);

    setContent(vBox);
}
项目:marathonv5    文件:ResourceView.java   
public ResourceView(IResourceActionSource source, Resource root, IResourceActionHandler handler,
        IResourceChangeListener listener) {
    this.source = source;
    this.handler = handler;
    setEditable(true);
    setRoot(root);
    getRoot().addEventHandler(ResourceModificationEvent.ANY, (event) -> {
        if (event.getEventType() == ResourceModificationEvent.DELETE) {
            listener.deleted(source, event.getResource());
        }
        if (event.getEventType() == ResourceModificationEvent.UPDATE) {
            listener.updated(source, event.getResource());
        }
        if (event.getEventType() == ResourceModificationEvent.MOVED) {
            listener.moved(source, event.getFrom(), event.getTo());
        }
        if (event.getEventType() == ResourceModificationEvent.COPIED) {
            listener.copied(source, event.getFrom(), event.getTo());
        }
    });
    setContextMenu(contextMenu);
    setContextMenuItems();
    getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getSelectionModel().getSelectedItems().addListener(new ListChangeListener<TreeItem<Resource>>() {
        @Override public void onChanged(Change<? extends TreeItem<Resource>> c) {
            setContextMenuItems();
        }
    });
    Callback<TreeView<Resource>, TreeCell<Resource>> value = new Callback<TreeView<Resource>, TreeCell<Resource>>() {
        @Override public TreeCell<Resource> call(TreeView<Resource> param) {
            return new TextFieldTreeCellImpl();
        }
    };
    setCellFactory(value);
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
private Set<Node> getTreeCells(TreeView<?> treeView) {
    Set<Node> l = treeView.lookupAll("*");
    Set<Node> r = new HashSet<>();
    for (Node node : l) {
        if (node instanceof TreeCell<?>) {
            r.add(node);
        }
    }
    return r;
}
项目:marathonv5    文件:JavaFXTreeCellElement.java   
@Override public String _getValue() {
    TreeCell<?> cell = (TreeCell<?>) getComponent();
    Node graphic = cell.getGraphic();
    JavaFXElement cellElement = (JavaFXElement) JavaFXElementFactory.createElement(graphic, driver, window);
    if (graphic != null && cellElement != null) {
        return cellElement._getValue();
    }
    return super._getValue();
}
项目:marathonv5    文件:JavaFXTreeViewNodeElement.java   
@SuppressWarnings({ "rawtypes", "unchecked" }) private Node getEditor() {
    TreeCell cell = (TreeCell) getPseudoComponent();
    TreeView treeView = (TreeView) getComponent();
    treeView.edit(cell.getTreeItem());
    Node cellComponent = cell.getGraphic();
    cellComponent.getProperties().put("marathon.celleditor", true);
    cellComponent.getProperties().put("marathon.cell", cell);
    return cellComponent;
}
项目:marathonv5    文件:JavaFXTreeViewNodeElement.java   
private Node getTextObj(TreeCell<?> cell) {
    for (Node child : cell.getChildrenUnmodifiable()) {
        if (child instanceof Text) {
            return child;
        }
    }
    return cell;
}
项目:marathonv5    文件:RFXTreeView.java   
private String getTreeCellValue(TreeView<?> treeView, int index) {
    if (index == -1) {
        return null;
    }
    TreeCell<?> treeCell = getCellAt(treeView, index);
    RFXComponent cellComponent = getFinder().findRCellComponent(treeCell, null, recorder);
    return cellComponent == null ? null : cellComponent.getValue();
}
项目:marathonv5    文件:RFXComponentTest.java   
public Point2D getPoint(TreeView<?> treeView, int index) {
    Set<Node> cells = treeView.lookupAll(".tree-cell");
    for (Node node : cells) {
        TreeCell<?> cell = (TreeCell<?>) node;
        if (cell.getIndex() == index) {
            Bounds bounds = cell.getBoundsInParent();
            return cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2);
        }
    }
    return null;
}
项目:marathonv5    文件:RFXComponentTest.java   
public TreeCell<?> getCellAt(TreeView<?> treeView, int index) {
    Set<Node> lookupAll = treeView.lookupAll(".tree-cell");
    for (Node node : lookupAll) {
        TreeCell<?> cell = (TreeCell<?>) node;
        if (cell.getIndex() == index) {
            return cell;
        }
    }
    return null;
}
项目:Gargoyle    文件:RaxStructureTreeView.java   
public RaxStructureTreeView() {

        setCellFactory(new Callback<TreeView<RaxItem>, TreeCell<RaxItem>>() {

            @Override
            public TreeCell<RaxItem> call(TreeView<RaxItem> param) {

                return new TextFieldTreeCell<>(new StringConverter<RaxItem>() {

                    @Override
                    public String toString(RaxItem object) {
                        if (object == null)
                            return "";
                        return object.getText();
                    }

                    @Override
                    public RaxItem fromString(String string) {
                        return null;
                    }
                });

            }
        });

        setRoot(treeItem);

    }
项目:arma-dialog-creator    文件:EditableTreeCellFactory.java   
EditableTreeCellFactory(@NotNull EditableTreeView<Tv, Td> treeView, @Nullable TreeCellSelectionUpdate treeCellSelectionUpdate) {
    this.treeCellSelectionUpdate = treeCellSelectionUpdate;
    this.treeView = treeView;
    this.setEditable(true);
    // first method called when the user clicks and drags a tree item
    TreeCell<Td> myTreeCell = this;

    //      addDragListeners(treeView, myTreeCell);
}
项目:Music-Player    文件:Playlist.java   
public void setTreeView(TreeView treeView) {
    this.treeView = treeView;

    treeView.setCellFactory(new Callback<TreeView<String>, TreeCell<String>>() {
        @Override
        public TreeCell call(TreeView<String> param) {
            return new DnDCell(param);
        }
    });
}
项目:openjfx-8u-dev-tests    文件:TreeViewCommonFunctionality.java   
protected static Range getVisibleRange(final Wrap<? extends Control> testedControl) {
    Bounds visibleIndices = org.jemmy.fx.control.TableUtils.shown1d(
            testedControl,
            new Callback<TreeCell, Integer>() {

                public Integer call(TreeCell p) {
                    return p.getIndex();
                }
            }, TreeCell.class, true);

    return new Range(visibleIndices.getBegin(), visibleIndices.getEnd());
}
项目:openjfx-8u-dev-tests    文件:TestBase.java   
protected Wrap getDisclosureNode(final Wrap<? extends IndexedCell> cellWrap) {

        final IndexedCell cell = cellWrap.getControl();
        final String arrowStyle = "tree-disclosure-node";

        if (TreeCell.class.isAssignableFrom(cell.getClass())) {
            return cellWrap.as(Parent.class, Node.class).lookup(new ByStyleClass(arrowStyle)).wrap();
        } else if (TreeTableCell.class.isAssignableFrom(cell.getClass())) {
            final NodeWrap<IndexedCell> nodeWrap = new NodeWrap(cellWrap.getEnvironment(), cellWrap.getControl().getParent());
            Parent cellAsParent = nodeWrap.as(Parent.class, IndexedCell.class);
            return cellAsParent.lookup(new ByStyleClass(arrowStyle)).wrap();
        } else {
            throw new IllegalStateException();
        }
    }
项目:openjfx-8u-dev-tests    文件:TreeViewTest.java   
@BeforeClass
public static void setUpClass() {
    if (isTreeViewTests) {
        TreeViewApp.main(null);
    } else {
        TreeTableAsOldTreeApp.main(null);
    }
    scene = Root.ROOT.lookup().wrap();
    parent = scene.as(Parent.class, Node.class);
    if (isTreeViewTests) {
        tree = parent.lookup(TreeView.class).wrap();
    } else {
        tree = parent.lookup(TreeTableView.class).wrap();
    }
    treeAsMultiSelectable = tree.as(Selectable.class, TreeItem.class);
    treeAsParent = tree.as(Parent.class, TreeItem.class);
    treeAsTreeSelector = tree.as(Tree.class, String.class);
    multipleSelection = parent.lookup(CheckBox.class, new ByID<CheckBox>(TreeViewApp.MULTIPLE_SELECTION_ID)).wrap();
    treeAsNodeParent = tree.as(Parent.class, Node.class);
    if (isTreeViewTests) {
        cellClass = TreeCell.class;
    } else {
        cellClass = TreeTableCell.class;
    }

    ThemeDriverFactory factory = (ThemeDriverFactory) ThemeDriverFactory.getThemeFactory();
    CaspianDriverFactory caspianFactory = null;
    if (factory instanceof CaspianDriverFactory) {
        caspianFactory = (CaspianDriverFactory) factory;
        caspianFactory.setDragDelta(11);
    }
}
项目:openjfx-8u-dev-tests    文件:TreeNodeWrap.java   
@Override
public Rectangle getScreenBounds() {
    return new FutureAction<>(getEnvironment(), () -> {
        TreeCell treeCell = treeViewWrap.getTreeCell(getControl());
        if (treeCell != null) {
            return NodeWrap.getScreenBounds(getEnvironment(), treeCell);
        }
        return null;
    }).get();
}
项目:openjfx-8u-dev-tests    文件:TreeNodeWrap.java   
public final Wrap<? extends Node> getNode() {
    return treeViewWrap.as(Parent.class, Node.class).
            lookup(TreeCell.class, new LookupCriteria<TreeCell>() {

                public boolean check(TreeCell cntrl) {
                    return cntrl.getItem() != null && cntrl.getTreeItem().equals(getControl());
                }

                @Override
                public String toString() {
                    return "Node for an item " + getControl().toString();
                }
            }).wrap();
}
项目:openjfx-8u-dev-tests    文件:TreeViewWrap.java   
/**
 * This method finds TreeCell for the selected item. Should be invoked only
 * using FX.deferAction() That can be needed for cases like obtaining
 * screenBounds for corresponding TreeCell.
 *
 * @return TreeCell, null if it is not visible
 */
@SuppressWarnings("unchecked")
TreeCell getTreeCell(final TreeItem item) {
    return (TreeCell) as(Parent.class, Node.class).lookup(TreeCell.class,
            new DescriptiveLookupCriteria<TreeCell>(cell -> {
                if (cell.isVisible() && cell.getOpacity() == 1.0) {
                    if (cell.getTreeItem() == item) {
                        return true;
                    }
                }
                return false;
            }, () -> "Looking for a visible treeCell with the value '" + item + "'")).get(0);
}
项目:tornadofx-controls-sampler    文件:ControlSampleCellFactory.java   
public TreeCell<ControlSample> call(TreeView<ControlSample> param) {
    return new TreeCell<ControlSample>() {
        protected void updateItem(ControlSample item, boolean empty) {
            super.updateItem(item, empty);
            setText(item == null || empty ? null : item.name());
        }
    };
}