public class ConnectorInteractor extends DragInteractor
Constructor and Description |
---|
ConnectorInteractor(ConnectorManipulator m)
Create a new interactor to be used with the given
manipulator
|
Modifier and Type | Method and Description |
---|---|
protected void |
_notifyConnectorListeners(ConnectorEvent event,
int id)
Notify registered connector listeners of the specified event.
|
void |
addConnectorListener(ConnectorListener l)
Add a connector listener.
|
protected void |
fireConnectorEvent(int id)
Fire a connector event to all connector listeners.
|
Connector |
getConnector()
Get the current connector.
|
GrabHandle |
getHandle()
Get the current grab handle.
|
Figure |
getTarget()
Get the current target figure.
|
void |
mouseReleased(LayerEvent event)
Handle a mouse-released event.
|
void |
removeConnectorListener(ConnectorListener l)
Remove a connector listener.
|
void |
setup(LayerEvent e)
Initialize the interactor when a grab-handle
is grabbed.
|
void |
snapToSite(FigureContainer container,
java.awt.geom.Rectangle2D hitRect)
Pick a site using the connector target and
then snap to it.
|
void |
translate(LayerEvent e,
double dx,
double dy)
Respond to translation of the grab-handle.
|
addLayerListener, appendConstraint, constrainPoint, fireLayerEvent, getSelectiveEnabled, getTargetArray, getX, getY, mouseDragged, mousePressed, prependConstraint, removeLayerListener, setSelectiveEnabled, setTargetArray, targets
accept, getMouseFilter, isConsuming, isEnabled, isMotionEnabled, mouseClicked, mouseEntered, mouseExited, mouseMoved, setConsuming, setEnabled, setMotionEnabled, setMouseFilter
public ConnectorInteractor(ConnectorManipulator m)
public void addConnectorListener(ConnectorListener l)
l
- The connector listenerprotected void fireConnectorEvent(int id)
id
- The idpublic Connector getConnector()
public GrabHandle getHandle()
public Figure getTarget()
public void mouseReleased(LayerEvent event)
mouseReleased
in interface LayerListener
mouseReleased
in class DragInteractor
event
- The eventpublic void removeConnectorListener(ConnectorListener l)
l
- The listener to be removedpublic void setup(LayerEvent e)
setup
in class DragInteractor
e
- The eventpublic void snapToSite(FigureContainer container, java.awt.geom.Rectangle2D hitRect)
container
- The container to pick in.hitRect
- the coordinates of the drag
point in the transform context of that container.public void translate(LayerEvent e, double dx, double dy)
translate
in class DragInteractor
e
- The eventdx
- The change in xdy
- The change in yprotected void _notifyConnectorListeners(ConnectorEvent event, int id)
event
- The event.id
- The id of the event (dragged, dropped, etc.).