1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.actions.controllers;
18
19 import org.apache.jetspeed.portal.Portlet;
20 import org.apache.jetspeed.portal.PortletSet;
21 import org.apache.jetspeed.portal.PortletController;
22 import org.apache.jetspeed.portal.PortletControllerConfig;
23 import org.apache.jetspeed.portal.PanedPortletController;
24 import org.apache.jetspeed.services.resources.JetspeedResources;
25
26
27 import org.apache.turbine.util.RunData;
28
29
30 import org.apache.velocity.context.Context;
31
32 /***
33 * This action builds a context suitable for controllers portlets
34 * in panes, ie with only a subsetof defined portlets defined at any
35 * time.
36 * Should be associated with a controller implementing PanedPortletController
37 * to work correctly
38 *
39 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
40 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
41 *
42 * @version $Id: PanedControllerAction.java,v 1.13 2004/02/23 02:49:58 jford Exp $
43 */
44 public class PanedControllerAction extends RowColumnControllerAction
45 {
46 /***
47 * Adds a "pane" portlet object in the context which represents the
48 * currently selected pane
49 */
50 protected void buildNormalContext( PortletController controller,
51 Context context,
52 RunData rundata )
53 {
54 PanedPortletController cont = (PanedPortletController)controller;
55
56 PortletSet myPortlets = cont.getPortlets();
57 PortletControllerConfig conf = cont.getConfig();
58
59 Portlet portlet = null;
60 String paneID = null;
61 String paneName = rundata.getParameters().getString( JetspeedResources.PATH_PANENAME_KEY );
62
63 if (null != paneName)
64 {
65 portlet = myPortlets.getPortletByName(paneName);
66 if (portlet != null)
67 {
68 paneID = portlet.getID();
69 rundata.getParameters().setString(JetspeedResources.PATH_PANEID_KEY, paneID);
70 }
71 }
72
73 if (null == portlet)
74 {
75 paneID = cont.retrievePaneID(rundata, true);
76 portlet = myPortlets.getPortletByID(paneID);
77 if (null == portlet)
78 {
79 paneID = cont.retrievePaneID(rundata, false);
80 portlet = myPortlets.getPortletByID(paneID);
81 }
82 }
83
84 if (portlet != null)
85 {
86 context.put("pane", portlet);
87 String state = portlet.getAttribute("_menustate", "open", rundata);
88
89
90 {
91 cont.savePaneID(rundata, paneID);
92 }
93 }
94 }
95
96 }