private void moveNode(final CheckedTreeNode toolNode, Direction dir) { CheckedTreeNode parentNode = (CheckedTreeNode) toolNode.getParent(); int index = parentNode.getIndex(toolNode); removeNodeFromParent(toolNode); int newIndex = dir.newIndex(index); parentNode.insert(toolNode, newIndex); getModel().nodesWereInserted(parentNode, new int[] {newIndex}); }
private boolean isMovingAvailable(final CheckedTreeNode toolNode, Direction dir) { TreeNode parent = toolNode.getParent(); int index = parent.getIndex(toolNode); return dir.isAvailable(index, parent.getChildCount()); }