|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.NodeRealizer y.view.ShapeNodeRealizer
public class ShapeNodeRealizer
A node realizer that displays a node as a geometric shape. Possible shapes are rectangle, ellipse, rounded rectangle, triangle, octagon, hexagon, diamond and parallelogram.
Field Summary | |
---|---|
static byte |
DIAMOND
Shape type constant. |
static byte |
ELLIPSE
Shape type constant. |
static byte |
HEXAGON
Shape type constant. |
static RenderingHints.Key |
KEY_SLOPPY_RECT_PAINTING
Sloppy rect painting hint key. |
static byte |
OCTAGON
Shape type constant. |
static byte |
PARALLELOGRAM
Shape type constant. |
static byte |
RECT
Shape type constant. |
static byte |
RECT_3D
Shape type constant. |
static byte |
ROUND_RECT
Shape type constant. |
protected Shape |
shape
The graphical shape representation that gets painted. |
static byte |
TRAPEZOID
Shape type constant. |
static byte |
TRAPEZOID_2
Shape type constant. |
static byte |
TRIANGLE
Shape type constant. |
static Object |
VALUE_SLOPPY_RECT_PAINTING_OFF
Sloppy rect painting hint value --- rendering in sloppy mode paints a ShapeNodeRealizer instance's actual shape. |
Fields inherited from class y.view.NodeRealizer |
---|
height, HOTSPOT_E, HOTSPOT_N, HOTSPOT_NE, HOTSPOT_NONE, HOTSPOT_NW, HOTSPOT_S, HOTSPOT_SE, HOTSPOT_SW, HOTSPOT_W, width, x, y |
Constructor Summary | |
---|---|
ShapeNodeRealizer()
Creates a new ShapeNodeRealizer with rectangular at position (0,0) and with empty label |
|
ShapeNodeRealizer(byte type)
Creates a new ShapeNodeRealizer at position (x,y) with specific type and empty label. |
|
ShapeNodeRealizer(byte type,
double x,
double y,
String label)
Creates a new ShapeNodeRealizer |
|
ShapeNodeRealizer(NodeRealizer argNodeRealizer)
Creates a new ShapeNodeRealizer as a copy of the given realizer. |
Method Summary | |
---|---|
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 and its drop shadow. |
boolean |
contains(double x,
double y)
Evaluate hit test on the node realizer. |
NodeRealizer |
createCopy(NodeRealizer nr)
Creates a copy of this realizer type that will be initialized with the values found in the given realizer. |
protected Color |
createSelectionColor(Color original)
Callback function that calculates/modifies a given Color instance for the selected use case. |
boolean |
findIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
Special Intersection handling for some types of shape. |
Color |
getDropShadowColor()
|
byte |
getDropShadowOffsetX()
Returns the horizontal offset of the drop shadow. |
byte |
getDropShadowOffsetY()
Returns the vertical offset of the drop shadow. |
byte |
getShapeType()
Returns shape type of this realizer |
byte |
hotSpotHit(double hx,
double hy)
Adjusted hitSpotHit that takes drop shadows into account. |
boolean |
isDropShadowVisible()
Queries whether or not the drop shadow is visible. |
void |
moveBy(double dx,
double dy)
Moves this realizer by the vector (dx,dy). |
protected void |
paint3DBorder(Graphics2D gfx,
boolean raised)
Responsible for painting a 3D border for a shape node of type RECT_3D . |
protected void |
paintFilledShape(Graphics2D gfx)
Responsible for painting the filled shape of this realizer using a specific color or paint. |
void |
paintHotSpots(Graphics2D gfx)
Paints graphical hotspots around this realizer. |
protected void |
paintNode(Graphics2D gfx)
Paints the node. |
protected void |
paintShadow(Graphics2D gfx)
Paints a shadow for the shape node. |
protected void |
paintShapeBorder(Graphics2D gfx)
Responsible for painting the border or outline of the shape of this realizer. |
void |
read(ObjectInputStream in)
Deprecated. Use the GraphML format instead. |
void |
setCenter(double x,
double y)
Sets the center location of this realizer |
void |
setDropShadowColor(Color shadowColor)
|
void |
setDropShadowOffsetX(byte shadowOffsetX)
Set the horizontal offset of the drop shadow. |
void |
setDropShadowOffsetY(byte shadowOffsetY)
Set the vertical offset of the drop shadow. |
void |
setLocation(double x,
double y)
Sets the upper left corner location of this realizer. |
void |
setShapeType(byte type)
Sets the shape type of this realizer. |
void |
setSize(double w,
double h)
Sets the size of the realizer. |
static Map |
shapeTypeToStringMap()
Returns a map whose keys are the shape type specifiers wrapped in Byte objects. |
void |
write(ObjectOutputStream out)
Deprecated. Use the GraphML format instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final RenderingHints.Key KEY_SLOPPY_RECT_PAINTING
SLOPPY_RECT_PAINTING
hint controls whether rendering
in sloppy mode paints a ShapeNodeRealizer
instance's
rectangular bounds or its actual shape.
The key's associated value must be either null
or
VALUE_SLOPPY_RECT_PAINTING_OFF
.
If the associated value is VALUE_SLOPPY_RECT_PAINTING_OFF
,
a ShapeNodeRealizer
instance's actual shape is painted
in sloppy mode.
VALUE_SLOPPY_RECT_PAINTING_OFF
,
NodeRealizer.paintSloppy(java.awt.Graphics2D)
public static final Object VALUE_SLOPPY_RECT_PAINTING_OFF
ShapeNodeRealizer
instance's actual shape.
KEY_SLOPPY_RECT_PAINTING
,
NodeRealizer.paintSloppy(java.awt.Graphics2D)
public static final byte RECT
public static final byte ROUND_RECT
public static final byte ELLIPSE
public static final byte PARALLELOGRAM
public static final byte HEXAGON
public static final byte TRIANGLE
public static final byte RECT_3D
public static final byte OCTAGON
public static final byte DIAMOND
public static final byte TRAPEZOID
public static final byte TRAPEZOID_2
protected Shape shape
Constructor Detail |
---|
public ShapeNodeRealizer()
public ShapeNodeRealizer(byte type)
type
- A shape type specifier.public ShapeNodeRealizer(byte type, double x, double y, String label)
type
- A shape type specifier.
ShapeNodeRealizer.ELLIPSE or ShapeNodeRealizer.RECTx
- x-Coordinate of the nodey
- y-Coordinate of the nodelabel
- The label of the nodepublic ShapeNodeRealizer(NodeRealizer argNodeRealizer)
Method Detail |
---|
public NodeRealizer createCopy(NodeRealizer nr)
createCopy
in class NodeRealizer
public void setCenter(double x, double y)
setCenter
in class NodeRealizer
public void setLocation(double x, double y)
setLocation
in interface NodeLayout
setLocation
in class NodeRealizer
x
- the x-coordinates of the upper left corner.y
- the y-coordinates of the upper left corner.public void moveBy(double dx, double dy)
moveBy
in class NodeRealizer
public void setSize(double w, double h)
setSize
in interface NodeLayout
setSize
in class NodeRealizer
w
- the width of the node.h
- the height of the node.public void setShapeType(byte type)
RECT
, ROUND_RECT
, ELLIPSE
,
PARALLELOGRAM
, HEXAGON
, TRIANGLE
,
RECT_3D
, OCTAGON
, DIAMOND
,
TRAPEZOID
, TRAPEZOID_2
.
public byte getShapeType()
setShapeType(byte)
public Color getDropShadowColor()
public void setDropShadowColor(Color shadowColor)
shadowColor
- The drop shadow color to set. If no color is set then no
drop shadow will be drawn.public byte getDropShadowOffsetY()
public void setDropShadowOffsetY(byte shadowOffsetY)
shadowOffsetY
- The drop shadow offset to set.public byte getDropShadowOffsetX()
public void setDropShadowOffsetX(byte shadowOffsetX)
shadowOffsetX
- The shadow offset to set.public boolean isDropShadowVisible()
protected void paintNode(Graphics2D gfx)
paintHotSpots(Graphics2D)
(only when selected)paintShadow(Graphics2D)
paintFilledShape(Graphics2D)
NodeRealizer.paintText(Graphics2D)
paintShapeBorder(Graphics2D)
paintNode
in class NodeRealizer
protected void paintShapeBorder(Graphics2D gfx)
paintNode(Graphics2D gfx)
.
protected void paintFilledShape(Graphics2D gfx)
protected Color createSelectionColor(Color original)
original
- the color to transform to for the selected case
protected void paint3DBorder(Graphics2D gfx, boolean raised)
RECT_3D
. This method is utilized by method
paintShapeBorder(java.awt.Graphics2D)
.
gfx
- the graphics context to useraised
- a boolean that determines whether the surrounded rectangle
appears to be raised above the surface or sunk into the surface.protected void paintShadow(Graphics2D gfx)
public boolean contains(double x, double y)
contains
in class NodeRealizer
x
- the x-coordinate of the point to check.y
- the y-coordinate of the point to check.
true
if the position (x,y) is part of the node
false
otherwise.public boolean findIntersection(double ix, double iy, double ox, double oy, Point2D result)
findIntersection
in class NodeRealizer
public void calcUnionRect(Rectangle2D r)
calcUnionRect
in class NodeRealizer
public void paintHotSpots(Graphics2D gfx)
NodeRealizer
paintHotSpots
in class NodeRealizer
public byte hotSpotHit(double hx, double hy)
hotSpotHit
in class NodeRealizer
public void write(ObjectOutputStream out) throws IOException
GraphML format
instead.
write
in class NodeRealizer
IOException
public void read(ObjectInputStream in) throws IOException, ClassNotFoundException
GraphML format
instead.
write(ObjectOutputStream)
method.
read
in class NodeRealizer
IOException
ClassNotFoundException
public static Map shapeTypeToStringMap()
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |