WebSphere Portal Server - Can I get the page layout model in the portlet? Side-by-side or single page (under eac

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > January 2006 > Can I get the page layout model in the portlet? Side-by-side or single page (under eac





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Can I get the page layout model in the portlet? Side-by-side or single page (under eac

2006-01-23, 7:53 am

Hi!
Is there any way to get the layout mode of the page in WPS 5.1?
I don't mean in the theme but in the portlet. I would like to change the layout if the portlet is side-by-side with another portlet or if the portlet is under another portlet.

As you know there are different strategies when placing portlets in a page. One of the is "single page" and another is two columns. Is there a way to - from a portlet (IBM) - get the layout mode of the page that is invoking the portlet?

Any clues? It feels like kind of off-pist!

Thanks!
Karin
Dennis te Lintelo

2006-01-29, 9:46 pm

Karin,

There is a way to get the layout mode of a portal page. I once did some testing with the code below which gives you the ContentNode of the portal:

InitialContext ctx = new InitialContext();
ContentModelHome cmHome =
(ContentModelHome)ctx.lookup("portal:service/model/ContentModel");
ContentModelProvider cmProvider = cmHome.getContentModelProvicer();
ContentModel cModel = cmProvider. getContentModel((ServletRequest)request,
(SerlvetResponse)response);
ContentNode root = (ContentNode)cModel.getRoot();

From the root you can iterate through the children and check if the node is:
- a ContentNode
- a Container
- a Control

You should be able to get the layout of the page from either the Container or the Control (not certain which one it was...)

Have fun!
Dennis




2006-01-29, 9:46 pm

Thanks Dennis!
I also found this content model and I'm trying to use the Layout Model for the page. Hopefully it will work. Or I'll add some configuration to my portlet.
If I use the SPI it will require 5.1.0.1 and I'm not sure if I should go down that road just yet.

Here is a link to the Info Center for the SPI Model:

http://publib.boulder.ibm.com/infoc...n_modelxmp.html

Regards
Karin
Dennis te Lintelo

2006-01-29, 9:47 pm

Karin,

Be also aware of the fact that I found it to be rather slow...This could be because I started from the portal root, but keep it in mind.

If you do have a piece of code which only takes care of the current page, I am very interested...:-)...

Thanks,
Dennis
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com