void setNewValue(boolean isRequired, String newValue, boolean isBulkUpdate) throws SvmValidationException { String newValueTrimmed = (newValue != null) ? newValue.trim() : ""; if (!isBulkUpdate) { checkRequired(isRequired, newValueTrimmed); } Time newValueAsTime = null; if (checkNotEmpty(newValueTrimmed)) { try { newValueAsTime = toTime(newValueTrimmed); } catch (ParseException e) { modelAttributeListener.invalidate(); throw new SvmValidationException(1300, e.getMessage(), field); } } String oldValue = getValueAsString(); attributeAccessor.setValue(newValueAsTime); if (newValueAsTime != null && !equalsNullSafe(newValueTrimmed, nullAsEmptyString(asString(newValueAsTime))) && equalsNullSafe(oldValue, getValueAsString())) { // Der Wert wurde formatiert und das Resultat entspricht dem alten Wert. Dann wird kein // PropertyChangeEvent // ausgelöst. Damit trotzdem ein Event ausgelöst wird, wird der alte Wert auf den nicht // formatierten Wert gesetzt. oldValue = newValueTrimmed; LOGGER.trace( "setNewValue: Alten Wert auf Eingabewert gesetzt, damit PropertyChangeEvent ausgelöst wird. Alter Wert=" + oldValue + ", neuer Wert=" + getValue()); } modelAttributeListener.firePropertyChange(field, oldValue, getValueAsString()); }
/** Achtung: Neuer Wert wird nicht geprüft! */ void initValue(String newValue) { String oldValue = getValueAsString(); Time newValueAsTime = null; if (checkNotEmpty(newValue)) { try { newValueAsTime = toTime(newValue); } catch (ParseException e) { // Neuer Wert wird nicht geprüft! } } attributeAccessor.setValue(newValueAsTime); modelAttributeListener.firePropertyChange(field, oldValue, getValueAsString()); }