summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/WEB-INF/liferay-display.xml4
-rw-r--r--WebContent/WEB-INF/liferay-portlet.xml16
-rw-r--r--WebContent/WEB-INF/portlet.xml437
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java107
-rw-r--r--src/com/vaadin/terminal/gwt/server/CommunicationManager.java3
-rw-r--r--src/com/vaadin/terminal/gwt/server/WebBrowser.java1
6 files changed, 340 insertions, 228 deletions
diff --git a/WebContent/WEB-INF/liferay-display.xml b/WebContent/WEB-INF/liferay-display.xml
index f5bbc414f2..73e43478ef 100644
--- a/WebContent/WEB-INF/liferay-display.xml
+++ b/WebContent/WEB-INF/liferay-display.xml
@@ -14,6 +14,8 @@
<portlet id="NotificationDemoPortlet" />
<portlet id="ChatServletPortlet" />
<portlet id="BrowserDemoPortlet" />
-
+ <portlet id="HelloWorldPortlet" />
+ <portlet id="AddressBookPortlet" />
+ <portlet id="CalcPortlet"/>
</category>
</display> \ No newline at end of file
diff --git a/WebContent/WEB-INF/liferay-portlet.xml b/WebContent/WEB-INF/liferay-portlet.xml
index 5217414ea7..eecb32eb15 100644
--- a/WebContent/WEB-INF/liferay-portlet.xml
+++ b/WebContent/WEB-INF/liferay-portlet.xml
@@ -57,7 +57,21 @@
<instanceable>true</instanceable>
<ajaxable>false</ajaxable>
</portlet>
-
+ <portlet>
+ <portlet-name>HelloWorldPortlet</portlet-name>
+ <instanceable>true</instanceable>
+ <ajaxable>false</ajaxable>
+ </portlet>
+ <portlet>
+ <portlet-name>AddressBookPortlet</portlet-name>
+ <instanceable>true</instanceable>
+ <ajaxable>false</ajaxable>
+ </portlet>
+ <portlet>
+ <portlet-name>CalcPortlet</portlet-name>
+ <instanceable>true</instanceable>
+ <ajaxable>false</ajaxable>
+ </portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
diff --git a/WebContent/WEB-INF/portlet.xml b/WebContent/WEB-INF/portlet.xml
index 88c3fa9a5b..719560852c 100644
--- a/WebContent/WEB-INF/portlet.xml
+++ b/WebContent/WEB-INF/portlet.xml
@@ -1,185 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
-<portlet-app
- xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
- <portlet>
- <portlet-name>PortletDemoPortlet</portlet-name>
- <display-name>Vaadin PortletDemo</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
- <init-param>
- <name>application</name>
- <value>PortletDemo</value>
- </init-param>
-
- <init-param><name>widgetset</name><value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value></init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
- <portlet-info>
- <title>PortletDemo</title>
- <short-title>PortletDemo</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <portlet-name>SimpleReserverPortlet</portlet-name>
- <display-name>Vaadin SimpleReserver</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
- <init-param>
- <name>application</name>
- <value>SimpleReserver</value>
- </init-param>
- <init-param><name>style</name><value>style=height:400px</value></init-param>
- <init-param><name>widgetset</name><value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value></init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
- <portlet-info>
- <title>SimpleReserver</title>
- <short-title>SimpleReserver</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <portlet-name>FeatureBrowserPortlet</portlet-name>
- <display-name>Vaadin FeatureBrowser</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
- <init-param>
- <name>application</name>
- <value>com.vaadin.tests.featurebrowser.FeaturesApplication</value>
- </init-param>
- <init-param><name>style</name><value>style=height:650px</value></init-param>
- <init-param><name>widgetset</name><value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value></init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
- <portlet-info>
- <title>FeatureBrowser</title>
- <short-title>FeatureBrowser</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <portlet-name>ChatServletPortlet</portlet-name>
- <display-name>Vaadin ChatServlet</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
- <init-param>
- <name>application</name>
- <value>chat</value>
- </init-param>
-
- <init-param><name>widgetset</name><value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value></init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
- <portlet-info>
- <title>ChatServlet</title>
- <short-title>ChatServlet</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
- <portlet>
- <portlet-name>BrowserDemoPortlet</portlet-name>
- <display-name>Vaadin BrowserDemo</display-name>
- <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
- <init-param>
- <name>application</name>
- <value>BrowserDemo</value>
- </init-param>
- <init-param><name>style</name><value>style=height:650px</value></init-param>
- <init-param><name>widgetset</name><value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value></init-param>
- <supports>
- <mime-type>text/html</mime-type>
- <portlet-mode>view</portlet-mode>
- <portlet-mode>edit</portlet-mode>
- <portlet-mode>help</portlet-mode>
- </supports>
- <portlet-info>
- <title>BrowserDemo</title>
- <short-title>BrowserDemo</short-title>
- </portlet-info>
-
- <security-role-ref>
- <role-name>administrator</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>guest</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>power-user</role-name>
- </security-role-ref>
- <security-role-ref>
- <role-name>user</role-name>
- </security-role-ref>
- </portlet>
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
+ <portlet>
+ <portlet-name>PortletDemoPortlet</portlet-name>
+ <display-name>Vaadin PortletDemo</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>com.vaadin.demo.PortletDemo</value>
+ </init-param>
- <!--
- This can be used to work around an issue in liferay 5.0-5.1.1
-
- <container-runtime-option>
- <name>javax.portlet.escapeXml</name>
- <value>false</value>
- </container-runtime-option>
--->
+ <init-param>
+ <name>widgetset</name>
+ <value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>PortletDemo</title>
+ <short-title>PortletDemo</short-title>
+ </portlet-info>
+
+ <security-role-ref>
+ <role-name>administrator</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>guest</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>power-user</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>user</role-name>
+ </security-role-ref>
+ </portlet>
+ <portlet>
+ <portlet-name>SimpleReserverPortlet</portlet-name>
+ <display-name>Vaadin SimpleReserver</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>SimpleReserver</value>
+ </init-param>
+ <init-param>
+ <name>style</name>
+ <value>style=height:400px</value>
+ </init-param>
+ <init-param>
+ <name>widgetset</name>
+ <value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>SimpleReserver</title>
+ <short-title>SimpleReserver</short-title>
+ </portlet-info>
+
+ <security-role-ref>
+ <role-name>administrator</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>guest</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>power-user</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>user</role-name>
+ </security-role-ref>
+ </portlet>
+ <portlet>
+ <portlet-name>FeatureBrowserPortlet</portlet-name>
+ <display-name>Vaadin FeatureBrowser</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>com.vaadin.tests.featurebrowser.FeaturesApplication</value>
+ </init-param>
+ <init-param>
+ <name>style</name>
+ <value>style=height:650px</value>
+ </init-param>
+ <init-param>
+ <name>widgetset</name>
+ <value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>FeatureBrowser</title>
+ <short-title>FeatureBrowser</short-title>
+ </portlet-info>
+
+ <security-role-ref>
+ <role-name>administrator</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>guest</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>power-user</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>user</role-name>
+ </security-role-ref>
+ </portlet>
+ <portlet>
+ <portlet-name>HelloWorldPortlet</portlet-name>
+ <display-name>Hello World</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>com.vaadin.demo.HelloWorld</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>HelloWorld</title>
+ <short-title>HelloWorld</short-title>
+ </portlet-info>
+ </portlet>
+ <portlet>
+ <portlet-name>AddressBookPortlet</portlet-name>
+ <display-name>Address Book</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>com.vaadin.demo.tutorial.addressbook.AddressBookApplication</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Address Book</title>
+ <short-title>Address Book</short-title>
+ </portlet-info>
+ </portlet>
+ <!-- TODO -->
+ <portlet>
+ <portlet-name>CalcPortlet</portlet-name>
+ <display-name>Calc</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>com.vaadin.demo.Calc</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Calc</title>
+ <short-title>Calc</short-title>
+ </portlet-info>
+ </portlet>
+ <portlet>
+ <portlet-name>ChatServletPortlet</portlet-name>
+ <display-name>Vaadin ChatServlet</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>chat</value>
+ </init-param>
+
+ <init-param>
+ <name>widgetset</name>
+ <value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>ChatServlet</title>
+ <short-title>ChatServlet</short-title>
+ </portlet-info>
+
+ <security-role-ref>
+ <role-name>administrator</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>guest</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>power-user</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>user</role-name>
+ </security-role-ref>
+ </portlet>
+ <portlet>
+ <portlet-name>BrowserDemoPortlet</portlet-name>
+ <display-name>Vaadin BrowserDemo</display-name>
+ <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
+ <init-param>
+ <name>application</name>
+ <value>BrowserDemo</value>
+ </init-param>
+ <init-param>
+ <name>style</name>
+ <value>style=height:650px</value>
+ </init-param>
+ <init-param>
+ <name>widgetset</name>
+ <value>com.vaadin.demo.reservation.gwt.ReservationWidgetSet</value>
+ </init-param>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ <portlet-mode>edit</portlet-mode>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>BrowserDemo</title>
+ <short-title>BrowserDemo</short-title>
+ </portlet-info>
+
+ <security-role-ref>
+ <role-name>administrator</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>guest</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>power-user</role-name>
+ </security-role-ref>
+ <security-role-ref>
+ <role-name>user</role-name>
+ </security-role-ref>
+ </portlet>
+
+ <!--
+ This can be used to work around an issue in liferay 5.0-5.1.1
+
+ <container-runtime-option> <name>javax.portlet.escapeXml</name>
+ <value>false</value> </container-runtime-option>
+ -->
</portlet-app> \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
index 5fbd45a9f9..fade97005f 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
@@ -37,24 +37,28 @@ import com.vaadin.ui.Window;
public abstract class AbstractApplicationPortlet extends GenericPortlet {
- public static final String ERROR_NO_WINDOW_FOUND = "No window found. Did you remember to setMainWindow()?";
+ private static final String ERROR_NO_WINDOW_FOUND = "No window found. Did you remember to setMainWindow()?";
- public static final String THEME_DIRECTORY_PATH = "VAADIN/themes/";
+ private static final String THEME_DIRECTORY_PATH = "VAADIN/themes/";
- public static final String WIDGETSET_DIRECTORY_PATH = "VAADIN/widgetsets/";
+ private static final String WIDGETSET_DIRECTORY_PATH = "VAADIN/widgetsets/";
- public static final String DEFAULT_WIDGETSET = "com.vaadin.terminal.gwt.DefaultWidgetSet";
+ private static final String DEFAULT_WIDGETSET = "com.vaadin.terminal.gwt.DefaultWidgetSet";
- public static final String URL_PARAMETER_REPAINT_ALL = "repaintAll";
+ private static final String DEFAULT_THEME_NAME = "reindeer";
+
+ private static final String URL_PARAMETER_REPAINT_ALL = "repaintAll";
- public static final String URL_PARAMETER_RESTART_APPLICATION = "restartApplication";
+ private static final String URL_PARAMETER_RESTART_APPLICATION = "restartApplication";
- public static final String URL_PARAMETER_CLOSE_APPLICATION = "closeApplication";
+ private static final String URL_PARAMETER_CLOSE_APPLICATION = "closeApplication";
- public static final int DEFAULT_BUFFER_SIZE = 32 * 1024;
+ private static final int DEFAULT_BUFFER_SIZE = 32 * 1024;
// TODO Close application when portlet window is closed
+ // TODO What happens when the portlet window is resized?
+
private Properties applicationProperties;
@Override
@@ -110,14 +114,15 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
private boolean isStaticResourceRequest(ResourceRequest request) {
String resourceID = request.getResourceID();
- if (resourceID != null && resourceID.startsWith("/VAADIN/")) {
+ if (resourceID != null && !resourceID.startsWith("/VAADIN/")) {
return true;
}
return false;
}
private boolean isUIDLRequest(ResourceRequest request) {
- return request.getResourceID().equals("UIDL");
+ return request.getResourceID() != null
+ && request.getResourceID().equals("UIDL");
}
private boolean isFileUploadRequest(ActionRequest request) {
@@ -126,7 +131,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
protected void handleRequest(PortletRequest request,
PortletResponse response) throws PortletException, IOException {
- System.out.println("AbstractApplicationPortlet.handleRequest()");
+ System.out.println("AbstractApplicationPortlet.handleRequest() " + System.currentTimeMillis());
RequestType requestType = getRequestType(request);
@@ -233,39 +238,34 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
}
}
- // TODO Vaadin resources cannot be loaded, try to load other resources using the portlet context
- @Deprecated
+ // TODO Vaadin resources cannot be loaded, try to load other resources using
+ // the portlet context
+
private void serveStaticResources(ResourceRequest request,
ResourceResponse response) throws IOException, PortletException {
- // Currently, we can only provide VAADIN content
final String resourceID = request.getResourceID();
- if (resourceID.startsWith("/VAADIN/")) {
- // Strip leading "/"
- // final String filename = resourceID.substri
- final PortletContext pc = getPortletContext();
-
- System.out.println("Trying to load resource [" + resourceID + "]");
-
- InputStream is = pc.getResourceAsStream(resourceID);
- if (is != null) {
- final String mimetype = pc.getMimeType(resourceID);
- if (mimetype != null) {
- response.setContentType(mimetype);
- }
- final OutputStream os = response.getPortletOutputStream();
- final byte buffer[] = new byte[DEFAULT_BUFFER_SIZE];
- int bytes;
- while ((bytes = is.read(buffer)) >= 0) {
- os.write(buffer, 0, bytes);
- }
- return;
- }
- }
+ final PortletContext pc = getPortletContext();
+
+ System.out.println("Trying to load resource [" + resourceID + "]");
+ InputStream is = pc.getResourceAsStream(resourceID);
+ if (is != null) {
+ final String mimetype = pc.getMimeType(resourceID);
+ if (mimetype != null) {
+ response.setContentType(mimetype);
+ }
+ final OutputStream os = response.getPortletOutputStream();
+ final byte buffer[] = new byte[DEFAULT_BUFFER_SIZE];
+ int bytes;
+ while ((bytes = is.read(buffer)) >= 0) {
+ os.write(buffer, 0, bytes);
+ }
+ } else {
System.err.println("Requested resource [" + resourceID
+ "] could not be found");
response.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer
.toString(HttpServletResponse.SC_NOT_FOUND));
+ }
}
@Override
@@ -435,11 +435,13 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
response.getPortletOutputStream(), "UTF-8"));
;
- // TODO Make the widgetset URL creation more configurable
+ // TODO The widgetset URL is currently hard-corded for LifeRay
- String widgetsetURL = "/html/VAADIN/widgetsets/" + DEFAULT_WIDGETSET
+ String widgetsetURL = "/html/" + WIDGETSET_DIRECTORY_PATH + DEFAULT_WIDGETSET
+ "/" + DEFAULT_WIDGETSET + ".nocache.js?"
+ new Date().getTime();
+
+ String themeURI = "/html/" + THEME_DIRECTORY_PATH + DEFAULT_THEME_NAME;
page.write("<script type=\"text/javascript\">\n");
page.write("if(!vaadin || !vaadin.vaadinConfigurations) {\n "
@@ -466,10 +468,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
page.write("portletUidlURLBase: '" + uidlUrlBase.toString() + "', ");
page.write("pathInfo: '', ");
- page.write("themeUri:");
- // page.write(themeUri != null ? "'" + themeUri + "'" : "null");
- page.write("null"); // TODO Fix this
- page.write(", versionInfo : {vaadinVersion:\"");
+ page.write("themeUri: '" + themeURI + "', ");
+ page.write("versionInfo : {vaadinVersion:\"");
// page.write(VERSION);
page.write("UNVERSIONED"); // TODO Fix this
page.write("\",applicationVersion:\"");
@@ -477,7 +477,26 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
page.write("\"},");
// TODO Add system messages
page.write("};\n</script>\n");
- // TODO Add custom theme
+
+ //if (themeName != null) {
+ // Custom theme's stylesheet, load only once, in different
+ // script
+ // tag to be dominate styles injected by widget
+ // set
+ page.write("<script type=\"text/javascript\">\n");
+ page.write("//<![CDATA[\n");
+ page.write("if(!vaadin.themesLoaded['" + DEFAULT_THEME_NAME + "']) {\n");
+ page.write("var stylesheet = document.createElement('link');\n");
+ page.write("stylesheet.setAttribute('rel', 'stylesheet');\n");
+ page.write("stylesheet.setAttribute('type', 'text/css');\n");
+ page.write("stylesheet.setAttribute('href', '" + themeURI
+ + "/styles.css');\n");
+ page
+ .write("document.getElementsByTagName('head')[0].appendChild(stylesheet);\n");
+ page.write("vaadin.themesLoaded['" + DEFAULT_THEME_NAME + "'] = true;\n}\n");
+ page.write("//]]>\n</script>\n");
+ //}
+
// TODO Warn if widgetset has not been loaded after 15 seconds
/*- Add classnames;
@@ -496,7 +515,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet {
}
// TODO Add support for flexible theme names
String themeClass = "v-theme-"
- + "reindeer".replaceAll("[^a-zA-Z0-9]", "");
+ + DEFAULT_THEME_NAME.replaceAll("[^a-zA-Z0-9]", "");
String classNames = "v-app v-app-loading " + themeClass + " "
+ appClass;
diff --git a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java
index 07bbac7922..dd7de4b2b7 100644
--- a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java
@@ -79,6 +79,9 @@ import com.vaadin.ui.Upload.UploadException;
@SuppressWarnings("serial")
public class CommunicationManager implements Paintable.RepaintRequestListener,
Serializable {
+
+ // FIXME Create an abstract class with custom Request/Response/Session interfaces, then create
+ // subclasses for servlets and portlets.
private static String GET_PARAM_REPAINT_ALL = "repaintAll";
diff --git a/src/com/vaadin/terminal/gwt/server/WebBrowser.java b/src/com/vaadin/terminal/gwt/server/WebBrowser.java
index f7bba2f3ec..09d34c30b5 100644
--- a/src/com/vaadin/terminal/gwt/server/WebBrowser.java
+++ b/src/com/vaadin/terminal/gwt/server/WebBrowser.java
@@ -77,6 +77,7 @@ public class WebBrowser implements Terminal {
}
}
+ // TODO: This method depends on the Portlet API.
void updateBrowserProperties(PortletRequest request) {
locale = request.getLocale();
address = null;