Package diva.canvas.interactor

Examples of diva.canvas.interactor.DragInteractor


    public void createInteraction() {
        // Create a selection drag-selector on the pane
        SelectionDragger selectionDragger = new SelectionDragger(graphicsPane);
        SelectionModel model = new BasicSelectionModel();
        SelectionInteractor s;
        DragInteractor d;

        // For each figure, create a selection interactor with
        // a drag interactor attached to it. Set a different
        // manipulator for each.
        s = new SelectionInteractor(model);
        s.setPrototypeDecorator(new BoundsManipulator());
        d = new DragInteractor();
        s.addInteractor(d);
        d.setSelectiveEnabled(true);
        d.setMouseFilter(new MouseFilter(1, 0, 0));
        selectionDragger.addSelectionInteractor(s);
        _rectangle.setInteractor(s);

        s = new SelectionInteractor(model);
        s.setPrototypeDecorator(new CircleManipulator());
        d = new DragInteractor();
        s.addInteractor(d);
        d.setSelectiveEnabled(true);
        d.setMouseFilter(new MouseFilter(1, 0, 0));
        selectionDragger.addSelectionInteractor(s);
        _circle.setInteractor(s);

        s = new SelectionInteractor(model);
        s.setPrototypeDecorator(new PathManipulator());
        d = new DragInteractor();
        s.addInteractor(d);
        d.setSelectiveEnabled(true);
        d.setMouseFilter(new MouseFilter(1, 0, 0));
        selectionDragger.addSelectionInteractor(s);
        _line.setInteractor(s);

        s = new SelectionInteractor(model);
        s.setPrototypeDecorator(new PathManipulator());
        d = new DragInteractor();
        s.addInteractor(d);
        d.setSelectiveEnabled(true);
        d.setMouseFilter(new MouseFilter(1, 0, 0));
        selectionDragger.addSelectionInteractor(s);
        _shape.setInteractor(s);
    }
View Full Code Here


        figureA.setInteractor(si);
        figureB.setInteractor(si);

        // Add a layer listener to the drag interactor.
        // The listener just tells both connectors to reroute themselves.
        DragInteractor i = controller.getDragInteractor();
        i.addLayerListener(new LayerAdapter() {
            public void mouseDragged(LayerEvent e) {
                connectorA.reroute();
                connectorB.reroute();
            }
        });
View Full Code Here

     */
    public void createDraggableFigures() {
        FigureLayer layer = graphicsPane.getForegroundLayer();

        // Create the interactor to do the work.
        Interactor dragger = new DragInteractor();
        dragger.setMouseFilter(MouseFilter.defaultFilter);

        // Create a rectangle and make it draggable
        BasicFigure blue = new BasicRectangle(10.0, 10.0, 50.0, 50.0,
                Color.blue);
        layer.add(blue);
View Full Code Here

        _selectionDragger.addSelectionModel(_selectionInteractor
                .getSelectionModel());

        // Add the drag interactor to the selection interactor so
        // selected items are dragged
        _dragInteractor = new DragInteractor();
        _dragInteractor.setSelectiveEnabled(true);
        _dragInteractor.setMouseFilter(new MouseFilter(1, 0, 0));
        _selectionInteractor.addInteractor(_dragInteractor);
    }
View Full Code Here

     */
    public void createFigures() {
        FigureLayer layer = graphicsPane.getForegroundLayer();

        // Create an interactor to do the work.
        Interactor dragger = new DragInteractor();

        // Create the figure
        Figure one = new CloudFigure(10.0, 10.0, 80.0, 80.0);
        layer.add(one);
        one.setInteractor(dragger);
View Full Code Here

        figureB.setInteractor(si);
        figureC.setInteractor(si);

        // Add a layer listener to the drag interactor.
        // The listener just tells both connectors to reroute themselves.
        DragInteractor i = controller.getDragInteractor();
        i.addLayerListener(new LayerAdapter() {
            public void mouseDragged(LayerEvent e) {
                connectorA.reroute();
                connectorB.reroute();
                connectorC.reroute();
                connectorD.reroute();
            }
        });

        // The connector selection interactor uses the same selection model
        SelectionInteractor ci = new SelectionInteractor(si.getSelectionModel());
        connectorA.setInteractor(ci);
        connectorB.setInteractor(ci);
        connectorC.setInteractor(ci);
        connectorD.setInteractor(ci);

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

        // Create a manipulator to give resize handles on figures
        BoundsManipulator figureManipulator = new BoundsManipulator();
        controller.setSelectionManipulator(figureManipulator);

        // Make resizing reroute the connectors too
        DragInteractor j = figureManipulator.getHandleInteractor();
        j.addLayerListener(new LayerAdapter() {
            public void mouseDragged(LayerEvent e) {
                connectorA.reroute();
                connectorB.reroute();
                connectorC.reroute();
                connectorD.reroute();
View Full Code Here

     */
    public void testProperties() {
        runTestCase(new TestCase("Figure properties") {
            Figure figure;

            Interactor r = new DragInteractor();

            public void init() throws Exception {
                figure = factory.createFigure();
            }

View Full Code Here

    /**
     * Make the drag interactor, for figures that may be dragged.
     */
    private void _makeDragInteractor() {
        _dragInteractor = new DragInteractor();
        _dragInteractor.addLayerListener(new LayerAdapter() {

            public void mouseReleased(LayerEvent e) {
                Figure fig = e.getFigureSource();
                if (fig instanceof CanvasFigure) {
View Full Code Here

                // add an interactor that allows selecting figures, but not dragging or resizing
                SelectionInteractor fsi = g.getFixedSelectionInteractor();

                // only allows dragging
                DragInteractor di = g.getDragInteractor();

                Font font = new Font("Dialog", Font.PLAIN, 12);

                // create a rectangle with lable and rotate it
                Rectangle2D.Double r1 = new Rectangle2D.Double(30., 30., 30., 40.);
View Full Code Here

TOP

Related Classes of diva.canvas.interactor.DragInteractor

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.