01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.portal.pluto;
18:
19: import java.util.HashMap;
20: import java.util.Map;
21:
22: import javax.portlet.PortletMode;
23: import javax.portlet.WindowState;
24:
25: import org.apache.cocoon.portal.coplet.CopletInstanceData;
26: import org.apache.cocoon.portal.pluto.om.PortletEntityImpl;
27: import org.apache.pluto.om.window.PortletWindow;
28: import org.apache.pluto.services.information.PortletActionProvider;
29:
30: /**
31: *
32: *
33: * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
34: *
35: * @version CVS $Id: PortletActionProviderImpl.java 433543 2006-08-22 06:22:54Z crossley $
36: */
37: public class PortletActionProviderImpl implements PortletActionProvider {
38:
39: /** The target */
40: protected PortletWindow portletWindow;
41:
42: public PortletActionProviderImpl(PortletWindow portletWindow) {
43: this .portletWindow = portletWindow;
44: }
45:
46: /**
47: * @see org.apache.pluto.services.information.PortletActionProvider#changePortletMode(PortletWindow, PortletMode)
48: */
49: public void changePortletMode(PortletMode mode) {
50: if (mode != null) {
51: final CopletInstanceData cid = ((PortletEntityImpl) portletWindow
52: .getPortletEntity()).getCopletInstanceData();
53: cid.setTemporaryAttribute("portlet-mode", mode.toString());
54: }
55: }
56:
57: /**
58: * @see org.apache.pluto.services.information.PortletActionProvider#changePortletWindowState(PortletWindow, WindowState)
59: */
60: public void changePortletWindowState(WindowState state) {
61: if (state != null) {
62: final CopletInstanceData cid = ((PortletEntityImpl) portletWindow
63: .getPortletEntity()).getCopletInstanceData();
64: cid.setTemporaryAttribute("window-state", state.toString());
65: }
66: }
67:
68: public void changeRenderParameters(Map parameters) {
69: final CopletInstanceData cid = ((PortletEntityImpl) portletWindow
70: .getPortletEntity()).getCopletInstanceData();
71: if (parameters == null) {
72: cid.removeTemporaryAttribute("render-parameters");
73: } else {
74: cid.setTemporaryAttribute("render-parameters", new HashMap(
75: parameters));
76: }
77: }
78: }
|