@Override public void setValueChangeMode(ValueChangeMode valueChangeMode) { ObjectUtils.argumentNotNull(valueChangeMode, "ValueChangeMode must be not null"); if (isValueChangeModeSupported()) { ((HasValueChangeMode) field).setValueChangeMode(valueChangeMode); } }
@Override public ValueChangeMode getValueChangeMode() { if (isValueChangeModeSupported()) { return ((HasValueChangeMode) field).getValueChangeMode(); } return ValueChangeMode.BLUR; }
@Override public void setValueChangeTimeout(int valueChangeTimeout) { if (valueChangeTimeout < 0) { throw new IllegalArgumentException("Value change timeout must be greater or equal to 0"); } if (isValueChangeModeSupported()) { ((HasValueChangeMode) field).setValueChangeTimeout(valueChangeTimeout); } }
@Override public int getValueChangeTimeout() { if (isValueChangeModeSupported()) { return ((HasValueChangeMode) field).getValueChangeTimeout(); } return -1; }
@Override public boolean isValueChangeModeSupported() { return field instanceof HasValueChangeMode; }
/** * Sets the mode how the TextField triggers {@link ValueChangeEvent}s. * * @param valueChangeMode * the new mode * * @see ValueChangeMode * @return this (for method chaining) */ public default S withValueChangeMode(ValueChangeMode valueChangeMode) { ((HasValueChangeMode) this).setValueChangeMode(valueChangeMode); return (S) this; }
/** * Sets how often {@link ValueChangeEvent}s are triggered when the * {@link ValueChangeMode} is set to either {@link ValueChangeMode#LAZY} or * {@link ValueChangeMode#TIMEOUT}. * * @param valueChangeTimeout * timeout in milliseconds, must be greater or equal to 0 * @throws IllegalArgumentException * if given timeout is smaller than 0 * * @see ValueChangeMode * @return this (for method chaining) */ public default S withValueChangeTimeout(int valueChangeTimeout) { ((HasValueChangeMode) this).setValueChangeTimeout(valueChangeTimeout); return (S) this; }