This was what it took:

PortletDD pdd = PortletContextManager.getManager ().getPortletDescriptor(appName, portletName);

I had to stash the appName and portletName in Sakai data structures so I could regurgitate them at the right time.

It is too bad that I had to go to such effort - in a sense the doRender call does not need as much information:

               portletContainer.doRender(window, req, bufferedResponse);

doRender finds find all the necessary data about this Portlet- it would be nice someday to have the container to be able to hand me back a PortletDD with no more information than that which is present in the doRender.

now perhaps I am complaining about what is *my* responsibility and what is the container's responsibility - but if the container has the right code to resolve form effectively the windowId - then I theoretically should be able to ask for PortletDD knowing just the window id and request(perhaps).

Just thinking out loud.

/Chuck

On Mar 14, 2007, at 10:24 PM, David H. DeWolf wrote:

Try:  PortletContainer.getPortletAppDescriptor(applicationId)



Charles Severance wrote:
I am in my portal and trying to decide whether or not to put out a Help icon and/or an Edit icon. I would like to only do so if the Portlet supports the HELP or Edit modes.
I am in the render code about to call
         portletContainer.doRender(window, req, bufferedResponse);
and have access to all of the following structures:
PortletContainer portletContainer = getPortletContainer(context);
RequiredContainerServices rs = portletContainer.getRequiredContainerServices();
PortalCallbackService pcs = rs.getPortalCallbackService();
PortletURLProvider pup = pcs.getPortletURLProvider(request, window);
pup.setPortletMode(new PortletMode("edit"));
String editUrl = pup.toString();
pup = pcs.getPortletURLProvider(request, window);
pup.setPortletMode(new PortletMode("help"));
String helpUrl = pup.toString();
So I can derive what the right URLs are - but cannot figure out whether I should emit these URLs. I could figure this out if I could get my hands in the InternalPortletWindow or the PortletDD. But it seems that I cannot access these things until the Container has built the PortletRequest structures - at which point it is trivial because I can call isPortletModeAllowed() if I had those structures. It would seem to me that I should be able to lookup a PortletDD somehow...
/Chuck



Reply via email to