Package diva.canvas.interactor

Examples of diva.canvas.interactor.SelectionInteractor


    // For the MouseInputListener interface

    public void mouseClicked(MouseEvent e) {
        int count = e.getClickCount();
//        SelectionInteractor si = graphics.getSelectionInteractor();
        SelectionInteractor si = graphics.getRoiSelectionInteractor();

        if (mouseClicked) {  // clicked previously?
            if (drawingMode == POLYLINE) {
                if (count == 1) {
                    if (figure.getShape() instanceof Polyline2D.Double) {
View Full Code Here


        }

        startX = e.getX();
        startY = e.getY();
//        SelectionInteractor interactor = graphics.getSelectionInteractor();
        SelectionInteractor interactor = graphics.getRoiSelectionInteractor();

        Shape shape = null;
        figure = null;
        switch (drawingMode) {
            case LINE:
View Full Code Here

            while (i.hasNext()) {
                Figure f = (Figure) i.next();
                Interactor r = f.getInteractor();

                if ((r != null) && r instanceof SelectionInteractor) {
                    SelectionInteractor interactor = (SelectionInteractor) r;

                    if (_selectionModels.contains(interactor
                            .getSelectionModel())) {
                        expandSelection((SelectionInteractor) r, f);
                    }
                }
            }

            // Remove figures from the selection
            i = staleFigures.iterator();

            while (i.hasNext()) {
                Figure f = (Figure) i.next();
                Interactor r = f.getInteractor();

                if ((r != null) && r instanceof SelectionInteractor) {
                    SelectionInteractor interactor = (SelectionInteractor) r;

                    if (_selectionModels.contains(interactor
                            .getSelectionModel())) {
                        contractSelection((SelectionInteractor) r, f);
                    }
                }
            }
        } else {
            // Toggle figures into and out of the selection
            Iterator i = new CompoundIterator(freshFigures.iterator(),
                    staleFigures.iterator());

            while (i.hasNext()) {
                Figure f = (Figure) i.next();
                Interactor r = f.getInteractor();

                if ((r != null) && r instanceof SelectionInteractor) {
                    SelectionInteractor interactor = (SelectionInteractor) r;

                    if (_selectionModels.contains(interactor
                            .getSelectionModel())) {
                        if (interactor.getSelectionModel().containsSelection(f)) {
                            contractSelection(interactor, f);
                        } else {
                            expandSelection(interactor, f);
                        }
                    }
View Full Code Here

                }
            }
        });

        // Create a movable, resizable selection interactor
        _selectionInteractor = new SelectionInteractor();
        _selectionInteractor.setPrototypeDecorator(boundsManipulator);
        _selectionInteractor.getSelectionModel().addSelectionListener(_selectionListener);
        _selectionInteractor.addInteractor(_dragInteractor);
    }
View Full Code Here

                }
            }
        });

        // Create a movable, resizable selection interactor
        _roiSelectionInteractor = new SelectionInteractor();
        _roiSelectionInteractor.setPrototypeDecorator(rectangleManipulator);
        // connect the different selection models
        _roiSelectionInteractor.setSelectionModel(_selectionInteractor.getSelectionModel());
        _roiSelectionInteractor.addInteractor(_dragInteractor);
    }
View Full Code Here

                }
            }
        });

        // Create a movable, resizable selection interactor
        _lineInteractor = new SelectionInteractor(_selectionInteractor.getSelectionModel());
        _lineInteractor.setPrototypeDecorator(pathManipulator);
        _lineInteractor.getSelectionModel().addSelectionListener(_selectionListener);
        _lineInteractor.addInteractor(_dragInteractor);
    }
View Full Code Here

     * Make the drag interactor, for figures that may be dragged.
     */
    private void _makeFixedSelectionInteractor() {
        // create an fixed position, unresizable interactor
        SelectionModel model = _selectionInteractor.getSelectionModel();
        _fixedSelectionInteractor = new SelectionInteractor(model);
        // highlighting will draw a partially see-through rectangle over the figure
        Composite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.75F);
        BasicHighlighter h = new BasicHighlighter(new Color(204, 204, 255), 1.0F, composite);
        _fixedSelectionInteractor.setPrototypeDecorator(h);
    }
View Full Code Here

                // Create some interactors, which determine how you can interact with the figure
                // by selecting, dragging, resizing or rotating

                // plain selection: displays 4 blue grab handles on the figure when selected
                SelectionInteractor si = g.getSelectionInteractor();

                // selection for rotatable figures: adds a green rotate handle
                SelectionInteractor rsi = g.getRoiSelectionInteractor();

                // 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);
View Full Code Here

TOP

Related Classes of diva.canvas.interactor.SelectionInteractor

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.