public class IlpDefaultGraphLayoutSupport extends Object implements IlpGraphLayoutSupport
Constructor and Description |
---|
IlpDefaultGraphLayoutSupport()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
attach(IlpGraphView view)
Attaches this object to a given view.
|
void |
attach(IlpGraphView view,
boolean init)
Attaches this object to a given view.
|
IlvGraphModel |
createGraphModel()
Creates the graph model used for the manager content.
|
void |
detach()
Detaches this object from its current view.
|
int |
getAutoLayoutIndex()
Returns the index of the graph layout that should
be executed automatically when the view contents
change.
|
int |
getAutoLayoutIndex(IlpRepresentationObject ro)
Returns the index of the graph layout that should
be executed automatically in the subnetwork when the view
contents change.
|
IlvGraphLayout[] |
getGraphLayouts()
Returns the list of graph layouts that have been
configured to this view.
|
IlvGraphLayout[] |
getGraphLayouts(IlpRepresentationObject ro)
Returns the list of graph layouts that have been
configured to the given subnetwork object.
|
IlvGraphLayout |
getGraphLayouts(IlpRepresentationObject ro,
int index)
Returns the graph layout that is configured at the given
index for the given subnetwork object.
|
IlvGraphLayout |
getGraphLayouts(int index)
Returns the graph layout that is configured at the given
index.
|
IlvGraphLayout |
getLinkLayout()
Returns the graph layout for links.
|
IlvGraphLayout |
getLinkLayout(IlpRepresentationObject ro)
Returns the graph layout for links in the subnetwork of the given
representation object.
|
IlvGraphLayout |
getNodeLayout()
Returns the graph layout of the view for nodes.
|
void |
optimizeLayout()
Applies the registered node and/or a link layout algorithm to the manager
content.
|
void |
performAttachedLayout(int index)
Applies a given graph layout algorithm once to the manager content.
|
void |
performLayoutOnce(IlvGraphLayout layout,
Runnable initializations,
Runnable postprocessing)
Applies a given graph layout algorithm once to the manager content.
|
void |
setAutoLayoutIndex(IlpRepresentationObject ro,
int index)
Sets the index of the graph layout that should be
executed automatically in the subnetwork objects when the
view contents change.
|
void |
setAutoLayoutIndex(int index)
Sets the index of the graph layout that should be
executed automatically when the view contents change.
|
void |
setGraphLayouts(IlpRepresentationObject ro,
IlvGraphLayout[] layouts)
Changes the layouts that can be applied to the subnetwork that
represents the given representation object.
|
void |
setGraphLayouts(IlpRepresentationObject ro,
int index,
IlvGraphLayout layout)
Sets a new graph layout to this view.
|
void |
setGraphLayouts(IlvGraphLayout[] layouts)
Changes the layouts that can be applied to this view.
|
void |
setGraphLayouts(int index,
IlvGraphLayout layout)
Sets a new graph layout to this view.
|
void |
setLinkLayout(IlpRepresentationObject ro,
IlvGraphLayout layout)
Changes the link layout of subnetwork for the given representation
object.
|
void |
setLinkLayout(IlvGraphLayout layout,
boolean relayout)
Changes the link layout of this view.
|
void |
setNodeLayout(IlvGraphLayout layout,
boolean relayout)
Changes the node layout of this view.
|
public IlpDefaultGraphLayoutSupport()
public void attach(IlpGraphView view)
attach
in interface IlpGraphLayoutSupport
public void attach(IlpGraphView view, boolean init)
view
- Graphic viewinit
- Indicates if layouts should be initialized.public void detach()
detach
in interface IlpGraphLayoutSupport
public void setGraphLayouts(IlvGraphLayout[] layouts)
One of the graph layouts can be configured to run automatically
when the view contents change. The layout that should be
run automatically has to be defined using method
setAutoLayoutIndex(int)
.
The other layouts can be executed on demand using
method performAttachedLayout(int)
Note: For performance reasons this method does not perform any
of the layouts automatically. Once you have configured the layouts
and the index of the layout that shall be performed automatically,
you can run the layout using optimizeLayout()
.
setGraphLayouts
in interface IlpGraphLayoutSupport
layouts
- Graph layoutsRuntimeException
- if this instance is not attached
to a view.getGraphLayouts()
,
setAutoLayoutIndex(int)
,
performAttachedLayout(int)
public IlvGraphLayout[] getGraphLayouts()
getGraphLayouts
in interface IlpGraphLayoutSupport
RuntimeException
- if this instance is not attached
to a view.setGraphLayouts(IlvGraphLayout[])
public void setGraphLayouts(int index, IlvGraphLayout layout)
Note: For performance reasons this method does not perform any
of the layouts automatically. Once you have configured the layouts
and the index of the layout that shall be performed automatically,
you can run the layout using IlpGraphView.optimizeLayout()
.
setGraphLayouts
in interface IlpGraphLayoutSupport
index
- Layout indexlayout
- LayoutRuntimeException
- if this instance is not attached
to a view.public IlvGraphLayout getGraphLayouts(int index)
getGraphLayouts
in interface IlpGraphLayoutSupport
index
- Layout indexnull
if none is defined.RuntimeException
- if this instance is not attached
to a view.public void setAutoLayoutIndex(int index)
Note: For performance reasons this method does not perform any
of the layouts automatically. Once you have configured the layouts
and the index of the layout that shall be performed automatically,
you can run the layout using IlpGraphView.optimizeLayout()
.
Default value is 0.
setAutoLayoutIndex
in interface IlpGraphLayoutSupport
index
- Layout indexRuntimeException
- if this instance is not attached
to a view.public int getAutoLayoutIndex()
getAutoLayoutIndex
in interface IlpGraphLayoutSupport
-1
if none
shall be executed automatically.RuntimeException
- if this instance is not attached
to a view.public IlvGraphLayout getNodeLayout()
getNodeLayout
in interface IlpGraphLayoutSupport
null
if none has been specified.RuntimeException
- if this instance is not attached
to a view.public void setNodeLayout(IlvGraphLayout layout, boolean relayout)
Use this function with relayout
set to false
if you need to set some layout parameters after the layout has been
attached. This is needed for setting the layout region and for passing
any layout proxies to the graph layout (for example, using
IlvBusLayout.setBus
, IlvTreeLayout.setRoot
,
IlvCircularLayout.setClusterId
).
This method corresponds to:
setGraphLayouts(new IlvGraphLayout[] { layout }); setAutoLayoutIndex(0); if (relayout) optimizeLayout();
setNodeLayout
in interface IlpGraphLayoutSupport
layout
- A graph layout or null
.relayout
- Specifies whether the layout optimizers should be called
immediately.RuntimeException
- if this instance is not attached
to a view.setGraphLayouts(IlvGraphLayout[])
,
setGraphLayouts(int, IlvGraphLayout)
public IlvGraphLayout getLinkLayout()
getLinkLayout
in interface IlpGraphLayoutSupport
null
if none has been specified.RuntimeException
- if this instance is not attached
to a view.public void setLinkLayout(IlvGraphLayout layout, boolean relayout)
If layout
is null
, and the node layout does
not update links, a default link layout is substituted. It can be
obtained using getLinkLayout()
.
setLinkLayout
in interface IlpGraphLayoutSupport
layout
- A graph layout or null
.relayout
- Indicates if the layout should be reapplied immediately.RuntimeException
- if this instance is not attached
to a view.public void setGraphLayouts(IlpRepresentationObject ro, IlvGraphLayout[] layouts)
One of the graph layouts can be configured to run automatically
when the view contents change. The layout that should be
run automatically has to be defined using method
setAutoLayoutIndex(IlpRepresentationObject, int)
.
The other layouts can be executed on demand using
method performAttachedLayout(int)
Note: For performance reasons this method does not perform any
of the layouts automatically. Once you have configured the layouts
and the index of the layout that shall be performed automatically,
you can run the layout using optimizeLayout()
.
setGraphLayouts
in interface IlpGraphLayoutSupport
ro
- Subnetwork representation objectlayouts
- Graph layoutsRuntimeException
- if this instance is not attached
to a view.getGraphLayouts(IlpRepresentationObject)
,
setAutoLayoutIndex(IlpRepresentationObject, int)
,
performAttachedLayout(int)
public IlvGraphLayout[] getGraphLayouts(IlpRepresentationObject ro)
getGraphLayouts
in interface IlpGraphLayoutSupport
ro
- Subnetwork representation objectRuntimeException
- if this instance is not attached
to a view.setGraphLayouts(IlpRepresentationObject, IlvGraphLayout[])
public void setGraphLayouts(IlpRepresentationObject ro, int index, IlvGraphLayout layout)
setGraphLayouts
in interface IlpGraphLayoutSupport
ro
- Subnetwork representation objectindex
- Layout indexlayout
- LayoutRuntimeException
- if this instance is not attached
to a view.public IlvGraphLayout getGraphLayouts(IlpRepresentationObject ro, int index)
getGraphLayouts
in interface IlpGraphLayoutSupport
ro
- Subnetwork representation objectindex
- Layout indexnull
if none is defined.RuntimeException
- if this instance is not attached
to a view.public void setAutoLayoutIndex(IlpRepresentationObject ro, int index)
Default value is 0.
setAutoLayoutIndex
in interface IlpGraphLayoutSupport
ro
- Representation objectindex
- Layout indexRuntimeException
- if this instance is not attached
to a view.public int getAutoLayoutIndex(IlpRepresentationObject ro)
Default value is 0.
getAutoLayoutIndex
in interface IlpGraphLayoutSupport
ro
- Subnetwork representation objectRuntimeException
- if this instance is not attached
to a view.public void setLinkLayout(IlpRepresentationObject ro, IlvGraphLayout layout)
Since this layout is applied to a subnetwork, using this method does not trigger the automatic layout execution. This will be done in the view when some of its contents is changed.
setLinkLayout
in interface IlpGraphLayoutSupport
ro
- The container representation object.layout
- A graph layout or null
.RuntimeException
- if this instance is not attached
to a view.public IlvGraphLayout getLinkLayout(IlpRepresentationObject ro)
getLinkLayout
in interface IlpGraphLayoutSupport
null
if none has been specified.RuntimeException
- if this instance is not attached
to a view.public void optimizeLayout()
Applies the registered node and/or a link layout algorithm to the manager content.
Since the registered node and/or link layout is invoked automatically, this function needs to be used:
setGraphLayouts(IlvGraphLayout[])
, setGraphLayouts(int, IlvGraphLayout)
or setAutoLayoutIndex(int)
;setNodeLayout
or setLinkLayout
if it has been invoked with
relayout
=false
;optimizeLayout
in interface IlpGraphLayoutSupport
RuntimeException
- if this instance is not attached
to a view.setGraphLayouts(IlvGraphLayout[])
,
setGraphLayouts(int, IlvGraphLayout)
,
setAutoLayoutIndex(int)
,
setNodeLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
,
setLinkLayout(ilog.views.graphlayout.IlvGraphLayout, boolean)
public void performAttachedLayout(int index)
In contrast to the node and link layout optimizers that are registered in the grapher and called automatically when needed, this function allows you to call a layout only once. It is useful when the layout takes a lot of time.
performAttachedLayout
in interface IlpGraphLayoutSupport
index
- Layout indexRuntimeException
- if this instance is not attached
to a view.setGraphLayouts(IlvGraphLayout[])
,
setGraphLayouts(int, IlvGraphLayout)
public void performLayoutOnce(IlvGraphLayout layout, Runnable initializations, Runnable postprocessing)
In contrast to the node and link layout optimizers, that are registered in the grapher and called automatically when needed, this function allows you to call a layout only once. It is useful when the layout takes a lot of time to perform.
performLayoutOnce
in interface IlpGraphLayoutSupport
layout
- A graph layout that is not attached to any grapher
or graph model.initializations
- Code that performs initializations of the layout
after the layout is attached, but before it is run.postprocessing
- Code that performs post-processing of the layout
after the layout has been run, but before it is
detached.RuntimeException
- if this instance is not attached
to a view.public IlvGraphModel createGraphModel()
This graph model represents the whole Network component graph model.
In order to specify a different graph model for each subnetwork, override
the method IlvGraphModel.getGraphModel(java.lang.Object)
,
where the argument is the subnetwork grapher.
createGraphModel
in interface IlpGraphLayoutSupport
IltGrapherAdapter
RuntimeException
- if this instance is not attached
to a view.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.