예제 #1
0
 @Override
 public void setValue(String value, boolean fireEvents) {
   try {
     Number newValue = numberType.parseValue(value);
     if (newValue == null
         || maxConstrained && newValue.intValue() > max
         || minConstrained && newValue.intValue() < min) {
       return;
     }
     String prevText = getValue();
     setText(numberType.formatValue(newValue));
     if (fireEvents) {
       ValueChangeEvent.fireIfNotEqual(this, getValue(), prevText);
     }
   } catch (Exception ex) {
     // Do Nothing
   }
 }
예제 #2
0
 @Nullable
 @SuppressWarnings("unchecked")
 public <T extends Number> T getNumberValue() {
   if (getText().isEmpty()) return null;
   return (T) numberType.parseValue(getValue());
 }