]> source.dussan.org Git - vaadin-framework.git/commitdiff
Updated book tests: RichTestArea, Forms.
authorMarko Grönroos <magi@iki.fi>
Tue, 22 Jul 2008 08:33:43 +0000 (08:33 +0000)
committerMarko Grönroos <magi@iki.fi>
Tue, 22 Jul 2008 08:33:43 +0000 (08:33 +0000)
svn changeset:5111/svn branch:trunk

WebContent/ITMILL/themes/tests-book/styles.css
src/com/itmill/toolkit/tests/book/BookTestApplication.java
src/com/itmill/toolkit/tests/book/FormExample.java

index 3ad4e4a8ff3e1c06081937ef8181ca9b69c44cae..c33cbb36f36a656379729ff2f3b65ec643b75274 100644 (file)
@@ -8,6 +8,15 @@
        background: white;
 }
 
+/*****************************************************************************/
+/* For example_Forms()                                                       */
+/*****************************************************************************/
+.i-form {
+    border: thin solid;
+    padding: 5px 5px 5px 5px;
+}
+
+
 /*****************************************************************************/
 /* For example_Table()                                                       */
 /*****************************************************************************/
index 8939f62d357455e9c206311edd1ad41a938ca9d8..eb4b708acddb852c81de4fde2d942e355cad2997 100644 (file)
@@ -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("<a href='" + context.toString() +
                             examples[i] + "'>" + examples[i] + "</a>",
@@ -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("<p>Print this!</p>\n<script type='text/javascript'>print();</script>", 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("<h1>Hello</h1>\n<p>This contains some text.</p>");
+        
+        // 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);
+    }
 }
index 8b2fe6ef80f60407437dba920ed16e243aee5ec6..f4b4c304b6221223b3bcc29686840cc9108c2a8f 100644 (file)
@@ -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");