Package diva.canvas

Examples of diva.canvas.CanvasComponent


     */
    public void clearEdge(Object edge) {
        Figure f = _controller.getFigure(edge);

        if (f != null) {
            CanvasComponent container = f.getParent();
            f.setUserObject(null);
            _controller.setFigure(edge, null);

            if (container instanceof FigureLayer) {
                ((FigureLayer) container).remove(f);
View Full Code Here


        }

        Figure f = _controller.getFigure(node);

        if (f != null) {
            CanvasComponent container = f.getParent();
            f.setUserObject(null);
            _controller.setFigure(node, null);

            // If the figure is decorated, then we have to undecorate
            // it before proceeding, or the figure remains as a ghost!
            while (container instanceof FigureDecorator) {
                FigureDecorator decorator = (FigureDecorator) container;
                container = container.getParent();
                ((FigureContainer) container).undecorate(decorator);
            }

            if (container instanceof FigureLayer) {
                ((FigureLayer) container).remove(f);
View Full Code Here

            // so we have to use a lower level mechanism.
            double halo = layer.getPickHalo();
            double width = halo * 2;
            Rectangle2D region = new Rectangle2D.Double(transformedPoint.getX()
                    - halo, transformedPoint.getY() - halo, width, width);
            CanvasComponent figureUnderMouse = layer.pick(region);

            // Find a user object belonging to the figure under the mouse
            // or to any figure containing it (it may be a composite figure).
            Object objectUnderMouse = null;

            while (figureUnderMouse instanceof UserObjectContainer
                    && (objectUnderMouse == null)) {
                objectUnderMouse = ((UserObjectContainer) figureUnderMouse)
                        .getUserObject();

                if (objectUnderMouse instanceof NamedObj) {
                    if (figureUnderMouse instanceof Figure) {
                        return (Figure) figureUnderMouse;
                    }
                }

                figureUnderMouse = figureUnderMouse.getParent();
            }

            return null;
        }
View Full Code Here

            // 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;

                while ((_target == null) && (currentFigure != null)) {
                    Object object = currentFigure;

                    if (object instanceof Figure) {
                        object = ((Figure) currentFigure).getUserObject();
                    }

                    _target = (NamedObj) model.getSemanticObject(object);
                    currentFigure = currentFigure.getParent();
                }

                // NOTE: _target may end up null here!
                if (_target == null) {
                    throw new InternalErrorException(
View Full Code Here

TOP

Related Classes of diva.canvas.CanvasComponent

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.