|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.canvas.interactor.AbstractInteractor
diva.canvas.interactor.DragInteractor
public class DragInteractor
An interactor that responds to mouse drag events. It adds the notion of constraints, so that dragging can be limited to certain coordinates or "snapped" to suitable locations, and a "target" array, which contain the figure or figures that are dragged.
Field Summary | |
---|---|
private java.util.ArrayList<PointConstraint> |
_constraints
The set of constraints |
private LayerListener |
_layerListener
Layer listeners |
private double |
_prevX
|
private double |
_prevY
|
private boolean |
_selectiveEnabled
|
private java.lang.Object[] |
_targetArray
The target array. |
Constructor Summary | |
---|---|
DragInteractor()
|
Method Summary | |
---|---|
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. |
Methods inherited from class diva.canvas.interactor.AbstractInteractor |
---|
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseEntered, mouseExited, mouseMoved, setConsuming, setEnabled, setMotionEnabled, setMouseFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.ArrayList<PointConstraint> _constraints
private transient java.lang.Object[] _targetArray
private transient LayerListener _layerListener
private double _prevX
private double _prevY
private boolean _selectiveEnabled
Constructor Detail |
---|
public DragInteractor()
Method Detail |
---|
public void addLayerListener(LayerListener l)
public void appendConstraint(PointConstraint constraint)
public void constrainPoint(java.awt.geom.Point2D p)
public void fireLayerEvent(LayerEvent event)
public boolean getSelectiveEnabled()
public java.lang.Object[] getTargetArray()
public double getX()
public double getY()
public void mouseDragged(LayerEvent e)
mouseDragged
in interface LayerListener
mouseDragged
in class AbstractInteractor
public void mousePressed(LayerEvent e)
mousePressed
in interface LayerListener
mousePressed
in class AbstractInteractor
public void mouseReleased(LayerEvent e)
mouseReleased
in interface LayerListener
mouseReleased
in class AbstractInteractor
public void prependConstraint(PointConstraint constraint)
public void removeLayerListener(LayerListener l)
public boolean setSelectiveEnabled(boolean s)
public void setTargetArray(java.lang.Object[] arr)
public void setup(LayerEvent e)
public java.util.Iterator targets()
public void translate(LayerEvent e, double x, double y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |