Search in sources :

Example 6 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class EditSubprojectList method updateEVSchedule.

private void updateEVSchedule(Map subprojects) {
    String teamScheduleName = getValue("Project_Schedule_Name");
    logger.log(Level.FINE, "Master project {0} updating master schedule \"{1}\"", new Object[] { getPrefix(), teamScheduleName });
    // open the master schedule
    EVTaskList schedule = EVTaskList.openExisting(teamScheduleName, getDataRepository(), getPSPProperties(), getObjectCache(), false);
    if (!(schedule instanceof EVTaskListRollup)) {
        logger.log(Level.WARNING, "could not find a rollup schedule named \"{0}\"", teamScheduleName);
        return;
    }
    // empty all the children from the current master schedule.
    EVTaskListRollup master = (EVTaskListRollup) schedule;
    for (int i = master.getChildCount(master.getRoot()); i-- > 0; ) {
        EVTask task = (EVTask) master.getChild(master.getRoot(), i);
        master.removeTask(new TreePath(task.getPath()));
    }
    // now add the schedules of all the subprojects.
    for (Iterator i = subprojects.values().iterator(); i.hasNext(); ) {
        Subproject proj = (Subproject) i.next();
        String dataName = DataRepository.createDataName(proj.path, "Project_Schedule_Name");
        SimpleData d = getDataRepository().getSimpleValue(dataName);
        if (d == null) {
            logger.warning("Could not find schedule for subproject " + proj.path);
            continue;
        }
        String subscheduleName = d.format();
        if (!master.addTask(subscheduleName, getDataRepository(), getPSPProperties(), getObjectCache(), false)) {
            logger.warning("Could not add schedule for subproject " + proj.path);
        }
    }
    master.save();
    logger.fine("saved changed task list");
}
Also used : TreePath(javax.swing.tree.TreePath) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) EVTask(net.sourceforge.processdash.ev.EVTask) Iterator(java.util.Iterator) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 7 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class TaskScheduleDialog method deleteTask.

/** delete the currently selected task.
     */
protected void deleteTask() {
    if (!canEdit())
        return;
    TreePath selPath = treeTable.getTree().getSelectionPath();
    if (selPath == null)
        return;
    if (isFlatView()) {
        EVTask selectedTask = (EVTask) selPath.getLastPathComponent();
        selPath = new TreePath(selectedTask.getPath());
    }
    int pathLen = selPath.getPathCount();
    if (isRollup()) {
        if (pathLen != 2 || !confirmDelete(selPath))
            return;
    } else {
        if (pathLen < 2)
            return;
        if (pathLen == 2 && !confirmDelete(selPath))
            return;
    }
    // make the change.
    if (model.removeTask(selPath)) {
        setDirty(true);
        recalcAll();
        enableTaskButtons();
    }
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) Point(java.awt.Point)

Example 8 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class TaskScheduleDialog method enableTaskButtonsTreeView.

private void enableTaskButtonsTreeView() {
    TreePath selectionPath = treeTable.getTree().getSelectionPath();
    boolean enableDelete = false, enableUp = false, enableDown = false, isPruned = false;
    int pos = selectedTaskPos(selectionPath, model);
    if (pos != -1) {
        int numKids = ((EVTask) model.getRoot()).getNumChildren();
        isPruned = false;
        enableDelete = true;
        enableUp = (pos > 0);
        enableDown = (pos < numKids - 1);
    } else if (!isRollup() && selectionPath != null && selectionPath.getPathCount() > 2) {
        isPruned = ((EVTask) selectionPath.getLastPathComponent()).isUserPruned();
        enableDelete = isPruned || (disableTaskPruning == false);
    }
    addTaskAction.setEnabled(true);
    deleteTaskAction.setEnabled(enableDelete);
    if (!isRollup()) {
        String resKey;
        if (isPruned)
            resKey = "Buttons.Restore_Task";
        else if (pos == -1 && enableDelete)
            resKey = "Buttons.Exclude_Task";
        else
            resKey = "Buttons.Remove_Task";
        deleteTaskAction.setText(resources.getString(resKey));
    }
    moveUpAction.setEnabled(enableUp);
    moveDownAction.setEnabled(enableDown);
    expandAllAction.setEnabled(true);
    int firstRowNum = treeTable.getSelectionModel().getMinSelectionIndex();
    int lastRowNum = treeTable.getSelectionModel().getMaxSelectionIndex();
    boolean canFilter = firstRowNum > 0 && firstRowNum == lastRowNum;
    filteredChartAction.setEnabled(//
    canFilter && checkPermission(filteredChartAction, firstRowNum, EVPermissions.PERSONAL_CHARTS, "Chart"));
    filteredReportAction.setEnabled(//
    canFilter && checkPermission(filteredReportAction, firstRowNum, EVPermissions.PERSONAL_REPORT, "Report"));
    copyTaskInfoAction.setEnabled(firstRowNum >= 0);
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) Point(java.awt.Point)

Example 9 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class TaskScheduleDialog method expandAllForSelectedItems.

protected void expandAllForSelectedItems() {
    List<EVTask> selectedTasks = getSelectedTasksOrRoot();
    for (EVTask task : selectedTasks) expandAllForTask(task);
    selectNodesAndDescendants(selectedTasks);
}
Also used : EVTask(net.sourceforge.processdash.ev.EVTask)

Example 10 with EVTask

use of net.sourceforge.processdash.ev.EVTask in project processdash by dtuma.

the class TaskScheduleDialog method confirmDelete.

protected boolean confirmDelete(TreePath selPath) {
    EVTask task = (EVTask) selPath.getLastPathComponent();
    String fullName = isRollup() ? task.getName() : task.getFullName();
    String[] message = resources.formatStrings(isRollup() ? "Confirm.Delete_Schedule.Prompt_FMT" : "Confirm.Delete_Task.Prompt_FMT", fullName);
    return (JOptionPane.showConfirmDialog(frame, message, isRollup() ? resources.getString("Confirm.Delete_Schedule.Title") : resources.getString("Confirm.Delete_Task.Title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION);
}
Also used : EVTask(net.sourceforge.processdash.ev.EVTask)

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