Task ID order when creating a projectfile is not correct
Multi platform library to read and write schedule data
Brought to you by:
joniles
When creating a ProjectFile and adding tasks to it in a non-ordered way using Task.addTask or other methods to generate a hierarchy based on parent child relations, then the Task IDs won't get updated so that their order and OutlineLevel represent the parent child hierarchy.
Attached is an upgraded ProjectFile.synchronizeTaskIDs method with a recursive helper function synchronizeTaskIDsFromHierarchy that renumbers the tasks based on their parent child relationship when auto generation for task id and outline level are set to true.
ProjectFile.java diff against r1.31
Hi,
I've taken a similar approach to your suggested patch - I've just rejigged the naming of a couple of methods which have slightly different purposes. Anyhow - there is a new method on the ProjectFile class called synchronizeTaskIDToHierarchy. If you create a task hierarchy programatically with various inserts into the child task lists, then call this method to sort out the task IDs before writing the results to a file.
Jon