private static String getAcceptedCharset() {
   if (!GWT.isClient()) {
     return null;
   }
   StringBuffer strbuf = new StringBuffer();
   strbuf.append("0123456789");
   if (numberConstants.zeroDigit().charAt(0) != '0') {
     for (int i = 0; i < 10; i++) {
       strbuf.append(numberConstants.zeroDigit().charAt(0) + i);
     }
   }
   strbuf.append(numberConstants.decimalSeparator().charAt(0));
   if (numberConstants.groupingSeparator().charAt(0) == '\u00a0') {
     strbuf.append(' ');
   } else {
     strbuf.append(numberConstants.groupingSeparator().charAt(0));
   }
   strbuf.append((char) KeyboardListener.KEY_TAB);
   strbuf.append((char) KeyboardListener.KEY_BACKSPACE);
   strbuf.append((char) KeyboardListener.KEY_DELETE);
   strbuf.append((char) KeyboardListener.KEY_ENTER);
   strbuf.append((char) KeyboardListener.KEY_HOME);
   strbuf.append((char) KeyboardListener.KEY_END);
   strbuf.append((char) KeyboardListener.KEY_LEFT);
   strbuf.append((char) KeyboardListener.KEY_UP);
   strbuf.append((char) KeyboardListener.KEY_RIGHT);
   strbuf.append((char) KeyboardListener.KEY_DOWN);
   strbuf.append((char) DOMHelper.OTHER_KEY_LEFT);
   strbuf.append((char) DOMHelper.OTHER_KEY_UP);
   strbuf.append((char) DOMHelper.OTHER_KEY_RIGHT);
   strbuf.append((char) DOMHelper.OTHER_KEY_DOWN);
   return strbuf.toString();
 }
 protected String reformatContent() {
   String str = amountBox.getText();
   if (numberConstants.groupingSeparator().charAt(0) == '\u00a0') {
     str = str.replace(' ', '\u00a0');
   }
   double amount;
   try {
     amount = formatter.parse(str);
   } catch (NumberFormatException e) {
     amount = 0.0;
   }
   return formatter.format(amount);
 }
 /** Constructs a CurrencyWidget object. */
 public CurrencyWidget() {
   this(numberConstants.defCurrencyCode());
 }
 protected boolean isLeadingSymbol() {
   return numberConstants.currencyPattern().startsWith("\u00a4");
 }
Exemplo n.º 5
0
 /** Creates a new number field. */
 public SpinnerField() {
   messages = new SpinnerFieldMessages();
   propertyEditor = new NumberPropertyEditor();
   constants = LocaleInfo.getCurrentLocale().getNumberConstants();
   decimalSeparator = constants.decimalSeparator();
 }