}
protected void convertInput() {
//Keep the original attributes
if (!enabled.getModelObject()) {
setConvertedInput(new DimensionInfoImpl());
} else {
//To keep the original values for attributes not editable in UI:
DimensionInfoImpl info = new DimensionInfoImpl(this.getModelObject());
info.setEnabled(true);
attribute.processInput();
endAttribute.processInput();
info.setAttribute(attribute.getModelObject());
String endAttributeValue = endAttribute.getModelObject();
if ("-".equals(endAttributeValue)) {
endAttributeValue = null;
}
info.setEndAttribute(endAttributeValue);
units.processInput();
String unitsValue = units.getModelObject();
if ("time".equals(this.getId())) { // only one value is allowed for time units
unitsValue = DimensionInfo.TIME_UNITS;
} else if (unitsValue == null) { // allow blank units for any other dimension
unitsValue = "";
}
info.setUnits(unitsValue);
unitSymbol.processInput();
info.setUnitSymbol(unitSymbol.getModelObject());
info.setPresentation(presentation.getModelObject());
if (info.getPresentation() == DimensionPresentation.DISCRETE_INTERVAL) {
if(time) {
resTime.processInput();
info.setResolution(resTime.getModelObject());
} else {
resElevation.processInput();
info.setResolution(resElevation.getModelObject());
}
}
DimensionDefaultValueSetting defValueSetting = new DimensionDefaultValueSetting();
defaultValueStrategy.processInput();
defValueSetting.setStrategyType(defaultValueStrategy.getModelObject());
if (defValueSetting.getStrategyType() == Strategy.FIXED || defValueSetting.getStrategyType() == Strategy.NEAREST){
referenceValue.processInput();
if (referenceValue.hasErrorMessage()){
System.out.println("About to accept erroneous value "+referenceValue.getModelObject());
}
defValueSetting.setReferenceValue(referenceValue.getModelObject());
}
if (defValueSetting.getStrategyType() != Strategy.BUILTIN){
info.setDefaultValue(defValueSetting);
}
else {
info.setDefaultValue(null);
}
setConvertedInput(info);
}
};