1 | /* |
2 | * Copyright 2003,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 | package org.apache.pluto.driver.core; |
17 | |
18 | import javax.portlet.PortletMode; |
19 | import javax.portlet.WindowState; |
20 | |
21 | import org.apache.pluto.PortletWindow; |
22 | import org.apache.pluto.PortletWindowID; |
23 | import org.apache.pluto.driver.services.portal.PortletWindowConfig; |
24 | import org.apache.pluto.driver.url.PortalURL; |
25 | |
26 | /** |
27 | * Implementation of <code>PortletWindow</code> interface. |
28 | * @author <a href="mailto:zheng@apache.org">ZHENG Zhong</a> |
29 | * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a> |
30 | */ |
31 | public class PortletWindowImpl implements PortletWindow { |
32 | |
33 | // Private Member Variables ------------------------------------------------ |
34 | |
35 | private PortletWindowConfig config = null; |
36 | private PortalURL portalURL = null; |
37 | private PortletWindowIDImpl objectIdImpl = null; |
38 | |
39 | |
40 | // Constructor ------------------------------------------------------------- |
41 | |
42 | /** |
43 | * Constructs an instance. |
44 | * @param config the portlet window configuration. |
45 | * @param portalURL the portal URL. |
46 | */ |
47 | public PortletWindowImpl(PortletWindowConfig config, PortalURL portalURL) { |
48 | this.config = config; |
49 | this.portalURL = portalURL; |
50 | } |
51 | |
52 | |
53 | // PortletWindow Impl ------------------------------------------------------ |
54 | |
55 | public String getContextPath() { |
56 | return config.getContextPath(); |
57 | } |
58 | |
59 | public String getPortletName() { |
60 | return config.getPortletName(); |
61 | } |
62 | |
63 | public WindowState getWindowState() { |
64 | return portalURL.getWindowState(getId().getStringId()); |
65 | } |
66 | |
67 | public PortletMode getPortletMode() { |
68 | return portalURL.getPortletMode(getId().getStringId()); |
69 | } |
70 | |
71 | public PortletWindowID getId() { |
72 | if (objectIdImpl == null) { |
73 | objectIdImpl = PortletWindowIDImpl.createFromString(config.getId()); |
74 | } |
75 | return objectIdImpl; |
76 | } |
77 | } |