public class IlvHyperEdgePinConnector extends IlvHyperEdgeConnectorWithCache
attach(ilog.views.IlvGraphic, boolean)
).
When a hyperedge is connected to a node with pin connector,
it can only connect to the contact pins stored in the
connector. If a hyperedge tries to connect to an arbitrary point of
the node, the closest pin is searched and the hyperedge is connected to
this pin.
The hyperedge connector works similar to the IlvPinLinkConnector
,
however, this hyperedge pin connector is a graphic object that can be made
visible. In this case, all its pins are drawn. The connector is
automatically added or removed from its manager when its node is added
or removed from the manager.
IlvHyperEdge
,
IlvHyperGrapherPin
,
Serialized FormIlvHyperEdgeConnector.HyperEdgeConnectorProperty
IN_BACK, IN_FIXED_LAYER, IN_FRONT, IN_NODE_LAYER
Constructor and Description |
---|
IlvHyperEdgePinConnector()
Creates an empty
IlvHyperEdgePinConnector . |
IlvHyperEdgePinConnector(boolean fullyZoomable)
Creates an empty
IlvHyperEdgePinConnector . |
IlvHyperEdgePinConnector(IlvGraphic node)
Creates an
IlvHyperEdgePinConnector attached to the input
node. |
IlvHyperEdgePinConnector(IlvHyperEdgePinConnector source)
Creates an
IlvHyperEdgePinConnector by copying an existing
one. |
IlvHyperEdgePinConnector(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
actOnRead(IlvHyperEdgeEnd end,
IlvInputStream stream)
Called when reading the hyperedge end from the input stream.
|
void |
actOnWrite(IlvHyperEdgeEnd end,
IlvOutputStream stream)
Called when writing the hyperedge end to the output stream.
|
void |
addPin(IlvHyperGrapherPin pin,
boolean redraw)
Adds a pin.
|
void |
addPins(Collection pins,
boolean redraw)
Adds the pins of the input collection.
|
void |
attach(IlvGraphic node,
boolean redraw)
Installs the hyperedge connector on the node
node . |
protected void |
attachImpl(IlvGraphic obj)
This method is called inside
attach(ilog.views.IlvGraphic, boolean) to attach the connector
to the node or hyperedge. |
protected IlvRect |
calcBoundingBox(IlvTransformer t)
Calculates the bounding rectangle of the object.
|
protected IlvPoint |
calcConnectionPoint(IlvHyperEdgeEnd end,
IlvTransformer t)
Calculate the connection point of the hyperedge end at the corresponding
node.
|
void |
connect(IlvHyperEdgeEnd end,
IlvHyperGrapherPin pin)
Connect a hyperedge end to the input pin.
|
boolean |
connect(IlvHyperEdgeEnd end,
IlvPoint p,
IlvTransformer t)
Connect a hyperedge end to the closest suitable pin at a given point.
|
boolean |
connectionsZoomable()
Returns
true if the connection points of the hyperedge
at zoomable nodes are zoomable. |
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
detach(boolean redraw)
Detaches the hyperedge connector from the attached node.
|
protected void |
detachImpl()
This method is called inside
detach(boolean) to detach the connector
from the node or hyperedge. |
boolean |
disconnect(IlvHyperEdgeEnd end)
Disconnect a hyperedge end from the hyperedge connector.
|
void |
disconnectAll()
Disconnect all ends that are connected to pins of the hyperedge connector.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
IlvPoint |
getClosestConnectionPoint(IlvHyperEdgeEnd end,
IlvPoint p,
IlvTransformer t)
Returns the closest possible connection point of the hyperedge end
at the corresponding node.
|
IlvHyperGrapherPin |
getClosestPin(IlvHyperEdgeEnd end,
IlvPoint p,
IlvTransformer t)
Returns the closest pin at a given point suitable for the input
hyperedge end.
|
IlvHyperGrapherPin |
getClosestPin(IlvPoint p,
IlvTransformer t)
Returns the closest pin at a given point.
|
IlvGraphic |
getNode()
Returns the node associated with the hyperedge connector.
|
IlvHyperGrapherPin |
getPin(IlvHyperEdgeEnd end)
Returns the pin associated to a hyperedge end.
|
Iterator<IlvHyperGrapherPin> |
getPins()
Returns an iterator over the pins.
|
int |
getPinsCount()
Returns the number of pins.
|
boolean |
isGraphic()
Returns whether the connector displays a visible part.
|
boolean |
isPinDraggingRestrictedToNodeBorder()
Returns whether the movement of pins is restricted so that pins always
stay at the border of the node.
|
IlvSelection |
makeSelection()
Creates a selection object for this object.
|
void |
removeAllPins(boolean redraw)
Removes all pins.
|
void |
removePin(IlvHyperGrapherPin pin,
boolean redraw)
Removes a pin.
|
void |
removePins(Collection<IlvHyperGrapherPin> pins,
boolean redraw)
Removes the pins of the input collection.
|
void |
selectAllPins(boolean select,
boolean redraw)
Sets all pins of the connector selected or unselected.
|
void |
selectPin(IlvHyperGrapherPin pin,
boolean select,
boolean redraw)
Sets a pin of the connector selected or unselected.
|
void |
setPinDraggingRestrictedToNodeBorder(boolean flag)
Allows to restrict the movement of pins so that pins always stay at
the border of the node.
|
static void |
snapPinToNodeBorder(IlvHyperGrapherPin pin,
int absOffset)
Changes the position of the pin to that is snaps to the node border.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns
true if the object is zoomable; otherwise it
returns false . |
actOnOwnerInserted, actOnOwnerRemoved, adjust, adjustAll, getConnectionPoint
actAfterLayerChanged, actAfterOwnerTransform, actOnOwnerRead, allowRemoval, allowsConnectionPointMove, applyTransform, boundingBox, clearBoundingBoxCache, Get, GetAttached, getFixedLayer, getLayerMode, GetLocal, getOwner, isConnectionPointMoveAllowed, move, moveResize, resize, rotate, scale, setConnectionPointMoveAllowed, setFixedLayer, setLayerMode, translate
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, move, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setBackground, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setForeground, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
public IlvHyperEdgePinConnector()
IlvHyperEdgePinConnector
.
To attach the connector to a node, call attach(ilog.views.IlvGraphic, boolean)
.
To add pins to the connector, call addPin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
.
To connect a hyperedge to the connector, call connect(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvPoint, ilog.views.IlvTransformer)
.public IlvHyperEdgePinConnector(boolean fullyZoomable)
IlvHyperEdgePinConnector
.
To attach the connector to a node, call attach(ilog.views.IlvGraphic, boolean)
.
To add pins to the connector, call addPin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
.
To connect a hyperedge to the connector, call connect(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvPoint, ilog.views.IlvTransformer)
.
The parameter fullyZoomable
controls whether the connector
behaves fully zoomable.
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. connectionsZoomable()
returns
false
.
public IlvHyperEdgePinConnector(IlvGraphic node)
IlvHyperEdgePinConnector
attached to the input
node.
To add pins to the connector, call addPin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
.
To connect a hyperedge to the connector, call connect(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvPoint, ilog.views.IlvTransformer)
.public IlvHyperEdgePinConnector(IlvHyperEdgePinConnector source)
IlvHyperEdgePinConnector
by copying an existing
one.source
- The origin of the copy.public IlvHyperEdgePinConnector(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.
stream
- The input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvGraphic
IlvGraphic
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
You should not call this method directly; instead, you should use
the write
methods of the manager.write
in interface IlvPersistentObject
write
in class IlvHyperEdgeConnector
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public boolean isGraphic()
IlvGraphic
.
This is the case for this connector, hence it returns true
.isGraphic
in class IlvHyperEdgeConnector
public void attach(IlvGraphic node, boolean redraw)
node
.
After installation, the hyperedge connector controls the pins
where a hyperedge can attach at a node, except for those hyperedges
that are not connected to the hyperedge connector.
The method getNode()
returns the node node
.
The method detach(boolean)
is automatically called
to detach the old attached node, if any. Also, if any other
hyperedge connector was attached to this node, it gets detached.
If the node is inside a grapher, the hyperedge connector is inserted into this grapher.
attach
in class IlvHyperEdgeConnector
node
- The node.redraw
- If true
, the manager is redrawn.detach(boolean)
protected void attachImpl(IlvGraphic obj)
attach(ilog.views.IlvGraphic, boolean)
to attach the connector
to the node or hyperedge. You should not call this. You can override
this method in order to perform additional operations for specific
subclasses of IlvHyperEdgeConnector
.attachImpl
in class IlvHyperEdgeConnector
obj
- The node or hyperedge the connector is attached to.public void detach(boolean redraw)
All connected hyperedges are disconnected from this connector. This connector is removed from its grapher.
detach
in class IlvHyperEdgeConnector
redraw
- If true
, the manager is redrawn.attach(IlvGraphic, boolean)
protected void detachImpl()
detach(boolean)
to detach the connector
from the node or hyperedge. You should not call this. You can override
this method in order to perform additional operations for specific
subclasses of IlvHyperEdgeConnector
.detachImpl
in class IlvHyperEdgeConnectorWithCache
public IlvGraphic getNode()
attach(IlvGraphic, boolean)
public void addPin(IlvHyperGrapherPin pin, boolean redraw)
IlvHyperEdgePinConnector
,
it is removed from it. The method does nothing if the pin was already
added to this hyperedge connector.
pin
- The pin.redraw
- If true
, the manager that contains this
hyperedge connector is redrawn.removePin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
,
addPins(java.util.Collection, boolean)
public void addPins(Collection pins, boolean redraw)
pins
- The collection of pins.redraw
- If true
, the manager that contains this
hyperedge connector is redrawn.addPin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
public void removePin(IlvHyperGrapherPin pin, boolean redraw)
pin
- The pin.redraw
- If true
, the manager that contains this
hyperedge connector is redrawn.addPin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
,
removePins(java.util.Collection<ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin>, boolean)
public void removeAllPins(boolean redraw)
redraw
- If true
, the manager that contains this
hyperedge connector is redrawn.removePin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
public void removePins(Collection<IlvHyperGrapherPin> pins, boolean redraw)
pins
- The collection of pins.redraw
- If true
, the manager that contains this
hyperedge connector is redrawn.removePin(ilog.views.hypergraph.edgeconnector.IlvHyperGrapherPin, boolean)
public final Iterator<IlvHyperGrapherPin> getPins()
IlvHyperGrapherPin
objects.
The returned iterator does not support the Iterator.remove()
operation.public final int getPinsCount()
public IlvHyperGrapherPin getClosestPin(IlvPoint p, IlvTransformer t)
p
- The transformed point.t
- The transformer used to draw the node.public IlvHyperGrapherPin getClosestPin(IlvHyperEdgeEnd end, IlvPoint p, IlvTransformer t)
end
- The hyperedge end.p
- The transformed point.t
- The transformer used to draw the node.IlvHyperGrapherPin.allow(ilog.views.hypergraph.IlvHyperEdgeEnd)
public boolean connect(IlvHyperEdgeEnd end, IlvPoint p, IlvTransformer t)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).
It searches for the closest pin that allows the connection of the end and then connects the end to this pin.
connect
in class IlvHyperEdgeConnector
end
- The hyperedge end.p
- The proposed connection point in transformed coordinates.t
- The transformer used to draw the hyperedge.true
if the connection was successful,
false
otherwise.disconnect(ilog.views.hypergraph.IlvHyperEdgeEnd)
,
IlvHyperGrapherPin.allow(ilog.views.hypergraph.IlvHyperEdgeEnd)
public void connect(IlvHyperEdgeEnd end, IlvHyperGrapherPin pin)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).end
- The hyperedge end.pin
- The pin.public boolean disconnect(IlvHyperEdgeEnd end)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).disconnect
in class IlvHyperEdgeConnectorWithCache
end
- The hyperedge end.true
if the end was connected,
false
otherwise.connect(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvPoint, ilog.views.IlvTransformer)
protected IlvPoint calcConnectionPoint(IlvHyperEdgeEnd end, IlvTransformer t)
calcConnectionPoint
in class IlvHyperEdgeConnectorWithCache
end
- The hyperedge end.t
- The transformer used to draw the hyperedge.public IlvPoint getClosestConnectionPoint(IlvHyperEdgeEnd end, IlvPoint p, IlvTransformer t)
getClosestConnectionPoint
in class IlvHyperEdgeConnector
end
- The hyperedge end.p
- The proposed point in view coordinates.t
- The transformer used to draw the hyperedge.public void disconnectAll()
public IlvHyperGrapherPin getPin(IlvHyperEdgeEnd end)
null
if the hyperedge end is not connected to
any pin of this connector.public void actOnWrite(IlvHyperEdgeEnd end, IlvOutputStream stream) throws IOException
You must override this method if specific data is to be stored.
You should not call this method directly; instead, you should use
the write
methods of the IlvGrapher
that contains
node or hyperedge to which the hyperedge connector is attached.
actOnWrite
in class IlvHyperEdgeConnector
end
- The hyperedge end.stream
- The output stream.IOException
public void actOnRead(IlvHyperEdgeEnd end, IlvInputStream stream) throws IlvReadFileException
You must override this method if specific data is to be read.
You should not call this method directly; instead, you should use the
read
methods of the IlvGrapher
that contains the
node or hyperedge to which the hyperedge connector is attached.
actOnRead
in class IlvHyperEdgeConnector
end
- The hyperedge end.stream
- The input stream.IlvReadFileException
public void setPinDraggingRestrictedToNodeBorder(boolean flag)
isPinDraggingRestrictedToNodeBorder()
public boolean isPinDraggingRestrictedToNodeBorder()
public boolean connectionsZoomable()
true
if the connection points of the hyperedge
at zoomable nodes are zoomable. A connection point is zoomable if calling
the method IlvHyperEdgeConnectorWithCache.getConnectionPoint(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvTransformer)
with a transformer gives
the same result as calling it with a null
(identity)
transformer and then applying the transformer to the result.
This is only tested if the hyperedge end is attached to a zoomable node.
Note that an instance of a hyperedge connector must return the same value as long as it is attached to the same object.
Don't confuse this with the method zoomable()
which indicates
whether the connector as graphic object would be zoomable.
connectionsZoomable
in class IlvHyperEdgeConnector
public boolean zoomable()
true
if the object is zoomable; otherwise it
returns false
.
The connector is zoomable if it is attached to a zoomable node
and all pins of the connector are zoomable.public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvHyperEdgeConnector
dst
- The destination Graphics.t
- The transformation used to draw the object.IlvHyperEdgeConnector.boundingBox(ilog.views.IlvTransformer)
,
zoomable()
protected IlvRect calcBoundingBox(IlvTransformer t)
IlvHyperEdgeConnector.boundingBox(ilog.views.IlvTransformer)
).calcBoundingBox
in class IlvHyperEdgeConnector
t
- The transformer used to draw the object.public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
true
if the points lies within a pin of this
connector.contains
in class IlvHyperEdgeConnector
p
- The point to be tested.tp
- The point p
transformed by the transformer
t
.t
- The transformation used to draw the object.true
if the point lies inside this graphic object.IlvGraphic
public IlvSelection makeSelection()
makeSelection
in class IlvGraphic
IlvDrawSelection
public void selectAllPins(boolean select, boolean redraw)
select
- Whether all pins are selected or deselected.redraw
- Whether the pins are redrawn.IlvHyperGrapherPin.isSelected()
public void selectPin(IlvHyperGrapherPin pin, boolean select, boolean redraw)
pin
- The pin.select
- Whether the pin is selected or deselected.redraw
- Whether the pins are redrawn.IlvHyperGrapherPin.isSelected()
public static void snapPinToNodeBorder(IlvHyperGrapherPin pin, int absOffset)
pin
- The pin to be snapped.absOffset
- The offset of the pin to the node border.
A positive value means the pin is outside the node,
a negative value means the pin is inside the node.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.