From: Joonas Lehtinen Date: Wed, 24 Sep 2008 08:48:21 +0000 (+0000) Subject: Fixed #2067 : Added exception-handler to BufferedComponents demo. X-Git-Tag: 6.7.0.beta1~4106 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d7a9d3d234c43088f70ffe7cf0a89e55a5de5cbd;p=vaadin-framework.git Fixed #2067 : Added exception-handler to BufferedComponents demo. svn changeset:5495/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/demo/BufferedComponents.java b/src/com/itmill/toolkit/demo/BufferedComponents.java index 752ac00788..38846cfc4b 100644 --- a/src/com/itmill/toolkit/demo/BufferedComponents.java +++ b/src/com/itmill/toolkit/demo/BufferedComponents.java @@ -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