public class IlvRotatedGraphModel extends IlvGraphModel implements IlvGrapherPropertyAdapter
When using IlvLinkClipInterface
, IlvLinkConnectionBoxInterface
or IlvNodeBoxInterface
on a
layout in combination with this graph model, the implementations of
these interfaces must take into account the rotation. If you have an
implementation for those interfaces that work on the original graph
model, you can obtain an instance for the rotated graph model via
getLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface)
, getLinkConnectionBoxInterface(ilog.views.graphlayout.IlvLinkConnectionBoxInterface)
,
or getNodeBoxInterface(ilog.views.graphlayout.IlvNodeBoxInterface)
.
Constructor and Description |
---|
IlvRotatedGraphModel(IlvGraphModel model,
boolean owned,
IlvPoint center,
double angle)
The constructor.
|
IlvRotatedGraphModel(IlvGraphModel model,
boolean owned,
IlvTransformer t)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
afterAnimationStep()
Notifies the graph model that a layout animation step has finished.
|
void |
afterLayout(IlvGraphLayout layout,
IlvGraphLayoutReport layoutReport,
boolean redraw)
Notifies the graph model that a layout session has finished.
|
void |
beforeAnimationStep()
Notifies the graph model that a layout animation step has been
started.
|
void |
beforeLayout(IlvGraphLayout layout,
boolean redraw)
Notifies the graph model that a layout session has been started.
|
IlvRect |
boundingBox(Object nodeOrLink)
Returns the bounding rectangle of a node or a link.
|
protected IlvGraphModel |
createGraphModel(Object subgraph)
Creates a new graph model for a subgraph.
|
void |
dispose()
Disposes of this
IlvGraphModel and releases any resources
that it is using. |
Object |
getFrom(Object link)
Returns the origin node of a link.
|
IlvGrapher |
getGrapher()
Returns the
IlvGrapher that stores the nodes and links of the
graph. |
IlvGraphModel |
getGraphModel(Object subgraph)
Returns a graph model instance for a subgraph of a nested graph.
|
Enumeration |
getInterGraphLinks()
Returns the intergraph links contained in this graph.
|
int |
getInterGraphLinksCount()
Returns the number of intergraph links contained in this graph.
|
String |
getLayoutPropertyPrefix(IlvGraphLayout layout)
Returns the property name of the input layout, if it was most recently
stored as a named property, or
null if the layout was
never stored. |
IlvLinkClipInterface |
getLinkClipInterface(IlvLinkClipInterface ifc)
Returns the link clip interface to be used on layouts attached to this
model, if the input link clip interface specifies the link clipping
with respect to the original model.
|
IlvLinkConnectionBoxInterface |
getLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface ifc)
Returns the link connection box interface to be used on layouts
attached to this model, if the input link connection box interface
specifies the connection with respect to the original model.
|
IlvPoint |
getLinkPointAt(Object link,
int index)
Returns the point of a link at a specified index.
|
IlvPoint[] |
getLinkPoints(Object link)
Returns the points that define a link.
|
int |
getLinkPointsCount(Object link)
Returns the number of points that define a link, including the
connection points of the link on the origin and destination nodes.
|
Enumeration |
getLinks()
Returns an enumeration of the links.
|
int |
getLinksCount()
Returns the number of links.
|
Enumeration |
getLinksFrom(Object node)
Returns an enumeration of all the links that have
node as
their origin. |
int |
getLinksFromCount(Object node)
Returns the number of links that have
node as their
origin. |
Enumeration |
getLinksTo(Object node)
Returns an enumeration of all the links that have
node as
their destination. |
int |
getLinksToCount(Object node)
Returns the number of links that have
node as their
destination. |
double |
getLinkWidth(Object link)
Returns the width of a link.
|
IlvNodeBoxInterface |
getNodeBoxInterface(IlvNodeBoxInterface ifc)
Returns the node box interface to be used on layouts attached to this
model, if the input node box interface specifies the node box with
respect to the original model.
|
Enumeration |
getNodes()
Returns an enumeration of the nodes.
|
int |
getNodesCount()
Returns the number of nodes.
|
IlvGraphModel |
getOriginalGraphModel()
Returns the graph model encapsulated by this rotated graph model.
|
IlvGraphModel |
getParentModel()
Returns the graph model that encapsulates the parent graph of the
graph encapsulated by this graph model, or
null . |
String |
getPreferredLayoutPropertyPrefix()
Returns the property name of the preferred layout, or
null if no preferred layout was stored. |
Object |
getProperty(Object nodeOrLink,
String key)
Returns the value of a property.
|
Object |
getProperty(String key)
Returns the value of a property of the graph model.
|
Enumeration |
getSubgraphs()
Returns an enumeration of the subgraphs of the graph encapsulated by
this graph model.
|
int |
getSubgraphsCount()
Returns the number of subgraphs.
|
Object |
getTo(Object link)
Returns the destination node of a link.
|
IlvTransformer |
getTransformer()
Returns the internal transformer.
|
IlvTransformer |
getTransformer(IlvGraphModel subgraphModel)
Returns the transformer that allows you to convert the coordinate
system of the graph model of a subgraph to the coordinate system of
this graph model.
|
boolean |
hasMoveableConnectionPoint(Object link,
boolean origin)
Returns
true if the connection point of link
on the origin or destination node can be moved by a call to the
method reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean) . |
boolean |
hasPinnedConnectionPoint(Object link,
boolean origin)
Returns
true if the connection point of link
on the origin or destination node is "pinned," and false
otherwise. |
void |
inverseTransform(IlvPoint p)
Inverse transforms a point.
|
void |
inverseTransform(IlvRect r)
Inverse transforms a rectangle.
|
boolean |
isInterGraphLink(Object obj)
Returns
true if the object is a valid intergraph link,
and false otherwise. |
boolean |
isLink(Object obj)
Returns
true if the object is a valid normal link, and
false otherwise. |
boolean |
isNode(Object obj)
Returns
true if an object is a valid node, and
false otherwise. |
boolean |
isReshapeableLink(Object link,
boolean toStraightLine)
Returns
true if link can be reshaped, and
false otherwise. |
boolean |
isSubgraph(Object obj)
Returns
true if the object is a valid subgraph, and
false otherwise. |
boolean |
loadParametersFromNamedProperties(IlvGraphLayout layout)
Transfers the layout parameter settings from the named properties of
the grapher back to the layout instance.
|
boolean |
loadParametersFromNamedProperties(IlvGraphLayout layout,
String propertyPrefix)
Transfers the layout parameter settings from the named properties of
the grapher back to the layout instance.
|
IlvGraphLayout |
loadParametersFromNamedProperties(String propertyPrefix)
Transfers the layout parameter settings from the named properties of
the grapher back to a new layout instance.
|
boolean |
loadPreferredLayoutsFromNamedProperties(IlvDefaultLayoutProvider layoutProvider,
boolean withParameters,
boolean traverse)
Loads the preferred layout settings from the named properties of the
grapher into an
IlvDefaultLayoutProvider . |
void |
moveNode(Object node,
double x,
double y,
boolean redraw)
Changes the position of the specified node.
|
void |
removeParametersFromNamedProperties()
Removes all named properties that were used to store the graph layout
parameter settings from the grapher.
|
void |
removeParametersFromNamedProperties(Class layoutClass)
Removes the named properties that were used to store the graph layout
parameter settings from the grapher.
|
void |
removeParametersFromNamedProperties(String propertyPrefix)
Removes the named properties that were used to store the graph layout
parameter settings from the grapher.
|
void |
reshapeLink(Object link,
IlvPoint fromPoint,
IlvPoint[] points,
int startIndex,
int length,
IlvPoint toPoint,
boolean redraw)
Reshapes all the points of a link, given an array of intermediate
points, the start position in the array of points, the number of
intermediate points, and the connection points.
|
String |
saveParametersToNamedProperties(IlvGraphLayout layout,
boolean withDefaults)
Transfers the layout parameter settings to named properties of the
grapher.
|
String |
saveParametersToNamedProperties(IlvGraphLayout layout,
String propertyPrefix,
boolean withDefaults)
Transfers the layout parameter settings to named properties of the
grapher.
|
boolean |
savePreferredLayoutsToNamedProperties(IlvDefaultLayoutProvider layoutProvider,
boolean withParameters,
boolean withDefaults,
boolean traverse)
Transfers the preferred layout settings to named properties of the
grapher.
|
void |
setConnectionPointCheckEnabled(boolean enable)
Enables or disables the checks of the connection points of the links
on the origin or destination node.
|
void |
setLinkCheckEnabled(boolean enable)
Enables or disables the checks of the links.
|
void |
setPreferredLayoutPropertyPrefix(String propertyPrefix)
Sets the property name of the preferred layout.
|
void |
setProperty(Object nodeOrLink,
String key,
Object value)
Sets the value of a property for a node or a link.
|
void |
setProperty(String key,
Object value)
Sets the value of a property for the graph model.
|
void |
setTransformer(IlvTransformer t)
Sets the internal transformer.
|
void |
transform(IlvPoint p)
Transforms a point.
|
void |
transform(IlvRect r)
Transforms a rectangle.
|
addGraphModelListener, adjustmentEnd, afterAttach, afterDetach, boundingBox, fireGraphModelEvent, fireGraphModelEvent, geometryChanged, getInstanceId, getLayout, getLayouts, getLinks, getLinksCount, getNeighbors, getNodeDegree, getNodesAndLinks, getOpposite, getOriginatingLayout, getRootModel, isConnectionPointCheckEnabled, isInternalGraphModelChecking, isLayoutNeeded, isLinkBetween, isLinkCheckEnabled, move, performLayout, performLayout, removeGraphModelListener, setInternalGraphModelChecking, structureChanged
public IlvRotatedGraphModel(IlvGraphModel model, boolean owned, IlvTransformer t)
model
- The original graph model.owned
- Whether the original graph model is owned by this model. If
true
, then the original graph model is disposed when
this graph model is disposed.t
- The transformer applied to all coordinates.public IlvRotatedGraphModel(IlvGraphModel model, boolean owned, IlvPoint center, double angle)
model
- The original graph model.owned
- Whether the original graph model is owned by this model. If
true
, then the original graph model is disposed when
this graph model is disposed.center
- The center point of the rotation.angle
- The rotation angle in degrees.public IlvGraphModel getOriginalGraphModel()
public IlvTransformer getTransformer()
public void setTransformer(IlvTransformer t)
public void transform(IlvPoint p)
public void inverseTransform(IlvPoint p)
public void transform(IlvRect r)
public void inverseTransform(IlvRect r)
public void dispose()
IlvGraphModel
and releases any resources
that it is using. An IlvGraphModel
object cannot be used
after the dispose
method has been called. If there are
any layouts still attached, they get automatically detached from the
graph model. The method recursively disposes of this graph model and
all its graph model children (if any).dispose
in class IlvGraphModel
IlvGraphLayout.detach()
public IlvGrapher getGrapher()
IlvGrapher
that stores the nodes and links of the
graph. It returns null
if the nodes and links are not
stored by the JViews grapher class (IlvGrapher
).
The default implementation always returns null
. The
method is overridden in the class IlvGrapherAdapter
.
getGrapher
in interface IlvGrapherPropertyAdapter
getGrapher
in class IlvGraphModel
public IlvGraphModel getParentModel()
null
.getParentModel
in class IlvGraphModel
null
.getGraphModel(java.lang.Object)
,
IlvGraphModel.getRootModel()
public IlvGraphModel getGraphModel(Object subgraph)
The typical way to deal with nested graphs is the following:
getGraphModel(subgraph)
on the root graph model. If a
graph model has already been created for a subgraph, the graph model
is returned. Otherwise, a new instance of a graph model is created by
calling createGraphModel(java.lang.Object)
on the root graph model.
getGraphModel
in class IlvGraphModel
subgraph
- The subgraph object. This is an object for which the
method isSubgraph(java.lang.Object)
, called on the parent graph model of the
returned graph model, returns true
. This must not be
the root graph.subgraph
.IlvGraphModel.getRootModel()
protected IlvGraphModel createGraphModel(Object subgraph)
Subclasses must override this method in order to return a new
instance of the appropriate subclass of IlvGraphModel
,
encapsulating subgraph
.
createGraphModel
in class IlvGraphModel
subgraph
- The subgraph object.public IlvTransformer getTransformer(IlvGraphModel subgraphModel)
null
to indicate that both
graph models use the same coordinate system.
The default implementation always returns null
.
getTransformer
in class IlvGraphModel
public void beforeLayout(IlvGraphLayout layout, boolean redraw)
IlvGraphLayout.performLayout()
before the call to the method IlvGraphLayout.layout(boolean)
.
If necessary, you can override this method in order to perform
preliminary operations before the layout. In this case, you must
always call super.beforeLayout
.
beforeLayout
in class IlvGraphModel
layout
- The layout instance that is the origin of the
notification.redraw
- If true
, the layout algorithm will ask the
graph model to redraw the graph when the method
afterLayout
is called (that is, it will pass
true
for its redraw
argument).afterLayout(ilog.views.graphlayout.IlvGraphLayout, ilog.views.graphlayout.IlvGraphLayoutReport, boolean)
public void afterLayout(IlvGraphLayout layout, IlvGraphLayoutReport layoutReport, boolean redraw)
IlvGraphLayout.performLayout()
after
the method IlvGraphLayout.layout(boolean)
has finished, even if an
exception is thrown during the layout process.
Note that you can detect whether the layout was performed
successfully using the test layoutReport.getCode() ==
IlvGraphLayoutReport.LAYOUT_DONE
.
If necessary, you can override this method in order to perform some
operations after the layout. In this case, you must always call
super.afterLayout
. Note also that any overridden
implementation of this method should redraw the graph if the argument
redraw
is true
.
afterLayout
in class IlvGraphModel
layout
- The layout instance that is the origin of the
notification.layoutReport
- The layout report, or null
.redraw
- If true
, the layout algorithm asks the graph
model to redraw the graph.beforeLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
public void beforeAnimationStep()
The default implementation does nothing. If necessary, you can override this method in order to perform preliminary operations before the animation step.
beforeAnimationStep
in class IlvGraphModel
afterAnimationStep()
public void afterAnimationStep()
The default implementation does nothing. To support the animation mechanism, this method can be overridden by an adapter to redraw the graph after each step of the layout.
afterAnimationStep
in class IlvGraphModel
beforeAnimationStep()
public Enumeration getNodes()
getNodes
in class IlvGraphModel
isNode(java.lang.Object)
,
getNodesCount()
,
getLinks()
,
IlvGraphModel.getNodesAndLinks()
public int getNodesCount()
getNodes()
.getNodesCount
in class IlvGraphModel
getNodes()
public Enumeration getLinks()
getLinks
in class IlvGraphModel
isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
,
getLinksCount()
,
getNodes()
,
IlvGraphModel.getNodesAndLinks()
public int getLinksCount()
getLinks()
.getLinksCount
in class IlvGraphModel
getLinks()
,
getLinksFromCount(java.lang.Object)
,
getLinksToCount(java.lang.Object)
public Enumeration getSubgraphs()
isNode(java.lang.Object)
returns
true
.getSubgraphs
in class IlvGraphModel
isSubgraph(java.lang.Object)
,
getSubgraphsCount()
,
getNodes()
,
getLinks()
public int getSubgraphsCount()
getSubgraphs()
.getSubgraphsCount
in class IlvGraphModel
getSubgraphs()
public Enumeration getInterGraphLinks()
getInterGraphLinks
in class IlvGraphModel
isInterGraphLink(java.lang.Object)
,
getInterGraphLinksCount()
public int getInterGraphLinksCount()
The default implementation simply counts the number of objects as
returned by the method getInterGraphLinks()
.
getInterGraphLinksCount
in class IlvGraphModel
getInterGraphLinks()
public Enumeration getLinksFrom(Object node)
node
as
their origin. This enumeration must not contain intergraph links,
that is, links whose origin or destination node is not stored in this
graph.getLinksFrom
in class IlvGraphModel
node
- The origin node.isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
,
getLinksTo(java.lang.Object)
,
IlvGraphModel.getLinks(java.lang.Object)
public int getLinksFromCount(Object node)
node
as their
origin. The default implementation simply counts the number of links
returned by the method getLinksFrom
.getLinksFromCount
in class IlvGraphModel
node
- The node.getLinksFrom(java.lang.Object)
public Enumeration getLinksTo(Object node)
node
as
their destination. This enumeration must not contain intergraph
links, that is, links whose origin or destination node is not stored
in this graph.getLinksTo
in class IlvGraphModel
node
- The destination node.isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
,
getLinksFrom(java.lang.Object)
,
IlvGraphModel.getLinks(java.lang.Object)
public int getLinksToCount(Object node)
node
as their
destination. The default implementation simply counts the number of
links returned by the method getLinksTo
.getLinksToCount
in class IlvGraphModel
node
- The node.getLinksTo(java.lang.Object)
public Object getFrom(Object link)
This method must work for normal links and for intergraph links.
Notice that for intergraph links, the returned node may not be a node
of this graph model (that is, isNode(java.lang.Object)
may return
false
).
getFrom
in class IlvGraphModel
isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public Object getTo(Object link)
This method must work for normal links and for intergraph links.
Notice that for intergraph links, the returned node may not be a node
of this graph model (that is, isNode(java.lang.Object)
may return
false
).
getTo
in class IlvGraphModel
isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public boolean isNode(Object obj)
true
if an object is a valid node, and
false
otherwise.
Note that an object can be both a node and a graph; therefore, both
this method and isSubgraph(java.lang.Object)
can return true
for
the same object.
isNode
in class IlvGraphModel
obj
- The object to test.public boolean isLink(Object obj)
true
if the object is a valid normal link, and
false
otherwise.
The method must return false
for intergraph links.
isLink
in class IlvGraphModel
obj
- The object to test.isInterGraphLink(java.lang.Object)
public boolean isInterGraphLink(Object obj)
true
if the object is a valid intergraph link,
and false
otherwise. An intergraph link is a link stored
in a given graph that has an origin or destination not stored in this
graph.isInterGraphLink
in class IlvGraphModel
obj
- The object to test.isLink(java.lang.Object)
,
IlvGrapherAdapter.isInterGraphLink(java.lang.Object)
public boolean isSubgraph(Object obj)
true
if the object is a valid subgraph, and
false
otherwise. A subgraph is a node of this graph
model (that is isNode(java.lang.Object)
must return true
) that
represents a graph nested inside this graph. The method getGraphModel(java.lang.Object)
is applied to subgraphs when performing a nested
layout.
isSubgraph
in class IlvGraphModel
obj
- The object to test.public void setProperty(Object nodeOrLink, String key, Object value)
value
is null
, the property is removed.
Otherwise, the property value is set to value
. The
method must work for normal links and intergraph links.
The default implementation uses an internal data structure to store the binding between the node or link, the value of the property, and its key.
setProperty
in class IlvGraphModel
nodeOrLink
- The node or link for which the property is to be set.key
- The key string for the property.value
- The new value of the property.getProperty(java.lang.Object, java.lang.String)
public Object getProperty(Object nodeOrLink, String key)
null
if the property does not exist. The method must work for normal links
and intergraph links.
getProperty
in class IlvGraphModel
nodeOrLink
- The node or link for which the property is to be
retrieved.key
- The key string for the property.setProperty(java.lang.Object, java.lang.String, java.lang.Object)
public void setProperty(String key, Object value)
value
is null
, the property is removed.
Otherwise, the property value is set to value
. The
default implementation uses an internal data structure to store the
binding between the node or link, the value of the property, and its
key.setProperty
in class IlvGraphModel
key
- The key string for the property.value
- The new value of the property.getProperty(java.lang.Object, java.lang.String)
public Object getProperty(String key)
null
if the property does not exist.getProperty
in class IlvGraphModel
key
- The key string for the property.setProperty(java.lang.Object, java.lang.String, java.lang.Object)
public void moveNode(Object node, double x, double y, boolean redraw)
x
and
y
coordinates correspond to the top-left corner of the
rectangle that defines the node (see also the method boundingBox(Object)
).moveNode
in class IlvGraphModel
node
- The node.x
- The new x
position of the node.y
- The new y
position of the node.redraw
- If true
, the node is redrawn.public IlvRect boundingBox(Object nodeOrLink)
Note that the IlvRect
object that is returned by this
method may be modified by internal methods of JViews.
boundingBox
in class IlvGraphModel
public int getLinkPointsCount(Object link)
getLinkPointsCount
in class IlvGraphModel
isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public IlvPoint[] getLinkPoints(Object link)
getLinkPointsCount(link) - 1
must
correspond to the connection point of the link on the destination
node.
A link must always have at least two points, corresponding to the connection points. Therefore, the length of the array returned by this method must be at least 2. The method must work for normal links and intergraph links.
getLinkPoints
in class IlvGraphModel
isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public IlvPoint getLinkPointAt(Object link, int index)
The default implementation returns the point at the specified index
in the array returned by the method getLinkPoints
.
getLinkPointAt
in class IlvGraphModel
link
- The link.index
- The index of the point on the polyline link.isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public void setLinkCheckEnabled(boolean enable)
If enabled, when the method reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
receives a
non-null
argument for the array of intermediate points
(or its length is 0
), it checks whether the link can be
reshaped using the method isReshapeableLink(java.lang.Object, boolean)
.
The default value is true
. The checks can be disabled to
avoid the extra overhead cost when it is known that appropriate link
types are used.
public void setConnectionPointCheckEnabled(boolean enable)
If enabled, when the method reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
receives a
non-null
argument for the connection point on the origin
and/or destination node, it checks whether the corresponding
connection point can be moved using the method hasMoveableConnectionPoint(java.lang.Object, boolean)
.
The default value is true
. The checks can be disabled to
avoid the extra overhead cost when it is known that the connection
points can be freely moved.
public void reshapeLink(Object link, IlvPoint fromPoint, IlvPoint[] points, int startIndex, int length, IlvPoint toPoint, boolean redraw) throws IlvInappropriateLinkException
If the new shape of the link must be a straight-line link without any
intermediate points, call the method with null
for the
points
argument. The values of the arguments
startIndex
and length
are ignored.
If the connection point on the origin and/or destination node should
not be moved, call the method with null
for the
fromPoint
and/or toPoint
arguments.
The implementation of this method must use the methods isReshapeableLink(java.lang.Object, boolean)
and hasMoveableConnectionPoint(java.lang.Object, boolean)
to verify
whether it is able to perform the requested operation. See the
methods setLinkCheckEnabled(boolean)
and setConnectionPointCheckEnabled(boolean)
. (The overridden version of this
method in IlvGrapherAdapter
optionally performs these checks.
For details, see IlvGrapherAdapter.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
.)
reshapeLink
in class IlvGraphModel
link
- The link to be reshaped.fromPoint
- The connection point of the link on the origin node.points
- The array of intermediate points, or null
for
straight links.startIndex
- The starting position in the array of points.length
- The number of intermediate points.toPoint
- The connection point of the link on the destination node.redraw
- If true
, the link is redrawn.IlvInappropriateLinkException
- if the type of link is not
appropriate for this reshape operation (see setLinkCheckEnabled(boolean)
and setConnectionPointCheckEnabled(boolean)
).isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public boolean isReshapeableLink(Object link, boolean toStraightLine)
true
if link
can be reshaped, and
false
otherwise. The method must work for normal links
and intergraph links.
If the argument toStraightLine
is true
, the
method returns true
for any link that can be reshaped to
a straight line. Otherwise it returns false
.
If the argument toStraightLine
is false
,
the method returns true
for any link that can be
reshaped to a polyline (or a spline) with intermediate points.
Otherwise it returns false
.
The default implementation always returns true
. The
method is overridden in the class IlvGrapherAdapter
.
public boolean hasMoveableConnectionPoint(Object link, boolean origin)
true
if the connection point of link
on the origin or destination node can be moved by a call to the
method reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
. It returns false
if such a
call may fail to set the connection point to the argument passed to
reshapeLink
. The method must work for normal links and
intergraph links.
The default implementation always returns true
. The
method is overridden in the class IlvGrapherAdapter
.
hasMoveableConnectionPoint
in class IlvGraphModel
link
- The link.origin
- Set to true
if the connection point is on the
origin and false
otherwise.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
,
hasPinnedConnectionPoint(java.lang.Object, boolean)
public boolean hasPinnedConnectionPoint(Object link, boolean origin)
true
if the connection point of link
on the origin or destination node is "pinned," and false
otherwise. The connection point is said to be "pinned" if its
location is fixed with respect to the bounding box of the
corresponding origin or destination node of the link.
The method must work for normal links and intergraph links.
The default implementation always returns false
. The
method is overridden in the class IlvGrapherAdapter
.
hasPinnedConnectionPoint
in class IlvGraphModel
link
- The link.origin
- Set to true
if the connection point is on the
origin and false
otherwise.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
,
hasMoveableConnectionPoint(java.lang.Object, boolean)
public double getLinkWidth(Object link)
1
. The method must work for normal links and intergraph
links.getLinkWidth
in class IlvGraphModel
public String saveParametersToNamedProperties(IlvGraphLayout layout, boolean withDefaults)
IlvGrapherPropertyAdapter
.
If you want to store layout parameter settings into .ivl
files, this method should be called before IlvGrapher.write(ilog.views.io.IlvOutputStream)
.
It creates objects of class IlvGraphLayoutGrapherProperty
,
IlvGraphLayoutNodeProperty
, and IlvGraphLayoutLinkProperty
, stores the layout parameter settings in
these objects, and adds the objects as persistent named properties
with a unique property name to the grapher.
The named properties contain a copy of the parameter settings. It is
possible to save the parameter settings, change the parameters
temporarily in the working instance of layout, and restore the saved
values later using the method loadParametersFromNamedProperties(ilog.views.graphlayout.IlvGraphLayout)
. This can be nested, because the
last saved parameters are loaded first.
To avoid wasting memory, it is recommended that you remove the properties when they are no longer needed, for example, immediately after writing to a file or to an output stream. It is possible to transfer and store the parameter settings of multiple layouts at the same time. The typical calling sequence to save a grapher with layout parameter settings for some attached layouts is:
if (layout1.supportsSaveParametersToNamedProperties()) rotatedGraphModel.saveParametersToNamedProperties(layout1, false); if (layout2.supportsSaveParametersToNamedProperties()) rotatedGraphModel.saveParametersToNamedProperties(layout2, false); if (layout3.supportsSaveParametersToNamedProperties()) rotatedGraphModel.saveParametersToNamedProperties(layout3, false); ... rotatedGraphModel.getGrapher().write("abcd.ivl"); rotatedGraphModel.removeParametersFromNamedProperties();
If false
is passed for the argument
withDefaults
, the layout properties are persistent only
if they contain parameters that are not default values. As a result,
the .ivl
files will be smaller. If true
is
passed for the argument withDefaults
, the layout
properties are always persistent, and the default values of the
layout parameter settings are also written to files by the next call
of IlvGrapher.write(ilog.views.io.IlvOutputStream)
.
If the input layout does not support saving parameters to named
properties, a RuntimeException
is thrown.
saveParametersToNamedProperties
in interface IlvGrapherPropertyAdapter
layout
- The layout instance to be saved. It should be attached to
this grapher adapter.withDefaults
- If true
, the layout properties are
always persistent. If false
, they are persistent only
if nondefault parameter settings exist (that is, if the property is
saved to an .ivl
file, the default parameter settings
are not saved).loadParametersFromNamedProperties(ilog.views.graphlayout.IlvGraphLayout)
,
removeParametersFromNamedProperties()
,
IlvGraphLayout.supportsSaveParametersToNamedProperties()
,
IlvNamedProperty
public String saveParametersToNamedProperties(IlvGraphLayout layout, String propertyPrefix, boolean withDefaults)
IlvGrapherPropertyAdapter
. The name for the
properties is generated from the propertyPrefix
and the
layout instance. This method is used internally to recursively
transfer the parameters of sublayout instances of a parent layout to
properties.
If the input layout does not support saving parameters to named
properties, a RuntimeException
is thrown.
saveParametersToNamedProperties
in interface IlvGrapherPropertyAdapter
layout
- The layout instance to be saved. It should be attached to
this grapher adapter.propertyPrefix
- The prefix of the generated unique property name
that is used to store the layout properties.withDefaults
- If true
, the layout properties are
always persistent. If false
, they are persistent only
if nondefault parameter settings exist (that is, if the the
property is saved to an .ivl
file, the default
parameter settings are not saved).saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGraphLayout.supportsSaveParametersToNamedProperties()
public boolean savePreferredLayoutsToNamedProperties(IlvDefaultLayoutProvider layoutProvider, boolean withParameters, boolean withDefaults, boolean traverse)
IlvGrapherPropertyAdapter
.
If you want to store preferred layout settings into .ivl
files, this method should be called before IlvGrapher.write(ilog.views.io.IlvOutputStream)
.
It creates objects of class IlvGraphLayoutGrapherProperty
,
IlvGraphLayoutNodeProperty
, and IlvGraphLayoutLinkProperty
, stores the preferred layout settings in
these objects, and adds the objects as persistent named properties
with a unique property name to the grapher.
If false
is passed for the argument
withParameters
, the parameters of the preferred layouts
are not saved. Otherwise, the preferred layouts are saved with their
parameters.
If false
is passed for the argument
withDefaults
, the layout properties are persistent only
if they contain parameters that are not default values. As a result,
the .ivl
files will be smaller. If true
is
passed for the argument withDefaults
, the layout
properties are always persistent, and the default values of the
layout parameter settings are also written to files by the next call
of IlvGrapher.write(ilog.views.io.IlvOutputStream)
.
If the input layout does not support saving parameters to named
properties, a RuntimeException
is thrown.
savePreferredLayoutsToNamedProperties
in interface IlvGrapherPropertyAdapter
layoutProvider
- The layout provider into which the choices of the
preferred layouts for each graph and subgraph were stored.withParameters
- If true
, the parameters of the
preferred layouts are also stored. If false
, only the
name of the class of the preferred layout is saved.withDefaults
- If true
, the layout parameters are
always persistent. If false
, they are persistent only
if nondefault parameter settings exist (that is, if the the
property is saved to an .ivl
file, the default
parameter settings are not saved). This parameter has no effect if
the parameter withParameters
is false
.traverse
- If true
, the method applies recursively to
the subgraphs. Otherwise, the method applies only to this
IlvGraphModel
true
if the preferred layout for at least one
subgraph or the root graph has been saved, and false
otherwise.loadPreferredLayoutsFromNamedProperties(ilog.views.graphlayout.IlvDefaultLayoutProvider, boolean, boolean)
,
IlvGraphLayout.PerformLayout(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider, boolean, boolean, boolean)
,
IlvGraphModel.performLayout(ilog.views.graphlayout.IlvLayoutProvider, boolean, boolean, boolean)
public boolean loadParametersFromNamedProperties(IlvGraphLayout layout)
IlvGrapherPropertyAdapter
.
If you stored layout parameter settings into .ivl
files
using the method saveParametersToNamedProperties(ilog.views.graphlayout.IlvGraphLayout, boolean)
and want to
load them again, this method should be called after IlvManager.read(java.io.InputStream)
. It searches for a set of layout parameter
properties that matches the class of the input layout, transfers the
parameters to the layout instance, and removes this set of named
layout properties from the grapher.
If multiple settings of parameters of different layout classes
were saved, it loads the setting that fits the input layout class
(for instance, it loads the tree layout settings if the input class
is IlvTreeLayout
). If multiple settings of parameters of
the same layout class were saved, it loads the setting that
was last saved by implementing the stack principle (the last-in,
first-out principle).
The typical calling sequence to read a grapher with layout parameter settings for some attached layouts is:
rotatedGraphModel.getGrapher().read("abcd.ivl"); rotatedGraphModel.loadParametersFromNamedProperties(layout1); rotatedGraphModel.loadParametersFromNamedProperties(layout2); rotatedGraphModel.loadParametersFromNamedProperties(layout3); ... rotatedGraphModel.removeParametersFromNamedProperties();In this example, the final call of
removeParametersFromNamedProperties
is recommended to
avoid wasting memory when it is not known whether all layout
properties were loaded.
loadParametersFromNamedProperties
in interface IlvGrapherPropertyAdapter
layout
- The layout instance whose parameters are to be loaded. It
should be attached to this grapher adapter.true
if layout parameters for the input layout were
stored in named properties of the grapher, false
otherwise.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
removeParametersFromNamedProperties()
,
IlvGraphLayoutGrapherProperty.transfer(ilog.views.graphlayout.IlvGraphLayout)
,
IlvGraphLayoutNodeProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
,
IlvGraphLayoutLinkProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
public boolean loadParametersFromNamedProperties(IlvGraphLayout layout, String propertyPrefix)
IlvGrapherPropertyAdapter
.
It searches for a set of layout parameter properties that has the property prefix string in the property name. It transfers the parameters to the layout instance and removes this set of named layout properties from the grapher.
This method can also be used when the property prefix string is the full property name.
loadParametersFromNamedProperties
in interface IlvGrapherPropertyAdapter
layout
- The layout instance whose parameters are to be loaded. It
should be attached to this grapher adapter.propertyPrefix
- The prefix of the unique property name that was
used to store the layout properties.true
if layout parameters for the input layout were
stored in named properties of the grapher, false
otherwise.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGraphLayoutGrapherProperty.transfer(ilog.views.graphlayout.IlvGraphLayout)
,
IlvGraphLayoutNodeProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
,
IlvGraphLayoutLinkProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
public IlvGraphLayout loadParametersFromNamedProperties(String propertyPrefix)
IlvGrapherPropertyAdapter
. It returns the new layout instance that
will be attached to this grapher adapter.
It searches for a set of layout parameter properties that has the property prefix string in the property name. If a corresponding set of properties is found, it creates a new layout instance that fits the layout properties, transfers the parameters to the new layout instance, and removes this set of named layout properties from the grapher.
This method can be used when the property prefix string is the full
property name. However, it cannot be used if this grapher adapter was
internally created during IlvGraphLayout.attach(IlvGrapher)
.
It can only be used if this grapher adapter was explicitly allocated.
Note that the method throws a RuntimeException
in the
following cases:
IlvGraphLayout.attach(IlvGrapher)
.
loadParametersFromNamedProperties
in interface IlvGrapherPropertyAdapter
propertyPrefix
- The prefix of the unique property name that was
used to store the layout properties.null
if the parameters are not
loaded.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGraphLayoutGrapherProperty.transfer(ilog.views.graphlayout.IlvGraphLayout)
,
IlvGraphLayoutNodeProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
,
IlvGraphLayoutLinkProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
public boolean loadPreferredLayoutsFromNamedProperties(IlvDefaultLayoutProvider layoutProvider, boolean withParameters, boolean traverse)
IlvDefaultLayoutProvider
. This works
only if the encapsulated graph model is an instance of IlvGrapherPropertyAdapter
.
Notice that this method first calls the method IlvDefaultLayoutProvider.detachLayouts(ilog.views.graphlayout.IlvGraphModel, boolean)
on
layoutProvider
, passing as arguments this adapter and
traverse
. This ensures that any layout instance that may
have been previously specified as the preferred layout for
layoutProvider
gets removed from the provider and the
corresponding graphs are detached from these layout instances.
Note that, if the layout instance is null
, the method
throws a RuntimeException
in the following cases:
loadPreferredLayoutsFromNamedProperties
in interface IlvGrapherPropertyAdapter
layoutProvider
- The layout provider into which the choices of the
preferred layouts for each graph and subgraph are stored.withParameters
- If true
, the parameters of the
preferred layouts are also read (if any). If false
,
the preferred layout instance keeps its default settings.traverse
- If true
, the method applies recursively to
the subgraphs. Otherwise, the method applies only to this
IlvGraphModel
true
if layout parameters for at least one of the
input layout were loaded from named properties of the grapher,
false
otherwise.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGraphLayoutGrapherProperty.transfer(ilog.views.graphlayout.IlvGraphLayout)
,
IlvGraphLayoutNodeProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
,
IlvGraphLayoutLinkProperty.transfer(ilog.views.graphlayout.IlvGraphLayout, ilog.views.IlvGraphic)
,
savePreferredLayoutsToNamedProperties(ilog.views.graphlayout.IlvDefaultLayoutProvider, boolean, boolean, boolean)
,
IlvGraphLayout.PerformLayout(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider, boolean, boolean, boolean)
,
IlvGraphModel.performLayout(IlvLayoutProvider, boolean, boolean, boolean)
public void removeParametersFromNamedProperties()
IlvGrapherPropertyAdapter
.
removeParametersFromNamedProperties
in interface IlvGrapherPropertyAdapter
saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGraphLayoutGrapherProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
,
IlvGraphLayoutNodeProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
,
IlvGraphLayoutLinkProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
public void removeParametersFromNamedProperties(String propertyPrefix)
IlvGrapherPropertyAdapter
. It removes only those layout properties
that have the property prefix string in the property name.
This method can also be used when the property prefix string is the full property name.
removeParametersFromNamedProperties
in interface IlvGrapherPropertyAdapter
propertyPrefix
- The prefix of the unique property name that was
used to store the layout properties.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGraphLayoutGrapherProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
,
IlvGraphLayoutNodeProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
,
IlvGraphLayoutLinkProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
public void removeParametersFromNamedProperties(Class layoutClass)
IlvGrapherPropertyAdapter
. It removes only those layout properties
that fit the input layout class. For instance, if the input class is
IlvTreeLayout
, it removes all layout properties that are
related to the Tree Layout.
removeParametersFromNamedProperties
in interface IlvGrapherPropertyAdapter
layoutClass
- The layout class.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGraphLayoutGrapherProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
,
IlvGraphLayoutNodeProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
,
IlvGraphLayoutLinkProperty.dispose(ilog.views.graphlayout.IlvGrapherPropertyAdapter)
public void setPreferredLayoutPropertyPrefix(String propertyPrefix)
IlvGrapherPropertyAdapter
. This can be used after the layout
parameters were saved as named properties. Example:
if (layout.supportsSaveParametersToNamedProperties()) { property = rotatedGraphModel.saveParametersToNamedProperties(layout, false); rotatedGraphModel.setPreferredLayoutPropertyPrefix(property); } ... rotatedGraphModel.getGrapher().write("abcd.ivl"); rotatedGraphModel.removeParametersFromNamedProperties();If the file is loaded and the parameters are transfered to a default layout provider later, it will take this layout as the preferred layout.
setPreferredLayoutPropertyPrefix
in interface IlvGrapherPropertyAdapter
propertyPrefix
- The prefix of the unique property name that was
used to store the layout properties.getPreferredLayoutPropertyPrefix()
,
savePreferredLayoutsToNamedProperties(ilog.views.graphlayout.IlvDefaultLayoutProvider, boolean, boolean, boolean)
,
loadPreferredLayoutsFromNamedProperties(ilog.views.graphlayout.IlvDefaultLayoutProvider, boolean, boolean)
public String getPreferredLayoutPropertyPrefix()
null
if no preferred layout was stored. This works only
if the encapsulated graph model is an instance of IlvGrapherPropertyAdapter
.getPreferredLayoutPropertyPrefix
in interface IlvGrapherPropertyAdapter
setPreferredLayoutPropertyPrefix(java.lang.String)
public String getLayoutPropertyPrefix(IlvGraphLayout layout)
null
if the layout was
never stored. This works only if the encapsulated graph model is an
instance of IlvGrapherPropertyAdapter
.
This method can be used to retrieve the property name before loading the parameters into the layout instance in order to test whether the layout should be the preferred layout.
getLayoutPropertyPrefix
in interface IlvGrapherPropertyAdapter
layout
- The layout.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
loadParametersFromNamedProperties(IlvGraphLayout)
,
getPreferredLayoutPropertyPrefix()
public IlvNodeBoxInterface getNodeBoxInterface(IlvNodeBoxInterface ifc)
ifc
- The node box interface with respect to the original model.public IlvLinkConnectionBoxInterface getLinkConnectionBoxInterface(IlvLinkConnectionBoxInterface ifc)
ifc
- The link connection box interface with respect to the
original model.public IlvLinkClipInterface getLinkClipInterface(IlvLinkClipInterface ifc)
ifc
- The link clip interface with respect to the original model.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.