Examples of GraphPane


Examples of diva.graph.GraphPane

        typedRenderer.addTypedRenderer(Integer.class, integerRenderer);
        typedRenderer.addTypedRenderer(ArrayList.class, setRenderer);
        typedRenderer.addTypedRenderer(String.class, stringRenderer);

        // Use the renderer in the JGraph
        GraphPane gp = new GraphPane(bgc, new BasicGraphModel());
        bgc.getNodeController().setNodeRenderer(typedRenderer); // <=== HERE!

        JGraph g = new JGraph(gp);

        // Display it all
View Full Code Here

Examples of diva.graph.GraphPane

        _graph = _constructDivaGraph();

        // display the graph.
        final GraphController gc = new LocalZenoGraphController();
        final GraphPane gp = new GraphPane(gc, _graph);
        _jgraph = new JGraph(gp);
        _divaPanel.add(_jgraph);

        StateListener listener = new StateListener((GraphPane) _jgraph
                .getCanvasPane());
View Full Code Here

Examples of diva.graph.GraphPane

    protected void _doLayout(GraphModel graph, GraphPane gp) {
        // Do the layout
        try {
            final GraphModel layoutGraph = graph;
            final GraphController gc = gp.getGraphController();
            final GraphPane pane = gp;
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    // Layout is a bit stupid
                    LayoutTarget target = new BasicLayoutTarget(gc);
                    LevelLayout staticLayout = new LevelLayout(target);
                    staticLayout.setOrientation(LevelLayout.HORIZONTAL);
                    staticLayout.layout(layoutGraph.getRoot());
                    pane.repaint();
                }
            });
        } catch (Exception e) {
            System.out.println(e);
        }
View Full Code Here

Examples of diva.graph.GraphPane

         * This initialization cannot be done in the constructor because
         * the controller does not yet have a reference to its pane
         * at that time.
         */
        protected void initializeInteraction() {
            GraphPane pane = getGraphPane();

            // Create and set up the selection dragger
            _selectionDragger = new SelectionDragger(pane);
            _selectionDragger.addSelectionModel(getSelectionModel());
        }
View Full Code Here

Examples of diva.graph.GraphPane

        // ((TypedCompositeActor) (((PtolemyEffigy) (_tableau.getContainer()))
        //      .getModel()));
        BasicGraphFrame parent = (BasicGraphFrame) (_tableau.getFrame());
        JGraph jGraph = parent.getJGraph();
        GraphPane graphPane = jGraph.getGraphPane();
        _controller = graphPane.getGraphController();
        _selectionModel = _controller.getSelectionModel();

        Interactor interactor = _controller.getEdgeController(new Object())
                .getEdgeInteractor();
        _graphModel = (AbstractBasicGraphModel) _controller.getGraphModel();
View Full Code Here

Examples of diva.graph.GraphPane

     *  This initialization cannot be done in the constructor because
     *  the controller does not yet have a reference to its pane
     *  at that time.
     */
    protected void initializeInteraction() {
        GraphPane pane = getGraphPane();

        // Create and set up the selection dragger
        _selectionDragger = new SelectionDragger(pane);
        _selectionDragger.addSelectionModel(getSelectionModel());

View Full Code Here

Examples of diva.graph.GraphPane

    }

    /** Zoom to fit the current figures.
     */
    public void zoomFit() {
        GraphPane pane = getJGraph().getGraphPane();
        Rectangle2D bounds = pane.getForegroundLayer().getLayerBounds();

        if (bounds.isEmpty()) {
            // Empty diagram.
            return;
        }

        Rectangle2D viewSize = getVisibleRectangle();
        AffineTransform newTransform = CanvasUtilities.computeFitTransform(
                bounds, viewSize);
        JCanvas canvas = pane.getCanvas();
        canvas.getCanvasPane().setTransform(newTransform);

        if (_graphPanner != null) {
            _graphPanner.repaint();
        }
View Full Code Here

Examples of diva.graph.GraphPane

    /** Create the component that goes to the right of the library.
     *  @param entity The entity to display in the component.
     *  @return The component that goes to the right of the library.
     */
    protected JComponent _createRightComponent(NamedObj entity) {
        GraphPane pane = _createGraphPane(entity);
        pane.getForegroundLayer().setPickHalo(2);
        pane.getForegroundEventLayer().setConsuming(false);
        pane.getForegroundEventLayer().setEnabled(true);
        pane.getForegroundEventLayer().addLayerListener(new LayerAdapter() {
            /** Invoked when the mouse is pressed on a layer
             * or figure.
             */
            public void mousePressed(LayerEvent event) {
                Component component = event.getComponent();
View Full Code Here

Examples of diva.graph.GraphPane

    /** Return the graph controller associated with this frame.
     *  @return The graph controller associated with this frame.
     */
    protected GraphController _getGraphController() {
        GraphPane graphPane = getJGraph().getGraphPane();
        return graphPane.getGraphController();
    }
View Full Code Here

Examples of diva.graph.GraphPane

         @param point The point in the graph pane.
         *  @return The object under the specified point, or null if there
         *   is none or it is not a NamedObj.
         */
        private Figure _getFigureUnder(Point2D point) {
            GraphPane pane = ((JGraph) getComponent()).getGraphPane();

            // Account for the scaling in the pane.
            Point2D transformedPoint = new Point2D.Double();
            pane.getTransformContext().getInverseTransform().transform(point,
                    transformedPoint);

            FigureLayer layer = pane.getForegroundLayer();

            // Find the figure under the point.
            // NOTE: Unfortunately, FigureLayer.getCurrentFigure() doesn't
            // work with a drop target (I guess it hasn't seen the mouse events),
            // so we have to use a lower level mechanism.
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.