advancedStartItem.setValidators(timeValidator);
setButton = new ButtonItem(SET_ITEM, MSG.common_button_set());
setButton.setStartRow(false);
setButton.setEndRow(false);
setButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
MetricRangePreferences prefs = new MetricRangePreferences();
prefs.explicitBeginEnd = advanced;
if (advanced) {
try {
if (validate()) {
prefs.begin = advancedStartItem.getValueAsDate().getTime();
prefs.end = advancedEndItem.getValueAsDate().getTime();
if (null != prefs.begin && null != prefs.end && prefs.begin > prefs.end) {
CoreGUI.getMessageCenter().notify(new Message(MSG.view_measureTable_startBeforeEnd()));
} else {
setMetricRangeProperties(prefs);
}
}
} catch (Exception ex) {
// some of the digits are not filled correctly
Map<String, String> errors = new HashMap<String, String>();
errors.put(ADVANCED_END_ITEM, "MM/DD/YYYY HH:MM");
errors.put(ADVANCED_START_ITEM, "MM/DD/YYYY HH:MM");
setErrors(errors, true);
}
} else {
prefs.lastN = Integer.valueOf(simpleLastValuesItem.getValueAsString());
prefs.unit = Integer.valueOf(simpleLastUnitsItem.getValueAsString());
setMetricRangeProperties(prefs);
}
}
});
advancedSimpleButton = new ButtonItem(ADVANCED_BUTTON_ITEM, MSG.common_button_advanced());
advancedSimpleButton.setStartRow(false);
advancedSimpleButton.setEndRow(false);
advancedSimpleButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
advanced = !advanced;
update();
}
});