|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.gui.components.wheelswitch.AbstractWheelswitchFormatter
public abstract class AbstractWheelswitchFormatter
Formats java.lang.String
s to be displayed as digits in the
Wheelswitch
. The format is specified in a format
java.lang.String
. WheelswitchFormatter
also
stores the value, its bounds (minimum and maximum) and also the unit
displayed by the Wheelswitch
.
Field Summary | |
---|---|
protected boolean |
debug
|
protected PrintfFormat |
defFormatter
|
protected java.lang.String |
formatString
|
protected PrintfFormat |
formatter
|
protected java.lang.String |
generatedFormatString
|
protected double |
maximum
|
protected int |
maximumDigits
|
protected double |
minimum
|
protected java.lang.String |
unit
|
protected double |
value
|
protected java.lang.String |
valueString
|
Constructor Summary | |
---|---|
AbstractWheelswitchFormatter()
Constructs the PlainWheelswitchFormatter with no format string. |
|
AbstractWheelswitchFormatter(java.lang.String newFormatString)
Constructs the PlainWheelswitchFormatter and sets the format string. |
Method Summary | |
---|---|
static boolean |
checkFormat(java.lang.String format)
Checks the number format string. |
protected java.lang.String |
generateFormat()
|
java.lang.String |
getFormat()
Returns the currently stored format string. |
double |
getMaximum()
Returns the current maximum allowed value. |
int |
getMaximumDigits()
Returns the maximum allowed number of digits to represent the value. |
double |
getMinimum()
Returns the current minimum allowed value. |
java.lang.String |
getString()
Returns the formatted string representing the currently stored value. |
java.lang.String |
getUnit()
Returns the unit. |
double |
getValue()
Returns the currently stored value. |
protected abstract void |
internalSetString(java.lang.String newValueString)
|
void |
setFormat(java.lang.String newFormatString)
Sets the format string specifiing the format of Wheelswitch
display. |
void |
setMaximum(double newMaximum)
Sets a new maximum allowed value. |
void |
setMaximumDigits(int i)
Sets the maximum allowed number of digits to represent the value. |
void |
setMinimum(double newMinimum)
Sets a new minimum allowed value. |
void |
setString(java.lang.String newValueString)
Sets the value as string. |
void |
setUnit(java.lang.String unit)
Sets the unit. |
void |
setValue(double newValue)
Sets a new value and stores its formatted string. |
static java.lang.String |
transformFormat(java.lang.String format)
A conviniance method for transforming between the Printf type format strings and wheelswitch type format strings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PrintfFormat defFormatter
protected PrintfFormat formatter
protected java.lang.String formatString
protected java.lang.String generatedFormatString
protected java.lang.String unit
protected java.lang.String valueString
protected double maximum
protected double minimum
protected double value
protected int maximumDigits
protected boolean debug
Constructor Detail |
---|
public AbstractWheelswitchFormatter(java.lang.String newFormatString)
newFormatString
- setFormat(String)
public AbstractWheelswitchFormatter()
setFormat(String)
Method Detail |
---|
public void setFormat(java.lang.String newFormatString) throws java.lang.IllegalArgumentException
Wheelswitch
display. The format is first checked for validity by the
checkFormat(String)
method.
newFormatString
-
java.lang.IllegalArgumentException
- DOCUMENT ME!Double.parseDouble(String)
,
NumberFormatException
public java.lang.String getFormat()
public void setMaximum(double newMaximum)
newMaximum
- new maximum valuepublic double getMaximum()
public void setMinimum(double newMinimum)
newMinimum
- new minimum valuepublic double getMinimum()
public void setString(java.lang.String newValueString)
newValueString
- String representing the number to be formatted.
It only accepts values within bounds (maximum and minimum).public java.lang.String getString()
public void setValue(double newValue)
newValue
- new valueprotected abstract void internalSetString(java.lang.String newValueString)
public double getValue()
public static boolean checkFormat(java.lang.String format)
Double.parseDouble()
.
format
-
public static java.lang.String transformFormat(java.lang.String format)
format
-
java.lang.NullPointerException
- if format is null
java.lang.IllegalArgumentException
- if format is not supported (does not include
f,d,i,e or E tag)public void setMaximumDigits(int i)
i
- new maximum number of digitspublic int getMaximumDigits()
public void setUnit(java.lang.String unit)
unit
- new unitspublic java.lang.String getUnit()
protected java.lang.String generateFormat()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |