You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2003/03/24 02:13:42 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets GenericMVCPortlet.java
weaver 2003/03/23 17:13:42
Modified: src/java/org/apache/jetspeed/portal/portlets
GenericMVCPortlet.java
Log:
- added protected getCurrentTemplate method that returns the correct
template to use based whether or not the PortletSessionState contains
a "template" attribute, if it does use that value otherwise query the
PortletConfig for the default template.
Revision Changes Path
1.2 +33 -9 jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/GenericMVCPortlet.java
Index: GenericMVCPortlet.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/GenericMVCPortlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GenericMVCPortlet.java 20 Mar 2003 18:09:39 -0000 1.1
+++ GenericMVCPortlet.java 24 Mar 2003 01:13:42 -0000 1.2
@@ -62,10 +62,12 @@
import org.apache.ecs.ConcreteElement;
+import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletException;
import org.apache.jetspeed.portal.portlets.viewprocessor.*;
// using the * form due to the puggable nature
//ie no recompile to support new view processors
+import org.apache.jetspeed.util.PortletSessionState;
import org.apache.jetspeed.util.template.JetspeedLink;
import org.apache.jetspeed.util.template.JetspeedTemplateLink;
@@ -123,12 +125,21 @@
* mvc.viewprocessor.XSL = org.apache.jetspeedportlets.viewprocessors.XSLViewProcessor
*
* @author tkuebler
- * @author <a href="mailto:sweaver@rippe.com">Scott Weaver</a>
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
* @version $Id$
* @stereotype role
*/
public class GenericMVCPortlet extends AbstractInstancePortlet
{
+ // STW: Context keys
+ public static final String PORTLET = "portlet";
+ public static final String TEMPLATE = "template";
+ public static final String RUNDATA = "data";
+ public static final String PORTLET_CONFIG = "conf";
+ public static final String SKIN = "skin";
+ public static final String VIEW_TYPE = "viewType";
+
+
// need cache timer, etc
private String viewType = "ERROR: not set in config";
@@ -224,17 +235,16 @@
// create a new context
// populate it with data
GenericMVCContext context = new GenericMVCContext(TurbinePull.getGlobalContext());
- context.put("data", rundata);
- context.put("portlet", this);
- context.put("conf", this.getPortletConfig());
- context.put("skin", this.getPortletConfig().getPortletSkin());
- context.put("template", template);
- context.put("viewType", viewType);
+ context.put(RUNDATA, rundata);
+ context.put(PORTLET, this);
+ context.put(PORTLET_CONFIG, this.getPortletConfig());
+ context.put(SKIN, this.getPortletConfig().getPortletSkin());
+ context.put(TEMPLATE, getCurrentTemplate(rundata));
+ context.put(VIEW_TYPE, viewType);
populateRequest(rundata);
// put references to the pull tools in the context
TurbinePull.populateContext(context, rundata);
- Object fTool = context.get("format");
// Initialize jlink and jslink tools with ourselves
// to enable links between portlets
Object jlink = context.get("jlink");
@@ -331,7 +341,21 @@
request.setAttribute("portlet", this);
request.setAttribute("conf", this.getPortletConfig());
request.setAttribute("skin", this.getPortletConfig().getPortletSkin());
- request.setAttribute("template", template);
+ request.setAttribute("template", getCurrentTemplate(rundata));
request.setAttribute("viewType", viewType);
+ }
+
+ /**
+ *
+ */
+ protected String getCurrentTemplate( RunData data)
+ {
+ String useTemplate = (String) PortletSessionState.getAttribute(this, data, TEMPLATE);
+ if(useTemplate == null)
+ {
+ useTemplate = this.template;
+ }
+
+ return useTemplate;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org