Examples of GraphPane


Examples of diva.graph.GraphPane

            _sourceType = CANVAS_TYPE;

            // Action activated using an ActionInteractor.
            LayerEvent event = (LayerEvent) source;
            CanvasLayer layer = event.getLayerSource();
            GraphPane pane = (GraphPane) layer.getCanvasPane();
            GraphController controller = pane.getGraphController();
            GraphModel model = controller.getGraphModel();

            _figure = event.getFigureSource();

            // Set the target.
            if (_figure == null) {
                _target = (NamedObj) model.getRoot();
            } else {
                Object object = _figure.getUserObject();
                _target = (NamedObj) model.getSemanticObject(object);
            }

            // Set the position.
            _x = event.getX();
            _y = event.getY();

            // Set the parent.
            CanvasPane canvasPane = layer.getCanvasPane();
            parent = canvasPane.getCanvas();
        } else if (source instanceof JMenuItem) {
            // Action activated using a context menu or submenu.
            JMenuItem item = (JMenuItem) source;
            // Find the original context menu.
            Component contextMenu = item.getParent();
            if (!(contextMenu instanceof JContextMenu)) {
                // Probably a submenu.
                // FIXME: This only supports one level of submenus.
                if (contextMenu instanceof JPopupMenu) {
                    contextMenu = ((JPopupMenu) contextMenu).getInvoker();
                }
                if (contextMenu instanceof JMenu) {
                    contextMenu = contextMenu.getParent();
                }
            }
            if (contextMenu instanceof JContextMenu) {
                _sourceType = CONTEXTMENU_TYPE;
                JContextMenu menu = (JContextMenu) contextMenu;
                parent = menu.getInvoker();
                _target = (NamedObj) menu.getTarget();
                _x = item.getX();
                _y = item.getY();
            } else {
                // Not implicit location.. should there be?
                _sourceType = MENUBAR_TYPE;
            }
            /*
             } else if (source instanceof JMenuItem) {
             // Action activated using a context menu.
             JMenuItem item = (JMenuItem) source;

             if (item.getParent() instanceof JContextMenu) {
             _sourceType = CONTEXTMENU_TYPE;

             JContextMenu menu = (JContextMenu) item.getParent();
             parent = menu.getInvoker();
             _target = (NamedObj) menu.getTarget();
             _x = item.getX();
             _y = item.getY();
             } else {
             // Not implicit location.. should there be?
             _sourceType = MENUBAR_TYPE;
             }
             */
        } else if (source instanceof JButton) {
            // presumably we are in a toolbar...
            _sourceType = TOOLBAR_TYPE;
            _target = null;
            parent = ((Component) source).getParent();
        } else if (source instanceof JGraph) {
            // This is an absurdly convoluted way to get the info we need.
            // But there seems to be no other way.
            // This is an architectural flaw in vergil.
            GraphPane pane = ((JGraph) source).getGraphPane();
            FigureLayer layer = pane.getForegroundLayer();
            CanvasComponent currentFigure = layer.getCurrentFigure();
            GraphController controller = pane.getGraphController();
            GraphModel model = controller.getGraphModel();

            if (currentFigure != null) {
                _target = null;

View Full Code Here

Examples of diva.graph.GraphPane

                CanvasUtilities.translateTo(newFigure, 100.0, 100.0);
                controller.dispatch(new GraphViewEvent(this,
                        GraphViewEvent.NODE_DRAWN, newFigure));
            }
        };
        _graphPane = new GraphPane(controller, graphModel);
        _jgraph = new JGraph(_graphPane);
        _jgraph
                .setBorder(BorderFactory
                        .createEtchedBorder(EtchedBorder.RAISED));
        // The icon window is fixed size.
View Full Code Here

Examples of diva.graph.GraphPane

                    center = frame.getCenter();
                    x = center.getX();
                    y = center.getY();
                } else {
                    // Put in the middle of the pane.
                    GraphPane pane = getGraphPane();
                    center = pane.getSize();
                    x = center.getX() / 2;
                    y = center.getY() / 2;
                }
            } else {
                x = getX();
View Full Code Here

Examples of org.qi4j.envisage.graph.GraphPane

        this.application = application;

        setTitle( BUNDLE.getString( "Application.Title" ) );
        setContentPane( contentPane );

        graphPane = new GraphPane();
        treeModelPane = new TreeModelPane();
        detailModelPane = new DetailModelPane();

        treeModelPane.addTreeSelectionListener( new TreeSelectionListener()
        {
View Full Code Here

Examples of ru.spbu.math.ontologycomparison.zhukova.visualisation.ui.graphpane.GraphPane

    public void mouseDragged(MouseEvent e) {
        Point mouseLocation = e.getPoint();
        int dx = mouseLocation.x - MovingTool.from.x;
        int dy = mouseLocation.y - MovingTool.from.y;
        GraphPane graphPane = Tool.getGraphPane();
        Set<IVertex> vertices = graphPane.getSelectedVertices();
        for (IVertex v : vertices) {
            graphPane.getGraphModel().moveVertex(v, dx, dy);
        }
        MovingTool.from = mouseLocation;
        graphPane.repaint();
    }
View Full Code Here

Examples of ru.spbu.math.ontologycomparison.zhukova.visualisation.ui.graphpane.GraphPane

    public void mouseDragged(MouseEvent e) {
        Point mouseLocation = e.getPoint();
        int dx = mouseLocation.x - ResizingTool.from.x;
        int dy = mouseLocation.y - ResizingTool.from.y;
        GraphPane graphPane = Tool.getGraphPane();
        if (ResizingTool.moveLeftBorder) {
            ResizingTool.superVertex.moveLeftBorder(dx);
        }
        if (ResizingTool.moveRightBorder) {
            ResizingTool.superVertex.moveRightBorder(dx);
        }
        if (ResizingTool.moveBottomBorder) {
            ResizingTool.superVertex.moveBottomBorder(dy);
        }
        if (ResizingTool.moveTopBorder) {
            ResizingTool.superVertex.moveTopBorder(dy);
        }
        ResizingTool.from = mouseLocation;
        graphPane.repaint();
    }
View Full Code Here

Examples of ru.spbu.math.ontologycomparison.zhukova.visualisation.ui.graphpane.GraphPane

    }

    public void mouseReleased(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON1) {
            Point mouseLocation = e.getPoint();
            GraphPane graphPane = Tool.getGraphPane();
            if (mouseLocation.equals(SelectingTool.left)) {
                if (!SelectingTool.isOnlySuperVerticesSelection) {
                    Set<SimpleVertex> simpleVertices = graphPane.getGraphModel().getSimpleVertices();
                    for (IVertex v : simpleVertices) {
                        if (v.hitTest(mouseLocation)) {
                            graphPane.selectVertex(v);
                            break;
                        }
                    }
                }
                Set<SuperVertex> vertices = graphPane.getGraphModel().getSuperVertices();
                for (IVertex v : vertices) {
                    if (v.hitTest(mouseLocation)) {
                        graphPane.selectVertex(v);
                        break;
                    }
                }

            } else {
                Set<SuperVertex> superVertices = graphPane.getGraphModel().getSuperVertices();
                for (SuperVertex v : superVertices) {
                    if (v.isInRectangleTest(SelectingTool.left, mouseLocation)) {
                        graphPane.selectVertex(v);
                    }
                }
                if (!SelectingTool.isOnlySuperVerticesSelection) {
                    Set<SimpleVertex> simpleVertices = graphPane.getGraphModel().getSimpleVertices();
                    for (SimpleVertex v : simpleVertices) {
                        if (v.isInRectangleTest(SelectingTool.left, mouseLocation) && !graphPane.getSelectedVertices().contains(v.getSuperVertex())) {
                            graphPane.selectVertex(v);
                        }
                    }
                }
            }
            graphPane.repaint();
        }
        SelectingTool.rectangleWidth = 0;
        SelectingTool.rectangleHeight = 0;
    }
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.