As initiated by Julien today via chat, here are some thoughts about how this could be done (credit for the good parts goes to Julien; my ideas are the wacky ones ;)
any portlet can specify a dependency to another portlet via its descriptor (jboss-portal.xml), like so:
| <portlet>
| ....
| <portlet-link>
| <link-name>INeedYou</link-name>
| <portlet-name>Name of the portlet that is linked to as it appears in the portlet.xml</portlet-name>
| <link-type>render|action|event</link-type>
| </portlet-link>
| </portlet>
|
The portlet itself would contain code like:
| Context ctx = new PageContext(); // other contexts or scopes possible here ...?
| try{
| PortletLink link = ctx.lookup("java:comp/portlet/INeedYou");
| link.setParameter("blah", "blahblah");
| html.append(link.toString());
| // and for event links ; only in processAction of the initiating portlet
| if (link instanceof EventLink){
| ((EventLink)link).fire();
| }
| }catch(UnsatisfiedLinkException e){
| // link was not provided, recover somehow
| // provide base functionality without the links and events
| }
|
For this to work, the portal needs to provide a mechanism that 'encourages' the user /admin to provide the resolution for the link when the portlet is being assigned to a page. What seems to make sense is that the tool would list all portlets on the page that this portlet is in the process of being assigned to , and let the user choose which one to link to. A type check would be possible based on the portlet name in the link definition.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884599#3884599
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884599
|