gishur.graph.gui
Class RoundNodePainter
java.lang.Object
|
+--gishur.gui2.Painter
|
+--gishur.graph.gui.RoundNodePainter
- public class RoundNodePainter
- extends Painter
A Painter
for points of a round shape for Nodes
.
RoundNodePainters
are created by
RoundNodeStyles
.
One of their tasks is to calculate the area of the screen which has to be
drawn if an object using this RoundNodePainter
must
be redrawn. For this purpose, the method recalculate(gishur.gui2.RenderContext, gishur.gui2.PropertyStatusReader, gishur.core.Parameters)
must be called
with the point's properties, location etc. as arguments.
The other task is to perform the drawing operation with draw(java.awt.Graphics, gishur.gui2.RenderContext, gishur.gui2.PropertyStatusReader, byte)
, using the
DrawProperties
of the calling object. These properties, settable
with DrawAtom.setProperty(java.lang.String, java.lang.Object)
, determine the point's apperance, e.g.
its filling colour, border color, border width, visiblity etc.
Here is an overview of the properties used by a RoundNodePainter
:
Properties Summary |
Key |
Value Type |
Default value |
Meaning |
color |
java.awt.Color |
java.awt.Color.gray |
The colour of the inner area of this point. |
outline.visible |
java.lang.Boolean |
true |
Defines whether the border of the inner coloured area
of this point shall be visible on the screen or not. |
outline.width |
java.lang.Integer |
2 |
Defines the width in pixels of the border of the inner
coloured area of this point. Setting this value to zero
has the same effect like setting outline.visible
to false . |
outline.color |
java.awt.Color |
java.awt.Color.black |
The colour of the border of the inner coloured area
of this point. |
border.visible |
java.lang.Boolean |
false |
If this property is set to true , a one-pixel
border will drawn all around this point. |
border.color |
java.awt.Color |
java.awt.Color.yellow |
The colour of the optional one-pixel border around the
point. |
radius |
java.lang.Integer |
14 |
The radius of this point measured in pixels. |
label.visible |
java.lang.Boolean |
true |
Defines whether a label text in the middle of the area
of this node shall be visible on the screen or not. |
label.text |
java.lang.String |
null |
The label text. |
label.font |
java.awt.Font |
new Font("Helvetica",Font.PLAIN,12) |
The font of the label text. |
label.color |
java.awt.Color |
java.awt.Color.white |
The colour of label text. |
- Version:
- 1.0
- Author:
- Thomas Wolf
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 |
Method Summary |
java.awt.Point |
calculateDockingPoint(int x,
int y)
Calculates a docking point, that means a point on the outline of the
Painter , that lies nearest to the given point.
|
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 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, contains, getAlignmentPoint, getRelativeAlignmentPoint, 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 |
RoundNodePainter
public RoundNodePainter()
- Empty and only constructor. It only creates an
EllipseShape
-object
which will furthermore store the size of this point and provide
special drawing functionality.
recalculate
protected void recalculate(RenderContext context,
PropertyStatusReader prop,
Parameters param)
- Recalculates
this
Painter
using the given RenderContext
,
PropertyStatusReader
, local point information and other parameters.
- Overrides:
recalculate
in class Painter
- Parameters:
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
.
draw
public 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.
- Overrides:
draw
in class Painter
- Parameters:
g
- the Graphics
to draw oncontext
- the RenderContext
to useprop
- the PropertyStatusReader
to use for reading propertieslevel
- the level to draw
calculateDockingPoint
public java.awt.Point calculateDockingPoint(int x,
int y)
- Calculates a docking point, that means a point on the outline of the
Painter
, that lies nearest to the given point.
Returns the docking point nearest to (x,y)
.
- Overrides:
calculateDockingPoint
in class Painter
- Parameters:
x,y
- point, where to come from for docking (outside the
Painter
).- Returns:
- docking point