From bf15697851e95ca9fe5c20f7c304b851af7801a4 Mon Sep 17 00:00:00 2001 From: Jonatan Kronqvist Date: Tue, 18 Jan 2011 12:05:32 +0000 Subject: Cleaned up the fix for #5912 svn changeset:16923/svn branch:6.5 --- .../gwt/server/AbstractApplicationPortlet.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index 8e586f5ee5..4f93afff56 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -805,7 +805,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet Application newApplication = getNewApplication(request); final PortletApplicationContext2 context = PortletApplicationContext2 .getApplicationContext(request.getPortletSession()); - context.addApplication(newApplication, getDecoratedWindowID(request)); + context.addApplication(newApplication, request.getWindowID()); return newApplication; } @@ -822,8 +822,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet PortletApplicationContext2 context = PortletApplicationContext2 .getApplicationContext(session); - Application application = context - .getApplicationForWindowId(getDecoratedWindowID(request)); + Application application = context.getApplicationForWindowId(request + .getWindowID()); if (application == null) { return null; } @@ -936,12 +936,21 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet } writeAjaxPageHtmlMainDiv(request, response, page, - getDecoratedWindowID(request), classNames, divStyle); + getApplicationDomId(request), classNames, divStyle); page.close(); } - private String getDecoratedWindowID(PortletRequest request) { + /** + * Creates and returns a unique ID for the DIV where the application is to + * be rendered. We need to generate a unique ID because some portals already + * create a DIV with the portlet's Window ID as the DOM ID. + * + * @param request + * PortletRequest + * @return the id to use in the DOM + */ + private String getApplicationDomId(PortletRequest request) { return "v-" + request.getWindowID(); } @@ -1137,7 +1146,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet Map config) throws IOException, PortletException { writer.write("vaadin.vaadinConfigurations[\"" - + getDecoratedWindowID(request) + "\"] = {"); + + getApplicationDomId(request) + "\"] = {"); Iterator keyIt = config.keySet().iterator(); while (keyIt.hasNext()) { -- cgit v1.2.3