Methods Summary |
---|
protected java.lang.String | doGetPattern(java.lang.String patternKey)
if ("currency".equals(patternKey)) {
return NumberFormat.getCurrencyFormat().getPattern();
}
if ("decimal".equals(patternKey)) {
return NumberFormat.getDecimalFormat().getPattern();
}
if ("scientific".equals(patternKey)) {
return NumberFormat.getScientificFormat().getPattern();
}
if ("percent".equals(patternKey)) {
return NumberFormat.getPercentFormat().getPattern();
}
throw new IllegalArgumentException("Unknown pattern key '" + patternKey
+ "'");
|
protected void | doParseAndRememberPattern(java.lang.String pattern)
activeFormat = NumberFormat.getFormat(pattern);
|
protected void | doParseInput(java.lang.String toParse, com.google.gwt.user.client.ui.HasText output, com.google.gwt.user.client.ui.HasText error)
if (!"".equals(toParse)) {
try {
double x = Double.parseDouble(toParse);
String s = activeFormat.format(x);
output.setText(s);
} catch (NumberFormatException e) {
String errMsg = constants.failedToParseInput();
error.setText(errMsg);
}
} else {
output.setText("<None>");
}
|
public NumberFormatExampleConstants | getConstants()
return constants;
|