integerRangeValidator.setMin(1);
integerRangeValidator.setMax(Integer.MAX_VALUE);
valueItem.setValidators(integerRangeValidator);
valueItem.setValidateOnChange(true);
valueItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
updateValue();
}
});
SelectItem unitsItem = new SelectItem(FIELD_UNITS);
unitsItem.setShowTitle(false);
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
if (this.supportedUnitTypes.contains(UnitType.ITERATIONS)) {
valueMap.put("times", MSG.common_unit_times());
}
if (this.supportedUnitTypes.contains(UnitType.TIME)) {
for (TimeUnit unit : supportedUnits) {
valueMap.put(unit.name().toLowerCase(), unit.getDisplayName());
}
}
unitsItem.setValueMap(valueMap);
if (this.defaultTimeUnit != null) {
unitsItem.setDefaultValue(this.defaultTimeUnit.name().toLowerCase());
} else {
unitsItem.setDefaultToFirstOption(true);
}
unitsItem.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
updateValue();
}
});