diff options
author | Mikael Grankvist <mgrankvi@vaadin.com> | 2012-11-15 11:21:14 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-11-19 20:30:19 +0200 |
commit | fb771475c1b94d0dca3e1cb69f87cb8d80630aad (patch) | |
tree | ab7a0bcd14edda400f9763cc0c0d8f50d1f6dbda /server/src/com/vaadin/ui/PopupDateField.java | |
parent | 02a808548472a8aa66631fdbf5ee119b24061a92 (diff) | |
download | vaadin-framework-fb771475c1b94d0dca3e1cb69f87cb8d80630aad.tar.gz vaadin-framework-fb771475c1b94d0dca3e1cb69f87cb8d80630aad.zip |
Added possibility to disable text input for PopupDateField (#6790)
Change-Id: I3275fce74c26b1409aa00505c06f459d1ae2e6ce
Diffstat (limited to 'server/src/com/vaadin/ui/PopupDateField.java')
-rw-r--r-- | server/src/com/vaadin/ui/PopupDateField.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/PopupDateField.java b/server/src/com/vaadin/ui/PopupDateField.java index 39e0578301..8d26fa8e25 100644 --- a/server/src/com/vaadin/ui/PopupDateField.java +++ b/server/src/com/vaadin/ui/PopupDateField.java @@ -21,6 +21,7 @@ import java.util.Date; import com.vaadin.data.Property; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; +import com.vaadin.shared.ui.datefield.PopupDateFieldState; /** * <p> @@ -87,4 +88,34 @@ public class PopupDateField extends DateField { markAsDirty(); } + @Override + protected PopupDateFieldState getState() { + return (PopupDateFieldState) super.getState(); + } + + /** + * Checks whether the text field is enabled (default) or not. + * + * @see PopupDateField#setTextFieldEnabled(boolean); + * + * @return <b>true</b> if the text field is enabled, <b>false</b> otherwise. + */ + public boolean isTextFieldEnabled() { + return getState().textFieldEnabled; + } + + /** + * Enables or disables the text field. By default the text field is enabled. + * Disabling it causes only the button for date selection to be active, thus + * preventing the user from entering invalid dates. + * + * See {@link http://dev.vaadin.com/ticket/6790}. + * + * @param state + * <b>true</b> to enable text field, <b>false</b> to disable it. + */ + public void setTextFieldEnabled(boolean state) { + getState().textFieldEnabled = state; + } + } |