y.layout
Class FreeEdgeLabelModel

java.lang.Object
  |
  +--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()
           
 
Method Summary
 Object createModelParameter(YRectangle 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.
 YPoint 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()
Method Detail

getDefaultParameter

public Object getDefaultParameter()
Returns the default parameter.

Specified by:
getDefaultParameter in interface EdgeLabelModel

createModelParameter

public Object createModelParameter(YRectangle 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.

getLabelPlacement

public YPoint 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 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 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 - 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.

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

2003