|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.PortLabelModel
public class PortLabelModel
A NodeLabelModel
for labels that are associated to
node ports.
Note: This label model can only be used with labels in
NodeRealizer
instances.
Note: Serialization/deserialization of this label model is only
supported in the GraphML format
.
Nested Class Summary | |
---|---|
static class |
PortLabelModel.Handler
Provides GraphML (de-)serialization support for PortLabelModel and its parameters. |
Field Summary | |
---|---|
static byte |
CENTER
Node label position specifier. |
static byte |
EAST
Node label position specifier. |
static byte |
NORTH
Node label position specifier. |
static byte |
SOUTH
Node label position specifier. |
static byte |
WEST
Node label position specifier. |
Constructor Summary | |
---|---|
PortLabelModel(double offset)
Initializes a new PortLabelModel . |
|
PortLabelModel(double offset,
boolean localCandidatesEnabled)
Initializes a new PortLabelModel . |
Method Summary | |
---|---|
java.lang.Object |
createModelParameter(OrientedRectangle labelBounds,
NodeLayout nodeLayout)
Creates a parameter that holds the best matching positioning information supported by this model for the desired label position and specified node bounds. |
static java.lang.Object |
createParameter(NodePort port,
byte position)
Creates a parameter for the specified port and position. |
static java.util.Collection |
findLabels(NodePort port)
Returns a collection of labels that are associated to the specified port. |
java.lang.Object |
getDefaultParameter()
Creates a parameter that will position its associated label in the center of its node independent of all ports. |
YList |
getLabelCandidates(NodeLabelLayout nl,
NodeLayout nodeLayout)
Generates a list of possible label positions for this model. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
NodeLayout nodeLayout,
java.lang.Object param)
Determines the position of a label of the specified size for the specified node bounds and positioning information. |
double |
getOffset()
Returns the distance between label and associated node port. |
static NodePort |
getPort(NodeLabel label)
Returns the port to which the specified label is associated or null if there is no such port. |
static NodePort |
getPort(NodeRealizer owner,
java.lang.Object modelParameter)
Returns the NodePort instance of the specified node
realizer that is associated to the specified model parameter. |
static byte |
getPosition(java.lang.Object modelParameter)
Returns the positions specifier encoded in the specified model parameter. |
boolean |
isLocalCandidatesEnabled()
Returns true if this model supports only label candidates
that are related to the node port referenced by
the model parameter used and false if this model supports
label candidates related to all node ports of a given node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte NORTH
createParameter(NodePort, byte)
,
getPosition(Object)
,
Constant Field Valuespublic static final byte SOUTH
createParameter(NodePort, byte)
,
getPosition(Object)
,
Constant Field Valuespublic static final byte EAST
createParameter(NodePort, byte)
,
getPosition(Object)
,
Constant Field Valuespublic static final byte WEST
createParameter(NodePort, byte)
,
getPosition(Object)
,
Constant Field Valuespublic static final byte CENTER
createParameter(NodePort, byte)
,
getPosition(Object)
,
Constant Field ValuesConstructor Detail |
---|
public PortLabelModel(double offset)
PortLabelModel
.
offset
- specifies the distance between the label and its
associated port.public PortLabelModel(double offset, boolean localCandidatesEnabled)
PortLabelModel
.
offset
- specifies the distance between the label and its
associated port.localCandidatesEnabled
- if true
this model only
allows for label candidates related to the node port referenced by
the model parameter used; if false
this model allows for label
candidates related to all node ports of a given node.getLabelCandidates(y.layout.NodeLabelLayout, y.layout.NodeLayout)
Method Detail |
---|
public double getOffset()
public boolean isLocalCandidatesEnabled()
true
if this model supports only label candidates
that are related to the node port referenced by
the model parameter used and false
if this model supports
label candidates related to all node ports of a given node.
true
if this model supports only label candidates
that are related to the node port referenced by
the model parameter used and false
if this model supports
label candidates related to all node ports of a given node.public java.lang.Object createModelParameter(OrientedRectangle labelBounds, NodeLayout nodeLayout)
createModelParameter
in interface NodeLabelModel
labelBounds
- The bounds of the label for which a parameter representation is sought.nodeLayout
- The layout of the node to which the label belongs.
NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object)
public java.lang.Object getDefaultParameter()
getDefaultParameter
in interface NodeLabelModel
public OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, java.lang.Object param)
getLabelPlacement
in interface NodeLabelModel
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.
public YList getLabelCandidates(NodeLabelLayout nl, NodeLayout nodeLayout)
getLabelCandidates
in interface NodeLabelModel
nl
- The label layout for which candidates should be generated.nodeLayout
- The layout of the node to which the label belongs.
NodeLabelCandidate
instances.public static java.lang.Object createParameter(NodePort port, byte position)
public static byte getPosition(java.lang.Object modelParameter)
modelParameter
- the model parameter from which the position specifier
has to be extracted.
java.lang.IllegalArgumentException
- if the specified model parameter is not
valid for this model.NORTH
,
SOUTH
,
EAST
,
WEST
,
CENTER
public static NodePort getPort(NodeLabel label)
null
if there is no such port.
label
- the node label whose associated port should be determined.
null
if there is no such port.public static NodePort getPort(NodeRealizer owner, java.lang.Object modelParameter)
NodePort
instance of the specified node
realizer that is associated to the specified model parameter.
owner
- the node realizer whose ports are examined.modelParameter
- the model parameter that encodes the label-port
association.
NodePort
instance of the specified node
realizer that is associated to the specified model parameter or
null
if there is no corresponding NodePort
instance.
java.lang.IllegalArgumentException
- if the specified model parameter is not
valid for this model.public static java.util.Collection findLabels(NodePort port)
port
- the port whose associated labels are returned.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |