Examples of JGraphModelAdapter


Examples of org._3pq.jgrapht.ext.JGraphModelAdapter

        graph.addEdge(parentStack.get(0), node);
    }

    private JGraph createJGraph() {
        // create a visualization using JGraph, via an adapter
        JGraphModelAdapter m_jgAdapter = new JGraphModelAdapter(graph, JGraphModelAdapter.createDefaultVertexAttributes(), createDefaultEdgeAttributes());
        this.jgraph = new JGraph(m_jgAdapter);
        // layout setting
        JGraphUtils.applyOrderedTreeLayout(graph, m_jgAdapter, jgraph);
        // vertex color setting
        Iterator vertexIter = graph.vertexSet().iterator();
        while(vertexIter.hasNext()) {
            String vertex = (String) vertexIter.next();
            if(vertex.indexOf("QuantifiedExpr") > 0 || vertex.indexOf("FLWRExpr") > 0
                    || vertex.indexOf("PromoteJoinExpression") > 0) {
                DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
                AttributeMap attr = cell.getAttributes();
                GraphConstants.setBackground(attr, RED_NODE_COLOR);
                AttributeMap cellAttr = new AttributeMap();
                cellAttr.put(cell, attr);
                m_jgAdapter.edit(cellAttr, null, null, null);
            } else if(vertex.indexOf("DistinctSortExpr") > 0) {
                DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
                AttributeMap attr = cell.getAttributes();
                GraphConstants.setBackground(attr, GREEN_NODE_COLOR);
                AttributeMap cellAttr = new AttributeMap();
                cellAttr.put(cell, attr);
                m_jgAdapter.edit(cellAttr, null, null, null);
            } else if(vertex.indexOf("PathIndexAccessExpr") > 0) {
                DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
                AttributeMap attr = cell.getAttributes();
                GraphConstants.setBackground(attr, BLUE_NODE_COLOR);
                AttributeMap cellAttr = new AttributeMap();
                cellAttr.put(cell, attr);
                m_jgAdapter.edit(cellAttr, null, null, null);
            }
        }
        // mouseClicked event handling
        jgraph.addMouseListener(new MyMouseListener());
        return jgraph;
View Full Code Here

Examples of org.jgrapht.ext.JGraphModelAdapter

    public BasisPathController(GUIController control)
    {
        this.control = control;
        g = new ListenableDirectedGraph(DefaultEdge.class);

        GraphModel graphModel = new JGraphModelAdapter(g);
        graph = new JGraph(graphModel);

        //Add selection Listener to graph
        graph.addGraphSelectionListener(new GraphSelectionListenerImp(control));
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.