Search this API

y.layout
Class EdgeOppositeNodeLabelModel

java.lang.Object
  extended by y.layout.EdgeOppositeNodeLabelModel
All Implemented Interfaces:
NodeLabelModel

public class EdgeOppositeNodeLabelModel
extends java.lang.Object
implements NodeLabelModel

EdgeOppositeNodeLabelModel allows for placing node labels at the opposite side of the outgoing edges of a node.

The labels are always opposite to the edges

 

Constructor Summary
EdgeOppositeNodeLabelModel(LayoutGraph graph, Node node)
          Creates a new instance of EdgeOppositeNodeLabelModel with default settings.
 
Method Summary
 java.lang.Object createModelParameter(OrientedRectangle labelBounds, NodeLayout nodeLayout)
          Creates a model parameter that represents the given node label position within this model.
 java.lang.Object getDefaultParameter()
          Returns a model parameter that encodes the default position of this model's allowed node label positions.
 YList getLabelCandidates(NodeLabelLayout labelLayout, NodeLayout nodeLayout)
          Returns all NodeLabelCandidates that describe valid label positions within this model.
 OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, java.lang.Object param)
          Returns the bounds of the label for the position encoded by the given model parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdgeOppositeNodeLabelModel

public EdgeOppositeNodeLabelModel(LayoutGraph graph,
                                  Node node)
Creates a new instance of EdgeOppositeNodeLabelModel with default settings.

Parameters:
graph - the graph that owns the node and its label
node - the node that owns the label
Method Detail

getDefaultParameter

public java.lang.Object getDefaultParameter()
Description copied from interface: NodeLabelModel
Returns a model parameter that encodes the default position of this model's allowed node label positions.

This parameter can be passed to NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object) to retrieve the corresponding label box.

Specified by:
getDefaultParameter in interface NodeLabelModel
Returns:
the model parameter describing the default placement of the node label

getLabelPlacement

public OrientedRectangle getLabelPlacement(YDimension labelSize,
                                           NodeLayout nodeLayout,
                                           java.lang.Object param)
Description copied from interface: NodeLabelModel
Returns the bounds of the label for the position encoded by the given model parameter.

Specified by:
getLabelPlacement in interface NodeLabelModel
Parameters:
labelSize - the width and height of the label
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
Returns:
the oriented box of the label

createModelParameter

public java.lang.Object createModelParameter(OrientedRectangle labelBounds,
                                             NodeLayout nodeLayout)
Description copied from interface: NodeLabelModel
Creates a model parameter that represents the given node label position within this model.

The created model parameter is the closest parameter representation of the given label location that can be achieved within this model.

This parameter can be passed to NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object) to retrieve the current label box.

A model parameter can be an arbitrary Object. However it must contain all information to allow restoring of the encoded location with this NodeLabelModel.

Specified by:
createModelParameter in interface NodeLabelModel
Parameters:
labelBounds - the box of the label, encoding the label location for which the parameter should be created
nodeLayout - the layout of the node to which the label belongs
Returns:
the model parameter representing the given label location
See Also:
NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object)

getLabelCandidates

public YList getLabelCandidates(NodeLabelLayout labelLayout,
                                NodeLayout nodeLayout)
Description copied from interface: NodeLabelModel
Returns all NodeLabelCandidates that describe valid label positions within this model.

In case the implementing NodeLabelModel allows every possible location, this method always returns the current location as a LabelCandidate.

Specified by:
getLabelCandidates in interface NodeLabelModel
Parameters:
labelLayout - the label for which candidates should be generated
nodeLayout - the layout of the node to which the label belongs
Returns:
a list of NodeLabelCandidate instances

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