You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Stephan Huber <sh...@ti.com> on 2004/03/25 14:21:56 UTC

Portlet Preferences...

Hi Guys,

I've implemented a portlet to save user-defined bookmarks - in edit mode 
the user can edit and save bookmarks and in view mode all the bookmarks 
are displayed.

A bookmark itself is saved using portlet preferences. When adding new 
bookmarks (preferences) and switching to view mode the bookmarks are not 
at the end of the list - obviously portlet preferences are not saved in 
a specific order, are they?

How can I achieve that preferences are displayed (--> using getNames() 
and getValue()) in the order they are saved?

Best regards

- Stephan


Re: Portlet Preferences...

Posted by Rickard Öberg <ri...@senselogic.se>.
Stephan Huber wrote:
> I've implemented a portlet to save user-defined bookmarks - in edit mode 
> the user can edit and save bookmarks and in view mode all the bookmarks 
> are displayed.
> 
> A bookmark itself is saved using portlet preferences. When adding new 
> bookmarks (preferences) and switching to view mode the bookmarks are not 
> at the end of the list - obviously portlet preferences are not saved in 
> a specific order, are they?
> 
> How can I achieve that preferences are displayed (--> using getNames() 
> and getValue()) in the order they are saved?

There is no order for preferences. You should probably try using only 
two preferences "names" and "links" which map to String-arrays with the 
names and links that you want to use for bookmarks.

IMHO the Portlet Preferences API is incredibly limited. I very much 
prefer the PortletData String->Object mapping that is available in WPS, 
in which case you'd be able to have your bookmark list as a 
LinkedHashMap. We have had to make our own preferences implementation 
which allow preferences of the Object kind to be accessed through 
PortletRequest.getAttribute() in order to be able to make even 
moderately complex portlets work well. I hope this deficiency is fixed 
in the next version of the spec.

/Rickard