morciuch 2003/02/08 12:58:58
Modified: docs/site changes.html
src/java/org/apache/jetspeed/modules/actions/controllers
RowColumnControllerAction.java
xdocs changes.xml
Log:
Fixed pane ordering bug in the customizer (see Bugzilla bug# 16819)
Revision Changes Path
1.105 +3 -0 jakarta-jetspeed/docs/site/changes.html
Index: changes.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- changes.html 6 Feb 2003 16:14:26 -0000 1.104
+++ changes.html 8 Feb 2003 20:58:57 -0000 1.105
@@ -133,6 +133,9 @@
</li>
-->
<li>
+ Fixed - Bug # 16819 - 2003/02/08 - Fixed pane ordering bug in the customizer (MO)
+</li>
+<li>
Fixed - Bug # 16443 - 2003/02/05 - Reimplemented setTemplate method in
JspPortletAction to utilize session (MO)
</li>
<li>
1.17 +62 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java
Index: RowColumnControllerAction.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- RowColumnControllerAction.java 8 Nov 2002 23:13:44 -0000 1.16
+++ RowColumnControllerAction.java 8 Feb 2003 20:58:57 -0000 1.17
@@ -95,6 +95,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
+import java.util.Comparator;
/**
* This action builds a context suitable for controllers handlings simple
@@ -166,13 +167,32 @@
for (int i=0; i < portlets.getPortletsCount(); i++)
{
Portlets p = portlets.getPortlets(i);
+ if (Log.getLogger().isDebugEnabled())
+ {
+ Log.debug("RowColumnControllerAction: processing portlet: " +
p.getTitle());
+ }
Layout layout = p.getLayout();
+ if (layout == null)
+ {
+ // Pane should always have a layout with correct position
+ if (Log.getLogger().isDebugEnabled())
+ {
+ Log.debug("RowColumnControllerAction: no layout, creating a new
one");
+ }
+ layout = new PsmlLayout();
+ layout.setPosition(i);
+ p.setLayout(layout);
+ }
if (layout!=null)
{
try
{
int pos = (int)layout.getPosition();
- if (pos>=0)
+ if (Log.getLogger().isDebugEnabled())
+ {
+ Log.debug("RowColumnControllerAction: layout has position:
" + pos);
+ }
+ if (pos >= 0 && pos < plist.size())
{
plist.set(pos,p);
}
@@ -183,6 +203,7 @@
}
catch (Exception e)
{
+ Log.error(e.toString());
layout.setPosition(-1);
work.add(p);
}
@@ -386,6 +407,8 @@
{
set.removePortlets(i);
+ updateLayoutPositions(set);
+
// MODIFIED: Save changes for wml profiles
//if (isWML)
// doSave(data, null);
@@ -441,6 +464,44 @@
}
+ }
+
+ /**
+ * Updates the layout position based on physical order within the resorted
portlet list. Assures that
+ * layout position is always consecutive and within bounds.
+ *
+ * @param set
+ */
+ private void updateLayoutPositions(Portlets set)
+ {
+ // Load the panes into a list
+ List list = new ArrayList();
+ for(int i = 0; i < set.getPortletsCount(); i++)
+ {
+ Portlets pane = set.getPortlets(i);
+ list.add(pane);
+ }
+
+ // Sort list using the current layout position
+ Collections.sort(list,
+ new Comparator()
+ {
+ public int compare(Object pane1, Object pane2)
+ {
+ Long pos1 = new Long(((Portlets)
pane1).getLayout().getPosition());
+ Long pos2 = new Long(((Portlets)
pane2).getLayout().getPosition());
+ return pos1.compareTo(pos2);
+ }
+ });
+
+ // Update the layout position based on the physical order within the sorted
list
+ int position = 0;
+ for (Iterator iter = list.iterator(); iter.hasNext();)
+ {
+ Portlets pane = (Portlets) iter.next();
+ Layout layout = pane.getLayout();
+ layout.setPosition(position++);
+ }
}
/** Move a component up within the pane
1.122 +4 -1 jakarta-jetspeed/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- changes.xml 6 Feb 2003 16:14:28 -0000 1.121
+++ changes.xml 8 Feb 2003 20:58:58 -0000 1.122
@@ -23,6 +23,9 @@
</li>
-->
<li>
+ Fixed - Bug # 16819 - 2003/02/08 - Fixed pane ordering bug in the customizer (MO)
+</li>
+<li>
Fixed - Bug # 16443 - 2003/02/05 - Reimplemented setTemplate method in
JspPortletAction to utilize session (MO)
</li>
<li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]