KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > modules > actions > portlets > JspPortletAction


1 /*
2  * Copyright 2000-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.jetspeed.modules.actions.portlets;
18
19 // Jetspeed stuff
20
import org.apache.jetspeed.portal.Portlet;
21
22 // Turbine stuff
23

24 import org.apache.turbine.util.RunData;
25
26 import org.apache.velocity.context.Context;
27
28 /**
29  * An abstract action class to build JspPortlet actions.
30  *
31  * <p>Don't call it from the URL, the Portlet and the Action are automatically
32  * associated through the registry PortletName
33  * <p>
34  * <strong>NOTE:</strong>This supports the pre-MVC style of template based
35  * portlet development and is supplied for backward compatibility. It is
36  * suggested you use a combination of
37  * @see org.apache.jetspeed.portal.portlets.GenericMVCPortlet along with
38  * subclassing @see org.apache.jetspeed.portal.portlets.GenericMVCAction
39  * for future portlet development.
40  * </p>
41  *
42  * @author <a HREF="mailto:morciuch@apache.org">Mark Orciuch</a>
43  * @author <a HREF="mailto:sweaver@rippe.com">Scott Weaver</a>
44  *
45  * @version $Id: JspPortletAction.java,v 1.7 2004/02/23 02:56:58 jford Exp $
46  */

47 public abstract class JspPortletAction extends GenericMVCAction
48 {
49
50     /**
51     * @see org.apache.jetspeed.portal.portlets.mvc.PortletAction#buildConfigureContext(Portlet, Context, RunData)
52     */

53     protected void buildConfigureContext(Portlet portlet, Context context, RunData rundata)
54         throws Exception JavaDoc
55     {
56
57         buildConfigureContext(portlet, rundata);
58         if (rundata.getRequest().getAttribute("_" + portlet.getID() + "_noConfigureContext")
59             != null)
60         {
61             super.buildConfigureContext(portlet, context, rundata);
62         }
63     }
64
65     /**
66       * Kept for backward compatibility. New classes should use
67      * the method signatures build*(Portlet, Context, RunData)
68      * If you override this method <b>DO NOT</b> call super.buildConfigureContext().
69      * <br>
70      * Subclasses should override this method if they wish to
71      * provide their own customization behavior.
72      * Default is to use Portal base customizer action
73      */

74     protected void buildConfigureContext(Portlet portlet, RunData rundata) throws Exception JavaDoc
75     {
76
77         // STW: backward compatibility bootstrap flag
78
rundata.getRequest().setAttribute("_" + portlet.getID() + "_noConfigureContext", " ");
79     }
80
81     /**
82      * @see org.apache.jetspeed.portal.portlets.mvc.PortletAction#buildMaximizedContext(Portlet, Context, RunData)
83      */

84     protected void buildMaximizedContext(Portlet portlet, Context context, RunData rundata)
85         throws Exception JavaDoc
86     {
87         buildMaximizedContext(portlet, rundata);
88         if (rundata.getRequest().getAttribute("_" + portlet.getID() + "_noMaximizedContext")
89             != null)
90         {
91             super.buildMaximizedContext(portlet, context, rundata);
92         }
93     }
94
95     /**
96      * Kept for backward compatibility. New classes should use
97      * the method signatures build*(Portlet, Context, RunData)
98      * If you override this method <b>DO NOT</b> call super.buildMaximizedContext().
99      * <br>
100      * Subclasses should override this method if they wish to
101      * build specific content when maximized. Default behavior is
102      * to do the same as normal content.<br>
103      */

104     protected void buildMaximizedContext(Portlet portlet, RunData rundata) throws Exception JavaDoc
105     {
106         // STW: backward compatibility bootstrap flag
107
rundata.getRequest().setAttribute("_" + portlet.getID() + "_noMaximizedContext", " ");
108     }
109
110     /**
111      * @see org.apache.jetspeed.portal.portlets.mvc.PortletAction#buildNormalContext(Portlet, Context, RunData)
112      */

113     protected void buildNormalContext(Portlet portlet, Context context, RunData data)
114         throws Exception JavaDoc
115     {
116         buildNormalContext(portlet, data);
117     }
118
119     /**
120      * Subclasses must override this method to provide default behavior
121      * for the portlet action
122      */

123     protected abstract void buildNormalContext(Portlet portlet, RunData rundata) throws Exception JavaDoc;
124     
125     /**
126      * You should use one of PortletAction.setTemplate() methods
127      * @deprecated
128      */

129     public void setTemplate(RunData data, Portlet portlet, String JavaDoc template)
130     
131     {
132         if(template != null)
133         {
134             super.setTemplate(data, template, true);
135         }
136         else
137         {
138             super.resetTemplate(data);
139         }
140     }
141
142 }
143
Popular Tags