java.lang.Object com.realtime.crossfire.jxclient.gui.gauge.AbstractOrientation
public abstract class AbstractOrientation
Abstract base class for implementing Orientation
instances.
Field Summary | |
---|---|
private int |
cur
The current value. |
private int |
h
The height of the highlighted part of the image. |
private boolean |
hasNegativeImage
Whether the gauge can display negative images. |
private int |
height
The total height of the image. |
private int |
max
The maximum value; the gauge is displayed as full if . |
private int |
min
The minimum value; the gauge is displayed as empty if . |
private int |
w
The width of the highlighted part of the image. |
private int |
width
The total width of the image. |
private int |
x
The x-coordinate of the highlighted part of the image. |
private int |
y
The y-coordinate of the highlighted part of the image. |
Constructor Summary | |
---|---|
protected |
AbstractOrientation()
Creates a new instance. |
Method Summary | |
---|---|
protected static int |
calculate(int val,
int max,
int size)
Returns the fraction val/max rounded to
[0..size ]. |
int |
getCur()
Returns the current value. |
int |
getH()
Returns the height of the highlighted part of the image. |
int |
getHeight()
Returns the total height of the image. |
int |
getMax()
Returns the maximum value. |
int |
getMin()
Returns the minimum value. |
int |
getW()
Returns the width of the highlighted part of the image. |
int |
getWidth()
Returns the total width of the image. |
int |
getX()
Returns the x-coordinate of the highlighted part of the image. |
int |
getY()
Returns the y-coordinate of the highlighted part of the image. |
boolean |
isNegativeImage()
Returns whether the negative image should be shown. |
boolean |
isValid()
Returns whether the gauge's values are valid. |
protected abstract void |
reCalculate()
Recalculate the extents of the highlighted image part. |
void |
setExtends(int width,
int height)
Sets the extends of the image. |
protected void |
setExtent(int x,
int y,
int w,
int h)
Sets the extent of the highlighted part of the image. |
void |
setHasNegativeImage(boolean hasNegativeImage)
Sets whether the gauge can display negative images. |
boolean |
setValues(int cur,
int min,
int max)
Sets the gauge's values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int cur
private int h
private boolean hasNegativeImage
private int height
private int max
cur
>= max
.
private int min
cur
>= min
.
private int w
private int width
private int x
private int y
Constructor Detail |
---|
protected AbstractOrientation()
Method Detail |
---|
protected static int calculate(int val, int max, int size)
val/max
rounded to
[0..size
].
val
- the valuemax
- the range sizesize
- the size of the result
public int getCur()
public int getH()
getH
in interface Orientation
public int getHeight()
public int getMax()
public int getMin()
public int getW()
getW
in interface Orientation
public int getWidth()
public int getX()
getX
in interface Orientation
public int getY()
getY
in interface Orientation
public boolean isNegativeImage()
isNegativeImage
in interface Orientation
public boolean isValid()
isValid
in interface Orientation
protected abstract void reCalculate()
public void setExtends(int width, int height)
setExtends
in interface Orientation
width
- the widthheight
- the heightprotected void setExtent(int x, int y, int w, int h)
x
- the x-coordinatey
- the y-coordinatew
- the widthh
- the heightpublic void setHasNegativeImage(boolean hasNegativeImage)
setHasNegativeImage
in interface Orientation
hasNegativeImage
- whether the gauge can display negative imagespublic boolean setValues(int cur, int min, int max)
setValues
in interface Orientation
cur
- the current valuemin
- the minimum valuemax
- the maximum value