TreePath selectionPath = treeTable.getTree().getSelectionPath();
if (selectionPath == null) return;
// If the user has selected a node in the tree that has no siblings,
// we can move up a generation and start the filtering there.
EVTask task = (EVTask) selectionPath.getLastPathComponent();
EVTask parent = task.getParent();
while (parent != null && parent.getNumChildren() == 1) {
task = parent;
parent = task.getParent();
}
// The "filtered" node selected was really a sole descendant of the
// main task list. We can just display the regular, unfiltered chart.
if (parent == null) {
showChart();
return;
}
// The selected node happens to be the root of some subschedule. No
// filtering is needed; just display the chart for that schedule.
EVTaskList subSchedule = findTaskListWithRoot(model, task);
if (subSchedule != null) {
new TaskScheduleChart(subSchedule, null, dash);
return;
}
// Construct a string describing the filtered path
StringBuffer filteredPath = new StringBuffer();
for (int i = 1; i < selectionPath.getPathCount(); i++) {
EVTask t = (EVTask) selectionPath.getPathComponent(i);
filteredPath.append("/").append(t.getName());
if (t == task) break;
}
// Build an appropriate filter, and use it to launch a chart window
TaskFilter filter = new TaskFilter(filteredPath.substring(1),