001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.pluto.internal.impl;
018:
019: import javax.portlet.PortletMode;
020: import javax.portlet.WindowState;
021: import javax.servlet.ServletContext;
022:
023: import org.apache.pluto.PortletWindow;
024: import org.apache.pluto.PortletWindowID;
025: import org.apache.pluto.internal.InternalPortletWindow;
026: import org.apache.pluto.internal.PortletEntity;
027:
028: /**
029: * Implementation of <code>InternalPortletWindow</code> interface.
030: *
031: */
032: public class InternalPortletWindowImpl implements InternalPortletWindow {
033:
034: /** The underlying portlet window instance. */
035: private final PortletWindow portletWindow;
036:
037: /** The servlet context of the portlet. */
038: private final ServletContext servletContext;
039:
040: /** The portlet entity associated with the portlet window. */
041: private PortletEntity entity;
042:
043: // Constructor -------------------------------------------------------------
044:
045: /**
046: * Constructs an internal portlet window that wraps a portlet window.
047: * An internal portlet window instance is created everytime when the portlet
048: * container's <code>doRender()</code> or <code>doAction()</code> method is
049: * invoked.
050: *
051: * @param context the servlet context from which this window is
052: * being invoked.
053: * @param portletWindow the underlying portlet window instance.
054: */
055: public InternalPortletWindowImpl(ServletContext context,
056: PortletWindow portletWindow) {
057: this .servletContext = context;
058: this .portletWindow = portletWindow;
059: }
060:
061: // PortletWindow Impl ------------------------------------------------------
062:
063: public String getContextPath() {
064: return portletWindow.getContextPath();
065: }
066:
067: public String getPortletName() {
068: return portletWindow.getPortletName();
069: }
070:
071: public WindowState getWindowState() {
072: return portletWindow.getWindowState();
073: }
074:
075: public PortletMode getPortletMode() {
076: return portletWindow.getPortletMode();
077: }
078:
079: public PortletWindowID getId() {
080: return portletWindow.getId();
081: }
082:
083: // InternalPortletWindow Impl ----------------------------------------------
084:
085: public ServletContext getServletContext() {
086: return servletContext;
087: }
088:
089: public PortletEntity getPortletEntity() {
090: if (entity == null) {
091: entity = new PortletEntityImpl(servletContext,
092: getPortletName());
093: }
094: return entity;
095: }
096:
097: public PortletWindow getOriginalPortletWindow() {
098: return portletWindow;
099: }
100: }
|