portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Golden <ggol...@umich.edu>
Subject [PATCH] org.apache.jetspeed.portal.BasePortletSet.sortPortletSet( )
Date Wed, 03 Apr 2002 15:51:19 GMT
I hate sorting.  So apparently does the BasePortletSet's sortPortletSet().
In short, it does not sort the portlets properly by the layout position.
You can see this by comparing the order of the tabs or menus with the
position of the panes listed in the customizer.  If the order from the psml
file does not match the layout positions, you will see a difference.
RowColumnControllerAction takes care of the customizer's sorting, and does
it properly.  BasePortleSet takes care of sorting the portlets for the
normal display, and does not.
The method of walking the elements of a vector by position, and modifying
the vector by moving elements into different positions as you go is not a
good one.  In my test case, the very first element [0] had a layout of "1".
So it was removed from the vector (sliding all else down) and inserted at
position #1.  Note that the [1] element before is now the [0] element.
The next time through the loop, we look at the vector at [1].  Oops, we
forget to look at the portlet now sitting at [0]!  Again we look at that
previously first portlet, which is now happy at [1], and go on.
Instead of modifying a vector / list in place, RowColumnControllerAction
builds up a new one, looking at each portlet's layout position as the index
into the new list.  Those without layout values are placed, in order of
finding them, into the list in the holes or at the end.
I've fixed BasePortletSet to do the same.
David - could you apply this patch?
- Glenn 
Glenn R. Golden, Systems Research Programmer
University of Michigan School of Information
ggolden@umich.edu <mailto:ggolden@umich.edu>                734-615-1419


View raw message