]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed #2067 : Added exception-handler to BufferedComponents demo.
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>
Wed, 24 Sep 2008 08:48:21 +0000 (08:48 +0000)
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>
Wed, 24 Sep 2008 08:48:21 +0000 (08:48 +0000)
svn changeset:5495/svn branch:trunk

src/com/itmill/toolkit/demo/BufferedComponents.java

index 752ac007888419e8500918df35f6d10d3e1f7935..38846cfc4bd3e78e5178a25a415ec47768af707d 100644 (file)
@@ -12,6 +12,7 @@ import com.itmill.toolkit.ui.Label;
 import com.itmill.toolkit.ui.TextField;
 import com.itmill.toolkit.ui.Window;
 import com.itmill.toolkit.ui.Button.ClickEvent;
+import com.itmill.toolkit.ui.Window.Notification;
 
 public class BufferedComponents extends Application {
 
@@ -63,11 +64,19 @@ public class BufferedComponents extends Application {
                 text.discard();
             }
         }));
-        w.addComponent(new Button("commit", new Button.ClickListener() {
+        Button commit = new Button("commit", new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
-                text.commit();
+                try {
+                    text.commit();
+                    w.showNotification("Committed " + property
+                            + " to datasource.");
+                } catch (Throwable e) {
+                    w.showNotification("Error committing an invalid value: "
+                            + text, Notification.TYPE_WARNING_MESSAGE);
+                }
             }
-        }));
+        });
+        w.addComponent(commit);
 
         // Restart button for application
         // (easier debugging when you dont have to restart the server to