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

Antoine Herzog (JIRA) jira-events at lists.jboss.org
Sun Mar 11 19:58:46 EDT 2007


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.4.1 Final
         Environment: JBPortal 2.4.1
            Reporter: Antoine Herzog
         Assigned To: Julien Viet
            Priority: Minor


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