| 
 | Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.DiscreteNodeLabelModel
public class DiscreteNodeLabelModel
DiscreteNodeLabelModel allows placing labels at eight positions around 
 a node and at nine positions inside the node. 
 
 
 
 The predefined positions in this model
 
It's possible to specify an insets value that controls the distance between label and node.
Furthermore, there's the possibility to mask out arbitrary node label candidates. This can either be done by specifying predefined candidate masks or a combination of valid positions of this model using a logicalor-operation.
| Field Summary | |
|---|---|
| static int | BOTTOMPosition specifier that describes a label placement at the bottom inside the node. | 
| static int | BOTTOM_LEFTPosition specifier that describes a label placement at the bottom-left inside the node. | 
| static int | BOTTOM_RIGHTPosition specifier that describes a label placement at the bottom-right inside the node. | 
| static int | CENTERPosition specifier that describes a label placement at the center of the node. | 
| static int | CORNER_MASKPosition mask that constrains the positions to the corners outside the node. | 
| static int | EASTPosition specifier that describes a label placement east of the node. | 
| static int | EIGHT_POS_MASKPosition mask that constraints the positions to the eight node-external positions. | 
| static int | INTERNAL_MASKPosition mask that constrains the positions to the nine node-internal positions. | 
| static int | LEFTPosition specifier that describes a label placement at the left inside the node. | 
| static int | NORTHPosition specifier that describes a label placement north of the node. | 
| static int | NORTH_EASTPosition specifier that describes a label placement north-east of the node. | 
| static int | NORTH_WESTPosition specifier that describes a label placement north-west of the node. | 
| static int | RIGHTPosition specifier that describes a label placement at the right inside the node. | 
| static int | SANDWICH_MASKPosition mask that constrains the positions to aboveandbelowthe node. | 
| static int | SIDES_MASKPosition mask that constrains the positions to the node's four sides. | 
| static int | SOUTHPosition specifier that describes a label placement south of the node. | 
| static int | SOUTH_EASTPosition specifier that describes a label placement south-east of the node. | 
| static int | SOUTH_WESTPosition specifier that describes a label placement south-west of the node. | 
| static int | TOPPosition specifier that describes a label placement at the top inside the node. | 
| static int | TOP_LEFTPosition specifier that describes a label placement at the top-left inside the node. | 
| static int | TOP_RIGHTPosition specifier that describes a label placement at the top-right inside the node. | 
| static int | WESTPosition specifier that describes a label placement west of the node. | 
| Constructor Summary | |
|---|---|
| DiscreteNodeLabelModel()Creates a new instance of DiscreteNodeLabelModelwith default settings. | |
| DiscreteNodeLabelModel(int candidateMask)Creates a new instance of DiscreteNodeLabelModelusing the given candidate mask. | |
| DiscreteNodeLabelModel(int candidateMask,
                       double inset)Creates a new instance of DiscreteNodeLabelModelusing the given candidate mask and insets. | |
| Method Summary | |
|---|---|
|  java.lang.Object | createModelParameter(OrientedRectangle labelBounds,
                     NodeLayout nodeLayout)Creates a model parameter that represents the given node label position within this model. | 
|  int | getCandidateMask()Returns the candidate mask which specifies the valid positions for node labels. | 
|  java.lang.Object | getDefaultParameter()Returns a model parameter that encodes the default position of this model's allowed node label positions. | 
|  double | getDistance()Returns the distance between the label's bounding box and the node. | 
|  YList | getLabelCandidates(NodeLabelLayout labelLayout,
                   NodeLayout nodeLayout)Returns all NodeLabelCandidates that describe valid label positions within this model. | 
| protected  OrientedRectangle | getLabelPlacement(YDimension labelSize,
                  NodeLayout nodeLayout,
                  int position)Returns the oriented box of the label for the given label position. | 
|  OrientedRectangle | getLabelPlacement(YDimension labelSize,
                  NodeLayout nodeLayout,
                  java.lang.Object parameter)Returns the bounds of the label for the position encoded by the given model parameter. | 
|  boolean | isParameterValid(java.lang.Object parameter)Checks whether or not the given model parameter encodes a valid node label position for this model. | 
|  void | setDistance(double distance)Specifies the distance between the label's bounding box and the node. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int NORTH
public static final int NORTH_WEST
public static final int NORTH_EAST
public static final int EAST
public static final int WEST
public static final int SOUTH
public static final int SOUTH_WEST
public static final int SOUTH_EAST
public static final int CENTER
public static final int BOTTOM
public static final int TOP
public static final int LEFT
public static final int RIGHT
public static final int TOP_LEFT
public static final int TOP_RIGHT
public static final int BOTTOM_LEFT
public static final int BOTTOM_RIGHT
public static final int SANDWICH_MASK
above and below the node.
public static final int INTERNAL_MASK
public static final int SIDES_MASK
public static final int CORNER_MASK
public static final int EIGHT_POS_MASK
| Constructor Detail | 
|---|
public DiscreteNodeLabelModel()
DiscreteNodeLabelModel with default settings.
public DiscreteNodeLabelModel(int candidateMask)
DiscreteNodeLabelModel using the given candidate mask.
 The specified mask can also describe a single position.
candidateMask - the position mask that defines the allowed positions for a node label
public DiscreteNodeLabelModel(int candidateMask,
                              double inset)
DiscreteNodeLabelModel using the given candidate mask and insets. 
 The specified mask can also describe a single position.
candidateMask - the position mask that defines the allowed positions for a node labelinset - the inset value that defines the internal label distance to the node's border| Method Detail | 
|---|
public int getCandidateMask()
INTERNAL_MASKpublic double getDistance()
The distance must be a non-negative value.
setDistance(double)public void setDistance(double distance)
The distance must be a non-negative value.
public java.lang.Object getDefaultParameter()
getDefaultParameter in interface NodeLabelModelCENTER when none of the above 
 default positions is part of the allowed positions.public boolean isParameterValid(java.lang.Object parameter)
If the model parameter describes a position that is accepted by the candidate mask, this is a valid parameter.
parameter - the model parameter
true if the label position described by the given model parameter is allowed,
         false otherwise
public OrientedRectangle getLabelPlacement(YDimension labelSize,
                                           NodeLayout nodeLayout,
                                           java.lang.Object parameter)
NodeLabelModel
getLabelPlacement in interface NodeLabelModellabelSize - the width and height of the labelnodeLayout - the layout of the node to which the label belongsparameter - the model parameter that describes the abstract position of the label within this model
public YList getLabelCandidates(NodeLabelLayout labelLayout,
                                NodeLayout nodeLayout)
NodeLabelModelNodeLabelCandidates 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.
 
getLabelCandidates in interface NodeLabelModellabelLayout - the label for which candidates should be generatednodeLayout - the layout of the node to which the label belongs
NodeLabelCandidate instances
protected OrientedRectangle getLabelPlacement(YDimension labelSize,
                                              NodeLayout nodeLayout,
                                              int position)
   This method is called by getLabelPlacement(YDimension, NodeLayout, Object) and
   getLabelCandidates(NodeLabelLayout, NodeLayout) to retrieve a valid position.
 
labelSize - the size of the label that should be placednodeLayout - the layout of the node to which the label belongsposition - the label position that is valid in this model
public java.lang.Object createModelParameter(OrientedRectangle labelBounds,
                                             NodeLayout nodeLayout)
NodeLabelModelThe 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.
 
createModelParameter in interface NodeLabelModellabelBounds - the box of the label, encoding the label location for which the parameter should be creatednodeLayout - the layout of the node to which the label belongs
NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object)| 
 | © Copyright 2000-2025, yWorks GmbH. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||