public class DragInteractor extends AbstractInteractor
Constructor and Description |
---|
DragInteractor() |
Modifier and Type | Method and Description |
---|---|
void |
addLayerListener(LayerListener l)
Add the given layer listener to this interactor.
|
void |
appendConstraint(PointConstraint constraint)
Append a constraint to the list of constraints on
this interactor.
|
void |
constrainPoint(java.awt.geom.Point2D p)
Constrain a point using the current constraints.
|
void |
fireLayerEvent(LayerEvent event)
Fire a layer event.
|
boolean |
getSelectiveEnabled()
Get the flag that says that the interactor responds only
if the figure being moused on is selected.
|
java.lang.Object[] |
getTargetArray()
Get the target array.
|
double |
getX()
Get the current value of the X coordinate.
|
double |
getY()
Get the current value of the Y coordinate.
|
void |
mouseDragged(LayerEvent e)
Constrain the point and move the target if the mouse
move.
|
void |
mousePressed(LayerEvent e)
Handle a mouse press on a figure or layer.
|
void |
mouseReleased(LayerEvent e)
Handle a mouse released event.
|
void |
prependConstraint(PointConstraint constraint)
Prepend a constraint to the list of constraints on
this interactor.
|
void |
removeLayerListener(LayerListener l)
Remove the given layer listener from this interactor.
|
boolean |
setSelectiveEnabled(boolean s)
Set the flag that says that the interactor responds only
if the figure being moused on is selected.
|
void |
setTargetArray(java.lang.Object[] arr)
Set the target that the interactor operates on.
|
void |
setup(LayerEvent e)
Initialize the interactor before a mouse-pressed event is
processed.
|
java.util.Iterator |
targets()
Get an iterator over the target figures.
|
void |
translate(LayerEvent e,
double x,
double y)
Translate the target by the given distance.
|
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseEntered, mouseExited, mouseMoved, setConsuming, setEnabled, setMotionEnabled, setMouseFilter
public void addLayerListener(LayerListener l)
l
- The listenerpublic void appendConstraint(PointConstraint constraint)
constraint
- The constraint.public void constrainPoint(java.awt.geom.Point2D p)
p
- The pointpublic void fireLayerEvent(LayerEvent event)
event
- The eventpublic boolean getSelectiveEnabled()
setSelectiveEnabled(boolean)
public java.lang.Object[] getTargetArray()
setTargetArray(Object[])
public double getX()
public double getY()
public void mouseDragged(LayerEvent e)
mouseDragged
in interface LayerListener
mouseDragged
in class AbstractInteractor
e
- the eventpublic void mousePressed(LayerEvent e)
mousePressed
in interface LayerListener
mousePressed
in class AbstractInteractor
e
- the eventpublic void mouseReleased(LayerEvent e)
mouseReleased
in interface LayerListener
mouseReleased
in class AbstractInteractor
e
- The eventpublic void prependConstraint(PointConstraint constraint)
constraint
- The constraintpublic void removeLayerListener(LayerListener l)
l
- the listenerpublic boolean setSelectiveEnabled(boolean s)
s
- The value of selective enablegetSelectiveEnabled()
public void setTargetArray(java.lang.Object[] arr)
arr
- The arraygetTargetArray()
public void setup(LayerEvent e)
e
- The eventpublic java.util.Iterator targets()
public void translate(LayerEvent e, double x, double y)
e
- The eventx
- the x distancey
- the y distance