Implemented move in the new ordered list updater

pull/14/head
Sam Bosley 12 years ago
parent fa5739f499
commit fb21f68b84

@ -85,6 +85,27 @@ public abstract class NewOrderedListUpdater<LIST> {
}
}
public void moveTo(long targetTaskId, long beforeTaskId) {
Node target = idToNode.get(targetTaskId);
Node before = idToNode.get(beforeTaskId);
if (target == null || before == null)
return;
moveHelper(target, before);
}
private void moveHelper(Node moveThis, Node beforeThis) {
Node parent = beforeThis.parent;
ArrayList<Node> siblings = parent.children;
int index = siblings.indexOf(beforeThis);
if (index < 0)
return;
moveThis.parent = parent;
siblings.add(index, moveThis);
}
private Node buildTreeModel(String serializedTree) {
Node root = new Node(-1, null);
try {

Loading…
Cancel
Save