1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.actions.portlets;
18
19
20 import org.apache.jetspeed.portal.Portlet;
21
22
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
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
75 {
76
77
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
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
105 {
106
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
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;
124
125 /***
126 * You should use one of PortletAction.setTemplate() methods
127 * @deprecated
128 */
129 public void setTemplate(RunData data, Portlet portlet, String 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 }