y.layout
Interface EdgeLabelModel

All Known Implementing Classes:
DiscreteEdgeLabelModel, FreeEdgeLabelModel, SliderEdgeLabelModel

public interface EdgeLabelModel

This interface defines the properties of the model associated with an edge label layout.

An edge label model provides a set of possible candidates for the placement of an edge label.


Method Summary
 Object createModelParameter(YRectangle labelBounds, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
          Creates a model parameter that represents the given edge label context best within this model.
 Object getDefaultParameter()
          Returns the default parameter for this model.
 YList getLabelCandidates(EdgeLabelLayout labelLayout, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
          Returns a list of EdgeLabelCandidate objects each of which describes a valid label position within this model.
 YPoint getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, Object param)
          Returns the coordinate of the upper-left corner of a label whose environment corresponds to the given parameters.
 

Method Detail

getDefaultParameter

public Object getDefaultParameter()
Returns the default parameter for this model.


getLabelPlacement

public YPoint getLabelPlacement(YDimension labelSize,
                                EdgeLayout edgeLayout,
                                NodeLayout sourceLayout,
                                NodeLayout targetLayout,
                                Object param)
Returns the coordinate of the upper-left corner of a label whose environment corresponds to the given parameters.

Parameters:
labelSize - the size of the label that should be placed
edgeLayout - the layout of the edge to which the label belongs.
sourceLayout - the layout of the source node of the label owning edge.
targetLayout - the layout of the target node of the label owning edge.
param - the model paramter that describes the abstract position of the label within this model. The parameter must have been generated by this model.

getLabelCandidates

public YList getLabelCandidates(EdgeLabelLayout labelLayout,
                                EdgeLayout edgeLayout,
                                NodeLayout sourceLayout,
                                NodeLayout targetLayout)
Returns a list of EdgeLabelCandidate objects each of which describes a valid label position within this model.

Parameters:
labelLayout - label for which candidates should be generated
edgeLayout - the layout of the edge to which the label belongs.
sourceLayout - the layout of the source node of the label owning edge.
targetLayout - the layout of the target node of the label owning edge.

createModelParameter

public Object createModelParameter(YRectangle labelBounds,
                                   EdgeLayout edgeLayout,
                                   NodeLayout sourceLayout,
                                   NodeLayout targetLayout)
Creates a model parameter that represents the given edge label context best within this model. The created model parameter represents the closest parameter representation of the given label location that can be achived within the model.

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.
sourceLayout - the layout of the source node of the label owning edge.
targetLayout - the layout of the target node of the label owning edge.

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

2003