summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/ITMILL/themes/tests-magi/layouts/layoutname.html19
-rw-r--r--WebContent/WEB-INF/web.xml30
-rw-r--r--WebContent/embeddingexample.html37
-rw-r--r--WebContent/embeddingiframe.html26
-rw-r--r--src/com/itmill/toolkit/tests/magi/ChatApplication.java68
5 files changed, 179 insertions, 1 deletions
diff --git a/WebContent/ITMILL/themes/tests-magi/layouts/layoutname.html b/WebContent/ITMILL/themes/tests-magi/layouts/layoutname.html
new file mode 100644
index 0000000000..6b75910783
--- /dev/null
+++ b/WebContent/ITMILL/themes/tests-magi/layouts/layoutname.html
@@ -0,0 +1,19 @@
+<table width="100%" height="100%">
+ <tr height="100%">
+ <td>
+ <table align="center">
+ <tr>
+ <td align="right">User&nbsp;name:</td>
+ <td><div location="username"></div></td>
+ </tr>
+ <tr>
+ <td align="right">Password:</td>
+ <td><div location="password"></div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td align="right" colspan="2"><div location="okbutton"></div></td>
+ </tr>
+</table> \ No newline at end of file
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 02817d0816..d3d33ff943 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -365,7 +365,25 @@
<param-value>com.itmill.toolkit.tests.magi.MagiTestApplication</param-value>
</init-param>
</servlet>
-
+
+ <servlet>
+ <servlet-name>WindowTestServlet</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.magi.WindowTestApplication</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ChatServlet</servlet-name>
+ <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
+ <init-param>
+ <param-name>application</param-name>
+ <param-value>com.itmill.toolkit.tests.magi.ChatApplication</param-value>
+ </init-param>
+ </servlet>
+
<servlet>
<servlet-name>BrowserDemo</servlet-name>
<servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>
@@ -563,6 +581,16 @@
<url-pattern>/testbench2/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>WindowTestServlet</servlet-name>
+ <url-pattern>/windowtest/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ChatServlet</servlet-name>
+ <url-pattern>/chat/*</url-pattern>
+ </servlet-mapping>
+
<servlet-mapping>
<servlet-name>BrowserDemo</servlet-name>
<url-pattern>/BrowserDemo/*</url-pattern>
diff --git a/WebContent/embeddingexample.html b/WebContent/embeddingexample.html
new file mode 100644
index 0000000000..35b2ffde52
--- /dev/null
+++ b/WebContent/embeddingexample.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+ <head>
+ <title>Embedding Example</title>
+
+ <!-- Set parameter for the IT Mill Toolkit Client-Side Engine. -->
+ <script type="text/javascript">
+ var itmill = {appUri:'Calc', pathInfo: '/'};
+ </script>
+
+ <!-- Load the IT Mill Toolkit Client-Side Engine. -->
+ <script language='javascript' src='/itmill-toolkit-examples/ITMILL/widgetsets/com.itmill.toolkit.terminal.gwt.DefaultWidgetSet/com.itmill.toolkit.terminal.gwt.DefaultWidgetSet.nocache.js'></script>
+
+ <!-- We can stylize the web application. -->
+ <style>
+ #itmill-ajax-window {background: #c0c0ff;}
+ .i-button {background: pink;}
+ </style>
+ </head>
+
+ <body>
+ <!-- This <iframe> element is required by GWT. -->
+ <iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
+
+ <h1>This is a HTML page</h1>
+ <p>Below is the IT Toolkit Application inside a table:</p>
+ <table align="center" border="3" style="background: yellow;">
+ <tr><th>The Calculator</th></tr>
+ <tr>
+ <td>
+ <!-- Placeholder <div> for the IT Mill Toolkit application -->
+ <div id="itmill-ajax-window"/>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/WebContent/embeddingiframe.html b/WebContent/embeddingiframe.html
new file mode 100644
index 0000000000..026a6d75c2
--- /dev/null
+++ b/WebContent/embeddingiframe.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+ <head>
+ <title>Embedding in IFrame</title>
+ </head>
+
+ <body style="background: #d0ffd0;">
+ <h1>This is a HTML page</h1>
+ <p>Below are two IT Mill Toolkit applications embedded inside a table:</p>
+
+ <table align="center" border="3">
+ <tr>
+ <th>The Calculator</th>
+ <th>The Color Picker</th>
+ </tr>
+ <tr valign="top">
+ <td>
+ <iframe src="/itmill-toolkit-examples/Calc" height="200" width="150" frameborder="0"></iframe>
+ </td>
+ <td>
+ <iframe src="/itmill-toolkit-examples/colorpicker" height="330" width="400" frameborder="0"></iframe>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/src/com/itmill/toolkit/tests/magi/ChatApplication.java b/src/com/itmill/toolkit/tests/magi/ChatApplication.java
new file mode 100644
index 0000000000..ffb9a9d285
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/magi/ChatApplication.java
@@ -0,0 +1,68 @@
+package com.itmill.toolkit.tests.magi;
+
+import java.util.*;
+import com.itmill.toolkit.Application;
+import com.itmill.toolkit.ui.*;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+public class ChatApplication extends Application implements Button.ClickListener {
+ /* ChatApplication instances of different users.
+ * Warning: a hack, not safe, because sessions can expire. */
+ static List users = new ArrayList();
+
+ /* Messages as a shared list. */
+ static List messages = new ArrayList();
+ int localSize = 0;
+
+ /* User interface. */
+ Table messageTable = new Table();
+ TextField username = new TextField("Username:");
+ TextField message = new TextField("Message:");
+
+ public void init() {
+ final Window main = new Window ("Chat");
+ setMainWindow(main);
+ setTheme("tests-magi");
+ users.add(this);
+
+ main.addComponent(username);
+
+ main.addComponent(messageTable);
+ messageTable.addContainerProperty("Sender", String.class, "");
+ messageTable.addContainerProperty("Message", String.class, "");
+ updateTable();
+
+ main.addComponent(message);
+
+ Button send = new Button("Send");
+ send.addListener(this);
+ main.addComponent(send);
+
+ // Poll for new messages once a second.
+ ProgressIndicator poller = new ProgressIndicator();
+ poller.addStyleName("invisible");
+ main.addComponent(poller);
+ }
+
+ public void buttonClick(ClickEvent event) {
+ synchronized(users) {
+ // Create the new message in the shared list.
+ messages.add(new String[]{new String((String) username.getValue()),
+ new String((String) message.getValue())});
+
+ // Update the message tables for all users.
+ for (Iterator i = users.iterator();i.hasNext();)
+ ((ChatApplication)i.next()).updateTable();
+ }
+ }
+
+ void updateTable() {
+ if (localSize == messages.size())
+ return; // No updating needed
+
+ // Add new messages to the table
+ while (localSize < messages.size())
+ messageTable.addItem((Object[])messages.get(localSize++),
+ new Integer(localSize-1));
+ }
+}