@Override public void treeExpanded(TreeExpansionEvent e) { if (area != null) { area.repaint(); } DefaultMutableTreeTableNode node = (DefaultMutableTreeTableNode) (e.getPath().getLastPathComponent()); Task task = (Task) node.getUserObject(); task.setExpand(true); myProject.setAskForSave(true); }
@Override protected void onSelectionChanged(List<DefaultMutableTreeTableNode> selection) { if (isOnTaskSelectionEventProcessing) { return; } List<Task> selectedTasks = Lists.newArrayList(); for (DefaultMutableTreeTableNode node : selection) { if (node instanceof TaskNode) { selectedTasks.add((Task) node.getUserObject()); } } mySelectionManager.setSelectedTasks(selectedTasks); }
@Override protected void handlePopupTrigger(MouseEvent e) { if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON3) { TreePath selPath = getTreeTable().getTreeTable().getPathForLocation(e.getX(), e.getY()); if (selPath != null) { DefaultMutableTreeTableNode treeNode = (DefaultMutableTreeTableNode) selPath.getLastPathComponent(); Task task = (Task) treeNode.getUserObject(); if (!getTaskSelectionManager().isTaskSelected(task)) { getTaskSelectionManager().clear(); getTaskSelectionManager().addTask(task); } } createPopupMenu(e.getX(), e.getY()); e.consume(); } }
/** @return the mother task. */ public static DefaultMutableTreeTableNode getParentNode(DefaultMutableTreeTableNode node) { if (node == null) { return null; } return (DefaultMutableTreeTableNode) node.getParent(); }