|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.view.YLabel
y.view.NodeLabel
public class 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class y.view.YLabel |
|---|
YLabel.BoundsProvider, YLabel.Factory, YLabel.Layout, YLabel.Painter, YLabel.UserDataHandler |
| Field Summary | |
|---|---|
static byte |
ANYWHERE
Node label position specifier for label model FREE. |
static byte |
AUTOSIZE_NODE_HEIGHT
Autosize policy specifier. |
static byte |
AUTOSIZE_NODE_SIZE
Autosize policy specifier. |
static byte |
AUTOSIZE_NODE_WIDTH
Autosize policy specifier. |
static byte |
BOTTOM
Node label position specifier for label model INTERNAL. |
static byte |
BOTTOM_LEFT
Node label position specifier for label model INTERNAL. |
static byte |
BOTTOM_RIGHT
Node label position specifier for label model INTERNAL. |
static byte |
CENTER
Node label position specifier for label model INTERNAL. |
static byte |
CENTER_X
Node label position specifier for label model INTERNAL. |
static byte |
CORNERS
Node label model specifier. |
static byte |
DYNAMIC
Node label position specifier for label model EDGE_OPPOSITE. |
static byte |
E
Node label position specifier for label model SIDES and
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 INTERNAL. |
static byte |
N
Node label position specifier for label model SIDES,
SANDWICH and EIGHT_POS. |
static byte |
NE
Node label position specifier for label model CORNERS and
EIGHT_POS. |
static byte |
NW
Node label position specifier for label model CORNERS and
EIGHT_POS. |
static byte |
RIGHT
Node label position specifier for label model INTERNAL. |
static byte |
S
Node label position specifier for label model SIDES,
SANDWICH and EIGHT_POS. |
static byte |
SANDWICH
Node label model specifier. |
static byte |
SE
Node label position specifier for label model CORNERS and
EIGHT_POS. |
static byte |
SIDES
Node label model specifier. |
static byte |
SW
Node label position specifier for label model CORNERS and
EIGHT_POS. |
static byte |
TOP
Node label position specifier for label model INTERNAL. |
static byte |
TOP_LEFT
Node label position specifier for label model INTERNAL. |
static byte |
TOP_RIGHT
Node label position specifier for label model INTERNAL. |
static byte |
UNDEFINED
Dummy node label position specifier. |
static byte |
W
Node label position specifier for label model SIDES and
EIGHT_POS. |
| Fields inherited from class y.view.YLabel |
|---|
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, AUTOSIZE_CONTENT, AUTOSIZE_NONE, BOTTOM_TEXT_POSITION, CENTER_TEXT_POSITION, contentHeight, contentWidth, defaultInsets, height, LEFT_ALIGNED_TEXT_POSITION, LEFT_TEXT_POSITION, model, offsetDirty, offsetX, offsetY, placement, RIGHT_ALIGNED_TEXT_POSITION, RIGHT_TEXT_POSITION, sizeDirty, TOP_TEXT_POSITION, 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 |
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. |
YRectangle |
getBox()
NodeLabelLayout implementation. |
double |
getDistance()
Returns the distance of the label to the node. |
static YLabel.Factory |
getFactory()
Retrieves the factory instance that can be used to store different configurations
of pluggable node label behaviors. |
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 |
repaint()
Triggers a repaint of the bounds of this label in all views. |
void |
setAutoSizePolicy(byte autoSize)
Sets the autosize policy for this label. |
void |
setConfiguration(String name)
Configures this instance to use the configuration specified by the given name. |
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 coordinates of this label. |
void |
setOffsetDirty()
Marks the label offsets as dirty. |
void |
setPosition(byte p)
Sets the position of this label. |
void |
setSizeDirty()
Marks the size of the label as dirty |
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 java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte CENTER
INTERNAL.
Places the label in the center of the node.
public static final byte BOTTOM
INTERNAL.
Places the label inside the node at the bottom of it.
public static final byte TOP
INTERNAL.
Places the label inside the node at the top of it.
public static final byte TOP_LEFT
INTERNAL.
Places the label in the top left corner of a node.
public static final byte TOP_RIGHT
INTERNAL.
Places the label in the top right corner of a node.
public static final byte BOTTOM_LEFT
INTERNAL.
Places the label in the bottom left corner of a node.
public static final byte BOTTOM_RIGHT
INTERNAL.
Places the label in the bottom right corner of a node.
public static final byte LEFT
INTERNAL.
Places the label inside the node to the left of it.
public static final byte RIGHT
INTERNAL.
Places the label inside the node at the right of it.
public static final byte CENTER_X
INTERNAL.
UNCLEAR YET.
public static final byte NW
CORNERS and
EIGHT_POS. Places the label north west of the node.
public static final byte NE
CORNERS and
EIGHT_POS. Places the label north east of the node.
public static final byte SE
CORNERS and
EIGHT_POS. Places the label south east of the node.
public static final byte SW
CORNERS and
EIGHT_POS. Places the label south west of the node.
public static final byte N
SIDES,
SANDWICH and EIGHT_POS.
Places the label north of the node.
public static final byte S
SIDES,
SANDWICH and EIGHT_POS.
Places the label south of the node.
public static final byte E
SIDES and
EIGHT_POS. Places the label east of the node.
public static final byte W
SIDES and
EIGHT_POS. Places the label west of the node.
public static final byte DYNAMIC
EDGE_OPPOSITE.
Places the label dynamically.
public static final byte ANYWHERE
FREE.
Places the label at an arbitrary position.
public static final byte UNDEFINED
public static final byte CORNERS
NW, NE,
SE, SW as valid positions.
public static final byte INTERNAL
CENTER, BOTTOM, TOP, LEFT, RIGHT,
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
and CENTER_X as valid positions.
public static final byte SANDWICH
N and S as valid positions.
public static final byte SIDES
N, E,
S, W as valid positions.
public static final byte FREE
ANYWHERE as valid position.
public static final byte EIGHT_POS
SIDES and CORNERS
public static final byte EDGE_OPPOSITE
public static final byte AUTOSIZE_NODE_WIDTH
public static final byte AUTOSIZE_NODE_SIZE
public static final byte AUTOSIZE_NODE_HEIGHT
| Constructor Detail |
|---|
public NodeLabel(String st,
byte mode)
public NodeLabel(String str)
public NodeLabel()
| Method Detail |
|---|
public void setAutoSizePolicy(byte autoSize)
YLabel.AUTOSIZE_CONTENT is set.
setAutoSizePolicy in class YLabelautoSize - one of the specifiers YLabel.AUTOSIZE_CONTENT, AUTOSIZE_NODE_WIDTH, AUTOSIZE_NODE_SIZE, YLabel.AUTOSIZE_NONE or
AUTOSIZE_NODE_HEIGHT.public void setConfiguration(String name)
YLabelgetFactory()
and EdgeLabel.getFactory() respectively.
setConfiguration in class YLabelname - the name of the configuration as it has been specified in YLabel.Factory.addConfiguration(String, java.util.Map)YLabel.Factory,
YLabel.Factory.addConfiguration(String, java.util.Map)public static YLabel.Factory getFactory()
configurations
of pluggable node label behaviors.
YLabel.Factory.addConfiguration(String, java.util.Map),
setConfiguration(String)public Object clone()
clone in class Objectpublic void adoptValues(YLabel label)
adoptValues in class YLabel
public void setOffset(double x,
double y)
NodeRealizer.getX() and NodeRealizer.getY().
setOffset in class YLabelx - x offset relative to NodeRealizer.getX()y - y offset relative to NodeRealizer.getY()public void setOffsetDirty()
YLabel
setOffsetDirty in class YLabelpublic void setSizeDirty()
YLabel
setSizeDirty in class YLabelpublic void setText(String text)
setText in class YLabelpublic void setDistance(double _distance)
public double getDistance()
public NodeLabelModel getLabelModel()
getLabelModel in interface NodeLabelLayoutpublic void setLabelModel(NodeLabelModel m)
public Object getModelParameter()
getModelParameter in interface LabelLayoutpublic void setModelParameter(Object param)
setModelParameter in interface LabelLayoutsetModelParameter in class YLabelpublic void setModel(byte mo)
setModel in class YLabelpublic boolean hasFreePositioning()
public void setPosition(byte p)
setPosition in class YLabelpublic byte getPosition()
getPosition in class YLabel
public void setFreeOffset(double x,
double y)
FREE.
public YPoint getLocation()
getLocation in class YLabelpublic 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 YLabelpublic void calculateOffset()
YLabel
calculateOffset in class YLabelpublic Node getNode()
public NodeRealizer getRealizer()
public Graph2D getGraph2D()
public void bindRealizer(NodeRealizer r)
public YRectangle getBox()
getBox in interface LabelLayoutgetBox in class YLabelpublic void repaint()
repaint in class YLabelgetBox(),
View.updateView(double, double, double, double)
public boolean intersects(double x,
double y,
double width,
double height)
YLabeltrue iff the bounding box of this label
intersects with the given box.
intersects in class YLabelpublic void calcUnionRect(Rectangle2D r)
YLabelYLabel.BoundsProvider instance
registered with this instance's configuration.
calcUnionRect in class YLabel
public void write(ObjectOutputStream out)
throws IOException
write in class YLabelIOException
public void read(ObjectInputStream in)
throws IOException,
ClassNotFoundException
write(ObjectOutputStream) method.
read in class YLabelIOException
ClassNotFoundException
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||