this.treeView.setOnMouseClicked(mouseEv -> { final File target = new File(selectedFile); if (mouseEv.getClickCount() == 2 && target.exists() && target.isFile()) {
/** * Create a new skin * * @param control * the control * @param selectedItems * the selected items */ public ResourceTreeViewSkin(ResourceTreeView control, ObservableList<ResourceItem> selectedItems) { super(control); this.selectedItems = selectedItems; this.tree = new TreeView<>(); this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull ResourceItem>( ResourceTreeViewSkin::handleDirLabel, this::handleStyleclass)); this.tree.setShowRoot(false); this.tree.getSelectionModel().getSelectedItems() .addListener(this::handleSelectionChange); this.tree.setOnMouseClicked( e -> { if( e.getClickCount() > 1 ) { openSelectedResources(); } }); getChildren().add(this.tree); control.rootDirectoriesProperty().addListener(this::rebuildTable); control.iconSizeProperty().addListener(this::rebuildTable); rebuildTable(control.rootDirectoriesProperty()); }
/** * Create a new skin * * @param control * the control * @param selectedItems * the selected items */ public DirectoryTreeViewSkin(DirectoryTreeView control, ObservableList<DirItem> selectedItems) { super(control); this.selectedItems = selectedItems; this.tree = new TreeView<>(); this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull DirItem>( DirectoryTreeViewSkin::handleDirLabel, this::handleStyleclass)); this.tree.setShowRoot(false); this.tree.getSelectionModel().getSelectedItems() .addListener(this::handleSelectionChange); this.tree.setOnMouseClicked( e -> { if( e.getClickCount() > 1 ) { openSelectedResources(); } }); getChildren().add(this.tree); control.rootDirectoriesProperty().addListener(this::rebuildTable); control.iconSizeProperty().addListener(this::rebuildTable); rebuildTable(control.rootDirectoriesProperty()); }
/** * Create a new skin * * @param control * the control * @param selectedItems * the selected items */ public DirectoryTreeViewSkin(DirectoryTreeView control, ObservableList<DirItem> selectedItems) { super(control); this.selectedItems = selectedItems; this.tree = new TreeView<>(); this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull DirItem>( DirectoryTreeViewSkin::handleDirLabel, this::handleStyleclass)); this.tree.setShowRoot(false); this.tree.getSelectionModel().getSelectedItems() .addListener(this::handleSelectionChange); this.tree.setOnMouseClicked( e -> { if( e.getClickCount() > 1 ) { openSelectedResources(); } }); getChildren().add(this.tree); control.rootDirectoriesProperty().addListener(this::rebuildTable); control.iconSizeProperty().addListener(this::rebuildTable); rebuildTable(control.rootDirectoriesProperty()); }
/** * Create a new skin * * @param control * the control * @param selectedItems * the selected items */ public ResourceTreeViewSkin(ResourceTreeView control, ObservableList<ResourceItem> selectedItems) { super(control); this.selectedItems = selectedItems; this.tree = new TreeView<>(); this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull ResourceItem>( ResourceTreeViewSkin::handleDirLabel, this::handleStyleclass)); this.tree.setShowRoot(false); this.tree.getSelectionModel().getSelectedItems() .addListener(this::handleSelectionChange); this.tree.setOnMouseClicked( e -> { if( e.getClickCount() > 1 ) { openSelectedResources(); } }); getChildren().add(this.tree); control.rootDirectoriesProperty().addListener(this::rebuildTable); control.iconSizeProperty().addListener(this::rebuildTable); rebuildTable(control.rootDirectoriesProperty()); }