public class IlvMakeHyperEdgePinConnectorInteractor extends IlvMakeHyperEdgeBaseInteractor
IlvHyperEdgePinConnector
or add pins to it. It also allows to move the pins.
This interactor must be attached to a view that is attached to
an IlvHyperGrapher
.
Clicking on the node border creates a new pin.
If no hyperedge connector is yet installed at the node, it also installs
the hyperedge connector.
Clicking on an existing pin and dragging moves the pin
(if the pin allows moving).
This is actually the same as what the select interactor does via
IlvHyperEdgePinConnectorEdition
.
Clicking on an existing pin while holding the shift and the control key
simultaneously removes the pin.
More precisely: in order to create a pin, you move the mouse pointer
over the node. This highlights (selects) the node. Then you move the
mouse pointer to the border. You can even move the mouse slightly outside
the bounding box of the node. The pin margin (see IlvMakeHyperEdgeBaseInteractor.setPinMargin(double)
)
specifies how much you can move the mouse outside the node.
Then, a mouse click creates the pin. By default, the pin margin is 5
for this interactor.
IlvHyperEdgePinConnector
,
IlvHyperGrapher
,
Serialized FormConstructor and Description |
---|
IlvMakeHyperEdgePinConnectorInteractor()
Creates a new interactor.
|
Modifier and Type | Method and Description |
---|---|
protected IlvHyperGrapherPin |
createPin(IlvGraphic node,
IlvPoint p)
Creates a new hypergrapher pin.
|
Cursor |
getBorderCursor()
Returns the cursor when the mouse is on the border of a node.
|
int |
getFixedPinLayer()
Returns the layer of the pins of the newly created hyperedge connector
if the pin layer mode is
IlvHyperEdgeConnector.IN_FIXED_LAYER . |
protected IlvHyperGrapherPin |
getPin(IlvPoint p)
Returns the pin at input position, or
null if there is no
pin at that position. |
Color |
getPinColor()
Returns the color of the newly created pin when it is visible.
|
int |
getPinDirection()
Returns the direction into which the newly created pin connects to the
hyperedge.
|
int |
getPinLayerMode()
Returns the pin layer mode of the newly created hyperedge pin connector.
|
double |
getPinOffset()
Returns the offset of the newly created pin from the border of the node.
|
Color |
getPinSelectedColor()
Returns the color of the newly created pin when it is selected.
|
double |
getPinSize()
Returns the pin size of the newly created pin.
|
protected void |
highlightObject(IlvGraphic object)
Highlight the input object.
|
boolean |
isConnectionPointMoveAllowed()
Returns whether the newly created hyperedge connector allows to move the
hyperedge ends interactively when they are controlled by the connector.
|
boolean |
isConnectorFullyZoomable()
Returns whether the newly created hyperedge pin connector behaves fully
zoomable.
|
protected boolean |
isDragging(MouseEvent event)
Returns
true if the mouse event was dragging. |
protected boolean |
isNormalClick(MouseEvent event)
Returns
true if the mouse event was a normal click. |
protected boolean |
isNormalClickEnd(MouseEvent event)
Returns
true if the mouse event was a mouse up. |
boolean |
isPinAllowMultiConnection()
Returns whether a newly created pin should multiple hyperedge ends
to connect to the same pin.
|
boolean |
isPinDraggingAllowed()
Returns whether it is allowed to drag a selected pin.
|
boolean |
isPinDraggingRestrictedToNodeBorder()
Returns whether the movement of pins is restricted so that pins always
stay at the border of the node.
|
boolean |
isPinMovable()
Returns whether a newly created pin should be movable.
|
boolean |
isPinVisible()
Returns whether a newly created pin should be visible.
|
protected boolean |
isRemovePinClick(MouseEvent event)
Returns
true if the mouse event was a click on a pin
in order to remove the pin. |
protected void |
processMouseEvent(MouseEvent event)
Processes the mouse events.
|
protected void |
processMouseMotionEvent(MouseEvent event)
Processes the mouse moved and mouse dragged events.
|
protected void |
react(IlvPoint p)
Highlights or unhighlights the node under the specified point.
|
protected void |
reInitialize()
Reinitializes the interactor.
|
void |
setBorderCursor(Cursor cursor)
Changes the cursor when the mouse is on the border of a node.
|
void |
setConnectionPointMoveAllowed(boolean allow)
Sets whether the newly created hyperedge connector allows to move the
hyperedge ends interactively when they are controlled by the connector.
|
void |
setConnectorFullyZoomable(boolean enable)
Sets whether the newly created hyperedge pin connector behaves fully
zoomable.
|
void |
setFixedPinLayer(int layer)
Sets the layer of the pins of the newly created hyperedge connector
if the pin layer mode is
IlvHyperEdgeConnector.IN_FIXED_LAYER . |
void |
setPinAllowMultiConnection(boolean allow)
Sets whether a newly created pin should multiple hyperedge ends
to connect to the same pin.
|
void |
setPinColor(Color color)
Sets the color of the newly created pin when it is visible.
|
void |
setPinDirection(int direction)
Sets the direction into which the newly created pin connects to the
hyperedge.
|
void |
setPinDraggingAllowed(boolean flag)
Sets whether it is allowed to drag a selected pin.
|
void |
setPinDraggingRestrictedToNodeBorder(boolean flag)
Allows to restrict the movement of pins so that pins always stay at
the border of the node.
|
void |
setPinLayerMode(int mode)
Sets the pin layer mode of the newly created hyperedge pin connector.
|
void |
setPinMovable(boolean movable)
Sets whether a newly created pin should be movable.
|
void |
setPinOffset(double offset)
Sets the offset of the newly created pin from the border of the node.
|
void |
setPinSelectedColor(Color color)
Sets the color of the newly created pin if when is selected.
|
void |
setPinSize(double size)
Sets the pin size of the newly created pin.
|
void |
setPinVisible(boolean visible)
Sets whether a newly created pin should be visible.
|
attach, detach, getCursor, getHighlightedGraphic, getHighlightedPin, getObjectDrawingTransformer, getObjectToBeHighlighted, getPinCursor, getPinMargin, highlightPin, isCreationInSubManagersAllowed, isGridMode, isHyperEdge, isManagerToBeHighlighted, isNode, isPermanent, setCreationInSubManagersAllowed, setCursor, setGridMode, setPermanent, setPinCursor, setPinMargin, setPinSelected
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, isXORGhost, processEvent, processFocusEvent, processKeyEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
public IlvMakeHyperEdgePinConnectorInteractor()
protected void reInitialize()
reInitialize
in class IlvMakeHyperEdgeBaseInteractor
protected void processMouseEvent(MouseEvent event)
MouseListener
registered with this interactor (if any).processMouseEvent
in class IlvManagerViewInteractor
event
- The event.IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)
protected IlvHyperGrapherPin createPin(IlvGraphic node, IlvPoint p)
protected boolean isNormalClick(MouseEvent event)
true
if the mouse event was a normal click.
By default, this is a left mouse click.protected boolean isNormalClickEnd(MouseEvent event)
true
if the mouse event was a mouse up.protected boolean isRemovePinClick(MouseEvent event)
true
if the mouse event was a click on a pin
in order to remove the pin.
By default, it checks whether the control key and the shift key are
pressed simultaneously.protected boolean isDragging(MouseEvent event)
true
if the mouse event was dragging.protected void processMouseMotionEvent(MouseEvent event)
MouseMotionListener
registered with this interactor (if any).processMouseMotionEvent
in class IlvManagerViewInteractor
event
- The event.IlvManagerViewInteractor.addMouseMotionListener(java.awt.event.MouseMotionListener)
protected void react(IlvPoint p)
p
- The point in the coordinate space of the view.protected void highlightObject(IlvGraphic object)
highlightObject
in class IlvMakeHyperEdgeBaseInteractor
protected IlvHyperGrapherPin getPin(IlvPoint p)
null
if there is no
pin at that position.getPin
in class IlvMakeHyperEdgeBaseInteractor
public void setPinSize(double size)
IlvHyperGrapherPin.getSize()
,
getPinSize()
public double getPinSize()
IlvHyperGrapherPin.getSize()
,
setPinSize(double)
public void setPinOffset(double offset)
public double getPinOffset()
setPinOffset(double)
public void setPinDirection(int direction)
IlvDirection.Left
-
the hyperedge connects to the left side of the pin.
This should be used if the pin is on the left side of the node.
IlvDirection.Right
-
the hyperedge connects to the right side of the pin.
This should be used if the pin is on the right side of the node.
IlvDirection.Top
-
the hyperedge connects to the top side of the pin.
This should be used if the pin is on the top side of the node.
IlvDirection.Bottom
-
the hyperedge connects to the bottom side of the pin.
This should be used if the pin is on the bottom side of the node.
IlvDirection.Center
-
the hyperedge connects to the center of the pin.
0
-
the hyperedge determines the best connection automatically.
This is the default.
public int getPinDirection()
setPinDirection(int)
public void setPinVisible(boolean visible)
true
.public boolean isPinVisible()
public void setPinMovable(boolean movable)
true
.public boolean isPinMovable()
public void setPinAllowMultiConnection(boolean allow)
false
.public boolean isPinAllowMultiConnection()
public void setPinColor(Color color)
public Color getPinColor()
public void setPinSelectedColor(Color color)
public Color getPinSelectedColor()
public void setPinLayerMode(int mode)
IlvHyperEdgeConnector.IN_NODE_LAYER
-
the pins are placed in the same layer as the node.
This is the default.
IlvHyperEdgeConnector.IN_FRONT
-
the pins are placed in the a layer above the node layer.
The pins may overlap the nodes.
IlvHyperEdgeConnector.IN_BACK
-
the pins are placed in the a layer below the node layer.
The node may overlap the pins.
IlvHyperEdgeConnector.IN_FIXED_LAYER
-
the pins are placed in a fixed layer specified by
setFixedPinLayer(int)
.
public int getPinLayerMode()
setPinLayerMode(int)
public void setFixedPinLayer(int layer)
IlvHyperEdgeConnector.IN_FIXED_LAYER
.public int getFixedPinLayer()
IlvHyperEdgeConnector.IN_FIXED_LAYER
.setPinLayerMode(int)
,
setFixedPinLayer(int)
public void setConnectionPointMoveAllowed(boolean allow)
If moving hyperedge ends is allowed, then you can interactively move a hyperedge end from one pin to another pin. If moving pins is allowed, then you can interactively move th pin itself. The hyperedges stay connected to the pin while moving the pin.
public boolean isConnectionPointMoveAllowed()
setConnectionPointMoveAllowed(boolean)
public void setConnectorFullyZoomable(boolean enable)
If true
, the connector zooms the pin points relative
to the unzoomed bounding box of the end nodes.
For some graphic objects such as IlvHalfZoomingGraphic
, the
pin points might not be at the border of the visible bounding box of the
node, since the visible bounding box may differ from the calculated
bounding box. However, it works for most zoomable graphic objects and
it is in general faster.
If false
, the connector calculates the pin points
from the zoomed bounding box. This may match the visible bounding box
more precisely, but the connector has eventually
no zoomable connections, i.e.
IlvHyperEdgePinConnector.connectionsZoomable()
returns
false
.
public boolean isConnectorFullyZoomable()
setConnectorFullyZoomable(boolean)
public Cursor getBorderCursor()
public void setBorderCursor(Cursor cursor)
public void setPinDraggingRestrictedToNodeBorder(boolean flag)
isPinDraggingRestrictedToNodeBorder()
public boolean isPinDraggingRestrictedToNodeBorder()
public void setPinDraggingAllowed(boolean flag)
isPinDraggingAllowed()
public boolean isPinDraggingAllowed()
setPinDraggingAllowed(boolean)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.