public abstract class IlvHyperEdgeConnector extends IlvGraphic
IlvHyperEdge
) in a hypergrapher
(IlvHyperGrapher
).
The mechanism is slightly different than the IlvLinkConnector
of IlvLinkImage
. When a hyperedge is created and connected to
nodes, it is attached to the point specified by IlvHyperEdgeEnd
to the node. If no hyperedge connector is used, the hyper edge end
can be freely moved (comparable to the IlvFreeLinkConnector
of IlvLinkImage
). In order to restrict the possible attachment
points, a hyperedge connector can be used.
An IlvHyperEdgeConnector
can be associated with a node
or with a hyperedge (returned by the method getOwner()
).
It cannot be shared among multiple nodes and hyperedges.
In order to associate the connector with a node or hyperedge,
use the constructor IlvHyperEdgeConnector(IlvGraphic)
or
use the method attach(IlvGraphic, boolean)
.
Notice that the same instance of hyperedge connector cannot be shared
by several nodes or hyperedges.
The implementation of the method getConnectionPoint(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvTransformer)
decides
where the connection point of a hyperedge end (provided as an argument)
should be located. This method is called for all ends of a hyperedge
if the connector is associated with the hyperedge. It is called for
all ends of hyperedges ending at a node if the connector is associated
with the node, except for those hyperedges that have an individual
hyperedge connector.
Hyperedge connectors at nodes may be visible. For instance the
pin connector IlvHyperEdgePinConnector
can display the pins of
the connector. Therefore, the class IlvHyperEdgeConnector
is a subclass of IlvGraphic
.
The method isGraphic()
decides whether the hyperedge connector
must be displayed or whether it is purely a computation mechanism.
If it is purely a computation mechanism, it is never added to any
grapher.
IlvHyperEdge
,
IlvHyperEdgePinConnector
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IlvHyperEdgeConnector.HyperEdgeConnectorProperty
This named property stores the hyperedge connector at a node.
|
Modifier and Type | Field and Description |
---|---|
static int |
IN_BACK
Layer mode option.
|
static int |
IN_FIXED_LAYER
Layer mode option.
|
static int |
IN_FRONT
Layer mode option.
|
static int |
IN_NODE_LAYER
Layer mode option.
|
Constructor and Description |
---|
IlvHyperEdgeConnector()
Creates an empty
IlvHyperEdgeConnector . |
IlvHyperEdgeConnector(IlvGraphic obj)
Creates an
IlvHyperEdgeConnector attached to the input
object, which can be a node or a hyperedge. |
IlvHyperEdgeConnector(IlvHyperEdgeConnector source)
Creates an
IlvHyperEdgeConnector by copying an existing one. |
IlvHyperEdgeConnector(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
actAfterLayerChanged(IlvGraphic nodeOrEdge,
boolean redraw)
React when the layer of the node or hyperedge has changed.
|
void |
actAfterOwnerTransform(boolean redraw)
React when there was an
applyTransform on the node or hyperedge. |
void |
actOnOwnerInserted(IlvGraphic nodeOrEdge,
boolean redraw)
React when the node or hyperedge of this connector is inserted into
a hypergrapher.
|
void |
actOnOwnerRead(IlvGraphic nodeOrEdge)
React after the node or hyperedge is read from an IVL file.
|
void |
actOnOwnerRemoved(IlvGraphic nodeOrEdge,
boolean redraw)
React before the node or hyperedge is removed from its manager.
|
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 |
adjust(IlvHyperEdgeEnd end)
Adjusts one ends connected to the hyperedge connector.
|
void |
adjustAll()
Adjusts all ends connected to the hyperedge connector.
|
boolean |
allowRemoval()
Returns whether it currently allowed to remove the connector
from its manager.
|
boolean |
allowsConnectionPointMove(IlvHyperEdgeEnd end)
Indicates whether the connection point of a hyperedge can be moved
by interactors.
|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
void |
attach(IlvGraphic nodeOrEdge,
boolean redraw)
Installs the hyperedge connector on a node or hyperedge.
|
protected void |
attachImpl(IlvGraphic obj)
This method is called inside
attach(ilog.views.IlvGraphic, boolean) to attach the connector
to the node or hyperedge. |
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
protected IlvRect |
calcBoundingBox(IlvTransformer t)
Calculates the bounding rectangle of the object.
|
void |
clearBoundingBoxCache()
Clears the bounding box cache.
|
boolean |
connect(IlvHyperEdgeEnd end,
IlvPoint p,
IlvTransformer t)
Connect a hyperedge end to hyperedge connector.
|
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.
|
void |
detach(boolean redraw)
Detaches the hyperedge connector from the attached node or
hyperedge.
|
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 |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
static IlvHyperEdgeConnector |
Get(IlvHyperEdgeEnd end)
Returns the hyperedge connector that is responsible for handling
the input hyperedge end.
|
static IlvHyperEdgeConnector |
GetAttached(IlvGraphic nodeOrEdge)
Returns the hyperedge connector of a node or hyperedge.
|
abstract IlvPoint |
getClosestConnectionPoint(IlvHyperEdgeEnd end,
IlvPoint p,
IlvTransformer t)
Returns the closest possible connection point of the hyperedge end
at the corresponding node.
|
abstract IlvPoint |
getConnectionPoint(IlvHyperEdgeEnd end,
IlvTransformer t)
Returns the connection point of the hyperedge end at the corresponding
node.
|
int |
getFixedLayer()
Returns the layer of the connector if the layer mode is
IN_FIXED_LAYER . |
int |
getLayerMode()
Returns the layer mode.
|
static IlvHyperEdgeConnector |
GetLocal(IlvHyperEdgeEnd end)
Returns the hyperedge connector of the hyperedge, if any.
|
IlvGraphic |
getOwner()
Returns the node or hyperedge associated with the hyperedge connector.
|
boolean |
isConnectionPointMoveAllowed()
Returns whether it is globally allowed to move the connection points
interactively.
|
boolean |
isGraphic()
Returns whether the connector displays a visible part.
|
void |
move(double x,
double y)
Moves the object.
|
void |
moveResize(IlvRect size)
Resizes the object.
|
void |
resize(double neww,
double newh)
Resizes the object.
|
void |
rotate(IlvPoint center,
double angle)
Rotates the object.
|
void |
scale(double scalex,
double scaley)
Resizes the object.
|
void |
setConnectionPointMoveAllowed(boolean allow)
Sets whether it is globally allowed to move the connection points
interactively.
|
void |
setFixedLayer(int layer)
Sets the layer of the connector if the layer mode is
IN_FIXED_LAYER . |
void |
setLayerMode(int mode)
Sets the layer mode.
|
void |
translate(double dx,
double dy)
Translates the object.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
boolean |
zoomable()
Returns
true if the object is zoomable; otherwise it
returns false . |
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, copy, 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, makeSelection, 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 static final int IN_NODE_LAYER
setLayerMode(int)
,
isGraphic()
,
Constant Field Valuespublic static final int IN_FRONT
public static final int IN_BACK
public static final int IN_FIXED_LAYER
setFixedLayer(int)
.setLayerMode(int)
,
isGraphic()
,
Constant Field Valuespublic IlvHyperEdgeConnector()
IlvHyperEdgeConnector
.
To attach the connector to a node or hyperedge, call attach(ilog.views.IlvGraphic, boolean)
.public IlvHyperEdgeConnector(IlvGraphic obj)
IlvHyperEdgeConnector
attached to the input
object, which can be a node or a hyperedge.public IlvHyperEdgeConnector(IlvHyperEdgeConnector source)
IlvHyperEdgeConnector
by copying an existing one.source
- The origin of the copy.public IlvHyperEdgeConnector(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.
stream
- The input stream.IlvReadFileException
- if the format is not correct.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 IlvGraphic
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public boolean isGraphic()
IlvGraphic
.
A connector that displays a visible part can only be attached to
a node, not to a hyperedge.
If true
, the connector is added to the same manager as
the associated node, and hence is displayed in the manager.
The layer where the connector is placed can be specified by the
layer mode (see setLayerMode(int)
. This determines whether the
visible part of the connector overlaps the node or not.
The default implementation returns false
.public void attach(IlvGraphic nodeOrEdge, boolean redraw)
The method getOwner()
returns the node or hyperedge this connector
is attached to.
The method detach(boolean)
is automatically called
to detach the old attached owner, if any. Also, if any other
hyperedge connector was attached to this owner, it gets detached.
If the connector is attached to a node inside a grapher and if
isGraphic()
returns true, the hyperedge connector is inserted
into the grapher.
nodeOrEdge
- The node or hyperedge the connector is attached to.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
.obj
- The node or hyperedge the connector is attached to.public void detach(boolean redraw)
If the connector was attached to a node inside a grapher and if
isGraphic()
returns true, the hyperedge connector is removed
from the grapher.
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
.public boolean allowRemoval()
public void setConnectionPointMoveAllowed(boolean allow)
public boolean isConnectionPointMoveAllowed()
public boolean allowsConnectionPointMove(IlvHyperEdgeEnd end)
The default implementation returns the same result as
isConnectionPointMoveAllowed()
.
Subclasses can override this method to indicate to the interactors that
either all or some connection points cannot be moved.
public void actOnOwnerInserted(IlvGraphic nodeOrEdge, boolean redraw)
nodeOrEdge
- The node or hyperedge the connector is attached to.redraw
- If true
, the manager is redrawn.public void actOnOwnerRead(IlvGraphic nodeOrEdge)
nodeOrEdge
- The node or hyperedge the connector is attached to.public void actOnOwnerRemoved(IlvGraphic nodeOrEdge, boolean redraw)
nodeOrEdge
- The node or hyperedge the connector is attached to.redraw
- If true
, the manager is redrawn.public void actAfterOwnerTransform(boolean redraw)
applyTransform
on the node or hyperedge.
You should not call this methods.redraw
- If true
, the manager is redrawn.public void actAfterLayerChanged(IlvGraphic nodeOrEdge, boolean redraw)
nodeOrEdge
- The node or hyperedge the connector is attached to.redraw
- If true
, the manager is redrawn.public IlvGraphic getOwner()
attach(IlvGraphic, boolean)
public boolean connect(IlvHyperEdgeEnd end, IlvPoint p, IlvTransformer t)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).
The default implementation simply calls getClosestConnectionPoint(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvPoint, ilog.views.IlvTransformer)
and moves the hyperedge end point to this point.
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)
public boolean disconnect(IlvHyperEdgeEnd end)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).
The default implementation does nothing and returns true
.
end
- The hyperedge end.true
if the end was connected,
false
otherwise.connect(ilog.views.hypergraph.IlvHyperEdgeEnd, ilog.views.IlvPoint, ilog.views.IlvTransformer)
public abstract IlvPoint getConnectionPoint(IlvHyperEdgeEnd end, IlvTransformer t)
end
- The hyperedge end.t
- The transformer used to draw the hyperedge.public abstract IlvPoint getClosestConnectionPoint(IlvHyperEdgeEnd end, IlvPoint p, IlvTransformer t)
end
- The hyperedge end.p
- The proposed point in view coordinates.t
- The transformer used to draw the hyperedge.public void adjustAll()
adjust(ilog.views.hypergraph.IlvHyperEdgeEnd)
for all ends that are managed by this hyperedge connector.public void adjust(IlvHyperEdgeEnd end)
IlvHyperEdgeEnd.positionChanged()
.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.
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.
end
- The hyperedge end.stream
- The input stream.IlvReadFileException
public void setLayerMode(int mode)
IlvGraphic
. In this case, isGraphic()
returns true
and the connector can only be attached
at a node. It is added to the same manager as the associated node,
and hence is displayed in the manager.
The layer mode determines the manager layer where to place the connector.
The options are:
IN_NODE_LAYER
-
the connector is placed in the same layer as the node.
This is the default.
IN_FRONT
-
the connector is placed in the a layer above the node layer.
The visible parts of the connector may overlap the nodes.
IN_BACK
-
the connector is placed in the a layer below the node layer.
The node may overlap the visible parts of the connector.
This works only if the node is not in layer 0.
IN_FIXED_LAYER
-
the connector is placed in a fixed layer specified by
setFixedLayer(int)
.
getLayerMode()
,
isGraphic()
public int getLayerMode()
setLayerMode(int)
public void setFixedLayer(int layer)
IN_FIXED_LAYER
.setLayerMode(int)
,
getFixedLayer()
public int getFixedLayer()
IN_FIXED_LAYER
.setLayerMode(int)
,
setFixedLayer(int)
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 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.
The default implementation returns false
.
Don't confuse this with the method zoomable()
which indicates
whether the connector as graphic object would be zoomable.
public boolean zoomable()
true
if the object is zoomable; otherwise it
returns false
.
This method is only used if isGraphic()
returns
true
, i.e., if the connector behaves like an
IlvGraphic
.zoomable
in class IlvGraphic
draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
boundingBox(ilog.views.IlvTransformer)
,
boundingBox(ilog.views.IlvTransformer)
public void draw(Graphics dst, IlvTransformer t)
isGraphic()
returns
true
, i.e., if the connector behaves like an
IlvGraphic
.
draw
in class IlvGraphic
dst
- The destination Graphics.t
- The transformation used to draw the object.boundingBox(ilog.views.IlvTransformer)
,
zoomable()
public IlvRect boundingBox(IlvTransformer t)
calcBoundingBox(ilog.views.IlvTransformer)
to calculate the bounding box.
This method is only used if isGraphic()
returns
true
, i.e., if the connector behaves like an
IlvGraphic
.boundingBox
in class IlvGraphic
t
- The transformer used to draw the object. The value
null
can be used for the identity transformer.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
zoomable()
protected IlvRect calcBoundingBox(IlvTransformer t)
boundingBox(ilog.views.IlvTransformer)
).t
- The transformer used to draw the object.public void clearBoundingBoxCache()
boundingBox(ilog.views.IlvTransformer)
.public void applyTransform(IlvTransformer t)
isGraphic()
returns
true
, i.e., if the connector behaves like an
IlvGraphic
.applyTransform
in class IlvGraphic
t
- The transformer to be applied.IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
isGraphic()
returns
true
, i.e., if the connector behaves like an
IlvGraphic
.contains
in class IlvGraphic
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 void move(double x, double y)
move
in class IlvGraphic
x
- The new horizontal value.y
- The new vertical value.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void moveResize(IlvRect size)
moveResize
in class IlvGraphic
size
- The new bounding rectangle of the object.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void translate(double dx, double dy)
translate
in class IlvGraphic
dx
- The horizontal translation factor.dy
- The vertical translation factor.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void rotate(IlvPoint center, double angle)
rotate
in class IlvGraphic
center
- The center of the rotation.angle
- The rotation angle in degrees.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void scale(double scalex, double scaley)
scale
in class IlvGraphic
scalex
- The horizontal scaling factor.scaley
- The vertical scaling factor.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void resize(double neww, double newh)
resize
in class IlvGraphic
neww
- The new horizontal width.newh
- The new horizontal height.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public static IlvHyperEdgeConnector GetAttached(IlvGraphic nodeOrEdge)
public static IlvHyperEdgeConnector Get(IlvHyperEdgeEnd end)
public static IlvHyperEdgeConnector GetLocal(IlvHyperEdgeEnd end)
Different to Get(ilog.views.hypergraph.IlvHyperEdgeEnd)
, this is not necessarily the connector
that is currently responsible for the hyperedge end. If the hyperedge
is an intergraph hyperedge and the end node is inside a collapsed grapher,
then the connector of the collapsed grapher might be responsible for
the hyperedge end, but instead the connector of the (currently invisible)
end node is returned.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.