public TreeView<ProjectFile> buildTreeView(String workspacePath) { File workspaceRoot = new File(workspacePath); // TODO check existence ProjectFile workspaceRootProjectFile = new ProjectFile(workspaceRoot); TreeItem<ProjectFile> workspaceRootItem = buildTreeItem(workspaceRootProjectFile, 1); TreeView<ProjectFile> workspaceTreeView = new TreeView<ProjectFile>(workspaceRootItem); workspaceTreeView.setShowRoot(false); workspaceTreeView.setOnMouseClicked( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getClickCount() == 2) { TreeItem<ProjectFile> item = workspaceTreeView.getSelectionModel().getSelectedItem(); File file = item.getValue().getFile(); System.out.println("Double click on file : " + file.getAbsolutePath()); if (file.isFile()) { _mainActions.showEditorView(file); } } } }); return workspaceTreeView; }
private void refreshModules() { try { modulesTree.setShowRoot(false); dbgController.requestModFuncs(this::buildObjectTreeRoot); } catch (Exception e) { throw new RuntimeException("failed to build module/function tree", e); } }
/** Initialize the TreeView by adding in children nodes to a dummy root. Dummy root is hidden. */ private void createTree(ArrayList<String> allTask) { dummyRoot = new TreeItem<>(TREE_ROOT); overdueNode = setupNode(overdueNode, TITLE_FLAG + TREE_OVERDUE); todayNode = setupNode(todayNode, TITLE_FLAG + TREE_TODAY); tomorrowNode = setupNode(tomorrowNode, TITLE_FLAG + TREE_TOMORROW); everythingElseNode = setupNode(everythingElseNode, TITLE_FLAG + TREE_EVERYTHING_ELSE); allTreeView.setRoot(dummyRoot); allTreeView.setShowRoot(false); }
/** 板一覧を表示 */ public void showBoardList(List<Board> boards) { boardTreeView.setRoot(rootNode); boardTreeView.setShowRoot(false); rootNode.getValue().setTitle("root"); rootNode.getValue().setId("root_"); rootNode.setExpanded(true); // 履歴 TreeItem<Board> userTree = new TreeItem<Board>(new Board()); userTree.getValue().setTitle("ユーザ"); userTree.getValue().setId("user_"); userTree.setExpanded(true); rootNode.getChildren().add(userTree); TreeItem<Board> history = new TreeItem<Board>(new Board()); history.getValue().setTitle("履歴"); history.getValue().setId("history_"); history.setExpanded(true); userTree.getChildren().add(history); TreeItem<Board> favorite = new TreeItem<Board>(new Board()); favorite.getValue().setTitle("お気に入り"); favorite.getValue().setId("favorite_"); favorite.setExpanded(true); userTree.getChildren().add(favorite); TreeItem<Board> nichanBoard = new TreeItem<Board>(new Board()); nichanBoard.getValue().setTitle("2ch"); nichanBoard.getValue().setId("2ch_"); nichanBoard.setExpanded(true); rootNode.getChildren().add(nichanBoard); for (Board board : boards) { setupTreeItem(nichanBoard, board); } }