public class IlvGrapherAdapter extends IlvGraphModel implements IlvGrapherPropertyAdapter
IlvGrapherAdapter
encapsulates an IlvGrapher
and provides a bridge between the API of the IlvGrapher
and the API of the IlvGraphModel
.
IlvGrapherAdapter
is a concrete subclass of
IlvGraphModel
that allows an IlvGrapher
to
be laid out using the layout algorithms provided in JViews. It
provides an implementation for all the abstract methods of
IlvGraphModel
. It also provides overridden implementation
of some non-abstract methods of IlvGraphModel
, in order
to improve the efficiency by taking advantage of the particularities
of the IlvGrapher
.
If an application uses the class IlvGrapher
, the grapher
can be attached directly to the layout instance without explicitly
using a graph model (see the method IlvGraphLayout.attach(IlvGrapher)
. In this case, an
IlvGrapherAdapter
will be internally created. This
adapter can be retrieved using the method IlvGraphLayout.getGraphModel()
, which will return an instance of
IlvGrapherAdapter
.
Note that you must call the method IlvGraphModel.dispose()
when you no longer
need the adapter instance; otherwise, some objects may not be garbage
collected. This is necessary only if the adapter instance is directly
created by your code. Calling IlvGraphModel.dispose()
is not necessary if the
adapter instance is created internally by the JViews Graph Layout
library, for instance, when directly attaching an
IlvGrapher
to a layout instance using IlvGraphLayout.attach(IlvGrapher)
or when using an IlvDefaultLayoutProvider
for recursive layout.
Constructor and Description |
---|
IlvGrapherAdapter(IlvGrapher grapher)
Creates a new adapter for a given
IlvGrapher . |
Modifier and Type | Method and Description |
---|---|
void |
addLayer(IlvManagerLayer layer)
Adds a manager layer to the list of layers to be used during the
layout.
|
void |
afterAnimationStep()
Notifies the grapher adapter that a layout animation step has
finished.
|
void |
afterLayout(IlvGraphLayout layout,
IlvGraphLayoutReport layoutReport,
boolean redraw)
Notifies the grapher adapter that a layout session has finished.
|
void |
beforeAnimationStep()
Notifies the grapher adapter that a layout animation step has been
started.
|
void |
beforeLayout(IlvGraphLayout layout,
boolean redraw)
Notifies the grapher adapter that a layout session has been started.
|
IlvRect |
boundingBox(Object nodeOrLink)
Returns the bounding box of a node or a link.
|
protected IlvGraphModel |
createGraphModel(Object subgraph)
Creates a new
IlvGrapherAdapter for a subgraph. |
int |
getAnimationRedrawMode()
Returns the redraw mode that is used during animation.
|
int |
getCoordinatesMode()
Returns the current coordinates mode.
|
IlvLayoutGraphicFilter |
getFilter()
Returns the filter (if any).
|
Object |
getFrom(Object link)
Returns the origin node of a link.
|
IlvGrapher |
getGrapher()
Returns the
IlvGrapher encapsulated by the adapter. |
Enumeration |
getInterGraphLinks()
Returns the intergraph links contained in this graph.
|
int |
getInterGraphLinksCount()
Returns the number of intergraph links contained in this graph.
|
Enumeration |
getLayers()
Returns an enumeration of the manager layers to be taken into account
during the layout.
|
int |
getLayersCount()
Returns the number of manager layers to be taken into account during
the layout.
|
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. |
Comparator |
getLinkComparator()
Returns the comparator used for sorting the links.
|
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 of a link.
|
Enumeration |
getLinks()
Returns an enumeration of the links (excluding intergraph links).
|
int |
getLinksCount(Object node)
Returns the number of links adjacent to
node . |
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
origin. |
double |
getLinkWidth(Object link)
Returns the width of the link.
|
Enumeration |
getNeighbors(Object node)
Returns an enumeration of all the nodes that are the "neighbors" of
node , in other words, the nodes that have a common
normal link with node . |
Comparator |
getNodeComparator()
Returns the comparator used for sorting the nodes.
|
Enumeration |
getNodes()
Returns an enumeration of the nodes.
|
Enumeration |
getNodesAndLinks()
Returns an enumeration of the nodes and links (excluding intergraph
links).
|
Object |
getOpposite(Object link,
Object node)
Returns the opposite node of a link.
|
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.
|
IlvTransformer |
getReferenceTransformer()
Returns the transformer to be taken into account.
|
IlvManagerView |
getReferenceView()
Returns the specified reference view (if any) and
null
otherwise. |
Enumeration |
getSubgraphs()
Returns an enumeration of the subgraphs of this graph, that is,
objects of type
IlvGrapher . |
int |
getSubgraphsCount()
Returns the number of subgraphs.
|
Object |
getTo(Object link)
Returns the destination node of a link.
|
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(Object, IlvPoint, IlvPoint[], int, int,
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. |
boolean |
isConstantModeManagerFrameAutoMargin()
Returns whether automatic correction of the margins of the
IlvConstantModeManagerFrame object is enabled when this
object appears as the frame of submanagers that are laid out. |
boolean |
isFullLayerNotification()
Returns
true if adding or removing a layer sends a
separate event for each object contained in the layer. |
boolean |
isInterGraphLink(Object obj)
Returns
true if the object is a valid intergraph link,
and false otherwise. |
boolean |
isLayerAdded(IlvManagerLayer layer)
Returns
true if the manager layer is one of the layers to
be taken into account during the layout. |
boolean |
isLayoutNeeded(IlvGraphLayout layout)
Returns
true if a given layout that has been already
applied to this graph is still valid. |
boolean |
isLink(Object obj)
Returns
true if an object is a valid link and
false otherwise. |
boolean |
isLinkBetween(Object node1,
Object node2)
Tests whether a link exists between two nodes.
|
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 graph 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.
|
protected void |
prepareGrapher(IlvGrapher grapher,
IlvGraphLayout layout,
boolean redraw)
Prepares the grapher for layout.
|
protected void |
prepareViewForAnimation(IlvManagerView view,
IlvGraphLayout layout,
boolean redraw)
Prepares a manager view for a layout in animation mode.
|
protected void |
redrawAfterLayout(IlvGrapher grapher,
IlvGraphLayout layout,
boolean redraw)
Redraws a grapher once the layout process has finished.
|
boolean |
removeAllLayers()
Removes all manager layers from the list of layers to be used during
the layout.
|
boolean |
removeLayer(IlvManagerLayer layer)
Removes a manager layer from the list of layers to be used during the
layout.
|
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, including the connection points on
the origin and destination nodes.
|
void |
restoreAndDisableViewCoordinates()
Restores the reference transformer and reference view that was
previously saved.
|
void |
saveAndEnableViewCoordinates(IlvGrapherAdapter rootGraphModel)
Saves the reference transformer and reference view such that it can
later be restored.
|
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 |
setAnimationRedrawMode(int mode)
Sets the redraw mode that is used during animation.
|
void |
setConstantModeManagerFrameAutoMargin(boolean enable)
Enables or disables the automatic correction of the margins of the
IlvConstantModeManagerFrame object when it appears as
the frame of submanagers that are laid out. |
void |
setCoordinatesMode(int mode)
Sets the coordinates mode to be used outside layout.
|
void |
setFilter(IlvLayoutGraphicFilter filter)
Allows you to specify a filter on the nodes and links.
|
void |
setFullLayerNotification(boolean flag)
Sets whether adding or removing a layer fires just one or many graph
model events.
|
void |
setLinkComparator(Comparator comparator)
Sets the comparator used for sorting the links.
|
void |
setNodeComparator(Comparator comparator)
Sets the comparator used for sorting the nodes.
|
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.
|
void |
setReferenceTransformer(IlvTransformer transformer)
Allows you to specify the reference transformer.
|
void |
setReferenceView(IlvManagerView view)
Allows you to specify the reference manager view.
|
String |
toString()
Returns a string representation of the object.
|
addGraphModelListener, adjustmentEnd, afterAttach, afterDetach, boundingBox, dispose, fireGraphModelEvent, fireGraphModelEvent, geometryChanged, getGraphModel, getInstanceId, getLayout, getLayouts, getLinks, getLinksCount, getNodeDegree, getNodesCount, getOriginatingLayout, getRootModel, isConnectionPointCheckEnabled, isInternalGraphModelChecking, isLinkCheckEnabled, move, performLayout, performLayout, removeGraphModelListener, setConnectionPointCheckEnabled, setInternalGraphModelChecking, setLinkCheckEnabled, structureChanged
public IlvGrapherAdapter(IlvGrapher grapher)
IlvGrapher
.public IlvGraphModel getParentModel()
null
.getParentModel
in class IlvGraphModel
null
.IlvGraphModel.getGraphModel(java.lang.Object)
,
IlvGraphModel.getRootModel()
public IlvGrapher getGrapher()
IlvGrapher
encapsulated by the adapter.getGrapher
in interface IlvGrapherPropertyAdapter
getGrapher
in class IlvGraphModel
public void setConstantModeManagerFrameAutoMargin(boolean enable)
IlvConstantModeManagerFrame
object when it appears as
the frame of submanagers that are laid out. If a submanager is laid
out with automatic correction enabled, its frame margins are set back
to the minimum frame margins. If a submanager is laid out with
automatic correction disabled, its frame margins remain unchanged and
space is potentially wasted since the contents of the graph have
moved to new positions due to the layout.
By default, automatic correction is enabled.
enable
- Whether automatic correction is enabled.isConstantModeManagerFrameAutoMargin()
,
IlvConstantModeManagerFrame
public boolean isConstantModeManagerFrameAutoMargin()
IlvConstantModeManagerFrame
object is enabled when this
object appears as the frame of submanagers that are laid out.
setConstantModeManagerFrameAutoMargin(boolean)
,
IlvConstantModeManagerFrame
public void setCoordinatesMode(int mode)
IlvGraphLayout.MANAGER_COORDINATES
- The geometry of the
graph is computed using the coordinate space of the manager (that is,
the encapsulated IlvGrapher
), without applying any
transformation.
This mode should be used if you visualize the graph at zoom level 1, or you do not visualize it at all, or the grapher contains only fully zoomable objects. In all these cases there is no need to take the transformer into account during the layout.
Note that in this mode the dimensional parameters of the layout algorithms are considered as being specified in manager coordinates.
IlvGraphLayout.VIEW_COORDINATES
- The geometry of the
graph is computed in the coordinate space of the manager view. More
exactly, all the coordinates are transformed using the current
reference transformer.
This mode should be used if you want the dimensional parameters of the layout algorithms to be considered as being specified in manager view coordinates.
IlvGraphLayout.INVERSE_VIEW_COORDINATES
- The geometry
of the graph is computed using the coordinate system of the manager
view and then transforming them back into the coordinate system of
the manager (by applying the inverse transformation). This mode is
equivalent to the "manager coordinates" mode if the geometry of the
graphic objects strictly obeys the transformer. (A small difference
may exist because of the limited precision of the computations.)
On the contrary, if some graphic objects are either nonzoomable (see
IlvGraphic.zoomable()
) or semizoomable (for example, links with
a maximum line width), this mode gives different results than the
manager coordinates mode. These results are optimal if the grapher is
visualized using the same transformer as the one taken into account
during the layout.
Note that in this mode the dimensional parameters of the layout algorithms are considered as being specified in manager coordinates.
The default value is IlvGraphLayout.INVERSE_VIEW_COORDINATES
.
Note: this coordinates mode is only used when layout is not running.
While layout is running, the coordinates mode of the layout instance
is used (see IlvGraphLayout.setCoordinatesMode(int)
).
mode
- The mode.getCoordinatesMode()
,
IlvGraphLayout.setCoordinatesMode(int)
,
setReferenceTransformer(ilog.views.IlvTransformer)
,
setReferenceView(ilog.views.IlvManagerView)
public int getCoordinatesMode()
setCoordinatesMode(int)
,
IlvGraphLayout.getCoordinatesMode()
public void beforeLayout(IlvGraphLayout layout, boolean redraw)
IlvGraphLayout.performLayout(boolean, boolean)
before the call to
the method IlvGraphLayout.layout(boolean)
.
Note that if redraw
is true
, the method
afterLayout(ilog.views.graphlayout.IlvGraphLayout, ilog.views.graphlayout.IlvGraphLayoutReport, boolean)
will be called with the value true
for the redraw
argument.
If the argument redraw
is true
, the default
implementation calls prepareGrapher(ilog.views.IlvGrapher, ilog.views.graphlayout.IlvGraphLayout, boolean)
with the following
arguments: the encapsulated grapher, the layout instance, and the
redraw
flag. If the layout is in animation mode (that
is, IlvGraphLayout.isAnimate()
returns true
) the
method prepareViewForAnimation(ilog.views.IlvManagerView, ilog.views.graphlayout.IlvGraphLayout, boolean)
is called on each view
attached to the encapsulated grapher.
You should not call this method directly.
beforeLayout
in class IlvGraphModel
layout
- The layout instance of the origin of the notification, or
null
.redraw
- If true
, the method prepareGrapher(ilog.views.IlvGrapher, ilog.views.graphlayout.IlvGraphLayout, boolean)
is called with the encapsulated grapher as the argument.afterLayout(ilog.views.graphlayout.IlvGraphLayout, ilog.views.graphlayout.IlvGraphLayoutReport, boolean)
,
prepareGrapher(ilog.views.IlvGrapher, ilog.views.graphlayout.IlvGraphLayout, boolean)
,
prepareViewForAnimation(ilog.views.IlvManagerView, ilog.views.graphlayout.IlvGraphLayout, boolean)
protected void prepareGrapher(IlvGrapher grapher, IlvGraphLayout layout, boolean redraw)
If redraw
is true
and the layout is not in
animation mode, that is, IlvGraphLayout.isAnimate()
returns
false
, the default implementation calls the method
IlvManager.initReDraws()
on grapher
. Otherwise,
the method does nothing.
You should not call this method directly.
grapher
- The IlvGrapher
encapsulated by this adapter.layout
- The layout instance on which the method IlvGraphLayout.performLayout()
has been called.redraw
- The redraw flag passed as an argument to the method IlvGraphLayout.performLayout(boolean, boolean)
.beforeLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
protected void prepareViewForAnimation(IlvManagerView view, IlvGraphLayout layout, boolean redraw)
If a layout is in animation mode, this method is called by beforeLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
.
The default implementation calls the method IlvManagerView.setRedrawMode(int)
on view
to set the redraw
mode of the view to the animation redraw mode.
Note that the original redraw mode is automatically restored after the layout.
You should not call this method directly.
view
- The manager view to be prepared for animation.layout
- The layout instance on which the method IlvGraphLayout.performLayout()
has been called.redraw
- The redraw flag passed as an argument to the method IlvGraphLayout.performLayout(boolean, boolean)
.setAnimationRedrawMode(int)
,
beforeLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
public void setAnimationRedrawMode(int mode)
IlvManagerView.THREADED_REDRAW
. Single-threaded (swing)
applications can use the mode
IlvManagerView.DIRECT_REDRAW
instead. The default is
IlvManagerView.DIRECT_REDRAW
.mode
- The mode.prepareViewForAnimation(ilog.views.IlvManagerView, ilog.views.graphlayout.IlvGraphLayout, boolean)
,
getAnimationRedrawMode()
,
IlvManagerView.setRedrawMode(int)
public int getAnimationRedrawMode()
public void afterLayout(IlvGraphLayout layout, IlvGraphLayoutReport layoutReport, boolean redraw)
IlvGraphLayout.performLayout(boolean, boolean)
after the method
IlvGraphLayout.layout(boolean)
has finished, even if an exception is
thrown during the layout process.
If the layout is in animation mode, that is, IlvGraphLayout.isAnimate()
returns true
, the method
restores the original draw mode (see IlvManagerView.setRedrawMode(int)
) that may have been changed by the
method prepareViewForAnimation(ilog.views.IlvManagerView, ilog.views.graphlayout.IlvGraphLayout, boolean)
.
Finally, the method calls redrawAfterLayout(ilog.views.IlvGrapher, ilog.views.graphlayout.IlvGraphLayout, boolean)
and passes as
arguments the encapsulated grapher, the layout instance, and the
redraw
flag.
You should not call this method directly.
afterLayout
in class IlvGraphModel
layout
- The layout instance on which the method IlvGraphLayout.performLayout(boolean, boolean)
has been called.layoutReport
- The layout report created by the layout instance, or
null
.redraw
- If true
, the method redrawAfterLayout(ilog.views.IlvGrapher, ilog.views.graphlayout.IlvGraphLayout, boolean)
is called with the encapsulated grapher as an
argument.beforeLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
public boolean isLayoutNeeded(IlvGraphLayout layout)
true
if a given layout that has been already
applied to this graph is still valid. The method returns
true
if at least one of the following holds:
IlvGraphLayout.isParametersUpToDate()
called on
layout
returns false
.
IlvGraphLayout.isGeometryUpToDate()
called on
layout
returns false
.
IlvGraphLayout.isStructureUpToDate()
called on
layout
returns false
.
getReferenceTransformer()
returns a different
transformer than the one that had been used the last time the layout
was successfully performed on this graph (except if the difference
between the two transformers is a pure translation).
getCoordinatesMode()
returns a different value
than the one used the last time the layout was successfully performed
on this graph.
false
isLayoutNeeded
in class IlvGraphModel
IlvGraphLayout.isLayoutNeeded()
,
IlvGraphLayout.isStructureUpToDate()
,
IlvGraphLayout.isGeometryUpToDate()
,
IlvGraphLayout.isParametersUpToDate()
protected void redrawAfterLayout(IlvGrapher grapher, IlvGraphLayout layout, boolean redraw)
You should not call this method directly. The method is called by
afterLayout(ilog.views.graphlayout.IlvGraphLayout, ilog.views.graphlayout.IlvGraphLayoutReport, boolean)
.
If redraw
is false
, the method does
nothing. Otherwise, if the layout is not in animation mode, that is,
IlvGraphLayout.isAnimate()
returns false
, the
default implementation calls the method IlvManager.reDrawViews()
on grapher
. Otherwise, if the
layout is in animation mode, the method IlvManager.reDraw()
is
called.
The method can be overridden to implement a different redrawing mechanism.
grapher
- The IlvGrapher
encapsulated by this adapter.layout
- The layout instance on which the method IlvGraphLayout.performLayout()
has been called.redraw
- If true
, the grapher is redrawn once the
layout has finished.afterLayout(ilog.views.graphlayout.IlvGraphLayout, ilog.views.graphlayout.IlvGraphLayoutReport, boolean)
public void beforeAnimationStep()
The default implementation calls the method IlvManager.initReDraws()
on the encapsulated grapher.
beforeAnimationStep
in class IlvGraphModel
afterAnimationStep()
,
IlvGraphLayout.setAnimate(boolean)
public void afterAnimationStep()
The default implementation calls the method IlvManager.reDrawViews()
on the encapsulated grapher.
Note that the effect of the method IlvManager.reDrawViews()
depends on the value of the argument redraw
passed to
the method IlvGraphLayout.performLayout(boolean, boolean)
. If
the argument is false
, the method IlvManager.reDrawViews()
is not able to redraw the invalid regions
of the views because no region becomes invalidated by calls to
methods such as IlvManager.moveObject(IlvGraphic, double,
double, boolean)
with the value false
for the
redraw
argument. Therefore, to get a redraw after each
step of the animation, the method IlvGraphLayout.performLayout(boolean, boolean)
must be called with
the value true
for the redraw
argument.
afterAnimationStep
in class IlvGraphModel
beforeAnimationStep()
,
IlvGraphLayout.setAnimate(boolean)
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(java.lang.Object)
).moveNode
in class IlvGraphModel
node
- The node.x
- The new x-position.y
- The new y-position.redraw
- If true
, the node is redrawn.public void setFilter(IlvLayoutGraphicFilter filter)
getNodes()
, getLinks()
, getLinksFrom(java.lang.Object)
, getNeighbors(java.lang.Object)
, and so on, return enumerations
of only the nodes or links that are accepted by the filter (if any).
To remove the filter, call this method with a null
argument.
Note that the same filter instance should not be shared among
different instances of IlvGrapherAdapter
.
filter
- The filter.getFilter()
public IlvLayoutGraphicFilter getFilter()
null
otherwise.public void addLayer(IlvManagerLayer layer)
getLayers()
returns null
.
An IllegalArgumentException
is thrown if the layer does
not belong to the encapsulated grapher.
layer
- The manager layer to be added.removeLayer(ilog.views.IlvManagerLayer)
,
removeAllLayers()
,
getLayers()
,
isLayerAdded(ilog.views.IlvManagerLayer)
public boolean removeLayer(IlvManagerLayer layer)
An IllegalArgumentException
is thrown if the layer does
not belong to the encapsulated IlvGrapher
.
layer
- The manager layer to be removed.true
if the layer is in the list of layers to be
used; false
if the layer is not in the list of layers
or if the list of layers is void.addLayer(ilog.views.IlvManagerLayer)
,
removeAllLayers()
,
getLayers()
public boolean removeAllLayers()
getLayers()
returns null
.false
if there are no layers to be removed and
true
otherwise.addLayer(ilog.views.IlvManagerLayer)
,
removeLayer(ilog.views.IlvManagerLayer)
,
getLayers()
public Enumeration getLayers()
addLayer(IlvManagerLayer)
, all layers in the encapsulated
IlvGrapher
are used. In this case, this method returns
null
.IlvManagerLayer
instances) to be taken into account during the layout. Returns
null
if the list of layers to be used is empty.getLayersCount()
,
addLayer(ilog.views.IlvManagerLayer)
,
removeLayer(ilog.views.IlvManagerLayer)
,
removeAllLayers()
public final int getLayersCount()
addLayer(IlvManagerLayer)
, all layers in the encapsulated IlvGrapher
are used. In this case, this method returns
0
.IlvManagerLayer
instances)
to be taken into account during the layout. Returns 0
if the list of layers to be used is empty.addLayer(ilog.views.IlvManagerLayer)
,
getLayers()
public final boolean isLayerAdded(IlvManagerLayer layer)
true
if the manager layer is one of the layers to
be taken into account during the layout. Otherwise, the method
returns false
. If you do not specify any layers using
the method addLayer(IlvManagerLayer)
, the method returns
false
for any argument.layer
- The manager layer to be tested.addLayer(ilog.views.IlvManagerLayer)
,
getLayers()
public void setFullLayerNotification(boolean flag)
true
is passed, adding or removing a
layer posts a separate event for each object contained in the layer.
If false
is passed, adding or removing a layer posts
only one event. This is more efficient. However some layout classes
listen to the events to clean up memory, so if you disable full layer
notification, you are responsible for calling IlvGraphLayout.cleanNode(ilog.views.graphlayout.IlvGraphModel, java.lang.Object)
and IlvGraphLayout.cleanLink(ilog.views.graphlayout.IlvGraphModel, java.lang.Object)
yourself to clean up the memory.
Full layer notification is enabled by default.
flag
- Set to true
to post separate events for each
object, or false
to post one event for the layer.addLayer(ilog.views.IlvManagerLayer)
,
removeLayer(ilog.views.IlvManagerLayer)
,
isFullLayerNotification()
,
IlvGraphModel.addGraphModelListener(ilog.views.graphlayout.GraphModelListener)
public final boolean isFullLayerNotification()
true
if adding or removing a layer sends a
separate event for each object contained in the layer. The method
returns false
if only one single event is fired in this
case.
setFullLayerNotification(boolean)
public final void setNodeComparator(Comparator comparator)
null
is passed, no comparator is used. Some layouts
produce different results of the order of the nodes change. The node
comparator allows to specify a fixed order that is invariant from the
order of objects in the underlying grapher.
The default value is null
(no comparator).
getNodeComparator()
public Comparator getNodeComparator()
setNodeComparator(Comparator)
public final void setLinkComparator(Comparator comparator)
null
is passed, no comparator is used. Some layouts
produce different results of the order of the links change. The link
comparator allows to specify a fixed order that is invariant from the
order of objects in the underlying grapher.
The default value is null
(no comparator).
getLinkComparator()
public Comparator getLinkComparator()
setLinkComparator(Comparator)
public void setReferenceTransformer(IlvTransformer transformer)
The reference transformer is the transformer (see the class IlvTransformer
) that is taken into account by the
IlvGrapherAdapter
when computing the geometry of the
grapher if the coordinates mode is either IlvGraphLayout.VIEW_COORDINATES
or IlvGraphLayout.INVERSE_VIEW_COORDINATES
(see also setCoordinatesMode(int)
).
If the coordinates mode is IlvGraphLayout.MANAGER_COORDINATES
, the reference transformer is not
taken into account. In this mode, the layout computes the geometry of
the grapher on the basis of the manager coordinates of objects,
without any transformation. If the encapsulated grapher contains only
zoomable graphics (see IlvGraphic.zoomable()
), the geometry
will stay valid and optimal for any transformer. If the encapsulated
grapher contains at least one nonzoomable object (such as IlvLabel
), or objects that do not strictly obey
the transformer (such as a link with maximum line width), the
geometry becomes dependent on the transformer that is used to draw
the grapher. Changing the transformer makes the layout invalid so
that a re-layout is necessary to again obtain the optimal layout with
respect to the new transformer. Calculating the layout in manager
coordinates may yield a nonoptimal result in a zoomed view. In this
case the layout must take the reference transformer into account to
obtain an optimal result.
If the coordinates mode is IlvGraphLayout.VIEW_COORDINATES
,
all coordinates are calculated and delivered to the layout algorithm
with respect to the reference transformer. In this mode, all
dimensional layout parameters must be specified in view coordinates
with respect to the reference transformer.
If the coordinates mode is IlvGraphLayout.INVERSE_VIEW_COORDINATES
, all coordinates are
calculated with respect to the reference transformer, but they are
delivered to the layout algorithm by transforming them back into
manager coordinates. This has the advantage that all dimensional
layout parameters can be specified in manager coordinates. If the
encapsulated grapher contains only zoomable graphics, the result is
the same as when using manager coordinates. The layout is nearly
independent of the view. In a few rare cases, a slight shifting of
the coordinates may occur due to the coordinate optimization. If the
encapsulated grapher contains nonzoomable objects, the calculation
with inverse view coordinates still produces an optimal result with
respect to the reference transformer. However, the layout is no
longer independent of the view, that is, it becomes nonoptimal when
the view transformer is changed.
In most cases it is not necessary to call this method because the
transformer to be taken into account is chosen using a set of default
rules (see getReferenceTransformer()
). If it is called, the
transformer specified using this method is returned by the method
getReferenceTransformer()
, overriding the default rules for
choosing the transformer.
If the Grapher
contains nonzoomable objects, you may
need to call this method in the following cases:
If a grapher containing nonzoomable objects is displayed
simultaneously in several views, you can use the method setReferenceView(ilog.views.IlvManagerView)
to indicate the view for which you want the layout
to correspond exactly to the geometry of the grapher.
If you specified a transformer but want to reset this setting and go
back to the default behavior, call the method with a
null
argument.
Note that if this method is overridden, you must call
super.setReferenceTransformer(transformer)
to notify the
grapher adapter that the reference transformer has changed.
Note also that a call to the method setReferenceView(ilog.views.IlvManagerView)
overrides the effect of a previous call to the method setReferenceTransformer(ilog.views.IlvTransformer)
. Similarly, a call to the method setReferenceTransformer(ilog.views.IlvTransformer)
overrides the effect of a previous call to
the method setReferenceView(ilog.views.IlvManagerView)
.
transformer
- The reference transformer.getReferenceTransformer()
,
setReferenceView(ilog.views.IlvManagerView)
,
setCoordinatesMode(int)
public IlvTransformer getReferenceTransformer()
This method returns the transformer specified using setReferenceTransformer(ilog.views.IlvTransformer)
if this transformer is not
null
.
If no reference transformer is set, it returns the current
transformer of the manager view specified using setReferenceView(ilog.views.IlvManagerView)
(if any).
If no reference view is set, it returns the current transformer of
the first manager view attached to the manager (as returned by the
method IlvManager.getViews()
). If the IlvGrapher
is a
subgrapher, that is, if it is used as a graphic object contained in
another IlvGrapher
, and the subgrapher has no view directly
attached, the first view of the closest parent graph is used.
Otherwise, this method returns an identity transformer.
Note that you should not modify the transformer returned by this method.
public void setReferenceView(IlvManagerView view)
The reference view is the manager view (see the class IlvManagerView
) whose current transformer (see the method IlvManagerView.getTransformer()
) is used as a reference transformer
(see the method getReferenceTransformer()
.
Usually the view
argument is the manager view that is
used for displaying the graph, but this is not mandatory.
Call this method with a null
argument to reset the
setting.
Note that a call to the method setReferenceTransformer(ilog.views.IlvTransformer)
overrides the effect of a call to the method setReferenceView(ilog.views.IlvManagerView)
. Similarly, a call to the method setReferenceView(ilog.views.IlvManagerView)
overrides the effect of a call to the method
setReferenceTransformer(ilog.views.IlvTransformer)
.
view
- The reference manager view.getReferenceView()
,
setReferenceTransformer(ilog.views.IlvTransformer)
,
setCoordinatesMode(int)
public IlvManagerView getReferenceView()
null
otherwise.public Enumeration getNodesAndLinks()
IlvManager.getObjects()
.getNodesAndLinks
in class IlvGraphModel
getNodes()
,
getLinks()
,
setFilter(IlvLayoutGraphicFilter)
,
setNodeComparator(Comparator)
,
setLinkComparator(Comparator)
public Enumeration getNodes()
IlvManager.getObjects()
on the encapsulated grapher and skips all
the elements that are not nodes.
Note that, because the nodes and the links are not stored separately
in the IlvGrapher
, browsing all elements returned by
this method is not any more efficient than browsing them using the
enumeration returned by the method getNodesAndLinks()
.
getNodes
in class IlvGraphModel
isNode(java.lang.Object)
,
getLinks()
,
getNodesAndLinks()
,
setFilter(IlvLayoutGraphicFilter)
,
setNodeComparator(Comparator)
public Enumeration getLinks()
IlvManager.getObjects()
on the encapsulated
grapher and skips all the elements that are not links.
Note that, because the nodes and the links are not stored separately
in the IlvGrapher
, browsing all elements returned by
this method is not any more efficient than browsing them using the
enumeration returned by the method getNodesAndLinks()
.
getLinks
in class IlvGraphModel
isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
,
getNodes()
,
getNodesAndLinks()
,
setFilter(IlvLayoutGraphicFilter)
,
setLinkComparator(Comparator)
public Enumeration getSubgraphs()
IlvGrapher
. This method uses the method
IlvManager.getManagers()
, called on the encapsulated grapher,
to obtain the subgraphs. Only submanagers that are instances of
IlvGrapher
, not collapsed and not filtered by this
adapter, are taken into account.getSubgraphs
in class IlvGraphModel
isSubgraph(java.lang.Object)
,
getSubgraphsCount()
,
getNodes()
,
getLinks()
,
setFilter(IlvLayoutGraphicFilter)
public int getSubgraphsCount()
getSubgraphsCount
in class IlvGraphModel
getSubgraphs()
public Enumeration getInterGraphLinks()
getInterGraphLinks
in class IlvGraphModel
isInterGraphLink(java.lang.Object)
,
IlvGrapher.getInterGraphLinks()
,
getInterGraphLinksCount()
,
setFilter(IlvLayoutGraphicFilter)
public int getInterGraphLinksCount()
getInterGraphLinksCount
in class IlvGraphModel
isInterGraphLink(java.lang.Object)
,
getInterGraphLinks()
public Enumeration getLinksFrom(Object node)
node
as
their origin. The enumeration does not include intergraph links.getLinksFrom
in class IlvGraphModel
node
- The node.isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public int getLinksFromCount(Object node)
node
as their
origin.getLinksFromCount
in class IlvGraphModel
node
- The node.IlvGraphModel.getLinksFrom(java.lang.Object)
public Enumeration getLinksTo(Object node)
node
as
their destination. The enumeration does not include intergraph links.getLinksTo
in class IlvGraphModel
node
- The node.isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public int getLinksToCount(Object node)
node
as their
origin.getLinksToCount
in class IlvGraphModel
node
- The node.IlvGraphModel.getLinksTo(java.lang.Object)
public int getLinksCount(Object node)
node
.getLinksCount
in class IlvGraphModel
node
- The node.IlvGraphModel.getLinks(java.lang.Object)
,
getLinksFromCount(java.lang.Object)
,
getLinksToCount(java.lang.Object)
public Enumeration getNeighbors(Object node)
node
, in other words, the nodes that have a common
normal link with node
. This method does not consider
intergraph links.
Note that a neighbor node will be contained in the enumeration the
same number of times as the number of links between node
and this neighbor.
getNeighbors
in class IlvGraphModel
node
- The node.isLink(java.lang.Object)
,
isInterGraphLink(java.lang.Object)
public Object getOpposite(Object link, Object node)
getOpposite
in class IlvGraphModel
link
- The link.node
- The node.IlvGraphModel.isLink(java.lang.Object)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
public Object getFrom(Object link)
getFrom
in class IlvGraphModel
link
- The link.getTo(java.lang.Object)
,
IlvLinkImage.getVisibleFrom()
public Object getTo(Object link)
getTo
in class IlvGraphModel
link
- The link.getFrom(java.lang.Object)
,
IlvLinkImage.getVisibleTo()
public boolean isNode(Object obj)
true
if an object is a valid node and
false
otherwise. An object is not valid in one of the
following cases:
isNode
in class IlvGraphModel
obj
- The object to test.public boolean isLink(Object obj)
true
if an object is a valid link and
false
otherwise. An object is not valid in one of the
following cases:
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. An object is not valid in one of the following cases:
IlvGrapher.isInterGraphLink(ilog.views.IlvGraphic)
).
IlvGraphModel
and the class
IlvGrapher
. The class IlvGrapher
recognizes
an intergraph link by testing link.getFrom()
and
link.getTo()
. The class IlvGrapherAdapter
recognizes an intergraph link by testing
link.getVisibleFrom()
and
link.getVisibleTo()
. Thus, a link that has both
visible end nodes in the encapsulated grapher is considered a
normal link in the IlvGrapherAdapter
while it may be
considered an intergraph link in the IlvGrapher
.
isInterGraphLink
in class IlvGraphModel
obj
- The object to test.isLink(java.lang.Object)
public boolean isSubgraph(Object obj)
true
if the object is a valid graph and
false
otherwise. An object is not a valid graph in one
of the following cases:
IlvGrapher
.
IlvGrapher
.
isSubgraph
in class IlvGraphModel
obj
- The object to test.protected IlvGraphModel createGraphModel(Object subgraph)
IlvGrapherAdapter
for a subgraph. The
method can be called on any instance of an
IlvGrapherAdapter
.createGraphModel
in class IlvGraphModel
subgraph
- A subgraph. It must be an instance of
IlvGrapher
.public IlvTransformer getTransformer(IlvGraphModel subgraphModel)
null
to indicate that both
graph models use the same coordinate system.getTransformer
in class IlvGraphModel
public boolean isLinkBetween(Object node1, Object node2)
isLinkBetween
in class IlvGraphModel
node1
- The first node to test.node2
- The second node to test.IlvGraphModel.isLink(java.lang.Object)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
public void setProperty(Object nodeOrLink, String key, Object value)
value
is null
, the property is removed.
Otherwise, the property value is set to value
.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(Object, String)
,
setProperty(String, Object)
public Object getProperty(Object nodeOrLink, String key)
null
if the property does not exist.getProperty
in class IlvGraphModel
nodeOrLink
- The node or link for which the property is to be set.key
- The key string for the property.setProperty(Object, String, Object)
public void setProperty(String key, Object value)
value
is
null
, the property is removed. Otherwise, the property
value is set to value
.
This method is overridden in order to use the more efficient user
property mechanism provided by IlvGrapher
(see IlvManager.setProperty(java.lang.String, java.lang.Object)
).
setProperty
in class IlvGraphModel
key
- The key string for the property.value
- The new value of the property.getProperty(String)
,
setProperty(Object, String, Object)
public Object getProperty(String key)
null
if the property does not exist.getProperty
in class IlvGraphModel
key
- The key string for the property.setProperty(String, Object)
public IlvRect boundingBox(Object nodeOrLink)
IlvGraphic.boundingBox(IlvTransformer)
in a way that
depends on the current coordinate mode option (see setCoordinatesMode(int)
):
IlvGraphLayout.MANAGER_COORDINATES
: returns the bounding
box of the graphic object in the coordinate space of the manager,
that is, it calls IlvGraphic.boundingBox(IlvTransformer)
with a null
argument.IlvGraphLayout.VIEW_COORDINATES
: returns the bounding box
of the graphic object in the coordinate space of the view, that is,
it calls IlvGraphic.boundingBox(IlvTransformer)
with the
reference transformer as an argument (see getReferenceTransformer()
).IlvGraphLayout.INVERSE_VIEW_COORDINATES
: returns the
bounding box of the graphic object in the coordinate space of the
view after applying the inverse transformation to the rectangle
(using the reference transformer).boundingBox
in class IlvGraphModel
nodeOrLink
- The node or link.public double getLinkWidth(Object link)
IlvLinkImage.getLineWidth(IlvTransformer)
in a way that depends on
the current coordinate mode option (see setCoordinatesMode(int)
):
IlvGraphLayout.MANAGER_COORDINATES
: returns the width in
the coordinate space of the manager, that is, it calls
IlvLinkImage.getLineWidth(IlvTransformer)
with a
null
argument.IlvGraphLayout.VIEW_COORDINATES
: returns the width in the
coordinate space of the view, that is, it calls
IlvGraphic.boundingBox(IlvTransformer)
with the
reference transformer as an argument (see getReferenceTransformer()
).IlvGraphLayout.INVERSE_VIEW_COORDINATES
: returns the
width in the coordinate space of the view after dividing it with the
zoom factor (see IlvTransformer.zoomFactor()
) of the reference
transformer.getLinkWidth
in class IlvGraphModel
link
- The link.public int getLinkPointsCount(Object link)
getLinkPointsCount
in class IlvGraphModel
link
- The link.IlvGraphModel.isLink(java.lang.Object)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
public IlvPoint[] getLinkPoints(Object link)
IlvLinkImage.getLinkPoints(IlvTransformer)
in a way that
depends on the current coordinate mode option (see setCoordinatesMode(int)
):
IlvGraphLayout.MANAGER_COORDINATES
: returns the points in
the coordinate space of the manager, that is, it calls
IlvLinkImage.getLinkPoints(IlvTransformer)
with a
null
argument.IlvGraphLayout.VIEW_COORDINATES
: returns the points in
the coordinate space of the view, that is, it calls
IlvLinkImage.getLinkPoints(IlvTransformer)
with the
reference transformer as an argument (see getReferenceTransformer()
).IlvGraphLayout.INVERSE_VIEW_COORDINATES
: returns the
points in the coordinate space of the view after applying the inverse
transformation to the points (using the reference transformer).getLinkPoints
in class IlvGraphModel
link
- The link.IlvGraphModel.isLink(java.lang.Object)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
public IlvPoint getLinkPointAt(Object link, int index)
IlvLinkImage.getPointAt(int, IlvTransformer)
in a way
that depends on the current coordinate mode option (see setCoordinatesMode(int)
):
IlvGraphLayout.MANAGER_COORDINATES
: returns the point in
the coordinate space of the manager, that is, it calls
IlvLinkImage.getPointAt(int, IlvTransformer)
with a
null
argument.IlvGraphLayout.VIEW_COORDINATES
: returns the point in the
coordinate space of the view, that is, it calls
IlvLinkImage.getPointAt(int, IlvTransformer)
with the
reference transformer as an argument (see getReferenceTransformer()
).IlvGraphLayout.INVERSE_VIEW_COORDINATES
: returns the
point in the coordinate space of the view after applying the inverse
transformation to the point (using the reference transformer).getLinkPointAt
in class IlvGraphModel
link
- The link.index
- The index of the point.IlvGraphModel.isLink(java.lang.Object)
,
IlvGraphModel.isInterGraphLink(java.lang.Object)
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, without any
intermediate points, call the method with null
for the
points
argument. In this case, the values of the
arguments startIndex
and length
are
ignored.
If link checks are enabled (see IlvGraphModel.isLinkCheckEnabled()
), the
method checks whether the particular type of link supports the
requested reshape operation by calling the method isReshapeableLink(java.lang.Object, boolean)
:
points
is null
or
length
is zero, it passes the value true
for the toStraightLine
argument of isReshapeableLink(java.lang.Object, boolean)
.
points
is non-null
and length
> 0
, it passes the value false
.
isReshapeableLink(java.lang.Object, boolean)
returns false
, an IlvInappropriateLinkException
is thrown.
If link connection point checks are enabled (see IlvGraphModel.isConnectionPointCheckEnabled()
), the method checks the link
connectors attached to the origin and destination node:
fromPoint
or toPoint
is
non-null
and no link connector is attached to the
corresponding node, the method attaches an IlvFreeLinkConnector
to the corresponding node. The free link
connector can respect the prescribed connection points. Otherwise, if
a link connector that is not an instance of IlvFreeLinkConnector
(or a subclass) is attached, the method throws
an IlvInappropriateLinkException
.
fromPoint
or
toPoint
) is null
and an IlvFreeLinkConnector
is attached to the corresponding node, the link
connector is detached.
reshapeLink
in class IlvGraphModel
link
- The link to be reshaped.fromPoint
- The connection point of the link on the origin node. If
null
, the connection point is not moved.points
- The intermediate points of the link (ordered from origin
node to destination node). If null
, all the
intermediate points of the link are removed.startIndex
- The start position in the array of points.length
- The number of intermediate points.toPoint
- The connection point of the link on the destination node.
If null
, the connection point is not moved.redraw
- If true
, the link is redrawn.IlvInappropriateLinkException
- if either the type of link or
the type of link connector is not appropriate for this reshape
operationIlvGraphLayoutUtil.EnsureAppropriateLinkTypes(IlvGraphLayout, boolean)
,
IlvGraphLayoutUtil.EnsureAppropriateLinkConnectors(IlvGraphLayout, boolean)
,
IlvGraphLayoutUtil.EnsureAppropriateLinks(IlvGraphLayout, boolean)
,
IlvGraphModel.setLinkCheckEnabled(boolean)
,
IlvGraphModel.setConnectionPointCheckEnabled(boolean)
public boolean isReshapeableLink(Object link, boolean toStraightLine)
true
if link
can be reshaped and
false
otherwise.
If the argument toStraightLine
is true
, the
method returns true
for any links that are not instances
of the classes IlvOneLinkImage
and IlvDoubleLinkImage
and any of their subclasses.
These link classes do not allow the intermediate points to be
removed.
If the argument toStraightLine
is false
,
the method returns true
for any links that are not
instances of the class IlvLinkImage
(base class, not
subclasses) or instances of the classes IlvOneLinkImage
and IlvDoubleLinkImage
and any of their subclasses.
These link classes do not allow intermediate points to be added,
moved, or removed.
isReshapeableLink
in class IlvGraphModel
link
- The link.toStraightLine
- A boolean to specify the extent of intermediate
point conditions (see description).reshapeLink(Object, IlvPoint, IlvPoint[], int, int, IlvPoint, boolean)
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(Object, IlvPoint, IlvPoint[], int, int,
IlvPoint, boolean)
. Returns false
if such a call may
fail to set the connection point to the argument passed to
reshapeLink
.
The method returns false
if a link connector other than
IlvFreeLinkConnector
is attached to the origin or destination
node of the link, and returns true
otherwise.
hasMoveableConnectionPoint
in class IlvGraphModel
link
- The link.origin
- Set to true
if the connection point is on the
origin and false
otherwise.reshapeLink(Object, IlvPoint, IlvPoint[], int, int, IlvPoint, boolean)
,
IlvGraphModel.isConnectionPointCheckEnabled()
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.
This overridden implementation returns true
if and only
if the corresponding connection point of link
is handled
by an IlvPinLinkConnector
and is connected
to one of its pins (
).
IlvGrapherPin
Note that any overridden implementation of this method must work for both normal links and intergraph links.
hasPinnedConnectionPoint
in class IlvGraphModel
link
- The link.origin
- Set to true
if the connection point is on the
origin, and false
otherwise.reshapeLink(Object, IlvPoint, IlvPoint[], int, int, IlvPoint, boolean)
,
hasMoveableConnectionPoint(java.lang.Object, boolean)
public String saveParametersToNamedProperties(IlvGraphLayout layout, boolean withDefaults)
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()) grapherAdapter.saveParametersToNamedProperties(layout1, false); if (layout2.supportsSaveParametersToNamedProperties()) grapherAdapter.saveParametersToNamedProperties(layout2, false); if (layout3.supportsSaveParametersToNamedProperties()) grapherAdapter.saveParametersToNamedProperties(layout3, false); ... grapherAdapter.getGrapher().write("abcd.ivl"); grapherAdapter.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)
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)
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
IlvGrapherAdapter
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)
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:
grapherAdapter.getGrapher().read("abcd.ivl"); grapherAdapter.loadParametersFromNamedProperties(layout1); grapherAdapter.loadParametersFromNamedProperties(layout2); grapherAdapter.loadParametersFromNamedProperties(layout3); ... grapherAdapter.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)
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)
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
.
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
IlvGrapherAdapter
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()
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)
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)
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)
if (layout.supportsSaveParametersToNamedProperties()) { property = grapherAdapter.saveParametersToNamedProperties(layout, false); grapherAdapter.setPreferredLayoutPropertyPrefix(property); } ... grapherAdapter.getGrapher().write("abcd.ivl"); grapherAdapter.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.getPreferredLayoutPropertyPrefix
in interface IlvGrapherPropertyAdapter
setPreferredLayoutPropertyPrefix(java.lang.String)
public String getLayoutPropertyPrefix(IlvGraphLayout layout)
null
if the layout was
never stored.
This method can be used to retrieve the property name before loading the parameters into the layout instance, for 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 void saveAndEnableViewCoordinates(IlvGrapherAdapter rootGraphModel)
This is used only for internal purposes. You should not call this method directly.
public void restoreAndDisableViewCoordinates()
public String toString()
IlvGrapher
, if any (see getGrapher()
).© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.