paulsp 02/03/12 21:41:16
Modified: src/java/org/apache/jetspeed/modules/actions/controls
Close.java Customize.java Maximize.java
Minimize.java Restore.java
src/java/org/apache/jetspeed/modules/actions/portlets
CustomizeSetAction.java
src/java/org/apache/jetspeed/om/profile
BasePSMLDocument.java PSMLDocument.java
src/java/org/apache/jetspeed/portal/controls
VelocityPortletControl.java
src/java/org/apache/jetspeed/portal/portlets
VelocityPortlet.java
src/java/org/apache/jetspeed/services/portaltoolkit
JetspeedPortalToolkitService.java
src/java/org/apache/jetspeed/services/rundata
DefaultJetspeedRunData.java JetspeedRunData.java
src/java/org/apache/jetspeed/util/template JetspeedTool.java
webapp/WEB-INF/psml/user/turbine/html default.psml
webapp/WEB-INF/templates/vm/screens/html Maximize.vm
Log:
Implement PEID support for action buttons
Revision Changes Path
1.6 +13 -39
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Close.java
Index: Close.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Close.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Close.java 18 Jan 2002 12:39:43 -0000 1.5
+++ Close.java 13 Mar 2002 05:41:15 -0000 1.6
@@ -60,65 +60,39 @@
import org.apache.turbine.util.Log;
// Jetspeed stuff
-import org.apache.jetspeed.portal.Portlet;
-import org.apache.jetspeed.portal.PortletState;
-import org.apache.jetspeed.services.PortletFactory;
-import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
-import org.apache.jetspeed.xml.api.portletmarkup.Portlets;
/**
* Change the internal state of a portlet from normal to closed
*
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
*/
public class Close extends Action
{
+ /**
+ * @param rundata The RunData object for the current request
+ */
public void doPerform( RunData rundata ) throws Exception
{
+
+ // Only logged in users can minmize
if( rundata.getUser() == null || !rundata.getUser().hasLoggedIn() )
{
return;
}
- JetspeedRunData jdata = (JetspeedRunData)rundata;
-
- String name = jdata.getPortlet();
- if ( name == null )
+ // Get jsp_peid parmameter. If it does not exist, then do nothing
+ String peid = rundata.getParameters().getString("js_peid");
+ if ( peid == null )
{
return;
}
+
+ JetspeedRunData jdata = (JetspeedRunData)rundata;
- // This code handles the case where a portlet is on several tabs
- // only removing it from the tab that you selected.
- //
- // FIXME: Portlet name may not be unique, eg when a portlet is on the same
tab twice
- // ...but I could not find a reliable way of uniquely identifying the
- // portlet.
-
- Portlet portlet = PortletFactory.getPortlet( name );
-
- if ( portlet != null )
- {
- String parentContainer = jdata.getParameters().getString("container");
- if (parentContainer == null) return;
-
- Portlets portlets = jdata.getProfile()
- .getDocument()
- .getPortlets(parentContainer);
-
- if (portlets != null)
- {
- for (int i=0; i < portlets.getEntryCount(); i++)
- {
- if ( name.equals(portlets.getEntry(i).getParent()) )
- {
- portlets.removeEntry(i);
- }
- }
- }
-
- }
+ // Remove the Portlet using the PEID
+ jdata.getProfile().getDocument().removeEntryById(peid);
}
}
1.7 +15 -8
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Customize.java
Index: Customize.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Customize.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Customize.java 6 Dec 2001 06:26:54 -0000 1.6
+++ Customize.java 13 Mar 2002 05:41:15 -0000 1.7
@@ -75,22 +75,29 @@
* Handle Customization requests for the current portlet
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
*/
public class Customize extends Action
{
-
-
-
+ /**
+ * @param rundata The RunData object for the current request
+ */
public void doPerform( RunData rundata ) throws Exception
{
- JetspeedRunData jdata = (JetspeedRunData)rundata;
-
if( rundata.getUser() == null || !rundata.getUser().hasLoggedIn() )
{
return;
}
+ // Get jsp_peid parmameter. If it does not exist, then do nothing
+ String peid = rundata.getParameters().getString("js_peid");
+ if ( peid == null )
+ {
+ return;
+ }
+ JetspeedRunData jdata = (JetspeedRunData)rundata;
+
// Load the profile for customization (if not already loaded!)
// Andreas Kempf, Siemens ICM S CP PE, Munich
// ---------------------------------------------------------------------
@@ -150,7 +157,7 @@
{
PortletSet set = (PortletSet)sets.pop();
- if (set.getName().equals(name))
+ if (set.getID().equals(peid))
{
found = set;
}
@@ -170,7 +177,7 @@
if (real instanceof PortletSet)
{
- if (real.getName().equals(name))
+ if (real.getID().equals(peid))
{
found=real;
}
@@ -180,7 +187,7 @@
sets.push(real);
}
}
- else if (p.getName().equals(name))
+ else if (p.getID().equals(peid))
{
found = p;
}
1.7 +28 -9
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Maximize.java
Index: Maximize.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Maximize.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Maximize.java 3 Jan 2002 08:46:11 -0000 1.6
+++ Maximize.java 13 Mar 2002 05:41:15 -0000 1.7
@@ -60,8 +60,10 @@
import org.apache.turbine.util.Log;
// Jetspeed stuff
+import org.apache.jetspeed.portal.Portlet;
+import org.apache.jetspeed.services.PortletFactory;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
-
+import org.apache.jetspeed.xml.api.portletmarkup.Entry;
/**
* Change the state of a portlet to maximized. This setting is not persistent.
@@ -71,28 +73,45 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
*/
public class Maximize extends Action
{
+ /**
+ * @param rundata The RunData object for the current request
+ */
public void doPerform( RunData rundata ) throws Exception
{
-
- JetspeedRunData jdata = (JetspeedRunData)rundata;
-
+ // Only logged in users can maximize
if( rundata.getUser() == null || !rundata.getUser().hasLoggedIn() )
{
return;
}
-
- String name = jdata.getPortlet();
- if ( name == null )
+ // Get jsp_peid parmameter. If it does not exist, then do nothing
+ String peid = rundata.getParameters().getString("js_peid");
+ if ( peid == null )
{
return;
}
- //record that this portlet is now maximized
- jdata.getUser().setTemp("portlet",name);
+ // Get the Portlet using the PSML document and the PEID
+ JetspeedRunData jdata = (JetspeedRunData)rundata;
+ // Get the Portlet using the PSML document and the PEID
+ Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
+ if ( entry == null )
+ {
+ Log.warn("Failed to get PEID (" + peid + ") entry for User ("
+ + rundata.getUser().getName() + ")");
+ return;
+ }
+ Portlet portlet = PortletFactory.getPortlet(entry);
+
+ //record that this portlet is now maximized
+ jdata.getUser().setTemp("portlet",portlet.getName()); // FIXME: Remove
this as part of the PEID conversion
+ jdata.getUser().setTemp("js_peid",peid);
+ jdata.setJs_peid(peid);
jdata.setScreenTemplate("Maximize");
+
}
}
1.4 +25 -11
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Minimize.java
Index: Minimize.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Minimize.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Minimize.java 16 Jun 2001 09:40:36 -0000 1.3
+++ Minimize.java 13 Mar 2002 05:41:15 -0000 1.4
@@ -56,44 +56,58 @@
// Turbine stuff
import org.apache.turbine.modules.Action;
+import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletState;
import org.apache.jetspeed.services.PortletFactory;
-import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
-
+import org.apache.jetspeed.xml.api.portletmarkup.Entry;
/**
-Change the internal state of a portlet from normal to minimized
-
-@author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
+* Change the internal state of a portlet from normal to minimized
+*
+* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
+* @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
*/
public class Minimize extends Action
{
+ /**
+ * @param rundata The RunData object for the current request
+ */
public void doPerform( RunData rundata ) throws Exception
{
-
+ // Only logged in users can minmize
if( rundata.getUser() == null || !rundata.getUser().hasLoggedIn() )
{
return;
}
- String name = ((JetspeedRunData)rundata).getPortlet();
- if ( name == null )
+ // Get jsp_peid parmameter. If it does not exist, then do nothing
+ String peid = rundata.getParameters().getString("js_peid");
+ if ( peid == null )
{
return;
}
- Portlet portlet = PortletFactory.getPortlet( name );
+ JetspeedRunData jdata = (JetspeedRunData)rundata;
+
+ // Get the Portlet using the PSML document and the PEID
+ Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
+ if ( entry == null )
+ {
+ Log.warn("Failed to get PEID (" + peid + ") entry for User ("
+ + rundata.getUser().getName() + ")");
+ return;
+ }
+ Portlet portlet = PortletFactory.getPortlet(entry);
+ // Now set the portlet to minimized
if (( portlet != null )&&( portlet instanceof PortletState ))
{
((PortletState)portlet).setMinimized( true, rundata );
}
-
}
-
}
1.9 +26 -19
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Restore.java
Index: Restore.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Restore.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Restore.java 3 Jan 2002 08:46:11 -0000 1.8
+++ Restore.java 13 Mar 2002 05:41:15 -0000 1.9
@@ -56,53 +56,59 @@
// Turbine stuff
import org.apache.turbine.modules.Action;
-import org.apache.turbine.util.RunData;
import org.apache.turbine.util.Log;
+import org.apache.turbine.util.RunData;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletState;
import org.apache.jetspeed.services.PortletFactory;
-import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
+import org.apache.jetspeed.xml.api.portletmarkup.Entry;
/**
Change the internal state of a portlet from minimized to normal
@author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
+@author <a href="mailto:paulsp@apache">Paul Spencer</a>
*/
public class Restore extends Action
{
+ /**
+ * @param rundata The RunData object for the current request
+ */
public void doPerform( RunData rundata ) throws Exception
{
-
+ // Only logged in users can Restored
if( rundata.getUser() == null || !rundata.getUser().hasLoggedIn() )
{
return;
}
- JetspeedRunData jdata = (JetspeedRunData)rundata;
- String name = jdata.getPortlet();
- if ( name == null )
+ // Get jsp_peid parmameter. If it does not exist, then do nothing
+ String peid = rundata.getParameters().getString("js_peid");
+ if ( peid == null )
{
return;
}
-
- try
+
+ // Get the Portlet using the PSML document and the PEID
+ JetspeedRunData jdata = (JetspeedRunData)rundata;
+ Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
+ if ( entry == null )
{
- Portlet portlet = PortletFactory.getPortlet( name );
- if (( portlet != null )&&( portlet instanceof PortletState ))
- {
- ((PortletState)portlet).setMinimized( false, rundata );
- }
+ Log.warn("Failed to get PEID (" + peid + ") entry for User ("
+ + rundata.getUser().getName() + ")");
+ return;
}
- catch (Exception e)
+ Portlet portlet = PortletFactory.getPortlet(entry);
+
+ // Now unset the portlet to minimized
+ if (( portlet != null )&&( portlet instanceof PortletState ))
{
- // this is most likely a normal occurence, ie portlet was removed
- // from registry, portlet is actually a portlet set, etc...
- Log.debug("Exception occured while trying to get portlet "+name);
+ ((PortletState)portlet).setMinimized( false, rundata );
}
-
+
// make sure we use the default template
while (jdata.getCustomized()!=null)
{
@@ -110,7 +116,8 @@
}
//remove the maximized portlet name - nothing is maximized now
- rundata.getUser().removeTemp("portlet");
+ jdata.getUser().removeTemp("portlet");
+ jdata.getUser().removeTemp("js_peid");
jdata.setScreenTemplate("Home");
}
1.13 +3 -5
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java
Index: CustomizeSetAction.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- CustomizeSetAction.java 5 Mar 2002 18:45:38 -0000 1.12
+++ CustomizeSetAction.java 13 Mar 2002 05:41:15 -0000 1.13
@@ -315,20 +315,19 @@
PortletSet set = (PortletSet)((JetspeedRunData)rundata).getCustomized();
String title = rundata.getParameters().getString("title","My Pane");
-System.out.println("In CustomizeSetAction.doAddSet()");
if (set!=null)
{
Portlets portlets = ((JetspeedRunData)rundata).getProfile()
.getDocument()
- .getPortlets(set.getName());
+ .getPortletsById(set.getID());
if (portlets != null)
{
Portlets p = new Portlets();
p.setMetainfo(new Metainfo());
p.getMetainfo().setTitle(title);
+ // FIXME: get id from a Jetspeed service
p.setId( Long.toHexString(System.currentTimeMillis()) + "-" +
TurbineUniqueId.getUniqueId());
-System.out.println("In CustomizeSetAction.doAddSet() Entry.id = " + p.getId());
portlets.addPortlets(p);
}
}
@@ -352,7 +351,6 @@
PortletSet set = (PortletSet)((JetspeedRunData)rundata).getCustomized();
String[] pnames = rundata.getParameters().getStrings("pname");
-System.out.println("In CustomizeSetAction.doAdd()");
// Create a ClearPortletControl
Control ctrl = new Control();
ctrl.setName ("ClearPortletControl");
@@ -398,8 +396,8 @@
p.setControl (ctrl);
p.setParent(pnames[i]);
+ // FIXME: get id from a Jetspeed service
p.setId( Long.toHexString(System.currentTimeMillis()) + "-" +
TurbineUniqueId.getUniqueId());
-System.out.println("In CustomizeSetAction.doAdd() Entry.id = " + p.getId());
portlets.addEntry(p);
}
}
1.6 +39 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BasePSMLDocument.java
Index: BasePSMLDocument.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BasePSMLDocument.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BasePSMLDocument.java 5 Mar 2002 18:45:38 -0000 1.5
+++ BasePSMLDocument.java 13 Mar 2002 05:41:15 -0000 1.6
@@ -64,7 +64,7 @@
* document.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: BasePSMLDocument.java,v 1.5 2002/03/05 18:45:38 paulsp Exp $
+ * @version $Id: BasePSMLDocument.java,v 1.6 2002/03/13 05:41:15 paulsp Exp $
*/
public class BasePSMLDocument implements PSMLDocument
{
@@ -374,6 +374,44 @@
return result;
}
+ /**
+ * Remove the Entry in the specified PSML resource corresponding
+ * to the given portlet Id
+ *
+ * @param entryId the portlet's entry id to seek
+ */
+ public boolean removeEntryById(String entryId)
+ {
+ return removeEntryById(this.portlets, entryId);
+ }
+ /**
+ * Remove the Entry in the specified PSML resource corresponding
+ * to the given portlet Id
+ *
+ * @param portlets the PSML description to look into
+ * @param entryId the portlet's entry id to seek
+ */
+ public static boolean removeEntryById(Portlets portlets, String entryId)
+ {
+ for (int i=0; i < portlets.getEntryCount(); i++)
+ {
+ if ( entryId.equals(portlets.getEntry(i).getId()) )
+ {
+ portlets.removeEntry(i);
+ return true;
+ }
+ }
+
+ for (Enumeration e2 = portlets.enumeratePortlets (); e2.hasMoreElements ();
)
+ {
+ Portlets p = (Portlets) e2.nextElement ();
+
+ if (removeEntryById(p, entryId) == true)
+ return true;
+ }
+
+ return false;
+ }
}
1.4 +10 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/PSMLDocument.java
Index: PSMLDocument.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/PSMLDocument.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PSMLDocument.java 5 Mar 2002 18:45:38 -0000 1.3
+++ PSMLDocument.java 13 Mar 2002 05:41:15 -0000 1.4
@@ -63,7 +63,7 @@
* document.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: PSMLDocument.java,v 1.3 2002/03/05 18:45:38 paulsp Exp $
+ * @version $Id: PSMLDocument.java,v 1.4 2002/03/13 05:41:15 paulsp Exp $
*/
public interface PSMLDocument
{
@@ -137,5 +137,14 @@
*/
public Portlets getPortlets(int position);
+ /**
+ * Removes the first entry in the current PSML resource corresponding
+ * to the given entry id
+ *
+ * @param entryId the portlet's entry id to remove
+ * @return true if the entry was removed
+ */
+ public boolean removeEntryById(String entryId);
+
}
1.13 +3 -5
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java
Index: VelocityPortletControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- VelocityPortletControl.java 9 Mar 2002 06:29:17 -0000 1.12
+++ VelocityPortletControl.java 13 Mar 2002 05:41:15 -0000 1.13
@@ -106,7 +106,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
*
- * @version $Id: VelocityPortletControl.java,v 1.12 2002/03/09 06:29:17 taylor Exp $
+ * @version $Id: VelocityPortletControl.java,v 1.13 2002/03/13 05:41:15 paulsp Exp $
*
*/
public class VelocityPortletControl extends AbstractPortletControl
@@ -263,12 +263,10 @@
{
PortletAction action = (PortletAction)i.next();
- String container = "na";
- if ( portlet.getPortletConfig().getPortletSet() != null) container =
portlet.getPortletConfig().getPortletSet().getName();
+ // FIXME: RelativeDynamicURI should be replaced by JetspeedTemplateLink
action.setLink( new RelativeDynamicURI( rundata )
.addQueryData("action", getAction( action.getName()
) )
- .addQueryData("portlet", portlet.getName() )
- .addQueryData("container", container )
+ .addQueryData("js_peid", portlet.getID() )
.toString() );
}
1.13 +6 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/VelocityPortlet.java
Index: VelocityPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/VelocityPortlet.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- VelocityPortlet.java 5 Mar 2002 12:26:33 -0000 1.12
+++ VelocityPortlet.java 13 Mar 2002 05:41:15 -0000 1.13
@@ -83,18 +83,22 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
*/
public class VelocityPortlet extends AbstractPortlet
{
/**
- By default the data is non cacheable
- */
+ * By default the data is non cacheable
+ */
public void init( ) throws PortletException
{
setCacheable( false );
}
+ /**
+ * @param rundata The RunData object for the current request
+ */
public ConcreteElement getContent( RunData rundata )
{
1.15 +12 -1
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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- JetspeedPortalToolkitService.java 9 Mar 2002 06:29:17 -0000 1.14
+++ JetspeedPortalToolkitService.java 13 Mar 2002 05:41:15 -0000 1.15
@@ -84,7 +84,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
*
- * @version $Id: JetspeedPortalToolkitService.java,v 1.14 2002/03/09 06:29:17
taylor Exp $
+ * @version $Id: JetspeedPortalToolkitService.java,v 1.15 2002/03/13 05:41:15
paulsp Exp $
*/
public class JetspeedPortalToolkitService extends TurbineBaseService
implements PortalToolkitService
@@ -358,6 +358,10 @@
Stack unidentified = new Stack();
VariableInteger lastID = new VariableInteger(0);
PortletSet pset = getSet( portlets, new VariableInteger(0), lastID,
unidentified );
+
+ // FIXME: The section will be replaced when the ID is set when the PSML
+ // read and the <entry> or <portlet> does not contain an ID. The
+ // customizer (in actions.portlets.CustomizeSetAction.doAdd() and doAddSet()
int nextID = lastID.getValue() + 1;
while (!unidentified.empty())
{
@@ -488,6 +492,13 @@
{
lastID.setValue(newID);
}
+ }
+ catch (NumberFormatException e)
+ {
+ // ID was not a number, not null, or not an empty string, so it
+ // will not conflict with generated numbers.
+ p.setID( id );
+ return id;
}
catch (Exception e)
{
1.6 +29 -5
jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/DefaultJetspeedRunData.java
Index: DefaultJetspeedRunData.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/DefaultJetspeedRunData.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultJetspeedRunData.java 6 Dec 2001 06:26:54 -0000 1.5
+++ DefaultJetspeedRunData.java 13 Mar 2002 05:41:15 -0000 1.6
@@ -73,7 +73,8 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
- * @version $Id: DefaultJetspeedRunData.java,v 1.5 2001/12/06 06:26:54 taylor Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
+ * @version $Id: DefaultJetspeedRunData.java,v 1.6 2002/03/13 05:41:15 paulsp Exp $
*/
public class DefaultJetspeedRunData extends DefaultTurbineRunData
implements JetspeedRunData
@@ -81,6 +82,7 @@
private Profile profile = null;
private CapabilityMap map = null;
+ private String peid = null;
private String pid = null;
private int mode = NORMAL;
private String template = null;
@@ -92,7 +94,7 @@
*/
public String getPortlet()
{
- return pid;
+ return pid;
}
/**
@@ -288,12 +290,34 @@
/** Clears the state of this object for recycling... */
public void dispose()
{
- profile = null;
+ mode=0;
map = null;
+ peid = null;
pid = null;
- mode=0;
- template=null;
+ profile = null;
+ template = null;
super.dispose();
}
+
+ /**
+ * Returns the portlet id (PEID) referenced in this request
+ *
+ * @return the portlet id (PEID) referenced or null
+ */
+ public String getJs_peid()
+ {
+ return peid;
+ }
+
+ /**
+ * Sets the portlet id (PEID) referenced for this request
+ *
+ * @param id the portlet id (PEID) referenced in this request
+ */
+ public void setJs_peid(String peid)
+ {
+ this.peid = peid;
+ }
+
}
1.4 +15 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/JetspeedRunData.java
Index: JetspeedRunData.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/JetspeedRunData.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedRunData.java 22 Jul 2001 19:04:32 -0000 1.3
+++ JetspeedRunData.java 13 Mar 2002 05:41:15 -0000 1.4
@@ -67,7 +67,7 @@
* interface in future releases of Turbine</note>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: JetspeedRunData.java,v 1.3 2001/07/22 19:04:32 raphael Exp $
+ * @version $Id: JetspeedRunData.java,v 1.4 2002/03/13 05:41:15 paulsp Exp $
*/
public interface JetspeedRunData extends TurbineRunData
{
@@ -84,11 +84,25 @@
public String getPortlet();
/**
+ * Returns the portlet id (PEID) referenced in this request
+ *
+ * @return the portlet id (PEID) referenced or null
+ */
+ public String getJs_peid();
+
+ /**
* Sets the portlet id referenced for this request
*
* @param id the portlet id referenced in this request
*/
public void setPortlet(String id);
+
+ /**
+ * Sets the portlet id (PEID) referenced for this request
+ *
+ * @param id the portlet id (PEID) referenced in this request
+ */
+ public void setJs_peid(String peid);
/**
* Returns the portlet id which should be customized for this request
1.15 +73 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTool.java
Index: JetspeedTool.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTool.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- JetspeedTool.java 9 Mar 2002 06:29:17 -0000 1.14
+++ JetspeedTool.java 13 Mar 2002 05:41:16 -0000 1.15
@@ -89,7 +89,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
*
- * @version $Id: JetspeedTool.java,v 1.14 2002/03/09 06:29:17 taylor Exp $
+ * @version $Id: JetspeedTool.java,v 1.15 2002/03/13 05:41:16 paulsp Exp $
*/
public class JetspeedTool implements ApplicationTool
{
@@ -182,15 +182,19 @@
return result;
}
- /**
- * Return the content of a named portlet. This portlet is sought in
+ /**
+ * Return the content of a named portlet. This portlet is sought in
* the current PSML resource.
*
- * If a control is attached to the portlet description, returns the defined
+ * If a control is attached to the portlet description, returns the defined
* portlet and control, otherwise use the default control.
*
+ * Note: This will return the FIRST portlet with a name = name. Use
getPortletById().
+ *
* @param name the name of the portlet to render
* @return the rendered content of the portlet
+ *
+ * @deprecated Use getPortletById()
*/
public ConcreteElement getPortlet(String name)
{
@@ -362,4 +366,69 @@
}
+ /**
+ * Return the content of a portlet using the portlet's id (PEID). This portlet
is sought in
+ * the current PSML resource.
+ *
+ * If a control is attached to the portlet description, returns the defined
+ * portlet and control, otherwise use the default control.
+ *
+ * @param peid the peid of the portlet to render
+ * @return the rendered content of the portlet
+ */
+ public ConcreteElement getPortletById(String peid)
+ {
+ ConcreteElement result = null;
+ Portlet found = null;
+ Stack sets = new Stack();
+ sets.push(rundata.getProfile().getRootSet());
+
+ while ((sets.size() > 0) && (found==null))
+ {
+ PortletSet set = (PortletSet)sets.pop();
+
+ if (set.getID().equals(peid))
+ {
+ found = set;
+ }
+ else
+ {
+ Enumeration en = set.getPortlets();
+ while((found==null) && en.hasMoreElements())
+ {
+ Portlet p = (Portlet)en.nextElement();
+
+ // unstack the controls to find the real PortletSets
+ Portlet real = p;
+ while (real instanceof PortletControl)
+ {
+ real = ((PortletControl)p).getPortlet();
+ }
+
+ if (real instanceof PortletSet)
+ {
+ // we'll explore this set afterwards
+ sets.push(real);
+ }
+ else if (p.getID().equals(peid))
+ {
+ found = p;
+ }
+ }
+ }
+ }
+
+ if (found!=null)
+ {
+ result = found.getContent(rundata);
+ }
+
+ if (result==null)
+ {
+ //the customizer already streamed its content, return a stub
+ result = new ConcreteElement();
+ }
+
+ return result;
+ }
}
1.13 +10 -10
jakarta-jetspeed/webapp/WEB-INF/psml/user/turbine/html/default.psml
Index: default.psml
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/psml/user/turbine/html/default.psml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- default.psml 31 Jan 2002 12:24:28 -0000 1.12
+++ default.psml 13 Mar 2002 05:41:16 -0000 1.13
@@ -1,59 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
-<portlets xmlns="http://www.apache.org/2000/02/CVS">
+<portlets id="01" xmlns="http://www.apache.org/2000/02/CVS">
<metainfo>
<title>Default Jetspeed page</title>
</metainfo>
<controller name="TabController"/>
<control name="TabControl"/>
<skin name="orange-red"/>
- <portlets>
+ <portlets id="02">
<controller name="TwoColumns"/>
<metainfo>
<title>Home</title>
</metainfo>
- <entry parent="LoggedInWelcome">
+ <entry id="03" parent="LoggedInWelcome">
<layout>
<property name="column" value="0"/>
<property name="row" value="0"/>
</layout>
</entry>
- <entry parent="HelloVelocity">
+ <entry id="04" parent="HelloVelocity">
<layout>
<property name="column" value="1"/>
<property name="row" value="0"/>
</layout>
</entry>
- <entry parent="StockQuote">
+ <entry id="05" parent="StockQuote">
<layout>
<property name="column" value="0"/>
<property name="row" value="1"/>
</layout>
</entry>
- <entry parent="http://jakarta.apache.org/jetspeed/channels/jetspeed.rss">
+ <entry id="06"
parent="http://jakarta.apache.org/jetspeed/channels/jetspeed.rss">
<layout>
<property name="column" value="1"/>
<property name="row" value="1"/>
</layout>
</entry>
- <entry parent="http://www.xmlhack.com/rsscat.php">
+ <entry id="07" parent="http://www.xmlhack.com/rsscat.php">
<layout>
<property name="column" value="0"/>
<property name="row" value="2"/>
</layout>
</entry>
- <entry parent="http://jakarta.apache.org/jetspeed/channels/turbine.rss">
+ <entry id="08"
parent="http://jakarta.apache.org/jetspeed/channels/turbine.rss">
<layout>
<property name="column" value="1"/>
<property name="row" value="2"/>
</layout>
</entry>
- <entry parent="http://www.mozilla.org/news.rdf">
+ <entry id="09" parent="http://www.mozilla.org/news.rdf">
<layout>
<property name="column" value="0"/>
<property name="row" value="3"/>
</layout>
</entry>
- <entry parent="http://www.apacheweek.com/issues/apacheweek-headlines.xml">
+ <entry id="10"
parent="http://www.apacheweek.com/issues/apacheweek-headlines.xml">
<layout>
<property name="column" value="1"/>
<property name="row" value="3"/>
1.3 +2 -2
jakarta-jetspeed/webapp/WEB-INF/templates/vm/screens/html/Maximize.vm
Index: Maximize.vm
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/screens/html/Maximize.vm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Maximize.vm 28 Dec 2001 15:12:35 -0000 1.2
+++ Maximize.vm 13 Mar 2002 05:41:16 -0000 1.3
@@ -1,6 +1,6 @@
$data.setMode("maximize")
-#if ($data.Portlet)
-$jetspeed.getPortlet($data.Portlet)
+#if ($data.Js_peid)
+$jetspeed.getPortletById($data.Js_peid)
#else
This should not happen...
<p>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>