Example usage for javax.swing.event TreeExpansionEvent getPath

List of usage examples for javax.swing.event TreeExpansionEvent getPath

Introduction

In this page you can find the example usage for javax.swing.event TreeExpansionEvent getPath.

Prototype

public TreePath getPath() 

Source Link

Document

Returns the path to the value that has been expanded/collapsed.

Usage

From source file:com.mindcognition.mindraider.ui.swing.trash.TrashJPanel.java

/**
 * @see javax.swing.event.TreeWillExpandListener#treeWillCollapse(javax.swing.event.TreeExpansionEvent)
 *//*w  ww  . j  a  v  a 2  s.  c  o m*/
public void treeWillCollapse(TreeExpansionEvent e) throws ExpandVetoException {
    logger.debug("Tree will collapse " + e.getPath());
}

From source file:com.mindcognition.mindraider.ui.swing.trash.TrashJPanel.java

/**
 * @see javax.swing.event.TreeWillExpandListener#treeWillExpand(javax.swing.event.TreeExpansionEvent)
 */// w  w  w . j a va2  s  .  c  o  m
public void treeWillExpand(TreeExpansionEvent e) throws ExpandVetoException {
    logger.debug("Tree will expand " + e.getPath());

    /*
     * DefaultMutableTreeNode node = (DefaultMutableTreeNode)
     * tree.getLastSelectedPathComponent(); if (node == null) { return; }
     * logger.debug(""+node.getPath()[node.getLevel()]); // buttons
     * disabling switch(node.getLevel()) { case LEVEL_FOLDERS: // disconnect
     * childrens from the node Enumeration enumeration=node.children(); //
     * delete nodes itself while (enumeration.hasMoreElements()) { Object
     * object=enumeration.nextElement();
     * treeNodeToResourceUriMap.remove(object);
     * treeModel.removeNodeFromParent((MutableTreeNode)object); } // get
     * folder URI logger.debug("Expanding folder:
     * "+treeNodeToResourceUriMap.get(node)); FolderResource folder =new
     * FolderResource(MindRaider.folderCustodian.get((String)treeNodeToResourceUriMap.get(node)));
     * String[] notebookUris=folder.getNotebookUris(); if (notebookUris !=
     * null) { for (int i= 0; i < notebookUris.length; i++) {
     * NotebookResource notebook=new
     * NotebookResource(MindRider.notebookCustodian.get(notebookUris[i]));
     * addNotebookNode(node,notebook.resource.metadata.uri.toASCIIString(),notebook.getLabel()); } } }
     */
}

From source file:edu.harvard.i2b2.query.QueryConceptTreePanel.java

public void treeCollapsed(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject();

    //System.out.println("Node collapsed: "+data.dimcode());   

    if (data.visualAttribute().equals("FAO")) {
        data.visualAttribute("FA");
    } else if (data.visualAttribute().equals("CAO")) {
        data.visualAttribute("CA");
    }/*from   ww w .jav  a 2  s.c om*/
}

From source file:edu.harvard.i2b2.query.QueryConceptTreePanel.java

public void treeExpanded(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject();
    jTree1.scrollPathToVisible(new TreePath(node));

    //System.out.println("Node expanded: "+data.dimcode());   

    if (data.visualAttribute().equals("FA")) {
        data.visualAttribute("FAO");
    } else if (data.visualAttribute().equals("CA")) {
        data.visualAttribute("CAO");
    }//from ww w .  ja v a2 s.  c om

    // check to see if child is a placeholder ('working...')
    //   if so, make Web Service call to update children of node
    if (node.getChildCount() == 1) {
        final DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) node.getChildAt(0);
        if (((QueryConceptTreeNodeData) node1.getUserObject()).name().equalsIgnoreCase("working ......")) {
            final DefaultMutableTreeNode anode = node;
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    populateChildNodes(anode);
                }
            });
        }
    } else {
        for (int i = 0; i < node.getChildCount(); i++) {
            DefaultMutableTreeNode anode = (DefaultMutableTreeNode) node.getChildAt(0);
            QueryConceptTreeNodeData adata = (QueryConceptTreeNodeData) anode.getUserObject();
            if (adata.visualAttribute().equals("FAO")) {
                adata.visualAttribute("FA");
            } else if (adata.visualAttribute().equals("CAO")) {
                adata.visualAttribute("CA");
            }
        }
    }
}

From source file:edu.harvard.i2b2.query.QueryConceptTreePanel.java

public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject();

    //System.out.println("Node will collapse: "+data.dimcode());   

    if (data.visualAttribute().equals("FAO")) {
        data.visualAttribute("FA");
    } else if (data.visualAttribute().equals("CAO")) {
        data.visualAttribute("CA");
    }//from   www .ja v a2  s  .co  m
}

From source file:edu.harvard.i2b2.query.QueryConceptTreePanel.java

public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject();

    //System.out.println("Node will expand: "+data.dimcode());   

    if (data.visualAttribute().equals("FA")) {
        data.visualAttribute("FAO");
    } else if (data.visualAttribute().equals("CA")) {
        data.visualAttribute("CAO");
    }/*from www.ja v a 2 s  .com*/

    // check to see if child is a placeholder ('working...')
    //   if so, make Web Service call to update children of node
    if (node.getChildCount() == 1
            && !(node.getChildAt(0).toString().equalsIgnoreCase("Over 300 child nodes"))) {
        DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) node.getChildAt(0);
        if (((QueryConceptTreeNodeData) node1.getUserObject()).visualAttribute().equals("LAO")) {
            populateChildNodes(node);
        }
    } else {
        for (int i = 0; i < node.getChildCount(); i++) {
            DefaultMutableTreeNode anode = (DefaultMutableTreeNode) node.getChildAt(0);
            QueryConceptTreeNodeData adata = (QueryConceptTreeNodeData) anode.getUserObject();
            if (adata.visualAttribute().equals("FAO")) {
                adata.visualAttribute("FA");
            } else if (adata.visualAttribute().equals("CAO")) {
                adata.visualAttribute("CA");
            }
        }
    }
}

From source file:edu.harvard.i2b2.previousquery.QueryPreviousRunsPanel.java

public void treeExpanded(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryData data = (QueryData) node.getUserObject();
    jTree1.scrollPathToVisible(new TreePath(node));

    System.out.println("Node expanded: " + data.name());

    if (data.visualAttribute().equals("FA")) {
        data.visualAttribute("FAO");
    } else if (data.visualAttribute().equals("CA")) {
        data.visualAttribute("CAO");
    }//from  www . ja  v a  2  s  .  c o  m

    // check to see if child is a placeholder ('working...')
    //   if so, make Web Service call to update children of node
    if (node.getChildCount() == 1) {
        final DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) node.getChildAt(0);
        if (((QueryData) node1.getUserObject()).visualAttribute().equals("LAO")
                && ((QueryData) node1.getUserObject()).name().equals("working ......")) {
            final DefaultMutableTreeNode anode = node;
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    populateChildNodes(anode);
                }
            });
        }
    } else {
        for (int i = 0; i < node.getChildCount(); i++) {
            DefaultMutableTreeNode anode = (DefaultMutableTreeNode) node.getChildAt(0);
            QueryData adata = (QueryData) anode.getUserObject();
            if (adata.visualAttribute().equals("FAO")) {
                adata.visualAttribute("FA");
            } else if (adata.visualAttribute().equals("CAO")) {
                adata.visualAttribute("CA");
            }
        }
    }
}

From source file:com.lp.client.frame.component.PanelDokumentenablage.java

@Override
public void treeExpanded(TreeExpansionEvent event) {
    if (treeInProgress)
        return;//from w  w  w .  java  2s . c  o m
    setBusy(true);

    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    DefaultMutableTreeNode firstChild = (DefaultMutableTreeNode) node.getFirstChild();
    TreePath selectionPath = tree.getSelectionPath();
    if (MUST_LOAD_CHILDREN.equals(firstChild.getUserObject())) {

        node.removeAllChildren();
        DocPath expandPath = new DocPath();

        for (Object obj : node.getUserObjectPath()) {
            try {
                expandPath.add((DocNodeBase) obj);
            } catch (ClassCastException ex) {
                expandPath.add(new DocNodeLiteral(obj.toString()));
            }
        }

        List<DocNodeBase> childList;
        try {
            childList = DelegateFactory.getInstance().getJCRDocDelegate()
                    .getDocNodeChildrenFromNode(expandPath);
            setDocNodesOnTree(node, childList, expandPath);
        } catch (Throwable e) {
            treeModel.insertNodeInto(new DefaultMutableTreeNode(e), node, 0);
        }
        tree.expandPath(new TreePath(node.getPath()));
        tree.setSelectionPath(selectionPath);
    }
    setBusy(false);
}

From source file:edu.harvard.i2b2.query.ui.QueryConceptTreePanel.java

public void treeExpanded(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject();
    jTree1.scrollPathToVisible(new TreePath(node));

    //System.out.println("Node expanded: "+data.dimcode());   

    if (data.visualAttribute().equals("FA")) {
        data.visualAttribute("FAO");
    } else if (data.visualAttribute().equals("CA")) {
        data.visualAttribute("CAO");
    }/*from   w w  w  .  j a v  a2s  . c o m*/

    // check to see if child is a placeholder ('working...')
    //   if so, make Web Service call to update children of node
    if (node.getChildCount() == 1) {
        final DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) node.getChildAt(0);
        if (((QueryConceptTreeNodeData) node1.getUserObject()).name().equalsIgnoreCase("working ......")) {
            final DefaultMutableTreeNode anode = node;
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    populateChildNodes(anode);
                }
            });
        }
    } else {
        for (int i = 0; i < node.getChildCount(); i++) {
            DefaultMutableTreeNode anode = (DefaultMutableTreeNode) node.getChildAt(0);
            QueryConceptTreeNodeData adata = (QueryConceptTreeNodeData) anode.getUserObject();
            if (adata.visualAttribute().equals("FAO")) {
                //adata.visualAttribute("FA");
            } else if (adata.visualAttribute().equals("CAO")) {
                //adata.visualAttribute("CA");   
            }
        }
    }
}

From source file:edu.harvard.i2b2.query.ui.ConceptTreePanel.java

public void treeCollapsed(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject();

    // System.out.println("Node collapsed: "+data.dimcode());

    if (data.visualAttribute().equals("FAO")) {
        data.visualAttribute("FA");
    } else if (data.visualAttribute().equals("CAO")) {
        data.visualAttribute("CA");
    }/*from   w  w w. ja  v  a2 s.co  m*/
}