raphael 01/08/14 04:27:15
Modified: src/java/org/apache/jetspeed/services/portaltoolkit
JetspeedPortalToolkitService.java
Log:
[fix] fix portlets tree numbering scheme to avoid duplicate numbers
when using nested panes
Revision Changes Path
1.7 +27 -6
jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java
Index: JetspeedPortalToolkitService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/portaltoolkit/JetspeedPortalToolkitService.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JetspeedPortalToolkitService.java 2001/07/29 13:41:59 1.6
+++ JetspeedPortalToolkitService.java 2001/08/14 11:27:15 1.7
@@ -81,7 +81,7 @@
* Simple implementation of the PortalFactoryService.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: JetspeedPortalToolkitService.java,v 1.6 2001/07/29 13:41:59
raphael Exp $
+ * @version $Id: JetspeedPortalToolkitService.java,v 1.7 2001/08/14 11:27:15
raphael Exp $
*/
public class JetspeedPortalToolkitService extends TurbineBaseService
implements PortalToolkitService
@@ -352,7 +352,7 @@
*/
public PortletSet getSet( Portlets portlets )
{
- return getSet( portlets, 0 );
+ return getSet( portlets, new VariableInteger(0) );
}
/**
@@ -363,15 +363,15 @@
* @param count the portletset number within the complete tree
* @return a new instance of PortletSet
*/
- protected PortletSet getSet( Portlets portlets, int count)
+ protected PortletSet getSet( Portlets portlets, VariableInteger theCount)
{
// Create a new BasePortletSet to handle the portlets
BasePortletSet set = new BasePortletSet();
PortletController controller = getController( portlets.getController() );
set.setController( controller );
- set.setName(String.valueOf(count));
+ set.setName(String.valueOf(theCount.getValue()));
- count++;
+ theCount.setValue(theCount.getValue()+1);
//FIXME: this sucks ! we should either associate the portlet set
//with its portlets peer or set the porpoerties directly on the portlet
@@ -385,7 +385,7 @@
{
Map constraints = getParameters(subsets[i].getLayout());
int position = getPosition( subsets[i].getLayout() );
- set.addPortlet( getSet( subsets[i], count + i ),
+ set.addPortlet( getSet( subsets[i], theCount ),
controller.getConstraints(constraints),
position );
}
@@ -479,6 +479,8 @@
{
PortletConfig pc = new BasePortletConfig();
+
+ pc.setId(portlets.getId());
pc.setName( portlets.getName() );
pc.setInitParameters( getParameters( portlets ) );
@@ -663,5 +665,24 @@
return pos;
}
+ protected static class VariableInteger
+ {
+ int value;
+
+ public VariableInteger(int value)
+ {
+ this.value = value;
+ }
+
+ public int getValue()
+ {
+ return this.value;
+ }
+
+ public void setValue(int value)
+ {
+ this.value=value;
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]