Package diva.canvas.interactor
Class BoundsManipulator
- java.lang.Object
-
- diva.canvas.AbstractFigure
-
- diva.canvas.AbstractFigureContainer
-
- diva.canvas.FigureDecorator
-
- diva.canvas.interactor.Manipulator
-
- diva.canvas.interactor.BoundsManipulator
-
- All Implemented Interfaces:
CanvasComponent
,Figure
,FigureContainer
,FigureSet
,VisibleComponent
,UserObjectContainer
- Direct Known Subclasses:
AttributeBoundsManipulator
public class BoundsManipulator extends Manipulator
A manipulator which attaches grab handles to the bounds of the child figure. It renders the grab handles and gives them a chance to intercept picks.- Version:
- $Id$
- Author:
- John Reekie, Michael Shilman
-
-
Constructor Summary
Constructors Constructor Description BoundsManipulator()
Construct a new manipulator that uses rectangular grab-handles.BoundsManipulator(GrabHandleFactory f)
Construct a new manipulator using the given grab-handle factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Interactor
getDragInteractor()
Return the interactor that is attached to a move handle.BoundsGeometry
getGeometry()
Return the geometry of this manipulatorvoid
mousePressed(LayerEvent e)
Do nothing.void
mouseReleased(LayerEvent e)
Do nothing.FigureDecorator
newInstance(Figure f)
Create a new instance of this manipulator.void
refresh()
Refresh the geometry.void
setChild(Figure child)
Set the child figure.void
setDragInteractor(Interactor dragger)
Set the drag interactor for figures wrapped by this manipulator.-
Methods inherited from class diva.canvas.interactor.Manipulator
addGrabHandle, clearGrabHandles, getBounds, getGrabHandleFactory, getHandleInteractor, isRepainting, paint, pick, relocateGrabHandles, removeGrabHandle, repaint, repaint, repaintAlready, setGrabHandleFactory, setHandleFilter, setHandleInteractor, setRepainting
-
Methods inherited from class diva.canvas.FigureDecorator
add, contains, figures, figuresFromBack, figuresFromFront, getChild, getContainer, getDecoratedFigure, getFigureCount, getShape, hit, remove, replaceChild, transform, translate
-
Methods inherited from class diva.canvas.AbstractFigureContainer
decorate, pick, undecorate
-
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext
-
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, setVisible
-
-
-
-
Constructor Detail
-
BoundsManipulator
public BoundsManipulator()
Construct a new manipulator that uses rectangular grab-handles.
-
BoundsManipulator
public BoundsManipulator(GrabHandleFactory f)
Construct a new manipulator using the given grab-handle factory.
-
-
Method Detail
-
getDragInteractor
public Interactor getDragInteractor()
Return the interactor that is attached to a move handle.
-
getGeometry
public BoundsGeometry getGeometry()
Return the geometry of this manipulator
-
mouseReleased
public void mouseReleased(LayerEvent e)
Do nothing. This method is called when the resizer gets a mouse released event, indicating that resizing is complete. Subclasses may wish to override this to, for example, make a persistent record of the new size (which can be obtained by calling getChild().getBounds()).- Parameters:
e
- The mouse event.
-
mousePressed
public void mousePressed(LayerEvent e)
Do nothing. This method is called when the resizer gets a mouse pressed event, indicating that resizing may be starting. Subclasses may wish to override this to, for example, make a record of the size before resizing (which can be obtained by calling getChild().getBounds()).- Parameters:
e
- The mouse event.
-
newInstance
public FigureDecorator newInstance(Figure f)
Create a new instance of this manipulator. The new instance will have the same grab handle, and interactor for grab-handles.- Specified by:
newInstance
in classFigureDecorator
- Parameters:
f
- The figure- Returns:
- The new instance of the figure decorator.
-
refresh
public void refresh()
Refresh the geometry. This adjusts the bounds of the geometry to match the bounds of the child figure.- Specified by:
refresh
in classManipulator
-
setChild
public void setChild(Figure child)
Set the child figure. If we have any grab-handles, lose them. Then get a rectangle geometry object and create grab-handles on its sites.- Overrides:
setChild
in classFigureDecorator
- Parameters:
child
- The child figure.
-
setDragInteractor
public void setDragInteractor(Interactor dragger)
Set the drag interactor for figures wrapped by this manipulator. If set, the manipulator displays an additional handle that can be used to drag the figure. This is useful for certain types of figure that are outlines only.
-
-