jcontrol.ui.vole.meter
Class AnalogMeter

java.lang.Object
  |
  +--jcontrol.ui.vole.Component
        |
        +--jcontrol.ui.vole.meter.AnalogMeter

public class AnalogMeter
extends Component

This class AnalogMeter.class implements a graphical analog meter for JControl. Several parameters of the analog meter such as opening angle and orientation are user controllable.

(C) DOMOLOGIC Home Automation GmbH 2003

Version:
1.2
Author:
Marcus Timmermann, Wolfgang Klingauf

Field Summary
protected  int angleoffset
           
protected  boolean border
           
protected  int decimals
           
protected  int dials
           
protected  boolean firstLine
           
protected  java.lang.String inscriptMax
           
protected  java.lang.String inscriptMin
           
protected  int maxDisplay
           
protected  int maxValue
          Internal coordinates and parameters
protected  int minDisplay
           
protected  int minValue
          Internal coordinates and parameters
protected  int openangle
          The opening angle of the scale (0..180)
protected  int orientation
           
static int ORIENTATION_LEFT
          Align the scale of the analog meter to the bottom-left corner of it's bounding box.
static int ORIENTATION_MIDDLE
          Align the scale of the analog meter to the middle.
static int ORIENTATION_RIGHT
          Align the scale of the analog meter to the bottom-right corner of it's bounding box.
protected  boolean painting
           
protected  int radius
           
protected  java.lang.String unit
           
protected  int value
          The current value of the analog meter
protected  boolean wasCovered
           
protected  int xoff
           
protected  int xpos
          Internal coordinates and parameters
protected  int yoff
           
protected  int ypos
          Internal coordinates and parameters
 
Fields inherited from class jcontrol.ui.vole.Component
focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
AnalogMeter(int x, int y, int width, int height, int minValue, int maxValue, int dials)
          Creates a new AnalogMeter.
 
Method Summary
 int getOpenAngle()
          Return the current opening angle of the analog meter.
 void paint()
          Draws the AnalogMeter.
 void setBorder(boolean onoff)
          Sets whether a rectangular border should be painted around the AnalogMeter.
 void setBounds(int x, int y, int width, int height)
          Sets a new position and size for the AnalogMeter.
 void setGraphics(jcontrol.io.Graphics g)
          Set the graphics context of this AnalogMeter.
 void setInscription(java.lang.String inscriptMin, java.lang.String inscriptMax)
          Sets an inscription text which is displayed for the min and max value at the bottom of the analog meter.
 void setNumericDisplay(int minDisplay, int maxDisplay, int decimals, java.lang.String unit)
          Sets the parameters of a numeric value display.
 void setOpenAngle(int value)
          Set the opening angle of the analog meter.
 void setOrientation(int orientation)
          Set the scale orientation.
 void setValue(int value)
          Sets the current analog meter value.
 boolean transferFocus()
          AnalogMeter never gains focus.
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, onKeyEvent, remove, removeFocus, requestFocus, setFont, setLocation, setParent, setVisible, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, notifyAll, wait
 

Field Detail

angleoffset

protected int angleoffset

border

protected boolean border

decimals

protected int decimals

dials

protected int dials

firstLine

protected boolean firstLine

inscriptMax

protected java.lang.String inscriptMax

inscriptMin

protected java.lang.String inscriptMin

maxDisplay

protected int maxDisplay

maxValue

protected int maxValue
Internal coordinates and parameters


minDisplay

protected int minDisplay

minValue

protected int minValue
Internal coordinates and parameters


openangle

protected int openangle
The opening angle of the scale (0..180)


orientation

protected int orientation

ORIENTATION_LEFT

public static final int ORIENTATION_LEFT
Align the scale of the analog meter to the bottom-left corner of it's bounding box.

See Also:
Constant Field Values

ORIENTATION_MIDDLE

public static final int ORIENTATION_MIDDLE
Align the scale of the analog meter to the middle.

See Also:
Constant Field Values

ORIENTATION_RIGHT

public static final int ORIENTATION_RIGHT
Align the scale of the analog meter to the bottom-right corner of it's bounding box.

See Also:
Constant Field Values

painting

protected boolean painting

radius

protected int radius

unit

protected java.lang.String unit

value

protected int value
The current value of the analog meter


wasCovered

protected boolean wasCovered

xoff

protected int xoff

xpos

protected int xpos
Internal coordinates and parameters


yoff

protected int yoff

ypos

protected int ypos
Internal coordinates and parameters

Constructor Detail

AnalogMeter

public AnalogMeter(int x,
                   int y,
                   int width,
                   int height,
                   int minValue,
                   int maxValue,
                   int dials)
Creates a new AnalogMeter.

Parameters:
x - The x coordinate
y - The y coordinate
width - The width
height - The height
minValue - The minimum value
maxValue - The maximum value
dials - Number of dial lines
Method Detail

getOpenAngle

public int getOpenAngle()
Return the current opening angle of the analog meter.

Returns:
value angle between 0 and 180 degrees.

paint

public void paint()
Draws the AnalogMeter.

Overrides:
paint in class Component

setBorder

public void setBorder(boolean onoff)
Sets whether a rectangular border should be painted around the AnalogMeter.

Parameters:
onoff - Turn border on/off. The default is off.

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets a new position and size for the AnalogMeter.

Overrides:
setBounds in class Component
Parameters:
x - the new x coordinate
y - the new y coordinate
width - the new width
height - the new height

setGraphics

public void setGraphics(jcontrol.io.Graphics g)
Set the graphics context of this AnalogMeter.

Overrides:
setGraphics in class Component
Parameters:
g - the Display

setInscription

public void setInscription(java.lang.String inscriptMin,
                           java.lang.String inscriptMax)
Sets an inscription text which is displayed for the min and max value at the bottom of the analog meter.


setNumericDisplay

public void setNumericDisplay(int minDisplay,
                              int maxDisplay,
                              int decimals,
                              java.lang.String unit)
Sets the parameters of a numeric value display.

Parameters:
minDisplay - the minimum display value
maxDisplay - the maximum display value
decimals - The number of decimals behind the comma (may be "0").
unit - A String representing the unit of the meter value.

setOpenAngle

public void setOpenAngle(int value)
Set the opening angle of the analog meter.

Parameters:
value - angle between 0 and 180 degrees. Default value is 180 degrees.

setOrientation

public void setOrientation(int orientation)
Set the scale orientation. Possible values are ORIENTATION_LEFT, ORIENTATION_MIDDLE and ORIENTATION_RIGHT. The default is ORIENTATION_MIDDLE.

Parameters:
orientation - The new scale orientation.

setValue

public void setValue(int value)
Sets the current analog meter value. If the value is out of the range minValue .. maxValue, the value will be cut.

Parameters:
value - the value to set.

transferFocus

public boolean transferFocus()
AnalogMeter never gains focus.

Overrides:
transferFocus in class Component
Returns:
true, if the focus was transferred successfully.