Search this API

y.layout
Class FreeEdgeLabelModel

java.lang.Object
  extended by y.layout.FreeEdgeLabelModel
All Implemented Interfaces:
EdgeLabelModel

public class FreeEdgeLabelModel
extends Object
implements EdgeLabelModel

An edge label model that allows placement of labels at a fixed offset from the source intersection point of the node.


Nested Class Summary
static class FreeEdgeLabelModel.ModelParameter
          The model parameters for the FreeEdgeLabelModel.
 
Constructor Summary
FreeEdgeLabelModel()
          Creates a new instance of FreeEdgeLabelModel.
 
Method Summary
 Object createModelParameter(OrientedRectangle labelBounds, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode)
          Returns a model parameter that represents the given edge label context.
 Object getDefaultParameter()
          Returns the default parameter.
 YList getLabelCandidates(EdgeLabelLayout label, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode)
          Returns exactly one label candidate that corresponds to the actual label layout of the given label.
 OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode, Object param)
          Returns the positions of the upper left corner of the label with given parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeEdgeLabelModel

public FreeEdgeLabelModel()
Creates a new instance of FreeEdgeLabelModel.

Method Detail

getDefaultParameter

public Object getDefaultParameter()
Returns the default parameter.

Specified by:
getDefaultParameter in interface EdgeLabelModel
Returns:
A model parameter that can be passed to the EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object) method.

createModelParameter

public Object createModelParameter(OrientedRectangle labelBounds,
                                   EdgeLayout edgeLayout,
                                   NodeLayout sourceNode,
                                   NodeLayout targetNode)
Returns a model parameter that represents the given edge label context. The created model parameter reproduces the location of the given label bounds.

Specified by:
createModelParameter in interface EdgeLabelModel
Parameters:
labelBounds - The bounds of the label for which a parameter representation is sought.
edgeLayout - The layout of the edge to which the label belongs.
sourceNode - The layout of the source node of the label owning edge.
targetNode - The layout of the target node of the label owning edge.
Returns:
A model parameter that can be passed to the EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object) method.

getLabelPlacement

public OrientedRectangle getLabelPlacement(YDimension labelSize,
                                           EdgeLayout edgeLayout,
                                           NodeLayout sourceNode,
                                           NodeLayout targetNode,
                                           Object param)
Returns the positions of the upper left corner of the label with given parameter.

Specified by:
getLabelPlacement in interface EdgeLabelModel
Parameters:
labelSize - The size of the label that should be placed.
edgeLayout - The layout of the edge to which the label belongs.
sourceNode - The layout of the source node of the label owning edge.
targetNode - The layout of the target node of the label owning edge.
param - The model parameter that describes the abstract position of the label within this model. The parameter must have been generated by this model.
Returns:
The bounds of the label.

getLabelCandidates

public YList getLabelCandidates(EdgeLabelLayout label,
                                EdgeLayout edgeLayout,
                                NodeLayout sourceNode,
                                NodeLayout targetNode)
Returns exactly one label candidate that corresponds to the actual label layout of the given label.

Specified by:
getLabelCandidates in interface EdgeLabelModel
Parameters:
label - The label for which candidates should be generated.
edgeLayout - The layout of the edge to which the label belongs.
sourceNode - The layout of the source node of the label owning edge.
targetNode - The layout of the target node of the label owning edge.
Returns:
A list of EdgeLabelCandidate objects.

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.