| Developing with the SDK > Using and Adding Renderers > Predefined Renderers > The GraphLayout Renderer |
The GraphLayout Renderer |
INDEX
PREVIOUS
NEXT
|
| Note |
| Graph layout features are available only if you purchased a full JViews Diagrammer license. |
The GraphLayout renderer lets you apply an automatic layout algorithm to the nodes of the graph. The layout algorithm can be any of the algorithms made available by the Graph Layout capability.
The graph layout algorithm will be applied once when the data model is loaded, and also every time a new object is dynamically added to the model. The algorithm can be temporarily disabled and then re-enabled.
Table 4.6 lists the properties of the GraphLayout renderer.
Property |
Type |
Default |
Description |
|---|---|---|---|
connectingLinksToShape |
boolean | false |
Specifies whether the links should be connected to the shape of the node or to the bounding box of the node (including the label). Connection to the shape is possible if the node is an IlvGeneralNode object, and does not take the label into account if it is outside the shape. |
enabled |
boolean | true |
Enables/disables the graph layout algorithm. |
graphLayout |
IlvGraphLayout | null |
Specifies which algorithm to apply. You can use the full class name, for example:
or an abbreviated name (for example, Hierarchical). |
incrementalLayout |
boolean | false |
Tells the renderer to perform an incremental layout (if the selected algorithm is a hierarchical layout). If this property is true, all the nodes that are not selected will be marked for incremental layout. As a result, the layout will try to keep these nodes at their current position in the hierarchy, and place the selected nodes regardless of their current position. Note that this is related to a partial layout, but is not exactly the same. In particular, nodes that are not selected may still be moved slightly after an incremental layout. See IlvHierarchicalLayout for a complete description of incremental layout. |
partialLayout |
boolean | false |
Tells the renderer to lay out only the selected objects. Objects that are not selected are marked as fixed before the layout. |
savingNodePositions |
boolean | false |
Specifies whether the new positions of the nodes must be saved to the data model after the layout is applied. |
You can set any property of the IlvGraphLayout subclass corresponding to the selected layout algorithm. Code Sample 4.14 shows an example of some typical rules.
SDM { GraphLayout : "Hierarchical"; } GraphLayout { enabled : "false"; globalLinkStyle : "ORTHOGONAL_LINKS"; flowDirection : "Bottom"; } |
In this example, enabled is a property of the GraphLayout renderer itself, but globalLinkStyle and flowDirection are properties of the IlvHierarchicalLayout object used by the renderer.
The properties of each layout algorithm are fully explained in the Using Graph Layout Algorithms. The properties of the IlvGraphLayout subclasses conform to the JavaBeans conventions: if a class has a pair of methods called setMyProp (with a single parameter) and getMyProp (without parameters), then you can set the property myProp in the style sheet.
Table 4.7 lists the per-object rendering properties of the GraphLayout renderer:
You can set any parameter of a graph layout algorithm that applies to a particular node or link in the style sheet. Such a parameter is defined by a method of the form:
or
Node or link parameters are set in the style sheet as follows:
node {
MyParam : "value";
}
The name of the property is the name of the method, without the set prefix. Note that node and link parameters are capitalized, unlike Bean properties.
For example, the hierarchical layout defines a setFromPortSide method that lets you choose which side of the origin node a given link will be connected to. The signature of the method is:
setFromPortSide(Object link, int side);
In the style sheet, you can set this parameter as follows:
link {
FromPortSide : "WEST";
}
The value of the property can be any simple type (integer, String, float), or it can be the name of a public constant defined by the graph layout class, for example, WEST , which is defined in the class IlvHierarchicalLayout.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |