if (alertDef == null) {
clearFormValues();
} else {
clearFormValues();
AlertDampening alertDampening = alertDef.getAlertDampening();
if (alertDampening == null) {
alertDampening = new AlertDampening(AlertDampening.Category.NONE);
alertDefinition.setAlertDampening(alertDampening);
}
Category category = alertDampening.getCategory();
dampeningRuleSelection.setValue(category.name());
dampeningRuleStatic.setValue(getCategoryTitle(category));
dampeningRuleStatic.setTooltip(getCategoryHelp(category.name()));
switch (category) {
case NONE: {
break;
}
case CONSECUTIVE_COUNT: {
consecutiveOccurrencesSpinner.setValue(alertDampening.getValue());
consecutiveOccurrencesStatic.setValue(alertDampening.getValue());
break;
}
case PARTIAL_COUNT: {
partialOccurrencesSpinner.setValue(alertDampening.getValue());
partialOccurrencesStatic.setValue(alertDampening.getValue());
partialEvaluationsSpinner.setValue(alertDampening.getPeriod());
partialEvaluationsStatic.setValue(alertDampening.getPeriod());
break;
}
case DURATION_COUNT: {
durationOccurrencesSpinner.setValue(alertDampening.getValue());
durationOccurrencesStatic.setValue(alertDampening.getValue());
durationTimePeriodSpinner.setValue(alertDampening.getPeriod());
durationTimePeriodStatic.setValue(alertDampening.getPeriod());
durationTimeUnitsSelection.setValue(alertDampening.getPeriodUnits().name());
durationTimeUnitsStatic.setValue(getTimeUnitsTitle(alertDampening.getPeriodUnits()));
break;
}
default: {
throw new IllegalStateException(MSG.view_alert_common_tab_invalid_dampening_category(category.name())); // should never happen
}