3 Replies Latest reply on Mar 19, 2007 5:02 AM by Thomas Heute

    Layout : show a single window without the region / bug and p

    Antoine Herzog Master

      For the layout, the "portlet" tag (PortletTagHandler) do nothing.

      So we can't show a single 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 "belong to this region", 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.

      see the JIRA for the patch of code.

      Workaround before the bug is corrected in the next release :
      put the tag class and a copy of the tld file in the war and use this copy of the tag instead of original one.

        • 1. Re: Layout : show single window without region / bug and pat
          Antoine Herzog Master

          The JIRA is :
          http://jira.jboss.com/jira/browse/JBPORTAL-1316

          the patch code is :

           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);
           }
          

          (more readable than in the JIRA without code format).

          To replace in the PortletTagHandler class 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.

          • 2. Re: Layout : show a single window without the region / bug a
            Antoine Herzog Master

            a better patch is in the Jira.
            avoid to have another window come in the page if the window was not declared in the page.