I have extended DoubleTranslator.java and
override the method DoubleTranslator.toClient to
format the output.
public class MyDoubleTranslator extends
DoubleTranslator{
@Override
public String toClient(Double value) {
String returnValue = null;
DecimalFormat formatter = new DecimalFormat(0.#);
if (value==null){
returnValue = ;
}
else{
returnValue = formatter.format(value);
}
return returnValue;
}
}
In AppModule, I added
public static void contributeTranslatorSource(
MappedConfigurationString, Translator
configuration)
{
configuration.add(myDouble, new
MyDoubleTranslator());
}
Now I just add translate=translate:myDouble
to t:textField to have the displayed number
formatted . The above works. But the format pattern
#.0 is
hard coded.
Is there anyway to do something like
translate=translate:myDouble,pattern=#.0 ?
Thanks in advance for any assistance!
Shing
--- Shing Hing Man [EMAIL PROTECTED] wrote:
In Tap 4, I can use translator:number,pattern=0.#
(which used NumberTranslator.java)
to format the numeric value in a TextField
component.
How can this be done in T5.0.6 ?
I have checked the T5.0.6 API, it looks as though
T5.0.6 has no
NumberTranslator.java .
Must I implement a NumberTranslator ?
Shing
Home page : http://www.lombok.demon.co.uk/
___
Want ideas for reducing your carbon footprint? Visit
Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/environment.html
-
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
Home page : http://www.lombok.demon.co.uk/
___
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]