Class Manipulator

    • Constructor Detail

      • Manipulator

        public Manipulator()
    • Method Detail

      • addGrabHandle

        public void addGrabHandle​(GrabHandle gh)
        Add a grab-handle to this manipulator's collection of grab-handles.
      • clearGrabHandles

        public void clearGrabHandles()
        Clear all grab-handles.
      • getBounds

        public java.awt.geom.Rectangle2D getBounds()
        Get the bounds. This is the union of the child's bounding box and the bounding boxes of all the grab-handles
        Specified by:
        getBounds in interface Figure
        Overrides:
        getBounds in class FigureDecorator
        Returns:
        the bounding box of this figure.
      • getGrabHandleFactory

        public GrabHandleFactory getGrabHandleFactory()
        Get the grab handle factory.
      • getHandleInteractor

        public DragInteractor getHandleInteractor()
        Get the grab handle interactor.
      • isRepainting

        public boolean isRepainting()
        Test if this manipulator is in the process of repainting itself and its child.
      • paint

        public void paint​(java.awt.Graphics2D g)
        Paint the manipulator. This default implementation first paints the child figure, and then paints each of the grab-handles.
        Specified by:
        paint in interface VisibleComponent
        Overrides:
        paint in class FigureDecorator
        Parameters:
        g - The Graphics context
      • pick

        public Figure pick​(java.awt.geom.Rectangle2D r)
        Given a rectangle, return the top-most thing that hits it. This could be one of the grab-handles, or the child. If nothing hits, return null.
        Specified by:
        pick in interface FigureContainer
        Overrides:
        pick in class AbstractFigureContainer
        Parameters:
        r - The rectangle
        Returns:
        The figure
      • removeGrabHandle

        public void removeGrabHandle​(GrabHandle gh)
        Remove a grab-handle from this manipulator's collection of grab-handles.
      • repaint

        public void repaint​(DamageRegion d)
        Receive repaint notification. If the manipulator is already in the middle of repainting, ignore this request. Otherwise, generate another repaint call with the total region covered by the child and its grab-handles both before and after the grab-handles are moved to their new locations. Oh, and move the grab-handles to their new locations.
        Specified by:
        repaint in interface CanvasComponent
        Overrides:
        repaint in class AbstractFigureContainer
        Parameters:
        d - The region where a repaint has occurred.
      • refresh

        public abstract void refresh()
        Refresh the geometry. This means that the location of geometry must be adjusted to match the current position of the child figure.
      • relocateGrabHandles

        public void relocateGrabHandles()
        Relocate grab-handles to their correct positions. This is a utility method to simplify notification callbacks.
      • repaint

        public void repaint()
        Request a repaint of the manipulator and child. This method generates another repaint call with the total region covered by the child and its grab-handles both before and after the grab-handles are moved to their new locations. It also adjusts the geometry to the current location of the child moves the grab-handles to their new locations.
        Specified by:
        repaint in interface CanvasComponent
        Overrides:
        repaint in class AbstractFigure
      • repaintAlready

        public void repaintAlready()
        Request a repaint of the manipulator and child. This method generates another repaint call with the total region covered by the child and its grab-handles both before and after the grab-handles are moved to their new locations. It moves moves the grab-handles to their new locations, but does not adjust the geometry to the location of the child. This method should therefore be used for repaints that are generated by modifications to the geometry.
      • setGrabHandleFactory

        public void setGrabHandleFactory​(GrabHandleFactory factory)
        Set the grab handle factory. This is set by default to an instance of BasicGrabHandleFactory.
      • setHandleFilter

        public void setHandleFilter​(MouseFilter filter)
        Set the mouse filter that is set in the grab handle interactor.
      • setHandleInteractor

        public void setHandleInteractor​(DragInteractor interactor)
        Set the grab handle interactor. The interactor is set by default to an instance of DragInteractor. Note that any previously-set mouse filter will be lost.
      • setRepainting

        public void setRepainting​(boolean repainting)
        Set the repainting flag. This says that the manipulator is in the process of repainting itself and its child, and that it can therefore ignore repaint requests for the children.