private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
       DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent();
        
        if (node.getUserObject() instanceof Asset) {
          //save asset on to new element
            Element newElement = (Element) elementsCbo.getSelectedItem();
            Asset selectedAsset = (Asset) node.getUserObject();
            UpdateAsset(newElement, selectedAsset);
        }
     
        if (node.getUserObject() instanceof Task) {
            //save task on to new asset
            Asset newAsset = (Asset) assetCbo.getSelectedItem();
            Task selectedTask = (Task) node.getUserObject();
            
            UpdateTask(newAsset, selectedTask);
           }
          
        if (node.getUserObject() instanceof Element) {
            //save element on to new project
            Project newProject = (Project) projectsCbo.getSelectedItem();
            Element selectedElement = (Element) node.getUserObject();
           DefaultMutableTreeNode pnode2 = (DefaultMutableTreeNode) node.getParent();
           Project oldProject = (Project) pnode2.getUserObject();
           SetOfTasks AllTasksOnElement = new SetOfTasks();  
           Enumeration num = node.children();
           
            //node.children().
                    while (num.hasMoreElements()) {
                        //num.nextElement();
                        //Enumeration num2 = num..children();
                         DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) num.nextElement();
                          Enumeration num2 = childNode.children();
                           while (num2.hasMoreElements()) {
                                DefaultMutableTreeNode childChildNode = (DefaultMutableTreeNode) num2.nextElement();
                                AllTasksOnElement.add((Task) childChildNode.getUserObject()); 
                            }
                    }
                    
                    
                    
            UpdateElement(newProject, selectedElement, oldProject, AllTasksOnElement);
        }
           
         LoadUpTree();    
    }//GEN-LAST:event_jButton1ActionPerformed