I have started the work on that.
One neat advantage is the cms window declaration now looks like :
| <window>
| <window-name>CMSWindow</window-name>
| <content-type>cms</content-type>
| <region>center</region>
| <height>0</height>
| <uri>/default/index.html</uri>
| </window>
|
My first idea on the implementation was to introduce sub interfaces like
| interface PortletWindow extends Window { ... }
|
But it turns out that it does not cope well with hibernate system and does not allow
plugability of content very well. Also one of my initial idea is to leverage the generic
portal object properties to store the window content type (portlet or cms for now).
So finally I chosed to delegate content handling to a WindowContent interface which has
sub interfaces.
| public interface Window extends PortalObject
| {
| ContentType getContentType();
| WindowContent getContent();
| }
|
| public interface WindowContent
| {
| }
|
| public interface PortletContent extends WindowContent
| {
| String getInstanceRef();
| void setInstanceRef(String instanceRef);
| }
|
| public interface CMSContent extends WindowContent
| {
| String getURI();
| void setURI(String uri);
| }
|
The plug is done in the impl package which supports content handler that are responsible
to create the WindowContent interfaces. The portal object container uses that to create
the right WindowContent impl when it retrieves objects from the database.
At runtime now, I have extended the RenderWindowCommand in order to handle the different
content types differently.
The portlet one, is mostly like the current one. The cms one extends the portlet one and
changes several things :
1/ always retrieve the CMSPortletInstance instance
| InstanceContainer container =
getControllerContext().getController().getInstanceContainer();
| return container.getDefinition("CMSPortletInstance");
|
2/ if no navigational state exists, create it and initialize it with the URI provided by
the CMSContent interface
| //
| CMSContent content = (CMSContent)window.getContent();
| String uri = content.getURI();
|
| // Initialize the navigational state with the URI when needed
| PortletParametersStateString navigationalState =
(PortletParametersStateString)getAttribute(NAVIGATIONAL_STATE_SCOPE, windowId);
| if (navigationalState == null)
| {
| navigationalState = new PortletParametersStateString();
| navigationalState.setValue("path", uri);
| setAttribute(NAVIGATIONAL_STATE_SCOPE, windowId, navigationalState);
| }
|
3/ modify the results in order to add the properties that force no decoration of the
window
| if (o instanceof WindowResult)
| {
| WindowResult result = (WindowResult)o;
|
| //
| Map props = new HashMap(result.getWindowProperties());
| props.put("theme.windowRendererId", "emptyRenderer");
| props.put("theme.decorationRendererId",
"emptyRenderer");
| props.put("theme.portletRendererId", "emptyRenderer");
|
| //
| result.setWindowProperties(props);
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000678#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...