Search this API

y.layout
Interface NodeLabelModel

All Known Implementing Classes:
DiscreteNodeLabelModel, EdgeOppositeNodeLabelModel, FreeNodeLabelModel, PortLabelModel, SmartNodeLabelModel, TableGroupNodeRealizer.ColumnNodeLabelModel, TableGroupNodeRealizer.RowNodeLabelModel

public interface NodeLabelModel

This interface defines the properties of the model associated with a node label layout.

A node label model provides a set of possible candidates for the placement of a node label.


Method Summary
 Object createModelParameter(OrientedRectangle labelBounds, NodeLayout nodeLayout)
          Creates a model parameter that represents the given node label context best within this model.
 Object getDefaultParameter()
          Returns a model parameter that encodes the default position of this model's allowed node label positions.
 YList getLabelCandidates(NodeLabelLayout nl, NodeLayout nodeLayout)
          Returns a list of NodeLabelCandidate objects each of which describes a valid label position within this model.
 OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, Object param)
          Returns the oriented label position and bounds encoded by the given model parameter.
 

Method Detail

getDefaultParameter

Object getDefaultParameter()
Returns a model parameter that encodes the default position of this model's allowed node label positions.

Returns:
A model parameter that can be passed to the getLabelPlacement(YDimension, NodeLayout, Object) method.

getLabelPlacement

OrientedRectangle getLabelPlacement(YDimension labelSize,
                                    NodeLayout nodeLayout,
                                    Object param)
Returns the oriented label position and bounds encoded by the given model parameter.

Parameters:
labelSize - The size of the label that should be placed.
nodeLayout - The layout of the node to which the label belongs.
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 oriented label position and bounds.

getLabelCandidates

YList getLabelCandidates(NodeLabelLayout nl,
                         NodeLayout nodeLayout)
Returns a list of NodeLabelCandidate objects each of which describes a valid label position within this model.

Parameters:
nl - The label layout for which candidates should be generated.
nodeLayout - The layout of the node to which the label belongs.
Returns:
A list of NodeLabelCandidate objects.

createModelParameter

Object createModelParameter(OrientedRectangle labelBounds,
                            NodeLayout nodeLayout)
Creates a model parameter that represents the given node label context best within this model. The created model parameter represents the closest parameter representation of the given oriented label bounds that can be achieved within this model.

Parameters:
labelBounds - The bounds of the label for which a parameter representation is sought.
nodeLayout - The layout of the node to which the label belongs.
Returns:
A model parameter that can be passed to the getLabelPlacement(YDimension, NodeLayout, Object) method.

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