|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NumberDescriptor
Implementation of this interface provides conversion of a
Number
to String
and back. This interface acts as
kind of interpretation of a Number
with bijective
transformation to string.
This interfaces provides more flexible visualization of number as string than is available with standard ANSI C kind of formatting. For example: display and edit double value in hh:mm:ss format (interpret it as degrees).
It is advised for the descriptor implementation to define two final static String fields: NAME
and DESCRIPTION
. First should be short descriptive name and second should be short description. These strings are used in GUI choosers for NumberField visualization.
Method Summary | |
---|---|
java.lang.String |
getFormat()
Returns the format |
java.lang.Class |
getNumberType()
Returns last set number type. |
java.lang.Number |
parseNumber(java.lang.String number)
Parses string and creates Number . |
java.lang.String |
printEditString(java.lang.Number number)
Converts provided Number to a string, which is displayed
when NumberField enters in to edit mode and wants to edit value. |
java.lang.String |
printString(java.lang.Number number)
Converts provided Number to a string, which is used for
displaying the value. |
void |
setFormat(java.lang.String format)
Set the Number format |
void |
setNumberType(java.lang.Class newClass)
Sets number type to descriptor, ame as used on number field. |
Method Detail |
---|
java.lang.Number parseNumber(java.lang.String number)
Number
. If string is not
presentation of a number and can not be parsed, then null must be
returned.
number
- a string representing a number
Number
or null
if string
can not be parsedjava.lang.String printString(java.lang.Number number)
Number
to a string, which is used for
displaying the value.
number
- a number to be transformed to string
String
representing a number.java.lang.String printEditString(java.lang.Number number)
Number
to a string, which is displayed
when NumberField enters in to edit mode and wants to edit value. Edit
string is usually stripped from unnecessary characters and prepared for
easyer user editing.
number
- a number to be transformed to string
String
representation a number prepared for
editing.java.lang.String getFormat()
void setFormat(java.lang.String format)
format
- void setNumberType(java.lang.Class newClass)
newClass
- number typejava.lang.Class getNumberType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |