|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.view.NodeRealizer
Abstract graphical representation of a node. This class provides methods to draw a node. For this to happen a node must be bound to the realizer.
Field Summary | |
protected double |
height
|
static byte |
HOTSPOT_E
Hotspot type indentifier. |
static byte |
HOTSPOT_N
Hotspot type indentifier. |
static byte |
HOTSPOT_NE
Hotspot type indentifier. |
static byte |
HOTSPOT_NONE
Hotspot type indentifier. |
static byte |
HOTSPOT_NW
Hotspot type indentifier. |
static byte |
HOTSPOT_S
Hotspot type indentifier. |
static byte |
HOTSPOT_SE
Hotspot type indentifier. |
static byte |
HOTSPOT_SW
Hotspot type indentifier. |
static byte |
HOTSPOT_W
Hotspot type indentifier. |
protected double |
width
|
protected double |
x
|
protected double |
y
|
Constructor Summary | |
NodeRealizer()
Creates instance of NodeRealizer at location (0,0). |
|
NodeRealizer(double x,
double y)
Creates instance of NodeRealizer at a certain position . |
|
NodeRealizer(double x,
double y,
String label)
Creates instance of NodeRealizer at a certain position with given label. |
|
NodeRealizer(NodeRealizer argNodeRealizer)
Create instance of NodeRealizer and initialize it according to a given NodeRealizer. |
Method Summary | |
void |
addLabel(NodeLabel nl)
Add the given label to this realizer. |
void |
calcUnionRect(Rectangle2D r)
Enlarges the given rectangle such that it will contain the bounding box of this realizer and the bounding box of the realizer label. |
void |
calcUnionRect(Rectangle2D r,
byte layer)
Enlarges the given rectangle such that it will contain the bounding box of this realizer and the bounding box of the realizer label. |
boolean |
contains(double x,
double y)
Returns true iff the bounding box of this realizer
contains the given coords. |
NodeRealizer |
createCopy()
Returns a copy of this realizer that is not bound to any node. |
abstract NodeRealizer |
createCopy(NodeRealizer er)
Returns a realizer of the same type as this realizer, that adopts as many attributes as possible from the given realizer. |
NodeLabel |
createNodeLabel()
Creates a new node label that can be added to this realizer. |
boolean |
findBBIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
Returns true iff the coord (ix,iy)
is identical with (getCenterX(),getCenterY()) and
the coord (ox,oy), lies outside the bounding box
of this realizer. |
boolean |
findIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
Returns true iff the coord (ix,iy)
lies within the visual shape of this realizer and the
coord (ox,oy) lies outside of that shape.
|
Rectangle2D.Double |
getBoundingBox()
Return the bounding box of this realizer. |
double |
getCenterX()
Get X-Coordinate of the center of the node. |
double |
getCenterY()
Get Y-Coordinate of the center of the node. |
Color |
getFillColor()
Returns the fill color of this realizer. |
Color |
getFillColor2()
Returns the fill color of this realizer. |
double |
getHeight()
Returns the height of this realizer. |
static Color |
getHotSpotColor()
Returnsthe color of the hotspot marks for all realizers. |
NodeLabel |
getLabel()
Returns the first label associated with this realizer. |
NodeLabel |
getLabel(int i)
Returns the i-th label associated with this realizer. |
String |
getLabelText()
Returns the text of the first label assiciated with this realizer. |
byte |
getLayer()
Returns the logical graphical layer for this realizer. |
Color |
getLineColor()
Returns the outline color of this realizer. |
LineType |
getLineType()
Returns the line type of this realizer. |
Node |
getNode()
Returns the node this realizer is bound to. |
YList |
getPortCandidates(double gridResolution)
Returns a list of YPoint that contains absolute(!) |
static Color |
getSloppySelectionColor()
Returns the fill color of the node used when drawing a selected node in sloopy mode.. |
double |
getWidth()
Returns the width of this realizer. |
double |
getX()
Get X-Coordinate of the upper left corner of the node. |
double |
getY()
Get Y-Coordinate of the upper left corner of the node. |
byte |
hotSpotHit(double hx,
double hy)
Returns one of the predefined hotspot type constants to signal which hotspot is hit by the given coords. |
boolean |
intersects(double rx,
double ry,
double rw,
double rh)
Returns true iff the bounding box of this realizer
intersects with the given box. |
boolean |
isInBox(double xb,
double yb,
double wb,
double hb)
Returns true iff the bounding box of this realizer lies
completely within the given box. |
boolean |
isSelected()
Returns the selection state of this realizer. |
boolean |
isTransparent()
Returns the transparancy state of this realizer. |
boolean |
isVisible()
Returns true iff this realizer is marked as visible.
|
int |
labelCount()
Returns the number of labels associated with this realizer. |
void |
moveBy(double dx,
double dy)
Moves the node relatively to the current position. |
void |
paint(Graphics2D gfx)
Paints this realizer and its label(s) on the given graphics context. |
void |
paintHotSpots(Graphics2D g)
Paints graphical hotspots around this realizer. |
void |
paintLayer(Graphics2D g,
byte layer)
Requests this realizer to paint itself on the given graphics context under the constraint that the given layer is active. |
void |
paintLayerSloppy(Graphics2D g,
byte layer)
Paints the realizer in a cheap, uniform and sloppy way on g .
|
protected abstract void |
paintNode(Graphics2D g)
This method must be implemented by subclasses. |
void |
paintSloppy(Graphics2D g)
Paints the realizer in a cheap, uniform and sloppy way on g . |
void |
paintText(Graphics2D gfx)
Paints the labels that belong to this realizer |
void |
read(ObjectInputStream in)
Reads in the serialized form of this realizer. |
void |
removeLabel(NodeLabel nl)
Remove the given label from this realizer. |
void |
setCenter(double x,
double y)
Set the coordinates of the center of the node. |
void |
setCenterX(double x)
Set the x coordinate of the center of the node. |
void |
setCenterY(double y)
Set the y coordinate of the center of the node. |
void |
setEdgesDirty()
Marks adjacent edge realizers as dirty. |
void |
setFillColor(Color c)
Sets the fill color for this realizer. |
void |
setFillColor2(Color c)
Sets the second fill color for this realizer. |
void |
setFrame(double x,
double y,
double width,
double height)
Sets the frame of the realizer, i.e. its size and its location. |
void |
setFrame(Rectangle2D frame)
Sets the frame of the realizer, i.e. its size and its location. |
void |
setHeight(double height)
Sets the height of this realizer. |
static void |
setHotSpotColor(Color c)
Sets the color of the hotspot marks for all realizers. |
void |
setLabel(NodeLabel nl)
Sets the first label associated with this realizer. |
void |
setLabelText(String label)
Sets the text of the first label associated with this realizer. |
void |
setLayer(byte l)
Sets the logical graphical layer for this realizer. |
void |
setLayer(byte l,
boolean adjacentEdgesAsWell)
Sets the layer this realizer should be painted on. |
void |
setLineColor(Color c)
Sets the outline color for this realizer. |
void |
setLineType(LineType lt)
Sets the line type for this realizer. |
void |
setLocation(double x,
double y)
Sets the coordinates of the upper left corner of the node. |
void |
setSelected(boolean s)
Sets the selection state of this realizer. |
void |
setSize(double width,
double height)
Sets the size of the realizer. |
static void |
setSloppySelectionColor(Color c)
Sets the fill color of the node used when drawing a selected node in sloopy mode.. |
void |
setTransparent(boolean b)
Sets the transparancy of the realizer. |
void |
setVisible(boolean b)
Sets the visibility state of this realizer. |
void |
setWidth(double width)
Sets the width of this realizer. |
void |
setX(double xp)
Sets the X-Coordinate of the upper left corner of the node. |
void |
setY(double yp)
Sets the Y-Coordinate of the upper left corner of the node. |
void |
write(ObjectOutputStream out)
Writes this realizer in a serialized form to the given stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte HOTSPOT_NW
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_N
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_NE
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_SW
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_S
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_SE
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_W
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_E
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuespublic static final byte HOTSPOT_NONE
NodeRealizer.hotSpotHit(double,double)
,
Constant Field Valuesprotected double x
protected double y
protected double width
protected double height
Constructor Detail |
public NodeRealizer()
public NodeRealizer(double x, double y)
x
- X-Position of the center of the nodey
- Y-Position of the center of the nodepublic NodeRealizer(double x, double y, String label)
x
- X-Position of the center of the nodey
- Y-Position of the center of the nodelabel
- The label of the nodepublic NodeRealizer(NodeRealizer argNodeRealizer)
argNodeRealizer
- A NodeRealizerMethod Detail |
public NodeRealizer createCopy()
This method simply returns createCopy(this)
.
public abstract NodeRealizer createCopy(NodeRealizer er)
Subclassed realizers should always implement or overwrite this method, to guarantee correct copy behaviour of the realizer.
public Node getNode()
null
is returned.
public void setFillColor(Color c)
public Color getFillColor()
public void setFillColor2(Color c)
null
.
public Color getFillColor2()
public void setLineColor(Color c)
public Color getLineColor()
public void setLineType(LineType lt)
public LineType getLineType()
public void setTransparent(boolean b)
public boolean isTransparent()
public void setLabelText(String label)
label
- the text of the labelpublic String getLabelText()
public NodeLabel createNodeLabel()
public void setLabel(NodeLabel nl)
public void addLabel(NodeLabel nl)
public void removeLabel(NodeLabel nl)
public NodeLabel getLabel()
public NodeLabel getLabel(int i)
public int labelCount()
public double getCenterX()
public double getCenterY()
public void setCenter(double x, double y)
public void setCenterX(double x)
public void setCenterY(double y)
public double getX()
getX
in interface NodeLayout
public double getY()
getY
in interface NodeLayout
public void setLocation(double x, double y)
setLocation
in interface NodeLayout
x
- the x-coordinates of the upper left corner.y
- the y-coordinates of the upper left corner.public void setX(double xp)
public void setY(double yp)
public void moveBy(double dx, double dy)
public double getWidth()
getWidth
in interface NodeLayout
public double getHeight()
getHeight
in interface NodeLayout
public void setFrame(double x, double y, double width, double height)
public void setFrame(Rectangle2D frame)
public void setSize(double width, double height)
setSize
in interface NodeLayout
width
- the width of the node.height
- the heigth of the node.public void setWidth(double width)
NodeRealizer.setSize(double, double)
.
public void setHeight(double height)
NodeRealizer.setSize(double,double)
.
public void setVisible(boolean b)
public boolean isVisible()
true
iff this realizer is marked as visible.
Invisible realizers won't paint themselves on a graphics context.
public void setLayer(byte l)
Graph2DView.FG_LAYER
,
Graph2DView.BG_LAYER
public byte getLayer()
Graph2DView.FG_LAYER
,
Graph2DView.BG_LAYER
public void setLayer(byte l, boolean adjacentEdgesAsWell)
true
.
public void setSelected(boolean s)
public boolean isSelected()
public static void setHotSpotColor(Color c)
Color.gr
- See Also:
NodeRealizer.paintHotSpots(Graphics2D)
public static Color getHotSpotColor()
NodeRealizer.setHotSpotColor(Color)
public static void setSloppySelectionColor(Color c)
Color.gray
is used.
NodeRealizer.paintSloppy(Graphics2D)
public static Color getSloppySelectionColor()
NodeRealizer.paintSloppy(Graphics2D)
public Rectangle2D.Double getBoundingBox()
public byte hotSpotHit(double hx, double hy)
public boolean findBBIntersection(double ix, double iy, double ox, double oy, Point2D result)
true
iff the coord (ix,iy)
is identical with (getCenterX(),getCenterY())
and
the coord (ox,oy),
lies outside the bounding box
of this realizer. In that case the intersection point of the
line (ix,iy) - (ox,oy)
with the bounding box
of this realizer will be stored in the given point.
public boolean findIntersection(double ix, double iy, double ox, double oy, Point2D result)
true
iff the coord (ix,iy)
lies within the visual shape of this realizer and the
coord (ox,oy)
lies outside of that shape.
In that case the intersection point of the
line (ix,iy) - (ox,oy)
with that shape
will be stored in the given point.
public void calcUnionRect(Rectangle2D r, byte layer)
public void calcUnionRect(Rectangle2D r)
public boolean intersects(double rx, double ry, double rw, double rh)
true
iff the bounding box of this realizer
intersects with the given box.
public boolean contains(double x, double y)
true
iff the bounding box of this realizer
contains the given coords.
public boolean isInBox(double xb, double yb, double wb, double hb)
true
iff the bounding box of this realizer lies
completely within the given box.
public YList getPortCandidates(double gridResolution)
protected abstract void paintNode(Graphics2D g)
public void paintHotSpots(Graphics2D g)
public void paintLayer(Graphics2D g, byte layer)
paint
method will be invoked.
public void paintLayerSloppy(Graphics2D g, byte layer)
g
.
The given layer indicates what kind of layer objects should
be painted. By default this method does nothing if
layer != this.getLayer()
.
Otherwise paintSloppy
gets called.
public void paintSloppy(Graphics2D g)
g
. By default this call draws a
rectangle with this realizer's bounds and colors.
No label will be painted.
public void paint(Graphics2D gfx)
public void paintText(Graphics2D gfx)
public void setEdgesDirty()
public void write(ObjectOutputStream out) throws IOException
IOException
public void read(ObjectInputStream in) throws IOException, ClassNotFoundException
NodeRealizer.write(ObjectOutputStream)
method.
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 |