Package edu.uci.ics.jung.visualization

Examples of edu.uci.ics.jung.visualization.AbstractLayout


     * instances for the new view, and sets the functions and renderers related
     * @param key The new view's name
     */
    public void addView(String key) {
        putLayout(key, new StaticLayout(_myGraph));
        AbstractLayout l = getLayout(key);
        putVisualizationModel(key, new DefaultVisualizationModel(l, borderDimension));
        VisualizationModel vm = getVisualizationModel(key);
        putPR(key, new NexsmPluggableRenderer());
        PluggableRenderer pr = getPR(key);
        putVV(key, new VisualizationViewer(vm, pr, _dim));
        VisualizationViewer vv = getVV(key);
       
        putVV(key + "satellite", new SatelliteVisualizationViewer(vv, l, new PluggableRenderer(), new Dimension(160,160)));
        vv.setName(key);
        vv.setBorder(BorderFactory.createEtchedBorder());
        vv.setLayout(null);
       
        if (getBooleanParam("showcenterdot") != null) {
            if (getBooleanParam("showcenterdot"))
                addCenterDotPostRenderer(key);
        }
       
        if (getBooleanParam("showborder") != null) {
            if (getBooleanParam("showborder"))
                addBorderPreRenderer(key);
        }
       
        NexsmEditingModalGraphMouse graphMouse = new NexsmEditingModalGraphMouse(this);
       
        vv.setGraphMouse(graphMouse);
        graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
       
        pr.setGraphLabelRenderer(nglr);
        pr.setVertexStringer(vs);
        Predicate hiddenVertex = new HiddenVertexPredicate(userdatumkey+key);
        Predicate showEdge = new ShowEdgePredicate(userdatumkey+key);
        pr.setVertexIncludePredicate(hiddenVertex);
        pr.setEdgeIncludePredicate(showEdge);
       
        PluggableRenderer satelliteRenderer = (PluggableRenderer)getVV(key + "satellite").getRenderer();
        satelliteRenderer.setVertexIncludePredicate(hiddenVertex);
        satelliteRenderer.setEdgeIncludePredicate(showEdge);
        satelliteRenderer.setVertexPaintFunction(
                new PickableVertexPaintFunction(satelliteRenderer, Color.BLUE, Color.BLACK, Color.ORANGE));

        pr.setVertexIconFunction(vi);
        pr.setVertexShapeFunction(vi);
        pr.setEdgeStrokeFunction(new ConstantEdgeStrokeFunction(2));
        pr.setEdgePaintFunction(new NexsmEdgePaint());
       
        Color c = _colorparams.get("defaultbackgroundcolor");
        if (c != null)
            vv.setBackground(c);
        else
            vv.setBackground(Color.white);
        vv.setPickSupport(new ShapePickSupport());
        vv.setPickedState(pstate);
       
        l.initialize(_dim, _rndDecorator);
// TODO add these later when they work as they should be
//        addLogicalZoomControls(key);
//        addImagePreRenderer(key);
//        addErrorPostRenderer(key);
    }
View Full Code Here


     * Sets a layout for the view specified by key
     * @param key The view's name to set the layout
     * @param nl The layout type
     */
    public void setLayout(String key, NexsmLayoutType nl) {
        AbstractLayout l = null;
        switch (nl) {
            case ISOMLayout:
                l = new ISOMLayout(_myGraph);
                break;
            case StaticLayout:
View Full Code Here

            if (getBackground(key1) != null && getBackground(key1).length() > 0) {
                putBackground(key2, getBackground(key1));
                addImagePreRenderer(key2, getBackground(key2));
            }
           
            AbstractLayout l1 = getLayout(key1);
            AbstractLayout l2 = getLayout(key2);
            Vertex v = null;
            for (Object o: _myGraph.getVertices()) {
                if (o instanceof Vertex) {
                    v = (Vertex)o;
                    l2.forceMove(v, l1.getX(v), l1.getY(v));
                    if (v.getUserDatum(userdatumkey+key1) != null) {
                        v.setUserDatum(userdatumkey+key2, v.getUserDatum(userdatumkey+key1), UserData.REMOVE);
                    }
                }
            }
View Full Code Here

     * @param v The vertex to move
     * @param coords The new coordinates
     * @param key The view key name
     */
    public void moveVertex(Vertex v, Coordinates coords, String key) {
        AbstractLayout l = getLayout(key);
        if (l != null && v != null) {
            l.forceMove(v, coords.getX(), coords.getY());
        }
    }
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.visualization.AbstractLayout

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.