use of net.sourceforge.processdash.hier.HierarchyNote in project processdash by dtuma.
the class EVTask method saveToXML.
protected void saveToXML(StringBuffer result, boolean whitespace, String indent, boolean includeNotes, EVTaskList scheduleToEmbed) {
result.append(indent).append("<task name='").append(XMLUtils.escapeAttribute(name)).append("' pt='").append(planValue).append("' at='").append(actualTime);
if (planTime != planValue)
result.append("' ptt='").append(planTime);
if (actualTime != actualDirectTime)
result.append("' adt='").append(actualDirectTime);
if (actualCurrentTime != actualDirectTime)
result.append("' act='").append(actualCurrentTime);
if (planStartDate != null)
result.append("' psd='").append(EVSchedule.saveDate(planStartDate));
if (actualStartDate != null)
result.append("' asd='").append(EVSchedule.saveDate(actualStartDate));
if (planDate != null)
result.append("' pd='").append(EVSchedule.saveDate(planDate));
if (replanDate != null)
result.append("' rpd='").append(EVSchedule.saveDate(replanDate));
if (forecastDate != null)
result.append("' fd='").append(EVSchedule.saveDate(forecastDate));
if (dateCompleted != null)
result.append("' cd='").append(EVSchedule.saveDate(dateCompleted));
if (isLevelOfEffortTask())
result.append("' loe='").append(planLevelOfEffort);
if (taskOrdinal != INFER_FROM_CONTEXT)
result.append("' ord='").append(taskOrdinal);
if (pruningFlag != INFER_FROM_CONTEXT && pruningFlag != ANCESTOR_PRUNED)
result.append("' prune='").append(pruningFlag);
if (hasValue(taskIDs))
result.append("' tid='").append(XMLUtils.escapeAttribute(StringUtils.join(taskIDs, ",")));
if (hasValue(assignedTo))
result.append("' who='").append(XMLUtils.escapeAttribute(StringUtils.join(assignedTo, ",")));
if (XMLUtils.hasValue(flag))
result.append("' flag='").append(XMLUtils.escapeAttribute(flag));
if (nodeType != null)
result.append("' nt='").append(XMLUtils.escapeAttribute(nodeType));
if (nodeTypeSpec != null)
result.append("' nts='").append(XMLUtils.escapeAttribute(nodeTypeSpec.formatClean()));
String newline = (whitespace ? "\n" : "");
if (isLeaf() && !hasValue(dependencies) && !(includeNotes && noteData != null))
result.append("'/>").append(newline);
else {
result.append("'>").append(newline);
String subIndent = (whitespace ? (indent + " ") : "");
if (includeNotes && noteData != null) {
HierarchyNote note = noteData.get(HierarchyNoteManager.NOTE_KEY);
if (note != null)
result.append(subIndent).append(note.getAsXML()).append(newline);
}
if (hasValue(dependencies))
for (EVTaskDependency dep : dependencies) dep.getAsXML(result, subIndent, true);
// if this is a rollup task list, and we have been asked to embed
// subschedule information, get the subschedules our children need
List<EVTaskList> subschedules = null;
if (scheduleToEmbed instanceof EVTaskListRollup) {
subschedules = ((EVTaskListRollup) scheduleToEmbed).getSubSchedules();
}
// write <task> tags for each of our child nodes.
for (int i = 0; i < getNumChildren(); i++) {
EVTaskList childSubschedule = (//
subschedules == null ? //
null : subschedules.get(i));
getChild(i).saveToXML(result, whitespace, subIndent, includeNotes, childSubschedule);
}
// schedule information, write that data now.
if (scheduleToEmbed != null && subschedules == null)
scheduleToEmbed.getSchedule().saveToXML(result, subIndent);
result.append(indent).append("</task>").append(newline);
}
}
use of net.sourceforge.processdash.hier.HierarchyNote in project processdash by dtuma.
the class TaskCommenterButton method setCommentTooltipAndConflict.
// Navigate through the task hierarchy from the currentNode to the top. If any
// conflicting comments are found, "taskInConflict" and "conflictingCommentAuthor"
// will be set accordingly.
private void setCommentTooltipAndConflict(PropertyKey currentNode) {
Map<String, HierarchyNote> notes = HierarchyNoteManager.getNotesForPath(context.getDataRepository(), currentNode.path());
if (notes != null) {
if (deepestComment == null) {
HierarchyNote note = notes.get(HierarchyNoteManager.NOTE_KEY);
if (note != null)
deepestComment = note.getAsHTML() + getBylineHTML(note);
}
if (notes.get(HierarchyNoteManager.NOTE_CONFLICT_KEY) != null) {
commentConflictPresent = true;
taskInConflict = currentNode;
conflictingCommentAuthor = notes.get(HierarchyNoteManager.NOTE_CONFLICT_KEY).getAuthor();
}
}
PropertyKey parent = currentNode.getParent();
if (parent != null)
setCommentTooltipAndConflict(parent);
}
use of net.sourceforge.processdash.hier.HierarchyNote in project processdash by dtuma.
the class HierarchyNoteEditorDialog method showEditorFor.
private void showEditorFor(PropertyKey selectedNode) {
// anymore.
if (this.noteEditor != null)
this.noteEditor.removeDirtyListener(this);
noteEditorScrollPane.setViewportView(null);
// No node selected
if (selectedNode == null)
showEmptyEditor();
else {
String path = selectedNode.path();
taskPathLabel.setText(path);
HierarchyNoteFormat hierarchyNoteFormat = null;
HierarchyNoteEditor noteEditor = null;
Map<String, HierarchyNote> notes = HierarchyNoteManager.getNotesForPath(data, path);
// The selected node as some notes
if (notes != null) {
// We get the note format
String noteFormat = notes.get(HierarchyNoteManager.NOTE_KEY).getFormat();
hierarchyNoteFormat = HierarchyNoteManager.getNoteFormat(noteFormat);
noteInConflict = notes.get(HierarchyNoteManager.NOTE_CONFLICT_KEY);
// We get the editor of the desired note, for its format
noteEditor = hierarchyNoteFormat.getEditor(notes.get(HierarchyNoteManager.NOTE_KEY), noteInConflict, notes.get(HierarchyNoteManager.NOTE_BASE_KEY));
} else {
hierarchyNoteFormat = HierarchyNoteManager.getDefaultNoteFormat(data, path);
noteInConflict = null;
// Since there's no note for this node, we can get an empty Editor for
// the specified note format
noteEditor = hierarchyNoteFormat.getEditor(null, null, null);
}
final Component noteEditorComponent = noteEditor.getNoteEditorComponent();
noteEditorScrollPane.setViewportView(noteEditorComponent);
this.noteEditor = noteEditor;
this.nodeCommentShowedByEditor = selectedNode;
this.noteEditor.addDirtyListener(this);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
noteEditorComponent.requestFocus();
}
});
}
}
use of net.sourceforge.processdash.hier.HierarchyNote in project processdash by dtuma.
the class HierarchyNoteEditorDialog method saveComment.
/* Before calling this event, a node must absolutely selected */
public void saveComment() {
String noteContent = noteEditor.getContent();
HierarchyNote note = new HierarchyNote();
note.setContent(noteContent, noteEditor.getFormatID());
Map<String, HierarchyNote> noteData = new HashMap<String, HierarchyNote>();
noteData.put(HierarchyNoteManager.NOTE_KEY, note);
if (noteInConflict != null) {
noteData.put(HierarchyNoteManager.NOTE_BASE_KEY, noteInConflict);
noteData.put(HierarchyNoteManager.NOTE_CONFLICT_KEY, null);
}
HierarchyNoteManager.saveNotesForPath(data, nodeCommentShowedByEditor.path(), noteData);
treeModel.commentStatusChanged(nodeCommentShowedByEditor);
noteEditor.setDirty(false);
noteInConflict = null;
revertComment();
}
Aggregations