Hi Jacek,
On 9/12/06, Jacek Wiślicki <[EMAIL PROTECTED]> wrote:
Wiadomosc od Edgar Poce z 2006-09-12 17:58 brzmiala:
> Sorry I wasn't clear, let me try again :). I'd like the portlet to
> know the path where it's deployed in the portal site hierarchy. The
> above method should return the path to the fragment of type portlet
> where the portlet was added. E.g. if I deploy a wysiwyg portlet at
> /default.psml I'd like to get the path to the fragment of type portlet
> where the portlet is shown. Something like "/default.psml/twocolumns
> fragment-id1/portlet fragment-id12/".
Start with PageManager. It can retrieve a node corresponding to any page
by its path:
Page page pageManager.getPage(path);
My main problem is how to get the path from a PortletRequest, see the
method in my first post. Once I get that path to the *fragment* of
type portlet the snippet bellow will surely help me.
thanks,
edgar
A Page object can retrieve its root fragment with:
Fragment = page.getRootFragment();
Once you have a fragment (e.g. the root one), you can get all its
children with the following method:
protected List listFragments(Fragment rootFragment, String type, List
list)
{
List fragments = rootFragment.getFragments();
for(Iterator iterator = fragments.iterator();
iterator.hasNext();)
{
Fragment fragment = (Fragment)iterator.next();
if(fragment.getType().equals(type))
list.add(fragment);
listFragments(fragment, type, list);
}
return list;
}
The method retrieves recursively all the subfragments of a give type
(i.e. Fragment.PORTLET, Fragment.LAYOUT). I hope this example helps you.
--
pozdrawiam,
Jacek Wislicki
[EMAIL PROTECTED]
http://www.nauka-biznes.org.pl/jetspeed/portal/
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]