View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      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.jetspeed.om.window.impl;
18  
19  import java.io.Serializable;
20  
21  import org.apache.pluto.om.window.PortletWindow;
22  import org.apache.pluto.om.window.PortletWindowCtrl;
23  import org.apache.pluto.om.window.PortletWindowListCtrl;
24  import org.apache.pluto.om.entity.PortletEntity;
25  import org.apache.pluto.om.common.ObjectID;
26  import org.apache.jetspeed.util.JetspeedObjectID;
27  
28  /***
29   * <P>
30   * The <CODE>PortletWindow</CODE> implementation represents a single window
31   * of an portlet instance as it can be shown only once on a single page. 
32   * Adding the same portlet e.g. twice on a page results in two different windows.
33   * </P>
34   *
35   * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
36   * @version $Id: PortletWindowImpl.java 589933 2007-10-30 01:51:50Z woonsan $
37   **/
38  public class PortletWindowImpl implements PortletWindow, PortletWindowCtrl, Serializable
39  {
40      private ObjectID objectId = null;
41      private transient PortletEntity portletEntity = null;
42      private boolean instantlyRendered;
43  
44      public PortletWindowImpl(String id)
45      {
46          this.objectId = JetspeedObjectID.createFromString(id);
47      }
48  
49      public PortletWindowImpl(ObjectID oid)
50      {
51          this.objectId = oid;
52      }
53  
54      public PortletWindowImpl()
55      {
56          super();
57      }
58  
59      /***
60      * Returns the identifier of this portlet instance window as object id
61      *
62      * @return the object identifier
63      **/
64      public ObjectID getId()
65      {
66          return objectId;
67      }
68      /***
69       * Returns the portlet entity
70       *
71       * @return the portlet entity
72       **/
73      public PortletEntity getPortletEntity()
74      {
75          return portletEntity;
76      }
77  
78      // controller impl
79      /***
80       * binds an identifier to this portlet window
81       *
82       * @param id the new identifier
83       */
84      public void setId(String id)
85      {
86          objectId = JetspeedObjectID.createFromString(id);
87      }
88  
89      /***
90       * binds a portlet instance to this portlet window
91       * 
92       * @param portletEntity a portlet entity object
93       **/
94      public void setPortletEntity(PortletEntity portletEntity)
95      {
96          this.portletEntity = portletEntity;
97          ((PortletWindowListCtrl)portletEntity.getPortletWindowList()).add(this);
98      }
99      
100     /***
101      * Sets flag that the content is instantly rendered from JPT.
102      */
103     public void setInstantlyRendered(boolean instantlyRendered)
104     {
105         this.instantlyRendered = instantlyRendered;
106     }
107     
108     /***
109      * Checks if the content is instantly rendered from JPT.
110      */
111     public boolean isInstantlyRendered()
112     {
113         return this.instantlyRendered;
114     }
115 
116 }