Search in sources :

Example 16 with EVTask

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);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) Point(java.awt.Point)

Example 17 with EVTask

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);
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask)

Example 18 with EVTask

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;
}
Also used : EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) UserFilter(net.sourceforge.processdash.team.group.UserFilter) EVTaskList(net.sourceforge.processdash.ev.EVTaskList)

Example 19 with EVTask

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);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) Point(java.awt.Point)

Example 20 with EVTask

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);
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) EVTaskFilter(net.sourceforge.processdash.ev.EVTaskFilter) Point(java.awt.Point)

Aggregations

EVTask (net.sourceforge.processdash.ev.EVTask)24 TreePath (javax.swing.tree.TreePath)12 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)8 Point (java.awt.Point)6 ArrayList (java.util.ArrayList)6 Iterator (java.util.Iterator)4 LinkedList (java.util.LinkedList)3 List (java.util.List)3 MilestoneList (net.sourceforge.processdash.ev.MilestoneList)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 EVTaskDependency (net.sourceforge.processdash.ev.EVTaskDependency)2 Component (java.awt.Component)1 Collection (java.util.Collection)1 EventObject (java.util.EventObject)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 JLabel (javax.swing.JLabel)1 JTree (javax.swing.JTree)1