gishur.graph.gui
Class GraphElementInfoPainter

java.lang.Object
  |
  +--gishur.gui2.Painter
        |
        +--gishur.graph.gui.GraphElementInfoPainter

public class GraphElementInfoPainter
extends Painter

A GraphElementInfoPainter draws an infobox with entries for GraphElement properties. The appearance of the infobox is highly configurable by setting the properties listed below. A GraphElementInfoPainter drawed by this painter consists of a title bar with a title string (font, color, textcolor and text settable) and the main box, which contains lines of labels and assigned values, whose appearance and content is of course settable, too (dependend by the property name associated). The font, color etc. can be changed for all labels and values as well as for single lines. The labels and values are surrounded by a one-pixel frame line of settable color. Besides, distinct sections of labels can be separated by inserting a separator, which is a label having of a string representation of "--". This will cause a small empty area between the previous and the next label (the gap width is settable). To make the use of different color schemes easier, GraphElementInfoStyle provides three complete color palettes (GraphElementInfoStyle.GREEN_STYLE, InfoStyle#BLUE_STYLE and GraphElementInfoStyle.RED_STYLE). The style can be told to use one of these palettes as default colors. An explicit listing of all configurable properties:

Properties Summary
General box properties
Key Value Type Default value Meaning
color java.awt.Color InfoStyle#YELLOW_BACK_COLOR The color of the back area of the box.
width int adjustable The width of the info box. If no value is set, the painter will calculate the optimal width.
height int adjustable The height of the info box. If no value is set, the painter will calculate the optimal height.
linecolor java.awt.Color Defined by this painter's InfoStyle, i.e. Color.black for each of the three style types (GraphElementInfoStyle.GREEN_STYLE, GraphElementInfoStyle.BLUE_STYLE or GraphElementInfoStyle.RED_STYLE). The color of the one-pixel frame line around the box (not the same as the border!).
border.visible boolean false Determines whether a border line shall be visible around the box or not.
border.color java.awt.Color Color.yellow Determines the color of the border line around the box (if it is visible).
Title properties
title.text java.lang.String "Values" The title string of the info box. Must be a String, no other objects allowed!
title.font java.awt.Font Helvetica The font which shall be used to print the title string.
title.textcolor java.awt.Color Color.white The title string's color.
title.color java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_TITLE_COLOR, GraphElementInfoStyle.GREEN_TITLE_COLOR, or GraphElementInfoStyle.BLUE_TITLE_COLOR, dependent on the style's type. The color of the box's title bar.
Labels properties
label.font java.awt.Font Helvetica The font which shall be used to print the labels.
label.spaceheight int 6 The height in pixels which shall be assigned to a separator label, i.e. a label not consisting of text but of an empty part separating two sections of labels inside the box.
label.color java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_BOX_COLOR, GraphElementInfoStyle.GREEN_BOX_COLOR or GraphElementInfoStyle.BLUE_BOX_COLOR, dependent on the style's type. The color which fills each label box for which no other color is specified by label.i.color.
label.linecolor java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_LINE_COLOR, GraphElementInfoStyle.BLUE_LINE_COLOR or GraphElementInfoStyle.GREEN_LINE_COLOR, dependent on the style's type. The color to use for the one-pixel label box frame line, if no other color is specified by label.i.linecolor.
label.textcolor java.awt.Color Defined by this painter's GraphElementInfoStyle: Color.black for each of the three style types (GraphElementInfoStyle.GREEN_STYLE, GraphElementInfoStyle.BLUE_STYLE or GraphElementInfoStyle.RED_STYLE). The color to use for the label text output, if no other color is specified by label.i.textcolor.
label.leftalign boolean false Determines whether labels shall printed out aligned to the left border of their boxes or aligned to the right border, if no other alignment is specified by label.i.leftalign.
name.label.text java.lang.Object null The label object for the property name. The label text output will be the return- String of the toString()-method, or the return- String of the ToInfoString.toInfoString()-method, if this object implements the ToInfoString-interface.
name.label.font java.awt.Font Helvetica The font to use for the i-th label.
name.label.color java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_BOX_COLOR, GraphElementInfoStyle.GREEN_BOX_COLOR or GraphElementInfoStyle.BLUE_BOX_COLOR, dependent on the style's type. The color which fills the i-th label box.
name.label.linecolor java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_LINE_COLOR, GraphElementInfoStyle.BLUE_LINE_COLOR or GraphElementInfoStyle.GREEN_LINE_COLOR, dependent on the style's type. The color to use for the one-pixel label box frame of the i-th label.
name.label.textcolor java.awt.Color Defined by this painter's GraphElementInfoStyle: Color.black for each of the three style types (GraphElementInfoStyle.GREEN_STYLE, GraphElementInfoStyle.BLUE_STYLE or GraphElementInfoStyle.RED_STYLE). The color to use for the i-th label text output.
name.label.leftalign boolean false Determines whether this label shall be printed out aligned to the left border of its box or to the right border.
Values properties
value.font java.awt.Font Helvetica The font which shall be used to print the values.
value.color java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_BOX_COLOR, GraphElementInfoStyle.GREEN_BOX_COLOR or GraphElementInfoStyle.BLUE_BOX_COLOR, dependent on the style's type. The color which fills each value box for which no special color is specified by value.i.color.
value.linecolor java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_LINE_COLOR, GraphElementInfoStyle.BLUE_LINE_COLOR or GraphElementInfoStyle.GREEN_LINE_COLOR, dependent on the style's type. The color to use for the one-pixel value box frame line, if no other color is specified by value.i.linecolor.
value.textcolor java.awt.Color Defined by this painter's GraphElementInfoStyle: Color.black for each of the three style types (GraphElementInfoStyle.GREEN_STYLE, GraphElementInfoStyle.BLUE_STYLE or GraphElementInfoStyle.RED_STYLE). The color to use for the value text output, if no other color is specified by value.i.textcolor.
value.leftalign boolean true Determines whether values shall printed out aligned to the left border of their boxes or aligned to the right border, if no other alignment is specified by value.i.leftalign.
name.value.text java.lang.Object null The i-th value object. The value text output will be the return- String of the toString()-method, or the return- String of the ToInfoString.toInfoString()-method, if this object implements the ToInfoString-interface.
name.value.font java.awt.Font Helvetica The font to use for the i-th value.
name.value.color java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_BOX_COLOR, GraphElementInfoStyle.GREEN_BOX_COLOR or GraphElementInfoStyle.BLUE_BOX_COLOR, dependent on the style's type. The color which fills the i-th value's box.
name.value.linecolor java.awt.Color Defined by this painter's GraphElementInfoStyle: GraphElementInfoStyle.RED_LINE_COLOR, GraphElementInfoStyle.BLUE_LINE_COLOR or GraphElementInfoStyle.GREEN_LINE_COLOR, dependent on the style's type. The color to use for the one-pixel value box frame line of the i-th value.
name.value.textcolor java.awt.Color Defined by this painter's GraphElementInfoStyle: Color.black for each of the three style types (GraphElementInfoStyle.GREEN_STYLE, GraphElementInfoStyle.BLUE_STYLE or GraphElementInfoStyle.RED_STYLE). The color to use for the value text output of the i-th value.
name.value.leftalign boolean true Determines whether the i-th value shall printed out aligned to the left border of its box or aligned to the right border.

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
 
Constructor Summary
GraphElementInfoPainter()
          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  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, 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
 

Constructor Detail

GraphElementInfoPainter

public GraphElementInfoPainter()
Default constructor.
Method Detail

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 use
prop - the PropertyStatusReader to use for reading properties
param - a Parameters-object for location and other parameters parsed by the DisplayObject, that uses this Painter.

draw

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.
Overrides:
draw in class Painter
Parameters:
g - the Graphics to draw on
context - the RenderContext to use
prop - the PropertyStatusReader to use for reading properties
level - the level to draw