aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/TextField.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/itmill/toolkit/ui/TextField.java')
-rw-r--r--src/com/itmill/toolkit/ui/TextField.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/ui/TextField.java b/src/com/itmill/toolkit/ui/TextField.java
index 0b7336e215..e5572f0b9f 100644
--- a/src/com/itmill/toolkit/ui/TextField.java
+++ b/src/com/itmill/toolkit/ui/TextField.java
@@ -73,6 +73,8 @@ public class TextField extends AbstractField {
*/
private boolean nullSettingAllowed = false;
+ private String inputPrompt = null;
+
/**
* Maximum character count in text field.
*/
@@ -159,6 +161,10 @@ public class TextField extends AbstractField {
target.addAttribute("maxLength", getMaxLength());
}
+ if (inputPrompt != null) {
+ target.addAttribute("prompt", inputPrompt);
+ }
+
// Adds the number of column and rows
final int c = getColumns();
final int r = getRows();
@@ -475,6 +481,26 @@ public class TextField extends AbstractField {
}
/**
+ * 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;
+ }
+
+ /**
* Gets the value formatter of TextField.
*
* @return the Format used to format the value.