Packagecom.yworks.yfiles.layout
Interfacepublic interface LabelLayoutFactory

Factory that provides methods to create, add and remove node/edge labels for com.yworks.yfiles.layout.LayoutGraph s. It can be used, e.g., to temporarily add labels during layout calculation. Note that original labels which are removed during a layout calculation have to be re-added when the layout calculation is done. Otherwise buffered layout calculations (com.yworks.yfiles.layout.BufferedLayouter) and delayed layout results (com.yworks.yfiles.layout.LayoutTool.applyGraphLayout()) will most likely produce incorrect results or break down with ClassCastExceptions.

An instance of the factory can be obtained with method com.yworks.yfiles.layout.LayoutTool.getLabelFactory(). This method uses the added protected com.yworks.yfiles.layout.LayoutGraph.createLabelFactory() method to create the factory.

Note that each factory instance is bound to a specific graph instance, i.e., you can only create, add and remove labels for the graph specified in method getLabelFactory (com.yworks.yfiles.layout.LayoutTool.getLabelFactory()).

See also

com.yworks.yfiles.layout.LayoutGraph
buffered layout calculations
delayed layout results
com.yworks.yfiles.layout.LayoutTool.getLabelFactory()
com.yworks.yfiles.layout.LayoutGraph.createLabelFactory()
getLabelFactory


Public Properties
 PropertyDefined By
  graph : LayoutGraph
[read-only] Returns the graph associated with this label factory instance.
LabelLayoutFactory
Public Methods
 MethodDefined By
  
addEdgeLabelLayout(edge:Edge, labelLayout:EdgeLabelLayout):void
Adds the given edge label layout to the given edge.
LabelLayoutFactory
  
addNodeLabelLayout(node:Node, labelLayout:NodeLabelLayout):void
Adds the given node label layout to the given node.
LabelLayoutFactory
  
Creates a new label layout for the given edge.
LabelLayoutFactory
  
Creates a new label layout for the given edge.
LabelLayoutFactory
  
Creates a new label layout for the given node.
LabelLayoutFactory
  
Creates a new label layout for the given node.
LabelLayoutFactory
  
Removes the given edge label layout from the given edge.
LabelLayoutFactory
  
Removes the given node label layout from the given node.
LabelLayoutFactory
Property Detail
graphproperty
graph:LayoutGraph  [read-only]

Returns the graph associated with this label factory instance.


Implementation
    public function get graph():LayoutGraph
Method Detail
addEdgeLabelLayout()method
public function addEdgeLabelLayout(edge:Edge, labelLayout:EdgeLabelLayout):void

Adds the given edge label layout to the given edge. The given label layout has to be created with method createEdgeLabelLayout() or createEdgeLabelLayoutWithModel().

Note, implementations of this method must ensure that re-adding temporarily removed original labels during buffered layout calculations (com.yworks.yfiles.layout.BufferedLayouter) automatically restores the original order of labels at the given edge. Otherwise the layout calculation will most likely produce incorrect results or break down with ClassCastExceptions.

Parameters

edge:Edge — the given edge.
 
labelLayout:EdgeLabelLayout — the edge label layout that should be added to the given edge.


Throws
IllegalArgumentException — if the given label layout has already been added to the graph.

See also

addNodeLabelLayout()method 
public function addNodeLabelLayout(node:Node, labelLayout:NodeLabelLayout):void

Adds the given node label layout to the given node. The given label layout has to be created with method createNodeLabelLayout() or createNodeLabelLayoutWithModel().

Note, implementations of this method must ensure that re-adding temporarily removed original labels during buffered layout calculations (com.yworks.yfiles.layout.BufferedLayouter) automatically restores the original order of labels at the given node. Otherwise the layout calculation will most likely produce incorrect results or break down with ClassCastExceptions.

Parameters

node:Node — the given node.
 
labelLayout:NodeLabelLayout — the node label layout that should be added to the given node.


Throws
IllegalArgumentException — if the given label layout has already been added to the graph.

See also

createEdgeLabelLayout()method 
public function createEdgeLabelLayout(edge:Edge, orientedBox:YOrientedRectangle):EdgeLabelLayout

Creates a new label layout for the given edge. Note that calling this method has no effect on the edge's labels. The returned label layout has to be added to the edge using method addEdgeLabelLayout().

This method should create a label layout with a com.yworks.yfiles.layout.EdgeLabelModel that supports the desired oriented label box exactly as given.

Parameters

edge:Edge — the given edge.
 
orientedBox:YOrientedRectangle — the box specifying the size and location of the label.

Returns
EdgeLabelLayout — a new edge label layout.

See also

createEdgeLabelLayoutWithModel()method 
public function createEdgeLabelLayoutWithModel(edge:Edge, orientedBox:YOrientedRectangle, model:EdgeLabelModel, descriptor:PreferredPlacementDescriptor):EdgeLabelLayout

Creates a new label layout for the given edge. Note that calling this method has no effect on the edge's labels. The returned label layout has to be added to the edge using method addEdgeLabelLayout().

Note that the oriented box associated with the created edge label layout (see method com.yworks.yfiles.layout.EdgeLabelLayout.orientedBox) may differ from the given oriented box, i.e., the box associated with the label layout corresponds to the closest box (with respect to the given box) that is valid in the specified edge label model.

Parameters

edge:Edge — the given edge.
 
orientedBox:YOrientedRectangle — the box specifying the size and location of the label.
 
model:EdgeLabelModel — specifies the model of the created edge label.
 
descriptor:PreferredPlacementDescriptor — specifies the preferred placement descriptor of the created label. If this value is null, the default descriptor is used.

Returns
EdgeLabelLayout — a new edge label layout.

See also

createNodeLabelLayout()method 
public function createNodeLabelLayout(node:Node, orientedBox:YOrientedRectangle):NodeLabelLayout

Creates a new label layout for the given node. Note that calling this method has no effect on the node's labels. The returned label layout has to be added to the node using method addNodeLabelLayout().

This method should create a label layout with a com.yworks.yfiles.layout.NodeLabelModel that supports the desired oriented label box exactly as given.

Parameters

node:Node — the given node.
 
orientedBox:YOrientedRectangle — the box specifying the size and location of the label.

Returns
NodeLabelLayout — a new node label layout.

See also

createNodeLabelLayoutWithModel()method 
public function createNodeLabelLayoutWithModel(node:Node, orientedBox:YOrientedRectangle, model:NodeLabelModel):NodeLabelLayout

Creates a new label layout for the given node. Note that calling this method has no effect on the node's labels. The returned label layout has to be added to the node using method addNodeLabelLayout().

Note that the oriented box associated with the created node label layout (see method com.yworks.yfiles.layout.NodeLabelLayout.orientedBox) may differ from the given oriented box, i.e., the box associated with the label layout corresponds to the closest box (with respect to the given box) that is valid in the specified node label model.

Parameters

node:Node — the given node.
 
orientedBox:YOrientedRectangle — the box specifying the size and location of the label.
 
model:NodeLabelModel — specifies the model of the created node label.

Returns
NodeLabelLayout — a new node label layout.

See also

removeEdgeLabelLayout()method 
public function removeEdgeLabelLayout(edge:Edge, labelLayout:EdgeLabelLayout):void

Removes the given edge label layout from the given edge.

Note that original labels which are removed during a layout calculation have to be re-added when the layout calculation is done. Otherwise buffered layout calculations (com.yworks.yfiles.layout.BufferedLayouter) and delayed layout results (com.yworks.yfiles.layout.LayoutTool.applyGraphLayout()) will most likely produce incorrect results or break down with ClassCastExceptions.

Parameters

edge:Edge — the given edge.
 
labelLayout:EdgeLabelLayout — the label layout that should be removed from the given edge.

See also

removeNodeLabelLayout()method 
public function removeNodeLabelLayout(node:Node, labelLayout:NodeLabelLayout):void

Removes the given node label layout from the given node.

Note that original labels which are removed during a layout calculation have to be re-added when the layout calculation is done. Otherwise buffered layout calculations (com.yworks.yfiles.layout.BufferedLayouter) and delayed layout results (com.yworks.yfiles.layout.LayoutTool.applyGraphLayout()) will most likely produce incorrect results or break down with ClassCastExceptions.

Parameters

node:Node — the given node.
 
labelLayout:NodeLabelLayout — the label layout that should be removed from the given node.

See also