Class hmiViewer

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----hmiViewer

public class hmiViewer
extends Applet
implements hmiList, hmiList2, MouseListener, MouseMotionListener, Runnable
The main applet for an HMI page. It loads the widgets given on it's parameter lines, fetches values for their variables and calls their display methods.


Variable Index

 o bgImage
A background image.
 o bkgnd
Name of the background image as given by parameter "bkgnd".
 o blink
The color blink flag.
 o cellfh
Array of prepared requests used to retrieve variable values from server.
 o comInt
A reference to the communication Interface.
 o context
Our applet context.
 o dbGraphics
Graphics from dbImage.
 o dbImage
Image for double buffering of the screen.
 o debug
Compile with !=0 to enable debug output.
 o fontName
Name of the standard font as given by the parameter "font".
 o fonts
Array of prepared fonts to avoid "new Font".
 o kHash
Stores variable name / value pairs.
 o machine
Used when calling a trend diagram.
 o mainStatus
Status to show, when there is no valid hint.
 o port
Port number given by parameter "port".
 o refresh
Refresh time in millliseconds.
 o size
Our dimensions.
 o timer
Does a cyclic screen update.
 o trendLoad
Name of the trend script as given by parameter "trends".
 o userRights
Rights as given by the parameter "rights".
 o wasModified
True if applet has modified values and hence must tell the server to store them permanently.
 o widgets
Stores the widgets.

Constructor Index

 o hmiViewer()

Method Index

 o callTrend()
Calls the trend script.
 o destroy()
Calls C.I.'s destroy() to clean up lesftovers from communication.
 o get(String)
Get the textual contents of variable named k.
 o getBlink()
 o getComInt()
 o getFont(int)
Return an istance of the standard Font of size fh either from table or after creating it.
 o getFontMetrics(int)
 o getHash()
 o getImage(String)
 o getIntParam(String, int)
 o getRights(int)
 o hasHash()
 o init()
Initialization.
 o mouseClicked(MouseEvent)
Search a widget that can handle the mouse click and call it's action method.
 o mouseDragged(MouseEvent)
Do nothing.
 o mouseEntered(MouseEvent)
 o mouseExited(MouseEvent)
 o mouseMoved(MouseEvent)
Displays a hint in status bar, if mouse is in a widget's area.
 o mousePressed(MouseEvent)
 o mouseReleased(MouseEvent)
 o paint(Graphics)
Paints background, gray rectangle and background image.
 o processKeyEvent(KeyEvent)
Searches a widget that can handle the KeyEvent.
 o put(String, String)
Set the variable named k to value v.
 o putVal(String, double)
Let the communication Interface set the variable named k to value v.
 o run()
Runs refresh.
 o showDocument(String)
 o showDocument(String, String)
 o start()
Opens communication link via C.I.'s open().
 o stop()
Stops communication link via C.I.'s stop().
 o tPutVal(String)
Let the communication Interface set the variable named k temporary to 1.
 o update(Graphics)
Updates variables and makes the widgets repaint themselves.

Variables

 o debug
 static final int debug
Compile with !=0 to enable debug output.

 o timer
 Thread timer
Does a cyclic screen update.

 o blink
 boolean blink
The color blink flag.

 o wasModified
 boolean wasModified
True if applet has modified values and hence must tell the server to store them permanently.

 o bgImage
 Image bgImage
A background image.

 o dbImage
 Image dbImage
Image for double buffering of the screen.

 o dbGraphics
 Graphics dbGraphics
Graphics from dbImage.

 o userRights
 int userRights
Rights as given by the parameter "rights". Currently only the lsbit is used meaning "user may change settings".

 o cellfh
 String cellfh[]
Array of prepared requests used to retrieve variable values from server.

 o fonts
 Font fonts[]
Array of prepared fonts to avoid "new Font". Whenever an instance of the standard font of a specific size is required, it's stored Here. We can assume it will be used again.

 o kHash
 Hashtable kHash
Stores variable name / value pairs.

 o context
 AppletContext context
Our applet context.

 o widgets
 Vector widgets
Stores the widgets.

 o fontName
 String fontName
Name of the standard font as given by the parameter "font".

 o refresh
 int refresh
Refresh time in millliseconds. Defaults to 1000 if not given by the parameter "refresh".

 o machine
 String machine
Used when calling a trend diagram. The URL is formed as ?machine=machine&sources=,var2>. The purpose is to reuse the same hmi pages for mutiple identical machines with a different machine name. The (CGI) script that delivers the trend page should derive the data storage location from this parameter.

 o trendLoad
 String trendLoad
Name of the trend script as given by parameter "trends".

 o bkgnd
 String bkgnd
Name of the background image as given by parameter "bkgnd".

 o mainStatus
 String mainStatus
Status to show, when there is no valid hint.

 o port
 int port
Port number given by parameter "port". If not given the communicationInterface sets it's default.

 o size
 Dimension size
Our dimensions.

 o comInt
 hmiCommunicationInterface comInt
A reference to the communication Interface.

Constructors

 o hmiViewer
 public hmiViewer()

Methods

 o mouseMoved
 public void mouseMoved(MouseEvent evt)
Displays a hint in status bar, if mouse is in a widget's area.

 o mouseDragged
 public void mouseDragged(MouseEvent e)
Do nothing.

 o processKeyEvent
 public void processKeyEvent(KeyEvent e)
Searches a widget that can handle the KeyEvent. May change in future for mouseless operation.

Overrides:
processKeyEvent in class Component
 o putVal
 public synchronized void putVal(String k,
                                 double v)
Let the communication Interface set the variable named k to value v.

 o tPutVal
 public void tPutVal(String k)
Let the communication Interface set the variable named k temporary to 1.

 o put
 public void put(String k,
                 String v)
Set the variable named k to value v. This is NOT propageted to the server.

 o get
 public String get(String k)
Get the textual contents of variable named k.

 o showDocument
 public void showDocument(String d,
                          String target)
 o showDocument
 public void showDocument(String d)
 o hasHash
 public boolean hasHash()
 o getHash
 public Hashtable getHash()
 o getBlink
 public boolean getBlink()
 o getFontMetrics
 public FontMetrics getFontMetrics(int i)
 o getRights
 public boolean getRights(int mask)
 o getImage
 public Image getImage(String s)
 o mouseClicked
 public void mouseClicked(MouseEvent e)
Search a widget that can handle the mouse click and call it's action method. I think this is less code and time than making each widget an eventListener.

 o mousePressed
 public void mousePressed(MouseEvent evt)
 o mouseReleased
 public void mouseReleased(MouseEvent evt)
 o mouseEntered
 public void mouseEntered(MouseEvent evt)
 o mouseExited
 public void mouseExited(MouseEvent evt)
 o getIntParam
 public int getIntParam(String s,
                        int defaultv)
 o init
 public void init()
Initialization. Loads the communication interface. Initializes it using it's init(). Parses parameter lines and loads widgets according to them. Further Initializes the C.I. using it's init2().

Overrides:
init in class Applet
 o start
 public void start()
Opens communication link via C.I.'s open(). Starts the refresh thread.

Overrides:
start in class Applet
 o stop
 public void stop()
Stops communication link via C.I.'s stop(). Ends the refresh thread.

Overrides:
stop in class Applet
 o getFont
 public Font getFont(int fh)
Return an istance of the standard Font of size fh either from table or after creating it. Stores it for later use.

 o destroy
 public void destroy()
Calls C.I.'s destroy() to clean up lesftovers from communication.

Overrides:
destroy in class Applet
 o run
 public void run()
Runs refresh. Inverts blink flag. Waits till next refresh.

 o paint
 public void paint(Graphics g)
Paints background, gray rectangle and background image.

Overrides:
paint in class Container
 o update
 public void update(Graphics g)
Updates variables and makes the widgets repaint themselves.

Overrides:
update in class Container
 o callTrend
 public void callTrend()
Calls the trend script.

 o getComInt
 public hmiCommunicationInterface getComInt()