|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.gui2.Painter | +--gishur.graph.gui.EdgePainter
A painter class for Edges
. The appearance is highly configurable by setting
the appropriate properties. A drawn edge can consist of three parts of different thickness which lay over
each other. The thickness of the parts can be configured with width.0, width.1
or
width.2
, as well as different colors can be specified for the parts. If one wishes a simple
line, it is possible to set only the width
and color
property.
Besides, one can define the behaviour of the edge line for the case that the two nodes it connects are
moved towards each other until a critical distance is underrund (which is 2*parallel.point2
).
The line should then bend out of the direct connecting line to stay viewable and gripable for the user.
The behaviour in this case is defined by the parallel...
and loop...
properties.
This is a complete table of the settable properties:
Properties Summary | |||
Key | Value Type | Default value | Meaning |
General properties | |||
color | java.awt.Color | Color.black | The color of the edge (including the arrow). This color will be
used for all parts of the edge, if no colors are specified for
the parts of the edge with color.0, color.1 or
color.2 |
color.0 | java.awt.Color | none | The color of the outermost part of the edge. |
color.1 | java.awt.Color | none | The color of the part between the outermost part of the edge and the interior part. |
color.2 | java.awt.Color | none | The color of the interior part of the edge. |
width | int |
2 | The thickness of the line drawn as an edge in pixels. Note that width
is not used, if at least one of the parameters width.0, width.1 or
width.2 is set (see below). |
width.0 | int |
none | The total thickness of the edge, including its outermost part. |
width.1 | int |
none | The thickness of the edge excluding the outermost part. |
width.2 | int |
none | The thickness of the interior part of the edge. |
arrow.width | java.lang.Integer | 10 | The width (length) of the arrow. |
arrow.height | java.lang.Integer | 4 | The height of the arrow. |
border.color | java.awt.Color | Color.yellow | The color of the one-pixel surrounding line (if border.visible
is true ). |
border.visible | boolean |
false |
Determines whether a one-pixel surrounding line shall be drawn around the edge. |
Looping and bending properties | |||
parallel.distance | double |
20 | The distance in pixels between the connecting line of two nodes and the edge lines above and below this line. Each additional edge between nodes, which are connected by two or more edges will be separated from the others by this distance, too. |
parallel.point1 | double |
20 | The distance in pixels between the center of a node and the angle point of the bezier-curve which loops from the straight part of the edge line to the node (in the case of a bended edge line). This distance is measured in the direction of the direct line between the two nodes. That means, a value of zero will cause the edge to hit the node perpendicular to the direct connection line. |
parallel.point2 | double |
40 | The distance in pixels, measured in the direction of the direct connection line between the two nodes, which lies between the center of a node and the beginning of the straight part of the edge linem, i.e. the space bridged by the bezier curves. |
loop.high | double |
90 | If the distance between two nodes (in pixels) is decreased below loop.high ,
the edge line begins to bend out of the direct line between the nodes, to
avoid that it becomes too short for comfortable user handling. |
loop.low | double |
45 | The distance (in pixels) at which the edge line between two nodes is bended to
its maximal height (which is loop.factor*parallel.distance ). |
loop.factor | double |
2 | Determines the maximal bending height of an edge line, measured in units of
parallel.distance . |
Fields inherited from class gishur.gui2.Painter |
LEVEL_0, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_ALL, LEVEL_BITS_USED, LEVEL_DEFAULT, LEVEL_FIRST, LEVEL_LAST, LOCATEABLE, VISIBLE |
Constructor Summary | |
EdgePainter()
Default constructor. |
Method Summary | |
protected void |
draw(java.awt.Graphics g,
RenderContext context,
PropertyStatusReader prop,
byte level)
Draws the specified level of this Painter using the
given Graphics object and RenderContext for drawing,
and the given PropertyStatusReader for reading properties. |
protected java.awt.Point |
getRelativeAlignmentPoint(java.awt.Point p,
byte h_align,
byte v_align)
Returns an alignment point for the given alignment values relatively to the represented line. |
protected void |
recalculate(RenderContext context,
PropertyStatusReader prop,
Parameters param)
Recalculates this Painter using the given RenderContext ,
PropertyStatusReader , local point information and other parameters. |
Methods inherited from class gishur.gui2.Painter |
addBounds, addBounds, alignTo, alignTo, calculateDockingPoint, contains, getAlignmentPoint, height, isOnLevel, level, locateable, name, outline, reshape, setBounds, setBounds, setLevel, setLocation, setName, setOutline, setSubTypePrefix, style, visible, width, x, y |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EdgePainter()
Method Detail |
protected void recalculate(RenderContext context, PropertyStatusReader prop, Parameters param)
this
Painter
using the given RenderContext
,
PropertyStatusReader
, local point information and other parameters.recalculate
in class Painter
context
- the RenderContext
to useprop
- the PropertyStatusReader
to use for reading propertiesparam
- a Parameters
-object for location and other parameters parsed
by the DisplayObject
, that uses this
Painter
.protected void draw(java.awt.Graphics g, RenderContext context, PropertyStatusReader prop, byte level)
this
Painter
using the
given Graphics
object and RenderContext
for drawing,
and the given PropertyStatusReader
for reading properties.draw
in class Painter
g
- the Graphics
to draw oncontext
- the RenderContext
to useprop
- the PropertyStatusReader
to use for reading propertieslevel
- the level to drawprotected java.awt.Point getRelativeAlignmentPoint(java.awt.Point p, byte h_align, byte v_align)
getRelativeAlignmentPoint
in class Painter
p
- a Point
object where to store the calculated point or
null
.h_align
- an alignment value
(-128==Alignment.LEFT
≤0==Alignment.CENTER
≤127==Alignment.RIGHT
)
for the horizontal alignmentv_align
- an alignment value
(-128==Alignment.TOP
≤0==Alignment.CENTER
≤127==Alignment.BOTTOM
)
for the vertical alignment
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |