@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 } }
@Nullable @SuppressWarnings("unchecked") public <T extends Number> T getNumberValue() { if (getText().isEmpty()) return null; return (T) numberType.parseValue(getValue()); }