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:edu.harvard.i2b2.query.ui.ConceptTreePanel.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");
    }/*ww  w.j  ava2 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 (((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 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");
    }/* www .  java  2  s.c o  m*/
}

From source file:edu.harvard.i2b2.query.ui.ConceptTreePanel.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   w  w w  . j  a  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
            && !(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.query.ui.GroupPanel.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("L")) {
        // return;
    }//from w w w  . j  av  a  2 s  .c  o  m

    if (data.visualAttribute().equals("FA")) {
        data.visualAttribute("FAO");
    } else if (data.visualAttribute().equals("CA")) {
        data.visualAttribute("CAO");
    }

    // 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.previousquery.ui.PreviousQueryPanel.java

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

    if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryResultData")) {
        QueryResultData rdata = (QueryResultData) node.getUserObject();
        if (rdata.patientCount().equalsIgnoreCase("0")) {

            final JPanel parent = this;
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(parent, "There are no patients in this set.", "Message",
                            JOptionPane.INFORMATION_MESSAGE);
                }//from w  ww . j av  a 2s  . c  o m
            });

            return;
        }
    }
}

From source file:edu.harvard.i2b2.previousquery.ui.PreviousQueryPanel.java

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

    if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryResultData")) {
        QueryResultData rdata = (QueryResultData) node.getUserObject();
        if (rdata.patientCount().equalsIgnoreCase("0")) {
            return;
            /*/*from  ww  w .j a  v a2s.co  m*/
             * final JPanel parent = this;
             * java.awt.EventQueue.invokeLater(new Runnable() { public void
             * run() { JOptionPane.showMessageDialog(parent, "There's no
             * patient in this set.", "Message",
             * JOptionPane.INFORMATION_MESSAGE); } });
             */

        }
    }

    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");
    }

    // 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:edu.harvard.i2b2.patientSet.ui.PatientSetJPanel.java

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

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

    if (data.visualAttribute().equals("FAO")) {
        data.visualAttribute("FA");
    } else if (data.visualAttribute().equals("CAO")) {
        data.visualAttribute("CA");
    }// w ww. j a v a 2s .co  m
}

From source file:edu.harvard.i2b2.patientSet.ui.PatientSetJPanel.java

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

    if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryResultData")) {
        //QueryResultData rdata = (QueryResultData) node.getUserObject();
        /*if (rdata.patientCount().equalsIgnoreCase("0")) {
                /*from w w w  .  j a  va 2  s. c om*/
           final JPanel parent = this;
           java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
          JOptionPane.showMessageDialog(parent,
                "There are no patients in this set.",
                "Message", JOptionPane.INFORMATION_MESSAGE);
              }
           });
                
           return;
        }*/
    }
}

From source file:edu.harvard.i2b2.patientSet.ui.PatientSetJPanel.java

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

    /*if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase(
    "QueryResultData")) {/*from  www .j  a v  a  2  s. co  m*/
       QueryResultData rdata = (QueryResultData) node.getUserObject();
       if (rdata.patientCount().equalsIgnoreCase("0")) {
    return;
    /*
     * final JPanel parent = this;
     * java.awt.EventQueue.invokeLater(new Runnable() { public void
     * run() { JOptionPane.showMessageDialog(parent, "There's no
     * patient in this set.", "Message",
     * JOptionPane.INFORMATION_MESSAGE); } });
     */

    //}
    //}*/

    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");
    }

    // 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:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeFileSystemTreeExpanded(javax.swing.event.TreeExpansionEvent evt) {
    setWaitCursor(true);/*  www . j  a v  a2  s  .c  o  m*/
    LOG.debug("Expanding Tree");
    TreePath currentPath = evt.getPath();
    depositPresenter.expandFileSystemTree(currentPath);
    setWaitCursor(false);
}