From b1ea681c2c749fcddbf310b4c06706d4f1006c37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marko=20Gr=C3=B6nroos?= Date: Tue, 15 Jul 2008 16:27:49 +0000 Subject: [PATCH] Updated book tests: Tables, notifications, printing. svn changeset:5106/svn branch:trunk --- .../themes/tests-book/layouts/printpage.html | 5 ++ .../ITMILL/themes/tests-book/styles.css | 10 +++- .../tests/book/BookTestApplication.java | 49 ++++++++++++++++++- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 WebContent/ITMILL/themes/tests-book/layouts/printpage.html diff --git a/WebContent/ITMILL/themes/tests-book/layouts/printpage.html b/WebContent/ITMILL/themes/tests-book/layouts/printpage.html new file mode 100644 index 0000000000..2e65addcd8 --- /dev/null +++ b/WebContent/ITMILL/themes/tests-book/layouts/printpage.html @@ -0,0 +1,5 @@ +
Here is some static content.
+ + diff --git a/WebContent/ITMILL/themes/tests-book/styles.css b/WebContent/ITMILL/themes/tests-book/styles.css index 0354677361..3ad4e4a8ff 100644 --- a/WebContent/ITMILL/themes/tests-book/styles.css +++ b/WebContent/ITMILL/themes/tests-book/styles.css @@ -9,7 +9,15 @@ } /*****************************************************************************/ -/* For example_Tree() */ +/* For example_Table() */ +/*****************************************************************************/ +/* Table rows contain three-row TextField components. */ +.i-table-components-inside .i-table-cell-content { + height: 54px; /* 3*18px = 54px. */ +} + +/*****************************************************************************/ +/* For example_Tree() */ /*****************************************************************************/ .i-expandlayout-treeexample .i-panel .i-orderedlayout { diff --git a/src/com/itmill/toolkit/tests/book/BookTestApplication.java b/src/com/itmill/toolkit/tests/book/BookTestApplication.java index e4a48fc4ca..8939f62d35 100644 --- a/src/com/itmill/toolkit/tests/book/BookTestApplication.java +++ b/src/com/itmill/toolkit/tests/book/BookTestApplication.java @@ -56,6 +56,7 @@ import com.itmill.toolkit.ui.TextField; import com.itmill.toolkit.ui.Tree; import com.itmill.toolkit.ui.Window; import com.itmill.toolkit.ui.Button.ClickEvent; +import com.itmill.toolkit.ui.Window.Notification; public class BookTestApplication extends com.itmill.toolkit.Application { Window main = new Window("Application window"); @@ -139,7 +140,7 @@ public class BookTestApplication extends com.itmill.toolkit.Application { "window/multiple", "classresource", "usererror", "progress/window", "progress/thread", "progress", "customlayout", "spacing", "margin", "clientinfo", - "fillinform/templates"}; + "fillinform/templates", "notification", "print"}; for (int i = 0; i < examples.length; i++) { main.addComponent(new Label("" + examples[i] + "", @@ -214,6 +215,10 @@ public class BookTestApplication extends com.itmill.toolkit.Application { example_ClientInfo(main, param); } else if (example.equals("fillinform")) { example_FillInForm(main, param); + } else if (example.equals("notification")) { + example_Notification(main, param); + } else if (example.equals("print")) { + example_Print(main, param); } else { ; // main.addComponent(new Label("Unknown test '"+example+"'.")); } @@ -1331,4 +1336,46 @@ public class BookTestApplication extends com.itmill.toolkit.Application { } } } + + void example_Notification(final Window main, String param) { + final Window sub1 = new Window(""); + main.addWindow(sub1); + + sub1.showNotification("The default notification"); + + //Notification notif = new Notification("Title"); + } + + void example_Print(final Window main, String param) { + if (param != null && param.equals("simple")) { + main.addComponent(new Label("", Label.CONTENT_XHTML)); + return; + } + + // A button to open the printer-friendly page. + Button printButton = new Button("Click to Print"); + main.addComponent(printButton); + printButton.addListener(new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + // Create a window that contains stuff you want to print. + Window printWindow = new Window("Window to Print"); + + // Have some content to print. + printWindow.addComponent(new Label("Here's some dynamic content.")); + + // To execute the print() JavaScript, we need to run it + // from a custom layout. + CustomLayout scriptLayout = new CustomLayout("printpage"); + printWindow.addComponent (scriptLayout); + + // Add the printing window as an application-level window. + main.getApplication().addWindow(printWindow); + + // Open the printing window as a new browser window + main.open(new ExternalResource(printWindow.getURL()), "_new"); + } + }); + + //main.addComponent(new Label("

Print this!

\n", Label.CONTENT_XHTML)); + } } -- 2.39.5