use of net.sourceforge.processdash.hier.ui.AddTaskTypeOption in project processdash by dtuma.
the class AddTeamProjectTask method getTaskTypes.
@Override
public List<AddTaskTypeOption<String[]>> getTaskTypes(String targetParent, String activeTask) {
// find the root node of the enclosing project
StringBuffer path = new StringBuffer(activeTask);
ctx.getData().getInheritableValue(path, "Project_ID");
String projectRoot = path.toString();
// create a ProcessUtil object to extract process metadata
ProcessUtil proc = new ProcessUtil(ctx.getData(), projectRoot);
String templateID = proc.getProcessID() + "/Indiv2Task";
List<String> phaseNames = proc.getProcessListPlain("Phase_List");
TeamPhaseIconSet icons = new TeamPhaseIconSet(phaseNames);
String currentPhase = proc.getEffectivePhase(activeTask, true);
SimpleData currentWorkflowID = ctx.getData().getSimpleValue(DataRepository.createDataName(activeTask, TeamDataConstants.WORKFLOW_ID_DATA_NAME));
// create a list of types representing the phases in our MCF
List<AddTaskTypeOption<String[]>> result = new ArrayList();
for (String phase : phaseNames) {
AddTaskTypeOption<String[]> oneType = new AddTaskTypeOption();
oneType.typeID = new String[] { phase, null };
oneType.displayName = phase;
oneType.icon = icons.get(phase);
oneType.templateID = templateID;
oneType.isDefault = phase.equalsIgnoreCase(currentPhase);
if (oneType.isDefault && currentWorkflowID != null && currentWorkflowID.test()) {
oneType.typeID[1] = currentWorkflowID.format();
}
result.add(oneType);
}
// if any problems occurred, create a single, simple task type
if (result.isEmpty()) {
AddTaskTypeOption oneType = new AddTaskTypeOption();
oneType.icon = HierarchyIcons.getTaskIcon();
oneType.templateID = templateID;
result.add(oneType);
}
return result;
}
Aggregations