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");
}
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();
}
}
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);
}
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);
}
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);
}
Aggregations