appli.getUndoManager().undoableEdit("Down", new Runnable(){
public void run()
{
for (int i = cdmtn.length - 1; i >= 0; i--)
{
DefaultMutableTreeNode father = gt2.getFatherNode(cdmtn[i]);
int index = father.getIndex((TreeNode) cdmtn[i]);
index++;
Task task = (Task) cdmtn[i].getUserObject();
// New position
if ((index < father.getChildCount()))
{
DefaultMutableTreeNode [] child = new DefaultMutableTreeNode[cdmtn[i].getChildCount()];
if(task.getExpand())
{
for(int j=0; j<cdmtn[i].getChildCount(); j++)
{
child[j] = (DefaultMutableTreeNode)cdmtn[i].getChildAt(j);
}
for(int j=0; j<child.length; j++)
{
child[j].removeFromParent();
treeModel.nodesWereRemoved(cdmtn[i],
new int[] { 0 },
new Object[] { child });
}
}
cdmtn[i].removeFromParent();
treeModel.nodesWereRemoved(father,
new int[] { index - 1 },
new Object[] { cdmtn });
father.insert(cdmtn[i], index);
treeModel.nodesWereInserted(father, new int[] {index});
if(task.getExpand())
{
for(int j=0; j<child.length; j++)