Examples of VisualizationViewer


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

     * the event (in our case a VisualizationViewer) and the Point.
     */
    public void mousePressed(MouseEvent e) {
        Point p = e.getPoint();
        if (checkModifiers(e) || e.getModifiers() == mskbutton) {
            final VisualizationViewer vv = (VisualizationViewer)e.getSource();
            final Graph graph = vv.getGraphLayout().getGraph();
            Point2D ip = vv.inverseViewTransform(p);

            PickSupport picksupport = vv.getPickSupport();
            final PickedState pickedstate = vv.getPickedState();
            Vertex v = picksupport.getVertex(ip.getX(), ip.getY());
            if (v != null && hasSomethingToDisplay(v, vv)) {
                String hostname = getGraphManager().getLabel(v);
               
                // open the new window
View Full Code Here

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

        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);
View Full Code Here

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

                }
            }
            double dx, dy = 0;
            double scale = 0;
            double crossover = 1.0;
            VisualizationViewer vv1 = getVV(key1);
            VisualizationViewer vv2 = getVV(key2);
            scale = vv1.getLayoutTransformer().getScale();
            if (scale == 1.0)
                scale = vv1.getViewTransformer().getScale();
            if (scale < 1.0) {
                vv2.getViewTransformer().setScale(scale, scale, vv2.getCenter());
                vv2.getLayoutTransformer().setScale(crossover, crossover, vv2.getCenter());
            } else {
                vv2.getLayoutTransformer().setScale(scale, scale, vv2.getCenter());
                vv2.getViewTransformer().setScale(crossover,crossover, vv2.getCenter());
            }
            dx = vv1.getLayoutTransformer().getTranslateX();
            dy = vv1.getLayoutTransformer().getTranslateY();
            getVV(key2).getLayoutTransformer().setTranslate(dx, dy);
           
View Full Code Here

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

    public void mouseDragged(java.awt.event.MouseEvent e) {
    }

    public void mouseClicked(java.awt.event.MouseEvent e) {
        VisualizationViewer vv = null;
        if (checkModifiers(e) && isConsumer()) {
            Object o = e.getSource();
            if (o instanceof VisualizationViewer) {
                vv = (VisualizationViewer)o;
                final Point2D p = vv.inverseTransform(e.getPoint());
                String text = JOptionPane.showInputDialog(vv, "Please provide the text", "Label's value", JOptionPane.QUESTION_MESSAGE);
                if (text != null && text.length() > 0) {
                    NexsmPaintableText npt = new NexsmPaintableText();
                    npt.setText(text);
                    npt.setP1(p);
                    npt.setColor(Color.BLACK);
                    if (gm != null) {
                        gm.putRenderer(vv.getName(), npt);
                    }
                }
            }
            e.consume();
            setConsumer(false);
View Full Code Here

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

        this.lensPaintable = new LensPaintable();
//        this.cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
    }

    public void mouseReleased(MouseEvent e) {
        VisualizationViewer vv = (VisualizationViewer)e.getSource();
        Point2D p = e.getPoint();
        if (checkModifiers(e) && isConsumer()) {
            if (Math.sqrt( line.getBounds2D().getWidth() + line.getBounds2D().getHeight() ) > 10) {
                Color c = JColorChooser.showDialog(vv, "Choose a foreground color", Color.GRAY);
                if (c != null) {
                    NexsmPaintableLine npb = new NexsmPaintableLine();
                    npb.setP1(vv.inverseTransform(down));
                    npb.setP2(vv.inverseTransform(p));
                    npb.setColor(c);
                    if (gm != null) {
                        gm.putRenderer(vv.getName(), npb);
                    }
                }
            }
            e.consume();
            setConsumer(false);
        }
        down = null;
        line.setLine(0,0,0,0);
        vv.removePostRenderPaintable(lensPaintable);
    }
View Full Code Here

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

        vv.removePostRenderPaintable(lensPaintable);
    }

    public void mousePressed(MouseEvent e) {
        down = e.getPoint();
        VisualizationViewer vv = (VisualizationViewer)e.getSource();
        if (checkModifiers(e) && isConsumer()) {
            vv.addPostRenderPaintable(lensPaintable);
            line.setLine(down,down);
        }
    }
View Full Code Here

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

     */
    public void addTab(String name) {
        JPanel jtmp = new JPanel();
        jtmp.setLayout(new java.awt.BorderLayout(5, 5));
       
        VisualizationViewer vv = (VisualizationViewer)_parent.getMap().getVV(name);
        if (vv != null) {
//            GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
            jtmp.add(vv);
            _parent.getJtabViews().add(name, jtmp);
            updateSatellitePanel();
View Full Code Here

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

     * Adds a new view in graphManager, you want to be sure that
     * there's a corresponding tab with the same name.
     * @param name The name for the new view
     */
    public void addNewView(String name) {
        VisualizationViewer vv = (VisualizationViewer)_parent.getMap().getVV(name);
        if (vv == null) {
            _parent.getMap().addView(name);
        }
    }
View Full Code Here

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

   
    private void setZoomControls() {
        final ScalingControl scaler = new CrossoverScalingControl();
        jBtnZoomPlus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VisualizationViewer vv = _parent.getMap().getVV(_parent.getNameSelectedTab());
                if (scaler != null && vv != null)
                    scaler.scale(vv, 1.1f, vv.getCenter());
            }
        });

        jBtnZoomMinus.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                VisualizationViewer vv = _parent.getMap().getVV(_parent.getNameSelectedTab());
                if (scaler != null && vv != null)
                    scaler.scale(vv, 0.9f, vv.getCenter());
            }
        })
    }
View Full Code Here

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

    /**
     * Changes the satellite panel show with the one corresponding to
     * the layout shown in the selected tab
     */
    public void updateSatellitePanel() {
        VisualizationViewer satellite = _parent.getMap().getVV(_parent.getNameSelectedTab() + "satellite");
        if (_parent.getJtabViews().getComponentCount() == 0) {
            jPanelSatellite.removeAll();
        }

        if (satellite != null) {
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.