From: Artur Signell Date: Thu, 12 Apr 2012 06:53:11 +0000 (+0300) Subject: Merge remote-tracking branch 'origin/6.8' X-Git-Tag: 7.0.0.alpha2~89 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c9529cc721186776604060d3f980d327d0f9d729;p=vaadin-framework.git Merge remote-tracking branch 'origin/6.8' Conflicts: src/com/vaadin/ui/AbstractField.java --- c9529cc721186776604060d3f980d327d0f9d729 diff --cc src/com/vaadin/ui/AbstractField.java index 3b9d035a9a,e1d3270225..9f5516a6ce --- a/src/com/vaadin/ui/AbstractField.java +++ b/src/com/vaadin/ui/AbstractField.java @@@ -1360,8 -1133,17 +1376,14 @@@ public abstract class AbstractField @Override public void attach() { super.attach(); - // No-op if listeners already registered - addPropertyListeners(); - if (actionManager != null) { - actionManager.setViewer(getWindow()); - } + + if (!isListeningToPropertyEvents) { + addPropertyListeners(); + if (!isModified() && isReadThrough()) { + // Update value from data source + discard(); + } + } } @Override @@@ -1573,44 -1356,13 +1595,49 @@@ } } + /** + * Gets the converter used to convert the property data source value to the + * field value. + * + * @return The converter or null if none is set. + */ + public Converter getConverter() { + return converter; + } + + /** + * Sets the converter used to convert the field value to property data + * source type. The converter must have a presentation type that matches the + * field type. + * + * @param converter + * The new converter to use. + */ + public void setConverter(Converter converter) { + this.converter = (Converter) converter; + requestRepaint(); + } + + @Override + public AbstractFieldState getState() { + return (AbstractFieldState) super.getState(); + } + + @Override + public void updateState() { + super.updateState(); + + // Hide the error indicator if needed + getState().setHideErrors(shouldHideErrors()); + } + + /** + * Registers this as an event listener for events sent by the data source + * (if any). Does nothing if + * isListeningToPropertyEvents == true. + */ private void addPropertyListeners() { - if (!isListening) { + if (!isListeningToPropertyEvents) { if (dataSource instanceof Property.ValueChangeNotifier) { ((Property.ValueChangeNotifier) dataSource).addListener(this); } @@@ -1632,7 -1388,7 +1663,7 @@@ ((Property.ReadOnlyStatusChangeNotifier) dataSource) .removeListener(this); } - isListening = false; + isListeningToPropertyEvents = false; } } -} +}