Package edu.uci.ics.jung.graph

Examples of edu.uci.ics.jung.graph.Forest


   
    @SuppressWarnings("unchecked")
  public void collapse(Layout layout, Forest tree, Object subRoot) throws InstantiationException, IllegalAccessException {
       
      // get a sub tree from subRoot
      Forest subTree = TreeUtils.getSubTree(tree, subRoot);
      Object parent = null;
      Object edge = null;
      if(tree.getPredecessorCount(subRoot) > 0) {
        parent = tree.getPredecessors(subRoot).iterator().next();
        edge = tree.getInEdges(subRoot).iterator().next();
View Full Code Here


            public void actionPerformed(ActionEvent e) {
                Collection picked =new HashSet(vv.getPickedVertexState().getPicked());
                if(picked.size() == 1) {
                  Object root = picked.iterator().next();
                    Forest inGraph = (Forest)layout.getGraph();

                    try {
            collapser.collapse(vv.getGraphLayout(), inGraph, root);
          } catch (InstantiationException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          } catch (IllegalAccessException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          }

                    vv.getPickedVertexState().clear();
                    vv.repaint();
                }
            }});

        JButton expand = new JButton("Expand");
        expand.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                Collection picked = vv.getPickedVertexState().getPicked();
                for(Object v : picked) {
                    if(v instanceof Forest) {
                        Forest inGraph = (Forest)layout.getGraph();
                  collapser.expand(inGraph, (Forest)v);
                    }
                    vv.getPickedVertexState().clear();
                   vv.repaint();
                }
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.graph.Forest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.