aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2009-04-06 13:27:02 +0000
committerMarc Englund <marc.englund@itmill.com>2009-04-06 13:27:02 +0000
commitbdee6749d449ffdf7cf6584d9d67bca6f3d0dd79 (patch)
treea352b7570bd5888f30af6e1f260fdea87deb240c /src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
parentaa059edab19e8b10ebd18fb4c42b95c95dd60f49 (diff)
downloadvaadin-framework-bdee6749d449ffdf7cf6584d9d67bca6f3d0dd79.tar.gz
vaadin-framework-bdee6749d449ffdf7cf6584d9d67bca6f3d0dd79.zip
(merged from 5.4) Implements "input prompt" for ComboBox and TextField. Also includes Sampler samples. Fixes #1455
svn changeset:7337/svn branch:6.0
Diffstat (limited to 'src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java')
-rw-r--r--src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java b/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
new file mode 100644
index 0000000000..19f995044a
--- /dev/null
+++ b/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
@@ -0,0 +1,49 @@
+package com.itmill.toolkit.demo.sampler.features.text;
+
+import com.itmill.toolkit.data.Property;
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.ui.TextField;
+import com.itmill.toolkit.ui.VerticalLayout;
+
+public class TextFieldInputPromptExample extends VerticalLayout implements
+ Property.ValueChangeListener {
+
+ public TextFieldInputPromptExample() {
+ // add som 'air' to the layout
+ setSpacing(true);
+ setMargin(true);
+
+ // Username field + input prompt
+ TextField username = new TextField();
+ username.setInputPrompt("Username");
+ // configure & add to layout
+ username.setImmediate(true);
+ username.addListener(this);
+ addComponent(username);
+
+ // Password field + input prompt
+ TextField password = new TextField();
+ password.setInputPrompt("Password");
+ // configure & add to layout
+ password.setSecret(true);
+ password.setImmediate(true);
+ password.addListener(this);
+ addComponent(password);
+
+ // Comment field + input prompt
+ TextField comment = new TextField();
+ comment.setInputPrompt("Comment");
+ // configure & add to layout
+ comment.setRows(3);
+ comment.setImmediate(true);
+ comment.addListener(this);
+ addComponent(comment);
+
+ }
+
+ public void valueChange(ValueChangeEvent event) {
+ getWindow().showNotification("Received " + event.getProperty());
+
+ }
+
+}