[jboss-jira] [JBoss JIRA] Resolved: (JBPORTAL-1316) PortletTagHandler : bug and patch / portlet in layout page

Thomas Heute (JIRA) jira-events at lists.jboss.org
Wed Mar 14 12:21:32 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBPORTAL-1316?page=all ]

Thomas Heute resolved JBPORTAL-1316.
------------------------------------

    Fix Version/s: 2.6.CR1
       Resolution: Done
         Assignee: Thomas Heute  (was: Julien Viet)

I applied your patch, thanks !


> PortletTagHandler : bug and patch / portlet in layout page
> ----------------------------------------------------------
>
>                 Key: JBPORTAL-1316
>                 URL: http://jira.jboss.com/jira/browse/JBPORTAL-1316
>             Project: JBoss Portal
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Portal Theme
>    Affects Versions: 2.6.CR1, 2.4.2 Final
>         Environment: JBPortal 2.4.1
>            Reporter: Antoine Herzog
>         Assigned To: Thomas Heute
>            Priority: Minor
>             Fix For: 2.6.CR1
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> The PortletTagHandler do nothing.
> Can't show a window with this tag in the layout jsp file.
> (the "region" tag works, but this special "portlet" tag to show only one window, without the region relation, does not work).
> the bug : the page.getWindowContext(windowID) needs the window id.
> in the code, it is used with the window Name : page.getWindowContext(windowName)
> todo : rewrite the code so it uses the window ID. 
> The patch : replace the code with the one here under.
> In the doTag() method, from :
>       if (page.getWindowContext(windowName) == null)
>       {
>          log.debug("no such window on this page. Page [" + page.getPageName() + "] Window [" + windowName + "]");
>          return;
>       }
> .../...
> To : the end of the method.
> Working code :
> 		String windowID = null;
> 		// we have the windowName (which is the window name), but we need the
> 		// window id
> 		Map portletContexts = page.getWindowContextMap();
> 		for (Iterator i = portletContexts.keySet().iterator(); i.hasNext();) {
> 			windowID = (String) i.next();
> 			WindowContext portletContext = (WindowContext) portletContexts
> 					.get(windowID);
> 			if (windowName.equals(portletContext.getWindowName())) {
> 				if (log.isDebugEnabled()) {
> 					log.debug("found the portlet to render: " + windowName);
> 				}
> 				break;
> 			}
> 		}
> 		if (windowID == null) {
> 			log
> 					.warn("can't find the window id of the window name on this page. Page ["
> 							+ page.getPageName()
> 							+ "] Window ["
> 							+ windowName
> 							+ "]. This window won't be shown in page.");
> 			return;
> 		}
> 		if (page.getWindowContext(windowID) == null) {
> 			log.warn("no such window on this page. Page [" + page.getPageName()
> 					+ "] Window name [" + windowName + "]" + "] Window Id ["
> 					+ windowID + "]");
> 			return;
> 		}
> 		WindowContext windowContext = page.getWindowContext(windowID);
> 		RenderContext renderContext = (RenderContext) request
> 				.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
> 		renderContext = renderContext.getContext(windowContext);
> 		try {
> 			renderContext.render();
> 			out.write(renderContext.getMarkupFragment().toString());
> 			out.flush();
> 		} catch (RenderException e) {
> 			throw new JspException(e);
> 		}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list