|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.view.YLabel | +--y.view.NodeLabel
This class represents a label associated with a NodeRealizer.
NodeLabel has special label models and positions that are suitable for placing the label relative to a node.
Field Summary | |
static byte |
ANYWHERE
Node label position specifier for label model NodeLabel.FREE .
|
static byte |
AUTOSIZE_CONTENT
Autosize policy specifier. |
static byte |
AUTOSIZE_NODE_HEIGHT
Autosize policy specifier. |
static byte |
AUTOSIZE_NODE_WIDTH
Autosize policy specifier. |
static byte |
BOTTOM
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
BOTTOM_LEFT
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
BOTTOM_RIGHT
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
CENTER
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
CENTER_X
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
CORNERS
Node label model specifier. |
static byte |
DYNAMIC
Node label position specifier for label model NodeLabel.EDGE_OPPOSITE .
|
static byte |
E
Node label position specifier for label model NodeLabel.SIDES and
NodeLabel.EIGHT_POS . |
static byte |
EDGE_OPPOSITE
Node label model specifier. |
static byte |
EIGHT_POS
Node label model specifier. |
static byte |
FREE
Node label model specifier. |
static byte |
INTERNAL
Node label model specifier. |
static byte |
LEFT
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
N
Node label position specifier for label model NodeLabel.SIDES ,
NodeLabel.SANDWICH and NodeLabel.EIGHT_POS .
|
static byte |
NE
Node label position specifier for label model NodeLabel.CORNERS and
NodeLabel.EIGHT_POS . |
static byte |
NW
Node label position specifier for label model NodeLabel.CORNERS and
NodeLabel.EIGHT_POS . |
static byte |
RIGHT
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
S
Node label position specifier for label model NodeLabel.SIDES ,
NodeLabel.SANDWICH and NodeLabel.EIGHT_POS .
|
static byte |
SANDWICH
Node label model specifier. |
static byte |
SE
Node label position specifier for label model NodeLabel.CORNERS and
NodeLabel.EIGHT_POS . |
static byte |
SIDES
Node label model specifier. |
static byte |
SW
Node label position specifier for label model NodeLabel.CORNERS and
NodeLabel.EIGHT_POS . |
static byte |
TOP
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
TOP_LEFT
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
TOP_RIGHT
Node label position specifier for label model NodeLabel.INTERNAL .
|
static byte |
UNDEFINED
Dummy node label position specifier. |
static byte |
W
Node label position specifier for label model NodeLabel.SIDES and
NodeLabel.EIGHT_POS . |
Fields inherited from class y.view.YLabel |
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, defaultInsets, height, model, offsetDirty, offsetX, offsetY, placement, sizeDirty, width |
Constructor Summary | |
NodeLabel()
Instantiates a new NodeLabel. |
|
NodeLabel(String str)
Instantiates a new NodeLabel with the given text and centered label position. |
|
NodeLabel(String st,
byte mode)
Instantiates a new NodeLabel with a given text and model. |
Method Summary | |
void |
adoptValues(YLabel label)
Adopts the values from the given label. |
static Vector |
availablePositions(Byte model)
Returns a vector of all valid positions for the given model The positions are wrapped in Byte objects. |
void |
bindRealizer(NodeRealizer r)
Binds the given node realizer to this label. |
void |
calculateOffset()
Calculates the offset of this label. |
void |
calculateSize(FontRenderContext frc)
Calculates the size of this label with the help of the given FontRenderContext. |
void |
calcUnionRect(Rectangle2D r)
Enlarges the given rectangle such that it will contain the bounding box of this label |
Object |
clone()
Creates an unbound copy of this NodeLabel. |
byte |
getAutoSizePolicy()
Returns the currently set autosize policy for this label. |
YRectangle |
getBox()
NodeLabelLayout implementation. |
double |
getDistance()
Returns the distance of the label to the node. |
Graph2D |
getGraph2D()
Returns the graph this node label is bound to. |
NodeLabelModel |
getLabelModel()
NodeLabelModel implementation. |
YPoint |
getLocation()
Returns the absolute coordinates of the labels location. |
Object |
getModelParameter()
NodeLabelModel implementation. |
static byte[] |
getModelPositions(byte model)
Returns a byte array containing all valid positions for the given model specifier. |
Node |
getNode()
Returns the node that is bound to this node label |
byte |
getPosition()
Returns the position of this label. |
NodeRealizer |
getRealizer()
Returns the node realizer that is bound to this node label |
boolean |
hasFreePositioning()
Whether of not the label has a free position, i.e. one that is solely dictated by the offset coordinates. |
boolean |
intersects(double x,
double y,
double width,
double height)
Returns true iff the bounding box of this label
intersects with the given box. |
boolean |
isOffsetDirty()
Returns true if the label offset is
not valid yet. |
static Map |
modelToStringMap()
Returns a map that whose keys are the known label model specifiers wrapped in Byte objects. |
static Map |
positionToStringMap()
Returns a map that whose keys are the known label position specifiers wrapped in Byte objects. |
void |
read(ObjectInputStream in)
Reads in the serialized form of this label. |
void |
setAutoSizePolicy(byte autoSize)
Sets the autosize policy for this label. |
void |
setDistance(double _distance)
Sets the distance of the label to the node. |
void |
setFreeOffset(double x,
double y)
Sets the free offset for this label. |
void |
setLabelModel(NodeLabelModel m)
Sets the NodeLabelModel implementation. |
void |
setModel(byte mo)
Set the label model. |
void |
setModelParameter(Object param)
NodeLabelModel implementation. |
void |
setOffset(double x,
double y)
Sets the offset coordinats of this label. |
void |
setOffsetDirty()
Marks the label offsets as dirty. |
void |
setPosition(byte p)
Sets the position of this label. |
void |
setText(String text)
Sets the text of this node label. |
void |
write(ObjectOutputStream out)
Writes out this label in a serialized form. |
Methods inherited from class y.view.YLabel |
calculateSize, getAlignment, getBackgroundColor, getFont, getFontName, getFontSize, getFontStyle, getHeight, getIcon, getInsets, getLineColor, getModel, getOffsetX, getOffsetY, getText, getTextColor, getTextLocation, getWidth, isBackgroundOn, isBackgroundPainted, isSizeDirty, isVisible, paint, setAlignment, setBackground, setBackgroundColor, setBackgroundPainted, setFont, setFontName, setFontSize, setFontStyle, setIcon, setInsets, setLineColor, setOffsetX, setOffsetY, setOldStyleDrawer, setSize, setSizeDirty, setTextColor, setVisible, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte CENTER
NodeLabel.INTERNAL
.
Places the label in the center of the node.
public static final byte BOTTOM
NodeLabel.INTERNAL
.
Places the label inside the node at the bottom of it.
public static final byte TOP
NodeLabel.INTERNAL
.
Places the label inside the node at the top of it.
public static final byte TOP_LEFT
NodeLabel.INTERNAL
.
Places the label in the top left corner of a node.
public static final byte TOP_RIGHT
NodeLabel.INTERNAL
.
Places the label in the top right corner of a node.
public static final byte BOTTOM_LEFT
NodeLabel.INTERNAL
.
Places the label in the bottom left corner of a node.
public static final byte BOTTOM_RIGHT
NodeLabel.INTERNAL
.
Places the label in the bottom right corner of a node.
public static final byte LEFT
NodeLabel.INTERNAL
.
Places the label inside the node to the left of it.
public static final byte RIGHT
NodeLabel.INTERNAL
.
Places the label inside the node at the right of it.
public static final byte CENTER_X
NodeLabel.INTERNAL
.
UNCLEAR YET.
public static final byte NW
NodeLabel.CORNERS
and
NodeLabel.EIGHT_POS
. Places the label north west of the node.
public static final byte NE
NodeLabel.CORNERS
and
NodeLabel.EIGHT_POS
. Places the label north east of the node.
public static final byte SE
NodeLabel.CORNERS
and
NodeLabel.EIGHT_POS
. Places the label south east of the node.
public static final byte SW
NodeLabel.CORNERS
and
NodeLabel.EIGHT_POS
. Places the label south west of the node.
public static final byte N
NodeLabel.SIDES
,
NodeLabel.SANDWICH
and NodeLabel.EIGHT_POS
.
Places the label north of the node.
public static final byte S
NodeLabel.SIDES
,
NodeLabel.SANDWICH
and NodeLabel.EIGHT_POS
.
Places the label south of the node.
public static final byte E
NodeLabel.SIDES
and
NodeLabel.EIGHT_POS
. Places the label east of the node.
public static final byte W
NodeLabel.SIDES
and
NodeLabel.EIGHT_POS
. Places the label west of the node.
public static final byte DYNAMIC
NodeLabel.EDGE_OPPOSITE
.
Places the label dynamically.
public static final byte ANYWHERE
NodeLabel.FREE
.
Places the label at an arbitrary position.
public static final byte UNDEFINED
public static final byte CORNERS
NodeLabel.NW
, NodeLabel.NE
,
NodeLabel.SE
, NodeLabel.SW
as valid positions.
public static final byte INTERNAL
NodeLabel.CENTER
, NodeLabel.BOTTOM
, NodeLabel.TOP
, NodeLabel.LEFT
, NodeLabel.RIGHT
,
NodeLabel.TOP_LEFT
, NodeLabel.TOP_RIGHT
, NodeLabel.BOTTOM_LEFT
, NodeLabel.BOTTOM_RIGHT
and NodeLabel.CENTER_X
as valid positions.
public static final byte SANDWICH
NodeLabel.N
and NodeLabel.S
as valid positions.
public static final byte SIDES
NodeLabel.N
, NodeLabel.E
,
NodeLabel.S
, NodeLabel.W
as valid positions.
public static final byte FREE
NodeLabel.ANYWHERE
as valid position.
public static final byte EIGHT_POS
NodeLabel.SIDES
and NodeLabel.CORNERS
public static final byte EDGE_OPPOSITE
public static final byte AUTOSIZE_CONTENT
public static final byte AUTOSIZE_NODE_WIDTH
public static final byte AUTOSIZE_NODE_HEIGHT
Constructor Detail |
public NodeLabel(String st, byte mode)
public NodeLabel(String str)
public NodeLabel()
Method Detail |
public Object clone()
clone
in class Object
public void adoptValues(YLabel label)
adoptValues
in class YLabel
public void setOffset(double x, double y)
setOffset
in class YLabel
public void setOffsetDirty()
YLabel
setOffsetDirty
in class YLabel
public void setAutoSizePolicy(byte autoSize)
NodeLabel.AUTOSIZE_CONTENT
is set.
autoSize
- one of the specifiers NodeLabel.AUTOSIZE_CONTENT
, NodeLabel.AUTOSIZE_NODE_WIDTH
or
NodeLabel.AUTOSIZE_NODE_HEIGHT
.public byte getAutoSizePolicy()
NodeLabel.setAutoSizePolicy(byte).
public void calculateSize(FontRenderContext frc)
YLabel
calculateSize
in class YLabel
public void setText(String text)
setText
in class YLabel
public void setDistance(double _distance)
public double getDistance()
public NodeLabelModel getLabelModel()
getLabelModel
in interface NodeLabelLayout
public void setLabelModel(NodeLabelModel m)
public Object getModelParameter()
getModelParameter
in interface LabelLayout
public void setModelParameter(Object param)
setModelParameter
in interface LabelLayout
setModelParameter
in class YLabel
public void setModel(byte mo)
setModel
in class YLabel
public boolean hasFreePositioning()
public void setPosition(byte p)
setPosition
in class YLabel
public byte getPosition()
getPosition
in class YLabel
public void setFreeOffset(double x, double y)
NodeLabel.FREE
.
public YPoint getLocation()
getLocation
in class YLabel
public static Map modelToStringMap()
public static Map positionToStringMap()
public static byte[] getModelPositions(byte model)
public static Vector availablePositions(Byte model)
public boolean isOffsetDirty()
true
if the label offset is
not valid yet.
isOffsetDirty
in class YLabel
public void calculateOffset()
YLabel
calculateOffset
in class YLabel
public Node getNode()
public NodeRealizer getRealizer()
public Graph2D getGraph2D()
public void bindRealizer(NodeRealizer r)
public YRectangle getBox()
getBox
in interface LabelLayout
getBox
in class YLabel
public boolean intersects(double x, double y, double width, double height)
YLabel
true
iff the bounding box of this label
intersects with the given box.
intersects
in class YLabel
public void calcUnionRect(Rectangle2D r)
YLabel
calcUnionRect
in class YLabel
public void write(ObjectOutputStream out) throws IOException
write
in class YLabel
IOException
public void read(ObjectInputStream in) throws IOException, ClassNotFoundException
NodeLabel.write(ObjectOutputStream)
method.
read
in class YLabel
IOException
ClassNotFoundException
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |