diff options
author | Artur Signell <artur@vaadin.com> | 2012-11-20 13:12:43 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-20 13:12:43 +0000 |
commit | 40e7287b82df23e9105f51b7ca086e93fb8903c5 (patch) | |
tree | 6e1bdb4b0382844d4ec170fe65b96da8a04e7ba2 /server/src | |
parent | 9c04958fdda8f490fc91aef19819ef9965c36e2e (diff) | |
parent | fb771475c1b94d0dca3e1cb69f87cb8d80630aad (diff) | |
download | vaadin-framework-40e7287b82df23e9105f51b7ca086e93fb8903c5.tar.gz vaadin-framework-40e7287b82df23e9105f51b7ca086e93fb8903c5.zip |
Merge "Added possibility to disable text input for PopupDateField (#6790)"
Diffstat (limited to 'server/src')
-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; + } + } |