use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class TaskScheduleDialog method setSelectedTasksTreeView.
private void setSelectedTasksTreeView(List<EVTask> tasks) {
treeTable.clearSelection();
EVTask t = tasks.get(0);
TreePath path = new TreePath(t.getPath());
treeTable.getTree().makeVisible(path);
int row = treeTable.getTree().getRowForPath(path);
if (row != -1) {
treeTable.getSelectionModel().addSelectionInterval(row, row);
scrollToRow(row);
}
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class TaskScheduleDialog method expandAllForTask.
private void expandAllForTask(EVTask task) {
for (EVTask child : task.getChildren()) expandAllForTask(child);
TreePath path = new TreePath(task.getPath());
treeTable.getTree().expandPath(path);
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class TaskScheduleDialog method checkPermission.
private boolean checkPermission(AbstractAction a, int row, String permissionID, String resKey) {
// if this is not a rollup in a team dashboard, permissions are OK
if (!isRollup() || !Settings.isTeamMode())
return true;
// get the list of people we can view data for. If null, the current
// user does not have permission to view personal data at all.
UserFilter userFilter = GroupPermission.getGrantedMembers(permissionID);
if (userFilter == null) {
a.putValue(Action.SHORT_DESCRIPTION, resources.getString("Buttons.Filtered_" + resKey + "_Blocked"));
return false;
}
// if the user is allowed to view data for everyone, return true
if (UserGroup.isEveryone(userFilter))
return true;
// find the personal schedule we are asking to view data for.
TreePath path = treeTable.getTree().getPathForRow(row);
if (path.getPathCount() < 2)
return false;
EVTask rootTask = (EVTask) path.getPathComponent(1);
EVTaskList subSchedule = findTaskListWithRoot(model, rootTask);
if (subSchedule == null)
return false;
// see if the current user has permission to view this schedule
EVTaskListGroupFilter filter = new EVTaskListGroupFilter(userFilter);
if (filter.include(subSchedule.getID()))
return true;
// if we don't have permission, display an explanatory tooltip
a.putValue(Action.SHORT_DESCRIPTION, resources.getString("Buttons.Filtered_" + resKey + "_Restricted"));
return false;
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class TaskScheduleDialog method getRowRangeForTaskAndDescendants.
private void getRowRangeForTaskAndDescendants(EVTask task, int[] range) {
TreePath path = new TreePath(task.getPath());
int row = treeTable.getTree().getRowForPath(path);
if (row != -1) {
range[0] = Math.min(range[0], row);
range[1] = Math.max(range[1], row);
List<EVTask> children = task.getChildren();
if (!children.isEmpty())
getRowRangeForTaskAndDescendants(children.get(children.size() - 1), range);
}
}
use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.
the class TaskScheduleDialog method showFilteredChart.
public void showFilteredChart() {
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();
}
// 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, groupFilterMenu, 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), getTaskFilterSet(task));
new TaskScheduleChart(model, filter, groupFilterMenu, dash);
}
Aggregations