From: Marko Grönroos Date: Tue, 22 Jul 2008 08:33:43 +0000 (+0000) Subject: Updated book tests: RichTestArea, Forms. X-Git-Tag: 6.7.0.beta1~4418 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cad630c34ec1504e6fff7436d71cf9baddf1846e;p=vaadin-framework.git Updated book tests: RichTestArea, Forms. svn changeset:5111/svn branch:trunk --- diff --git a/WebContent/ITMILL/themes/tests-book/styles.css b/WebContent/ITMILL/themes/tests-book/styles.css index 3ad4e4a8ff..c33cbb36f3 100644 --- a/WebContent/ITMILL/themes/tests-book/styles.css +++ b/WebContent/ITMILL/themes/tests-book/styles.css @@ -8,6 +8,15 @@ background: white; } +/*****************************************************************************/ +/* For example_Forms() */ +/*****************************************************************************/ +.i-form { + border: thin solid; + padding: 5px 5px 5px 5px; +} + + /*****************************************************************************/ /* For example_Table() */ /*****************************************************************************/ diff --git a/src/com/itmill/toolkit/tests/book/BookTestApplication.java b/src/com/itmill/toolkit/tests/book/BookTestApplication.java index 8939f62d35..eb4b708acd 100644 --- a/src/com/itmill/toolkit/tests/book/BookTestApplication.java +++ b/src/com/itmill/toolkit/tests/book/BookTestApplication.java @@ -49,6 +49,7 @@ import com.itmill.toolkit.ui.OrderedLayout; import com.itmill.toolkit.ui.Panel; import com.itmill.toolkit.ui.PopupDateField; import com.itmill.toolkit.ui.ProgressIndicator; +import com.itmill.toolkit.ui.RichTextArea; import com.itmill.toolkit.ui.Select; import com.itmill.toolkit.ui.TabSheet; import com.itmill.toolkit.ui.Table; @@ -140,7 +141,8 @@ public class BookTestApplication extends com.itmill.toolkit.Application { "window/multiple", "classresource", "usererror", "progress/window", "progress/thread", "progress", "customlayout", "spacing", "margin", "clientinfo", - "fillinform/templates", "notification", "print"}; + "fillinform/templates", "notification", "print", + "richtextfield"}; for (int i = 0; i < examples.length; i++) { main.addComponent(new Label("" + examples[i] + "", @@ -219,6 +221,8 @@ public class BookTestApplication extends com.itmill.toolkit.Application { example_Notification(main, param); } else if (example.equals("print")) { example_Print(main, param); + } else if (example.equals("richtextfield")) { + example_RichTextField(main, param); } else { ; // main.addComponent(new Label("Unknown test '"+example+"'.")); } @@ -1378,4 +1382,25 @@ public class BookTestApplication extends com.itmill.toolkit.Application { //main.addComponent(new Label("

Print this!

\n", Label.CONTENT_XHTML)); } + + void example_RichTextField(final Window main, String param) { + // Create the rich text area + final RichTextArea rtarea = new RichTextArea(); + + // Set initial content as HTML + rtarea.setValue("

Hello

\n

This contains some text.

"); + + // Show the text edited in the rich text area as HTML. + final Button show = new Button("Show HTML"); + final Label html = new Label((String) rtarea.getValue()); + show.addListener(new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + html.setValue(rtarea.getValue()); + } + }); + + main.addComponent(rtarea); + main.addComponent(show); + main.addComponent(html); + } } diff --git a/src/com/itmill/toolkit/tests/book/FormExample.java b/src/com/itmill/toolkit/tests/book/FormExample.java index 8b2fe6ef80..f4b4c304b6 100644 --- a/src/com/itmill/toolkit/tests/book/FormExample.java +++ b/src/com/itmill/toolkit/tests/book/FormExample.java @@ -210,13 +210,13 @@ public class FormExample extends CustomComponent { OrderedLayout.ORIENTATION_HORIZONTAL); // The Commit button calls form.commit(). - Button commit = new Button("Commit"); - commit.addListener(new Button.ClickListener() { + Button commit = new Button("Commit", form, "commit"); + /*commit.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { form.setValidationVisible(true); form.commit(); } - }); + });*/ // The Discard button calls form.discard(). Button discard = new Button("Discard", form, "discard");