public class IlvBusLayout extends IlvGraphLayout
The Bus Layout algorithm is designed to display bus network topologies, that is, a set of nodes connected to a bus node. The algorithm takes into account the size of the nodes (so that no nodes overlap) and provides several ordering and alignment options.
Here is a sample drawing produced with the Bus Layout algorithm:
To use this layout style, you must specify a node of the attached
graph model as the "bus" using the method setBus(ilog.views.IlvPolyPointsInterface)
. The bus
node must be an instance of a class that implements the interface
IlvPolyPointsInterface
, for instance, an IlvPolyline
(or a subclass). The layout algorithm
gives the bus polyline the appropriate shape by moving, adding, or
removing points as needed. Therefore, the initial number of points and
the position of those points are not significant. Note that for the
bus object, you can use only implementations of the interface
IlvPolyPointsInterface
for which the methods IlvPolyPointsInterface.allowsPointInsertion()
and IlvPolyPointsInterface.allowsPointRemoval()
return
true
.
Only the nodes connected to the bus node by a link are laid out.
The following figure illustrates the dimensional parameters of the layout algorithm.
The algorithm not only computes the shape of the bus object and the position of the nodes connected to the bus but also the connection points of the links on the bus node. These points are computed in such a manner as to obtain vertical links.
If the attached graph model encapsulates an IlvGrapher
, the
computation of the connection points is provided by a special subclass
of IlvLinkConnector
called IlvBusLinkConnector
.
Otherwise, the method getConnectionPoint(java.lang.Object, ilog.views.IlvPolyPointsInterface)
is provided to allow
you to implement a different mechanism.
See the corresponding chapter of the User's Manual for details on the algorithm, the types of graphs for which this algorithm can be used, the features, code samples, parameters, and so on.
Note that the initial position of the nodes (at the moment you start
the layout) does not affect the resulting layout. However, nodes
specified as fixed are not moved if you call the method IlvGraphLayout.setPreserveFixedNodes(boolean)
with a true
argument. The other
nodes are placed in such a way that overlaps with the fixed nodes are
avoided.
Modifier and Type | Field and Description |
---|---|
static int |
ALTERNATE
Alternate flow direction.
|
static Comparator |
ASCENDING_AREA
Ordering by ascending area.
|
static Comparator |
ASCENDING_HEIGHT
Ordering by ascending height.
|
static Comparator |
ASCENDING_INDEX
Ordering by ascending index.
|
static Comparator |
ASCENDING_WIDTH
Ordering by ascending width.
|
static int |
BOTTOM
Bottom alignment option.
|
static int |
CENTER
Center alignment option.
|
static Comparator |
DESCENDING_AREA
Ordering by descending area.
|
static Comparator |
DESCENDING_HEIGHT
Ordering by descending height.
|
static Comparator |
DESCENDING_INDEX
Ordering by descending index.
|
static Comparator |
DESCENDING_WIDTH
Ordering by descending width.
|
static int |
LEFT_TO_RIGHT
Left-to-right flow direction.
|
static int |
MIXED
Mixed alignment option.
|
static int |
NO_INDEX
No index code.
|
static int |
NO_ORDERING
Deprecated.
Beginning with JViews 6.5, pass the value
null
to setNodeComparator(java.util.Comparator) instead. |
static int |
NO_RESHAPE_STYLE
Option for no link reshaping.
|
static int |
NODES_ABOVE_BUS
Above-bus position for nodes.
|
static int |
NODES_BELOW_BUS
Below-bus position for nodes.
|
static int |
ORDER_BY_HEIGHT
Deprecated.
Beginning with JViews 6.5, pass the value
DESCENDING_HEIGHT to the method setNodeComparator(java.util.Comparator)
instead. |
static int |
ORDER_BY_INDEX
Deprecated.
Beginning with JViews 6.5, pass the value
ASCENDING_INDEX to the method setNodeComparator(java.util.Comparator) instead. |
static int |
STRAIGHT_LINE_STYLE
Option for straight-line link shape.
|
static int |
TOP
Top alignment option.
|
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
Constructor and Description |
---|
IlvBusLayout()
Creates a new instance of the Bus Layout algorithm.
|
IlvBusLayout(IlvBusLayout source)
Creates a new layout instance by copying an existing one.
|
Modifier and Type | Method and Description |
---|---|
int |
checkAppropriateLink(Object link)
Checks whether the input link is appropriate for this layout.
|
IlvGraphLayout |
copy()
Copies the layout instance.
|
void |
copyParameters(IlvGraphLayout source)
Copies the parameters from a given layout instance.
|
protected IlvGraphLayoutGrapherProperty |
createLayoutGrapherProperty(String name,
boolean withDefaults)
Returns a new instance of
IlvBusLayoutGrapherProperty that
stores the parameter settings of this layout class. |
protected IlvGraphLayoutNodeProperty |
createLayoutNodeProperty(String name,
IlvGraphic node,
boolean withDefaults)
Returns a new instance of
IlvBusLayoutNodeProperty that stores
the parameter settings of this layout class for nodes. |
void |
detach()
Overridden version of the method
detach . |
IlvPolyPointsInterface |
getBus()
Returns the current bus node.
|
double |
getConnectionOnBusMargin()
Returns the horizontal offset between the first/last node on a given
level and the left/right margin of the level.
|
IlvPoint |
getConnectionPoint(Object link,
IlvPolyPointsInterface bus)
Returns the connection point of
link on the bus node. |
int |
getFlowDirection()
Returns the option that specifies the flow direction of the nodes.
|
int |
getGlobalVerticalAlignment()
Returns the global vertical alignment style.
|
double |
getHorizontalOffset()
Returns the horizontal offset between nodes placed on the same level
of the bus.
|
int |
getIndex(Object node)
Returns the index associated with a node.
|
IlvBusLinkConnector |
getLinkConnector()
Returns the link connector installed on the bus node, if the bus is
already specified, or the link connector instance that will be
installed on the bus when it is specified.
|
int |
getLinkStyle()
Returns the current option for the style of the shape of the links.
|
double |
getMargin()
Returns the horizontal offset between the left/right border of the bus
level and the left/right border of the layout region.
|
double |
getMarginOnBus()
Returns the horizontal offset between the first/last node on a given
level and the left/right margin of the level.
|
int |
getMaxNumberOfNodesPerLevel()
Returns the maximum number of nodes per level.
|
IlvGraphicVector |
getMovingNodes()
Returns the vector of nodes being moved by the graph layout algorithm.
|
Comparator |
getNodeComparator()
Returns the comparator used for sorting the nodes.
|
int |
getNodePosition()
Returns the node position option.
|
int |
getOrdering()
Deprecated.
Beginning with JViews 6.5, use the method
getNodeComparator() instead. |
int |
getVerticalAlignment(Object node)
Returns the local vertical alignment style of the node.
|
double |
getVerticalOffsetToLevel()
Returns the vertical offset between the nodes and the horizontal level
of the bus to which they are connected.
|
double |
getVerticalOffsetToPreviousLevel()
Returns the vertical offset between nodes and the horizontal level of
the bus above the nodes.
|
protected void |
init()
Initializes instance variables.
|
boolean |
isBusLineExtremityAdjustingEnabled()
Returns
true if the adjustment of the extremity points of
the bus line is enabled. |
boolean |
isBusWidthAdjustingEnabled()
Returns
true if the adjustment of the bus width to the
total width of the nodes is enabled. |
boolean |
isIncrementalMode()
Returns
true if the incremental mode is enabled. |
protected void |
layout(boolean redraw)
Computes the layout using the Bus Layout algorithm.
|
protected IlvBusLinkConnector |
makeLinkConnector()
Creates a new instance of the link connector.
|
void |
setBus(IlvPolyPointsInterface bus)
Allows you to specify the bus node.
|
void |
setBusLineExtremityAdjustingEnabled(boolean enable)
Enables adjustment of the extremity points of the bus line.
|
void |
setBusWidthAdjustingEnabled(boolean enable)
Enables adjustment of the bus width to the total width of the nodes.
|
void |
setConnectionOnBusMargin(double margin)
Sets the horizontal offset between the first/last node on a given
level and the left/right margin of the level.
|
void |
setFlowDirection(int direction)
Allows you to specify the flow direction of the nodes.
|
void |
setGlobalVerticalAlignment(int alignment)
Sets the global vertical alignment style.
|
void |
setHorizontalOffset(double offset)
Sets the horizontal offset between nodes placed on the same level of
the bus.
|
void |
setIncrementalMode(boolean enable)
Enables or disables the incremental mode.
|
void |
setIndex(Object node,
int index)
Allows you to specify the index of a node.
|
void |
setLinkStyle(int style)
Sets the style of the shape of the links.
|
void |
setMargin(double margin)
Sets the horizontal offset between the left/right border of the bus
level and the left/right border of the layout region.
|
void |
setMarginOnBus(double margin)
Sets the horizontal offset between the first/last node on a given
level and the left/right margin of the level.
|
void |
setMaxNumberOfNodesPerLevel(int nNodes)
Sets the maximum number of nodes per level.
|
void |
setNodeComparator(Comparator comparator)
Sets the comparator used for sorting the nodes.
|
void |
setNodePosition(int position)
Sets the position of the nodes with respect to the bus line.
|
void |
setOrdering(int ordering)
Deprecated.
Beginning with JViews 6.5, use the method
setNodeComparator(java.util.Comparator) instead. |
void |
setVerticalAlignment(Object node,
int alignment)
Sets the vertical alignment style of an individual node.
|
void |
setVerticalOffsetToLevel(double offset)
Sets the vertical offset between the nodes and the horizontal level of
the bus to which they are connected.
|
void |
setVerticalOffsetToPreviousLevel(double offset)
Sets the vertical offset between the nodes and the horizontal level of
the bus above the nodes.
|
boolean |
supportsAllowedTime()
Indicates that this layout class can stop the layout computation in a
proper manner when the user-defined allowed time is exceeded.
|
boolean |
supportsLayoutOfConnectedComponents()
Indicates that this layout class can cut the attached graph into
connected components, apply itself to each connected component
separately, and use the layout instance returned by the method
IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected
components. |
boolean |
supportsLayoutRegion()
Indicates that this layout class can control the size of the graph
drawing to fit a user-defined region (a rectangle) or a user-defined
manager view.
|
boolean |
supportsLinkClipping()
Indicates that this layout class can use a link clip interface to clip
the end points of a link.
|
boolean |
supportsLinkConnectionBox()
Indicates that this layout class can use a link connection box
interface to calculate the end points of a link.
|
boolean |
supportsPreserveFixedNodes()
Indicates that this layout class allows the user to specify fixed
nodes.
|
boolean |
supportsSaveParametersToNamedProperties()
Indicates that this layout class can transfer the layout parameters to
named properties.
|
boolean |
supportsStopImmediately()
Indicates that this layout class can interrupt the current run of
layout immediately in a controlled way.
|
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, checkAppropriateLinks, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, connectAllLinksToCenter, connectLinkToCenter, contentsChanged, createLayoutLinkProperty, createLayoutReport, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayout, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLayouts, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, getParentLayout, getProperty, getProperty, getRecursiveLayout, getRemainingAllowedTime, getSeedValueForRandomGenerator, getSpecLayoutRegion, getSplineLinkFilter, increasePercentageComplete, isAnimate, isAutoLayout, isFitToView, isFixed, isGeometryUpToDate, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutRunning, isLayoutTimeElapsed, isLocalRecursiveLayoutNeeded, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoCheckAppropriateLinksEnabled, setAutoLayout, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLayoutRunning, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinBusyTime, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setStructureUpToDate, setUseDefaultParameters, setUseSeedValueForRandomGenerator, stopImmediately, supportsAnimation, supportsMemorySavings, supportsPercentageComplete, supportsPreserveFixedLinks, supportsRandomGenerator, supportsSplineRouting, unfixAllLinks, unfixAllNodes, useAnimateRedraw
public static final int NO_ORDERING
null
to setNodeComparator(java.util.Comparator)
instead.setOrdering(int)
, the nodes are arranged on the bus arbitrarily.public static final int ORDER_BY_HEIGHT
DESCENDING_HEIGHT
to the method setNodeComparator(java.util.Comparator)
instead.setOrdering(int)
, the nodes are arranged on the bus by
height, starting at the upper-left margin of the bus with the tallest
node. Ordering the nodes by height can save vertical space and
produce a more compact layout.public static final int ORDER_BY_INDEX
ASCENDING_INDEX
to the method setNodeComparator(java.util.Comparator)
instead.setOrdering(int)
, the nodes are arranged on the bus in the
order of their indexes, starting at the upper-left margin of the bus
with the node with the smallest index. Nodes that do not have an
index are placed after the nodes for which an index is specified.
Ordering by index allows you to specify a particular order for the
nodes.public static final Comparator DESCENDING_HEIGHT
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus by height, starting at the upper-left margin of the bus with
the tallest node. Ordering the nodes by height can save vertical
space and produce a more compact layout.public static final Comparator ASCENDING_HEIGHT
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus by ascending height, starting at the upper-left margin of the
bus with the shortest node. Ordering the nodes by height can save
vertical space and produce a more compact layout.public static final Comparator ASCENDING_WIDTH
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus by ascending width, starting at the upper-left margin of the
bus with the narrowest node.public static final Comparator DESCENDING_WIDTH
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus by width, starting at the upper-left margin of the bus with
the widest node.public static final Comparator ASCENDING_AREA
setNodeComparator(java.util.Comparator)
, the nodes are arranged on the
bus by ascending area, starting at the upper-left margin of the bus
with the node that has the smallest area.public static final Comparator DESCENDING_AREA
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus by area, starting at the upper-left margin of the bus with
the node that has the largest area.public static final Comparator ASCENDING_INDEX
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus in the order of their indexes, starting at the upper-left
margin of the bus with the node that has the lowest index. Nodes that
do not have an index are placed after nodes for which an index is
specified. Ordering by index allows you to specify a particular order
for the nodes.public static final Comparator DESCENDING_INDEX
setNodeComparator(java.util.Comparator)
, the nodes are arranged on
the bus in the order of their indexes, starting at the upper-left
margin of the bus with the node that has the highest index. Nodes
that do not have an index are placed after nodes for which an index
is specified. Ordering by index allows you to specify a particular
order for the nodes.public static final int NO_INDEX
getIndex(java.lang.Object)
when a node has no index value.public static final int STRAIGHT_LINE_STYLE
setLinkStyle(int)
, the links are
given a straight-line shape.public static final int NO_RESHAPE_STYLE
setLinkStyle(int)
, the links are not reshaped.public static final int CENTER
When used as the argument of the method setGlobalVerticalAlignment(int)
, all the nodes are vertically
centered on their level. The alignment of an individual node can be
set by setVerticalAlignment(Object, int)
.
public static final int TOP
setGlobalVerticalAlignment(int)
, all the nodes are aligned to the
top border of their level. The alignment of an individual node can be
set by setVerticalAlignment(Object, int)
.public static final int BOTTOM
setGlobalVerticalAlignment(int)
, all the nodes are aligned
to the bottom border of their level. The alignment of an individual
node can be set by setVerticalAlignment(Object, int)
.public static final int MIXED
setGlobalVerticalAlignment(int)
, each node can have a different
alignment. The alignment of an individual node can be set by setVerticalAlignment(Object, int)
.public static final int LEFT_TO_RIGHT
setFlowDirection(int)
, all the nodes "flow" from left to right on
all levels of the bus.public static final int ALTERNATE
setFlowDirection(int)
, all the nodes "flow" from left to right on
the odd bus levels (first, third, fifth, and so on) and from right to
left on the even bus levels (second, fourth, sixth, and so on). The
levels are numbered from the top.public static final int NODES_ABOVE_BUS
setNodePosition(int)
, the nodes are placed above
the bus line.public static final int NODES_BELOW_BUS
setNodePosition(int)
, the nodes are placed below
the bus line.public IlvBusLayout()
IlvGraphLayout.attach(IlvGrapher)
. IlvGraphLayout.attach(IlvGraphModel)
. setBus(ilog.views.IlvPolyPointsInterface)
. IlvGraphLayout.performLayout()
. public IlvBusLayout(IlvBusLayout source)
copy()
method. Any subclass should
provide a copy constructor.
The parameters of the source
layout are copied using the
method copyParameters(ilog.views.graphlayout.IlvGraphLayout)
.
source
- The layout instance that is copied.copy()
,
copyParameters(ilog.views.graphlayout.IlvGraphLayout)
public IlvGraphLayout copy()
This method copies the layout instance by calling the copy constructor.
When performing a recursive layout of a nested graph, this method is
used by IlvLayoutProvider
to "clone" the layout instance of a
parent graph.
Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the layout region specification and the customization interfaces, are also copied. A copy of the layout instance used for laying out the connected components is set on the new instance.
If a method of the type supportsXXX
is associated with a
parameter, the parameter is copied only if the corresponding method
returns true
.
copy
in class IlvGraphLayout
public void copyParameters(IlvGraphLayout source)
Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the layout region specification and the customization interfaces, are also copied. A copy of the layout instance used for laying out the connected components is set on this layout instance.
If a method of the type supportsXXX
is associated with a
parameter, the parameter is copied only if the corresponding method
returns true
.
copyParameters
in class IlvGraphLayout
source
- The layout instance from which the parameters are copied.copy()
protected void init()
You should not call this method directly. The method is called internally by the constructor without arguments and by the copy constructor. The method must be overridden by subclasses that need to initialize additional instance variables.
init
in class IlvGraphLayout
public void detach()
detach
.detach
in class IlvGraphLayout
detach()
protected void layout(boolean redraw) throws IlvGraphLayoutException
IlvGraphLayout.performLayout()
.layout
in class IlvGraphLayout
redraw
- If true
, the attached graph model will be
asked to redraw the graph after layout. When the layout algorithm
moves the nodes and reshapes the links, it is required to pass the
value of the redraw
argument to the methods IlvGraphModel.moveNode(java.lang.Object, double, double, boolean)
and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean)
.IlvGraphLayoutException
- in the following cases:
getBus()
).getCalcLayoutRegion().width > 2*getMargin() +
2*getMarginOnBus()
IlvInappropriateLinkException
- if the grapher contains links
that cannot be reshaped to a straight line and the link style is
STRAIGHT_LINE_STYLE
. (For details, see IlvInappropriateLinkException
).IlvGraphLayout.performLayout()
,
IlvGraphLayout.getCalcLayoutRegion()
,
getMargin()
,
getMarginOnBus()
public final boolean supportsPreserveFixedNodes()
setPreserveFixedNodes(boolean)
is called with a
true
argument.supportsPreserveFixedNodes
in class IlvGraphLayout
true
.IlvGraphLayout.setPreserveFixedNodes(boolean)
,
IlvGraphLayout.isPreserveFixedNodes()
public final boolean supportsLayoutRegion()
This layout uses the layout region to determine the vertical positioning of the upper level of the bus and the horizontal dimension of the levels of the bus. The height of the layout region is not used because it may need to be larger or smaller depending on the amount of space required for the drawing.
supportsLayoutRegion
in class IlvGraphLayout
true
.IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView)
,
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect)
,
IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect)
,
IlvGraphLayout.getSpecLayoutRegion()
,
IlvGraphLayout.getCalcLayoutRegion()
public final boolean supportsLayoutOfConnectedComponents()
IlvGraphLayout.getLayoutOfConnectedComponents()
to position the connected
components. By default, the returned layout is an instance of IlvGridLayout
, which can
be customized as needed.supportsLayoutOfConnectedComponents
in class IlvGraphLayout
true
.IlvGraphLayout.getLayoutOfConnectedComponents()
,
IlvGraphLayout.isLayoutOfConnectedComponentsEnabled()
,
IlvGraphLayout.performLayout(boolean, boolean)
public final boolean supportsAllowedTime()
IlvGraphLayoutReport.STOPPED_AND_INVALID
in this case.
supportsAllowedTime
in class IlvGraphLayout
true
.IlvGraphLayout.setAllowedTime(long)
,
IlvGraphLayout.getAllowedTime()
,
IlvGraphLayoutReport.getCode()
public final boolean supportsStopImmediately()
IlvGraphLayoutReport.STOPPED_AND_INVALID
in this case.
supportsStopImmediately
in class IlvGraphLayout
true
.IlvGraphLayout.stopImmediately()
,
IlvGraphLayout.isStoppedImmediately()
public final boolean supportsLinkConnectionBox()
The connection box interface is used only if link clipping is enabled
by setting a link clip interface and the link style is straight line.
In this case, the layout algorithm calculates the virtual center of
the end nodes of each link by the link connection box interface and
obtains the final connection points by clipping with the link clip
interface. The virtual center is defined as the center of the
connection box shifted by the average of the tangential "top" and
"bottom" offset in the horizontal direction and the average of the
tangential "left" and "right" offset in the vertical direction. For
instance, if the tangential offset is 20 at the top side and 10 at
all other sides, the average shift offset is (20 + 10)/2 =
15
in the horizontal direction and (10 + 10)/2 =
10
in the vertical direction; hence the virtual center is at
connectionBox.center() + (15, 10)
.
The bus node is never treated by the link clipping, because the bus
node usually has a special bus link connector (see IlvBusLinkConnector
). Therefore, the link connection box does not
affect the bus node.
If no link clipping is performed, the layout algorithm does not actively place the end points of links. It relies on the link connectors that are attached to the nodes to find appropriate connection points for the links.
supportsLinkConnectionBox
in class IlvGraphLayout
true
.IlvGraphLayout.setLinkConnectionBoxInterface(ilog.views.graphlayout.IlvLinkConnectionBoxInterface)
,
IlvGraphLayout.setLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface)
,
IlvLinkConnector
,
setLinkStyle(int)
,
setBus(ilog.views.IlvPolyPointsInterface)
,
supportsLinkClipping()
public final boolean supportsLinkClipping()
The bus node is never treated by the link clipping because the bus
node usually has a special bus link connector (see IlvBusLinkConnector
).
Link clipping is performed only if the link style is straight line. If no link clip interface is given, the layout algorithm does not actively place the end points of links. It relies on the link connectors that are attached to the nodes to find appropriate connection points for the links.
supportsLinkClipping
in class IlvGraphLayout
true
.IlvGraphLayout.setLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface)
,
IlvLinkConnector
,
setLinkStyle(int)
,
setBus(ilog.views.IlvPolyPointsInterface)
,
supportsLinkConnectionBox()
public final boolean supportsSaveParametersToNamedProperties()
supportsSaveParametersToNamedProperties
in class IlvGraphLayout
true
.IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
public void setBus(IlvPolyPointsInterface bus)
The number of points on the "polypoints" is not significant. The
methods IlvPolyPointsInterface.allowsPointInsertion()
and
IlvPolyPointsInterface.allowsPointRemoval()
, defined in the
class IlvPolyPointsInterface
, must return true
.
Note that if the attached graph is an IlvGrapher
(or IlvGrapherAdapter
), this method automatically installs on the bus
node the instance of the link connector returned by the method makeLinkConnector()
.
Remark: It may be useful to restrict users from modifying the bus
node. If the bus node is an IlvPolyline
contained in an IlvGrapher
, you can call the method
IlvManager.setEditable(ilog.views.IlvGraphic, boolean)
on the grapher instance with a
false
parameter.
IllegalArgumentException
- If bus
is not a node in
the attached graph (the method IlvGraphModel.isNode(java.lang.Object)
is
called), or the bus object does not allow point insertion and
removal (the methods IlvPolyPointsInterface.allowsPointInsertion()
and IlvPolyPointsInterface.allowsPointRemoval()
are called on the bus
object).setBus(IlvPolyline)
.getBus()
public IlvPolyPointsInterface getBus()
IlvGraphModel.isNode(java.lang.Object)
is called), the method
automatically searches for a node that is an instance of
IlvPolyPointsInterface
. If none is found, the method
returns null
.
The method also returns null
if the previously specified
bus object is null
or is no longer a node in the
attached graph, or if no graph is attached.
IlvPolyline getBus()
.setBus(ilog.views.IlvPolyPointsInterface)
public void setIndex(Object node, int index)
NO_INDEX
as an
index value if you want to reset an index you previously specified.
Note that index
must not be negative. The values of the
indexes for consecutive nodes are not necessarily consecutive. Only
the order of the values is important.
setIndex(IlvGraphic, int)
.getIndex(java.lang.Object)
public int getIndex(Object node)
NO_INDEX
if node
has no index.getIndex(IlvGraphic)
.setIndex(java.lang.Object, int)
public IlvBusLinkConnector getLinkConnector()
Returns null
if the attached graph is not an IlvGrapherAdapter
or IlvGrapher
.
makeLinkConnector()
protected IlvBusLinkConnector makeLinkConnector()
The default implementation returns a new instance of
IlvBusLinkConnector
. This method can be overridden to
create subclasses of IlvBusLinkConnector
. If the
overridden method returns null
, no link connector is
installed on the bus node. Note that the method is called only when
the attached graph is an IlvGrapherAdapter
or an
IlvGrapher
.
getLinkConnector()
public IlvPoint getConnectionPoint(Object link, IlvPolyPointsInterface bus)
link
on the bus node.
This method is provided to obtain the connection points of the links
on the bus node in case the attached graph model does not encapsulate
an IlvGrapher
. If the attached graph model encapsulates
an IlvGrapher
, the layout of the connection points of
the links are computed by the class IlvBusLinkConnector
and this method is not used.
This method should be used only after having performed the layout, that is, after the bus node has been reshaped. Also, the method should be called only for links that have the bus object as the origin or destination node and are not self-links (same origin and destination nodes).
IlvBusLinkConnector
,
setConnectionOnBusMargin(double)
,
getConnectionOnBusMargin()
public final void setFlowDirection(int direction)
LEFT_TO_RIGHT
- The nodes "flow" from left to right on
all the levels of the bus.ALTERNATE
- The nodes "flow" from left to right on the
odd bus levels (first, third, fifth, and so on) and from right to
left on the even bus levels (second, fourth, sixth, and so on). The
levels are numbered from the top.
The default is LEFT_TO_RIGHT
.
getFlowDirection()
public int getFlowDirection()
setFlowDirection(int)
public final void setOrdering(int ordering)
setNodeComparator(java.util.Comparator)
instead.NO_ORDERING
- The nodes are ordered in an arbitrary
way.ORDER_BY_HEIGHT
- The nodes are ordered in the
descending order of their height.ORDER_BY_INDEX
- The nodes are ordered in the ascending
order of their index (see setIndex(java.lang.Object, int)
).NO_ORDERING
.
Note that in incremental mode (see setIncrementalMode(boolean)
) and
with fixed nodes (see IlvGraphLayout.setFixed(java.lang.Object, boolean)
), the order of the nodes is
not completely preserved.
public int getOrdering()
getNodeComparator()
instead.setOrdering(int)
public final void setNodeComparator(Comparator comparator)
DESCENDING_HEIGHT
- The nodes are ordered in descending
order of height.ASCENDING_HEIGHT
- The nodes are ordered in ascending
order of height.DESCENDING_WIDTH
- The nodes are ordered in descending
order of width.ASCENDING_WIDTH
- The nodes are ordered in ascending
order of width.DESCENDING_AREA
- The nodes are ordered in descending
order of area.ASCENDING_AREA
- The nodes are ordered in ascending
order of area.ASCENDING_INDEX
- The nodes are ordered in ascending
order of index value (see setIndex(java.lang.Object, int)
).DESCENDING_INDEX
- The nodes are ordered in descending
order of index value (see setIndex(java.lang.Object, int)
).null
- The nodes are ordered in an arbitrary way.
Comparator
interface: the nodes are ordered according to this custom
comparator.null
.
The ordering of the nodes starts at the upper-left corner of the bus.
In incremental mode (see setIncrementalMode(boolean)
) or when nodes
are fixed (see IlvGraphLayout.setFixed(java.lang.Object, boolean)
), the order of the nodes is not
guaranteed to obey the comparator, since this specification competes
with the other constraints.
getNodeComparator()
public Comparator getNodeComparator()
setNodeComparator(java.util.Comparator)
public final void setGlobalVerticalAlignment(int alignment)
Valid values are:
CENTER
- the node is centered on its level.TOP
- the node is aligned with the top border of the
level.BOTTOM
- the node is aligned with the bottom border of
the level.MIXED
- each node can have a different alignment
option. In this case, the vertical alignment of each individual node
can be set by the method setVerticalAlignment(Object, int)
,
so that different alignments can occur in the same layout.
The default value is TOP
.
getGlobalVerticalAlignment()
,
setVerticalAlignment(java.lang.Object, int)
public final int getGlobalVerticalAlignment()
setGlobalVerticalAlignment(int)
public final void setVerticalAlignment(Object node, int alignment)
MIXED
. Otherwise, all nodes have the alignment style that
is specified as the global alignment style.
The parameter controls the vertical alignment of nodes inside their level.
Valid values are:
CENTER
- the node is centered on its level.TOP
- the node is aligned to the top border of the
level.BOTTOM
- the node is aligned to the bottom border of
the level.
The default value is TOP
.
getVerticalAlignment(java.lang.Object)
,
setGlobalVerticalAlignment(int)
public final int getVerticalAlignment(Object node)
setVerticalAlignment(java.lang.Object, int)
,
setGlobalVerticalAlignment(int)
public void setHorizontalOffset(double offset)
getHorizontalOffset()
public double getHorizontalOffset()
setHorizontalOffset(double)
public void setVerticalOffsetToLevel(double offset)
getVerticalOffsetToLevel()
public double getVerticalOffsetToLevel()
setVerticalOffsetToLevel(double)
public void setVerticalOffsetToPreviousLevel(double offset)
getVerticalOffsetToPreviousLevel()
public double getVerticalOffsetToPreviousLevel()
setVerticalOffsetToPreviousLevel(double)
public void setMargin(double margin)
Note that the following relationship must be respected:
getCalcLayoutRegion().width > 2*getMargin() +
2*getMarginOnBus()
getMargin()
public double getMargin()
setMargin(double)
public void setMarginOnBus(double margin)
getMarginOnBus()
public double getMarginOnBus()
Note that the following relationship must be respected:
getCalcLayoutRegion().width > 2*getMargin() +
2*getMarginOnBus()
setMarginOnBus(double)
public void setConnectionOnBusMargin(double margin)
IlvGrapherAdapter
, an
IlvBusLinkConnector
is used to compute the connection
points of the links on the bus. IlvBusLinkConnector
provides its own margin parameter. Therefore, the margin parameter
for the connection of the links on the bus node is automatically
updated according to the current margin specified in the instance of
IlvBusLinkConnector
. The method
setConnectionOnBusMargin
is provided only for the case
where the attached graph does not encapsulate an
IlvGrapher
.public double getConnectionOnBusMargin()
Note that the following relationship must be respected:
getCalcLayoutRegion().width > 2*getMargin() +
2*getMarginOnBus()
public void setMaxNumberOfNodesPerLevel(int nNodes)
The minimum value is 1
. The default value is
Integer.MAX_VALUE
, that is, the number of nodes placed
in each level is bounded only by the size of the nodes and the
dimensional parameters.
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView)
,
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect)
,
IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect)
,
IlvGraphLayout.getSpecLayoutRegion()
,
IlvGraphLayout.getCalcLayoutRegion()
,
setMargin(double)
,
setMarginOnBus(double)
,
setHorizontalOffset(double)
public int getMaxNumberOfNodesPerLevel()
setMaxNumberOfNodesPerLevel(int)
public void setBusWidthAdjustingEnabled(boolean enable)
If adjustment is disabled, the width of the bus object, that is, the difference between the maximum and minimum x-coordinates, depends on the current width of the layout region. If adjustment is enabled, the width of the bus object is automatically adjusted to the total width of the nodes, plus the margins.
The parameter has no effect if getFlowDirection()
returns
ALTERNATE
.
Bus width adjustment is disabled by default.
isBusWidthAdjustingEnabled()
,
setFlowDirection(int)
public boolean isBusWidthAdjustingEnabled()
true
if the adjustment of the bus width to the
total width of the nodes is enabled.setBusWidthAdjustingEnabled(boolean)
public void setBusLineExtremityAdjustingEnabled(boolean enable)
If adjustment is enabled, the extremity points of the bus line are
adjusted, if necessary, to the total width of the nodes, plus the
margins. This can make a difference when there is only one horizontal
bus line, or when the flow direction is ALTERNATE
.
If adjustment is disabled, the horizontal lines of the bus have equal length.
The default value is false
.
isBusLineExtremityAdjustingEnabled()
,
setFlowDirection(int)
public boolean isBusLineExtremityAdjustingEnabled()
true
if the adjustment of the extremity points of
the bus line is enabled.setBusLineExtremityAdjustingEnabled(boolean)
public void setLinkStyle(int style)
STRAIGHT_LINE_STYLE
(the links are given a straight-line shape) and
NO_RESHAPE_STYLE
(no reshape is performed on the links).
This feature can be useful when the graph contains links that have
intermediate points and are not straight-line links (for instance,
IlvPolylineLinkImage
links with
intermediate points).
The default value is STRAIGHT_LINE_STYLE
.
Note that when the graph attached to the layout is of type IlvGrapher
, the effect of the link reshaping depends on the type of
the links and the connectors installed at the node. For STRAIGHT_LINE_STYLE
, we recommend using links of type IlvPolylineLinkImage
and attaching a link
connector of type IlvBusLinkConnector
on the bus node (if no
link connector is attached, the layout automatically attaches it).
Other link or connector types may cause an IlvInappropriateLinkException
during layout. You can use the method
IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider)
before layout or
when the exception is caught to convert all links and link connectors
to an appropriate type.
getLinkStyle()
public int getLinkStyle()
setLinkStyle(int)
public void setIncrementalMode(boolean enable)
If the incremental mode is enabled, the stability of the layout is preserved as much as possible when new nodes are added, existing ones removed, or node sizes modified. This means that the nodes are placed at the same location or in the same order as in the previous layout whenever it is possible. In this mode, the layout algorithm processes the changes incrementally rather than redoing the entire layout for every change.
To preserve the stability, the incremental mode can keep some regions free. Therefore, the total area of the layout can be larger than in nonincremental mode.
Note that the layout is redone from scratch after a change of one of the following parameters:
The default value is false
(disabled).
public boolean isIncrementalMode()
true
if the incremental mode is enabled. It
returns false
otherwise.setIncrementalMode(boolean)
public final void setNodePosition(int position)
Valid values are:
NODES_ABOVE_BUS
- the nodes are placed above the bus
lineNODES_BELOW_BUS
- the nodes are placed below the bus
line
The default value is NODES_ABOVE_BUS
.
getNodePosition()
public final int getNodePosition()
setNodePosition(int)
public int checkAppropriateLink(Object link)
IlvGraphLayout.checkAppropriateLinks()
.
checkAppropriateLink
in class IlvGraphLayout
link
- The link to be checked.IlvGraphLayout.checkAppropriateLinks()
public IlvGraphicVector getMovingNodes()
IlvGrapherAdaper
in order to optimize for speed.getMovingNodes
in class IlvGraphLayout
protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
IlvBusLayoutGrapherProperty
that
stores the parameter settings of this layout class.
The method is used by IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
to create a named property that contains parameter settings
of this layout instance.
createLayoutGrapherProperty
in class IlvGraphLayout
IlvGraphLayoutGrapherProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
protected IlvGraphLayoutNodeProperty createLayoutNodeProperty(String name, IlvGraphic node, boolean withDefaults)
IlvBusLayoutNodeProperty
that stores
the parameter settings of this layout class for nodes.
The method is used by IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout,
boolean)
to create a named property for a node that contains
parameter settings of this layout instance for the input node.
createLayoutNodeProperty
in class IlvGraphLayout
IlvGraphLayoutNodeProperty
,
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean)
,
IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout)
,
IlvGrapherAdapter.removeParametersFromNamedProperties()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.