Package diva.canvas.connector

Examples of diva.canvas.connector.ConnectorManipulator


        // Tell the selection dragger to select connectors too
        controller.getSelectionDragger().addSelectionInteractor(ci);

        // Create and set up the manipulator for connectors
        ConnectorManipulator manipulator = new ConnectorManipulator();
        manipulator.setSnapHalo(4.0);
        manipulator.setConnectorTarget(new SRTarget());
        ci.setPrototypeDecorator(manipulator);

        // To illustrate the notification call-backs from the
        // manipulator, here is an simple example of a connector
        // listener
        ConnectorListener cl = new ConnectorListener() {
            public void connectorDragged(ConnectorEvent e) {
                //// System.out.println("Dragged");
            }

            public void connectorDropped(ConnectorEvent e) {
                System.out.println("Dropped");
            }

            public void connectorSnapped(ConnectorEvent e) {
                System.out.println("Snapped");
            }

            public void connectorUnsnapped(ConnectorEvent e) {
                System.out.println("Unsnapped");
            }
        };

        manipulator.addConnectorListener(cl);
    }
View Full Code Here


        // Create and set up the manipulators for connectors. Straight
        // connectors will have an instance of ConnectorManipulator
        // attached to them, while arc connectors will have an instance
        // of ArcManipulator attached to them.
        ConnectorManipulator cManipulator = new ConnectorManipulator();
        cManipulator.setSnapHalo(4.0);
        cManipulator.setConnectorTarget(target);

        ArcManipulator aManipulator = new ArcManipulator();
        aManipulator.setSnapHalo(4.0);
        aManipulator.setConnectorTarget(target);
View Full Code Here

        SelectionModel sm = controller.getSelectionModel();
        _interactor = new EdgeInteractor(sm);

        // Create and set up the manipulator for connectors
        ConnectorManipulator manipulator = new ConnectorManipulator();
        manipulator.setSnapHalo(4.0);
        manipulator.addConnectorListener(new EdgeDropper());
        ((EdgeInteractor) _interactor).setPrototypeDecorator(manipulator);

        // The mouse filter needs to accept regular click or control click
        MouseFilter handleFilter = new MouseFilter(1, 0, 0);
        manipulator.setHandleFilter(handleFilter);

        // Create and set up the target for connectors
        PerimeterTarget ct = new PerimeterTarget() {
            // Accept the head if the model graph model allows it.
            public boolean acceptHead(Connector c, Figure f) {
View Full Code Here

        // FIXME: This is rather dangerous because it assumes a
        // basic selection renderer.
        BasicSelectionRenderer selectionRenderer = (BasicSelectionRenderer) ((EdgeInteractor) _interactor)
                .getSelectionRenderer();
        ConnectorManipulator manipulator = (ConnectorManipulator) selectionRenderer
                .getDecorator();
        manipulator.setConnectorTarget(t);
    }
View Full Code Here

        // Add it to the selection so it gets a manipulator, and
        // make events go to the grab-handle under the mouse
        Figure ef = _controller.getFigure(edge);
        _controller.getSelectionModel().addSelection(ef);

        ConnectorManipulator cm = (ConnectorManipulator) ef.getParent();
        GrabHandle gh = cm.getHeadHandle();
        layer.grabPointer(e, gh);
    }
View Full Code Here

                // Add it to the selection so it gets a manipulator, and
                // make events go to the grab-handle under the mouse
                getSelectionModel().addSelection(c);

                ConnectorManipulator cm = (ConnectorManipulator) c.getParent();
                GrabHandle gh = cm.getHeadHandle();
                layer.grabPointer(event, gh);
            } catch (Exception ex) {
                MessageHandler.error("Drag connection failed:", ex);
            }
        }
View Full Code Here

        SelectionModel sm = controller.getSelectionModel();
        SelectionInteractor interactor = (SelectionInteractor) getEdgeInteractor();
        interactor.setSelectionModel(sm);

        // Create and set up the manipulator for connectors
        ConnectorManipulator manipulator = new ConnectorManipulator();
        manipulator.setSnapHalo(4.0);
        manipulator.addConnectorListener(new LinkDropper());
        interactor.setPrototypeDecorator(manipulator);

        // The mouse filter needs to accept regular click or control click
        MouseFilter handleFilter = new MouseFilter(1, 0, 0);
        manipulator.setHandleFilter(handleFilter);

        ConnectorTarget ct = new LinkTarget();
        setConnectorTarget(ct);
        setEdgeRenderer(new LinkRenderer());
View Full Code Here

                // Add it to the selection so it gets a manipulator, and
                // make events go to the grab-handle under the mouse
                Figure ef = getFigure(link);
                getSelectionModel().addSelection(ef);

                ConnectorManipulator cm = (ConnectorManipulator) ef.getParent();
                GrabHandle gh = cm.getHeadHandle();
                layer.grabPointer(event, gh);
            } catch (Exception ex) {
                MessageHandler.error("Drag connection failed:", ex);
            }
        }
View Full Code Here

        SelectionInteractor interactor = (SelectionInteractor) getEdgeInteractor();
        interactor.setSelectionModel(sm);

        // Create and set up the manipulator for connectors.
        // This overrides the manipulator created by the base class.
        ConnectorManipulator manipulator = new ArcManipulator();
        manipulator.setSnapHalo(4.0);
        manipulator.addConnectorListener(new LinkDropper());
        interactor.setPrototypeDecorator(manipulator);

        // The mouse filter needs to accept regular click or control click
        MouseFilter handleFilter = new MouseFilter(1, 0, 0);
        manipulator.setHandleFilter(handleFilter);

        ConnectorTarget ct = new LinkTarget();
        setConnectorTarget(ct);
        setEdgeRenderer(new LinkRenderer());
View Full Code Here

TOP

Related Classes of diva.canvas.connector.ConnectorManipulator

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.