summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2010-06-11 12:17:32 +0000
committerArtur Signell <artur.signell@itmill.com>2010-06-11 12:17:32 +0000
commit21097aac5e8f4ffb794c2956e8394c7eee37713c (patch)
tree71e28457d02fe76559e07c567fcc48d55490fc1b /src/com/vaadin/ui
parentf9412ed2f1c445ea62a8367f7bcd31699e702171 (diff)
downloadvaadin-framework-21097aac5e8f4ffb794c2956e8394c7eee37713c.tar.gz
vaadin-framework-21097aac5e8f4ffb794c2956e8394c7eee37713c.zip
Merged fix and sample for #2855 - "Implement input prompt for DateField" from /branches/6.4-minor-features
svn changeset:13646/svn branch:6.4
Diffstat (limited to 'src/com/vaadin/ui')
-rw-r--r--src/com/vaadin/ui/PopupDateField.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/com/vaadin/ui/PopupDateField.java b/src/com/vaadin/ui/PopupDateField.java
index 5164601f0d..e975cb23d2 100644
--- a/src/com/vaadin/ui/PopupDateField.java
+++ b/src/com/vaadin/ui/PopupDateField.java
@@ -7,6 +7,8 @@ package com.vaadin.ui;
import java.util.Date;
import com.vaadin.data.Property;
+import com.vaadin.terminal.PaintException;
+import com.vaadin.terminal.PaintTarget;
/**
* <p>
@@ -24,6 +26,8 @@ import com.vaadin.data.Property;
@SuppressWarnings("serial")
public class PopupDateField extends DateField {
+ private String inputPrompt = null;
+
public PopupDateField() {
super();
type = TYPE_POPUP;
@@ -49,4 +53,34 @@ public class PopupDateField extends DateField {
type = TYPE_POPUP;
}
+ @Override
+ public void paintContent(PaintTarget target) throws PaintException {
+ super.paintContent(target);
+
+ if (inputPrompt != null) {
+ target.addAttribute("prompt", inputPrompt);
+ }
+ }
+
+ /**
+ * Gets the current input prompt.
+ *
+ * @see #setInputPrompt(String)
+ * @return the current input prompt, or null if not enabled
+ */
+ public String getInputPrompt() {
+ return inputPrompt;
+ }
+
+ /**
+ * Sets the input prompt - a textual prompt that is displayed when the field
+ * would otherwise be empty, to prompt the user for input.
+ *
+ * @param inputPrompt
+ */
+ public void setInputPrompt(String inputPrompt) {
+ this.inputPrompt = inputPrompt;
+ requestRepaint();
+ }
+
}