Class hmiElement

java.lang.Object
   |
   +----hmiElement

public class hmiElement
extends Object
implements cellRefHolder
hmiElement is the prototype for all dynamic widgets in an HMI page.


Variable Index

 o Cells
The cellRefs, one for each parameter
 o colorCodes
Colors, -1 meaning don't draw, 0-15 are EGA colors, everything else is suposed to represent 256^2*red +256*green +blue.
 o comError
Error state.
 o debug
change to choose debug level
 o elNumber
A Number from the parameter name, used to retrieve individual hint texts.
 o flags
currently, only one bit is used to mark that the main value will be included into the next trend screen.
 o mainVal
Value to display
 o maximum
limit for color change
 o minimum
limit for color change
 o nopaint
a "do not paint" flag
 o owner
something like a hmiViewer applet that provides the environment
 o sx
Extension to the right and down.
 o sy
Extension to the right and down.
 o x
Upper left corner.
 o y
Upper left corner.

Constructor Index

 o hmiElement()

Method Index

 o action(MouseEvent)
This performs actions.
 o background(Graphics)
Overwrite this to draw something else than the standard background rectangle.
 o canHandleEvent(MouseEvent)
Tell whether event occured in our area.
 o ErrorPaint(Graphics)
Called in case of communication error.
 o fitText(Graphics, String)
Places a text into the greatest possible rectangle:
 o fitText(Graphics, String, int, int, int, int)
Places a text into a given rectangle:
 o getList()
Returns a reference to owner's Variable/Value Hashtable.
 o getval()
getval transfers the updated values into the specific variables:
 o hintString()
Get a hint string.
 o isEventInArea(MouseEvent)
Tell whether event occured in our area.
 o knob(Graphics, int, int)
This draws a knob (ellipsis with border) with color value numbers given in "body" and "border".
 o needCells()
Tell owner, how many cellRefs we will need.
Overwrite this method in classes that need more than the 16 standard parameters.
 o newElement(String, hmiList, int)
Creates a derived class from the widgets name and initializes it.
 o paint(Graphics)
The paint methode.
 o paintmore(Graphics)
Overwrite this to draw your widget's special appearence on the prepared background rectangle.
 o setColor(int, Graphics)
this is the standard methode for all elements that use the standard color scheme: color nr 1 foreground ,2 frame/scale, 3 background for normal values color nr 4 foreground ,5 frame/scale, 6 background for values below minimum color nr 7 foreground ,8 frame/scale, 9 background for values above maximum
 o setColor2(int, Graphics)
This sets one out of 9 color that come from the widgets nine color parameters.
 o setColor3(int, Graphics)
Sets one out of 16 colors (0..15) or -1 for don't paint.
 o setComError(int)
Sets communication error
 o setMore(String, int)
Get any extra parameters.
Overwrite this method in classes that need more than the 16 standard parameters.
 o usesKey(KeyEvent)
Returns true, if the widget can perform an action on a given KeyEvent.

Variables

 o debug
 static final int debug
change to choose debug level

 o elNumber
 int elNumber
A Number from the parameter name, used to retrieve individual hint texts.

 o x
 public int x
Upper left corner.

 o y
 public int y
Upper left corner.

 o sx
 public int sx
Extension to the right and down.

 o sy
 public int sy
Extension to the right and down.

 o colorCodes
 public int colorCodes[]
Colors, -1 meaning don't draw, 0-15 are EGA colors, everything else is suposed to represent 256^2*red +256*green +blue.
valuemeaning/color
-1
0black
1the EGA dark blue
2the EGA dark green
3 Blinking between this and this color
4the EGA dark red
5the EGA dark magenta
6JAVA orange near EGA orange/brown
7JAVA/EGA lightgray
8JAVA/EGA darkgray
9JAVA/EGA blue
10JAVA/EGA green
11JAVA/EGA cyan
12JAVA/EGA red
13JAVA/EGA magenta
14JAVA/EGA yellow
15JAVA/EGA white
FF8020treted as RGB triple

 o comError
 public int comError
Error state. 0=o.k.

 o flags
 public int flags
currently, only one bit is used to mark that the main value will be included into the next trend screen.

 o Cells
 public cellRef Cells[]
The cellRefs, one for each parameter

 o minimum
 double minimum
limit for color change

 o maximum
 double maximum
limit for color change

 o mainVal
 double mainVal
Value to display

 o owner
 public hmiList owner
something like a hmiViewer applet that provides the environment

 o nopaint
 boolean nopaint
a "do not paint" flag

Constructors

 o hmiElement
 public hmiElement()

Methods

 o canHandleEvent
 public boolean canHandleEvent(MouseEvent evt)
Tell whether event occured in our area.

 o isEventInArea
 public final boolean isEventInArea(MouseEvent evt)
Tell whether event occured in our area.

 o newElement
 public static hmiElement newElement(String s,
                                     hmiList owner,
                                     int pNumber)
Creates a derived class from the widgets name and initializes it.

 o needCells
 public int needCells()
Tell owner, how many cellRefs we will need.
Overwrite this method in classes that need more than the 16 standard parameters. See hmiLimited for an example.

 o setMore
 public void setMore(String s,
                     int n)
Get any extra parameters.
Overwrite this method in classes that need more than the 16 standard parameters. Call super.setMore() first. See hmiLimited for an example.

 o hintString
 public String hintString()
Get a hint string. Overwrite this in classes that give hints to the user. This looks in applet parameters first for the combination +"Hint"+. This allows you to assign individual hints for each widget. If this is not found, It looks for +"Hint" which should be a generic hint for that widget type. Example:
If you put in your applet tag:
name="hmiPotiHint" value="Click left turn left, right to turn right", this text will be shown for each poti.
If you put in your applet tag:
name="hmiPotiHint12" value="Click left to decrease speed of mixer, right to increase it" , this text will be shown for the poti created with name="12".

 o setComError
 public void setComError(int flag)
Sets communication error

 o getList
 public hmiList getList()
Returns a reference to owner's Variable/Value Hashtable.

 o knob
 public void knob(Graphics g,
                  int body,
                  int border)
This draws a knob (ellipsis with border) with color value numbers given in "body" and "border". It's here because all sorts of round switches and potentiometers can use it.

 o fitText
 public void fitText(Graphics g,
                     String S)
Places a text into the greatest possible rectangle:

 o fitText
 public void fitText(Graphics g,
                     String S,
                     int x,
                     int y,
                     int xs,
                     int ys)
Places a text into a given rectangle:

 o setColor2
 public void setColor2(int c,
                       Graphics g)
This sets one out of 9 color that come from the widgets nine color parameters.

 o setColor3
 public void setColor3(int c,
                       Graphics g)
Sets one out of 16 colors (0..15) or -1 for don't paint. The 16 colors are the standard EGA palette, only the dark cyan is replaced by blinking lightgreen/orange.

 o setColor
 public void setColor(int c,
                      Graphics g)
this is the standard methode for all elements that use the standard color scheme: color nr 1 foreground ,2 frame/scale, 3 background for normal values color nr 4 foreground ,5 frame/scale, 6 background for values below minimum color nr 7 foreground ,8 frame/scale, 9 background for values above maximum

 o getval
 public void getval()
getval transfers the updated values into the specific variables:

 o paint
 public void paint(Graphics g)
The paint methode. As most elements have a unicolor background and an enclosing rectangle "frame" and draw there private parts with foreground color, we do here as much as possible for most elements: Draw background, set foreground color, paint the rest with paintmore(). Overwrite this if you dont want that, otherwise overwrite paintmore.

 o paintmore
 public void paintmore(Graphics g)
Overwrite this to draw your widget's special appearence on the prepared background rectangle.

 o background
 public void background(Graphics g)
Overwrite this to draw something else than the standard background rectangle.

 o ErrorPaint
 public void ErrorPaint(Graphics g)
Called in case of communication error.

 o action
 public void action(MouseEvent e)
This performs actions. Standard is to call the trend script for left button and to mark the element to be included into next trend call for right button.

 o usesKey
 public boolean usesKey(KeyEvent e)
Returns true, if the widget can perform an action on a given KeyEvent.