Package diva.canvas

Examples of diva.canvas.CompositeFigure


    }

    /** Create a composite figure that does not have a background
     */
    public void createCompositeFigure() {
        CompositeFigure tc = new CompositeFigure();
        Figure bg = new BasicRectangle(100.0, 100.0, 100.0, 100.0, Color.green);
        tc.add(bg);
        layer.add(tc);
        tc.setInteractor(defaultInteractor);
        addPorts(tc);
    }
View Full Code Here


    /** Create a composite figure that uses the background facility.
     * Generally, for figures of this nature, this is a better thing to do.
     */
    public void createBackgroundedCompositeFigure() {
        CompositeFigure tc = new CompositeFigure();
        Figure bg = new BasicRectangle(100.0, 100.0, 100.0, 100.0, Color.blue);
        tc.setBackgroundFigure(bg);
        layer.add(tc);
        tc.setInteractor(defaultInteractor);
        addPorts(tc);
        tc.translate(200.0, 0);
    }
View Full Code Here

            FigureTest.FigureFactory {
        // FindBugs suggests making this class static so as to decrease
        // the size of instances and avoid dangling references.
        public Figure createFigure() {
            Figure bg = new BasicRectangle(10, 10, 20, 20, Color.blue);
            Figure cf = new CompositeFigure(bg);
            return cf;
        }
View Full Code Here

            double y = borderPercentage * p.getY();
            double w = getLayoutPercentage() * p.getX();
            double h = getLayoutPercentage() * p.getY();
            return new Rectangle2D.Double(x, y, w, h);
        } else if (model.isComposite(composite)) {
            CompositeFigure cf = (CompositeFigure) _controller
                    .getFigure(composite);

            if (cf != null) {
                return cf.getShape().getBounds2D();
            }
        }

        String err = "Unknown graph.  Cannot determine viewport.";
        throw new IllegalArgumentException(err);
View Full Code Here

     * in the controller's graph pane.
     */
    public Figure drawNode(Object node, Object parent) {
        // FIXME what if node was previously rendered?
        Figure newFigure = _renderNode(node);
        CompositeFigure cf = (CompositeFigure) _controller.getFigure(parent);
        cf.add(newFigure);

        // Now draw the contained nodes, letting them go where they want to.
        _drawChildren(node);

        _controller.dispatch(new GraphViewEvent(this,
View Full Code Here

        BasicFigure bf = new BasicFigure(shape);
        bf.setFillPaint(fill);

        if (model.isComposite(node)) {
            CompositeFigure rep = new CompositeFigure(bf);
            double scale = getCompositeScale();
            rep.getTransformContext().getTransform().scale(scale, scale);
            return rep;
        }

        bf.setToolTipText(bf.toString());
        return bf;
View Full Code Here

    /** Setup the transform object.
     */
    public void initialize() throws IllegalActionException {
        super.initialize();

        CompositeFigure compositeFigure = new CompositeFigure();
        _figure = compositeFigure;
        _applyInitialTransform(_figure);
    }
View Full Code Here

                double normal = CanvasUtilities.getNormal(direction);

                String name = port.getName();
                Rectangle2D backBounds = figure.getBounds();
                figure = new CompositeFigure(figure) {
                    // Override this because we want to show the type.
                    // It doesn't work to set it once because the type
                    // has not been resolved, and anyway, it may
                    // change. NOTE: This is copied from above.
                    public String getToolTipText() {
View Full Code Here

        protected void _highlightNode(Object node, Figure figure) {
            if ((node != null) && !_hide(node)) {
                GraphModel model = getController().getGraphModel();
                Object object = model.getSemanticObject(node);
                CompositeFigure cf = _getCompositeFigure(figure);

                if (object instanceof NamedObj && cf != null && !_transformed
                        && _results != null
                        && _results.get(_currentPosition).containsValue(object)) {
                    Rectangle2D bounds = cf.getBackgroundFigure().getBounds();
                    float padding = _HIGHLIGHT_PADDING;
                    RoundedRectangle rf = new RoundedRectangle(
                            bounds.getX() - padding, bounds.getY() - padding,
                            bounds.getWidth() + padding * 2.0,
                            bounds.getHeight() + padding * 2.0,
                            null, _HIGHLIGHT_THICKNESS, 32.0, 32.0);
                    rf.setStrokePaint(_HIGHLIGHT_COLOR);

                    int index = cf.getFigureCount();
                    if (index < 0) {
                        index = 0;
                    }
                    cf.add(index, rf);
                }
            }
        }
View Full Code Here

        // Wrap in a CompositeFigure with echos of the bounding box.
        // Note that the bounds here are actually bigger than the
        // bounding box, which may be OK in this case.
        Rectangle2D bounds = result.getBounds();
        CompositeFigure composite = new CompositeFigure();
        BasicRectangle rectangle = new BasicRectangle(bounds.getX() + 10.0,
                bounds.getY() + 10.0, bounds.getWidth(), bounds.getHeight(),
                Color.white);
        composite.add(rectangle);

        BasicRectangle rectangle2 = new BasicRectangle(bounds.getX() + 5.0,
                bounds.getY() + 5.0, bounds.getWidth(), bounds.getHeight(),
                Color.white);
        composite.add(rectangle2);

        BasicRectangle rectangle3 = new BasicRectangle(bounds.getX(), bounds
                .getY(), bounds.getWidth(), bounds.getHeight(), Color.white);
        composite.add(rectangle3);
        composite.add(result);
        return composite;
    }
View Full Code Here

TOP

Related Classes of diva.canvas.CompositeFigure

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.