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.jetspeed.om.window.impl;
018:
019: import java.io.Serializable;
020:
021: import org.apache.pluto.om.window.PortletWindow;
022: import org.apache.pluto.om.window.PortletWindowCtrl;
023: import org.apache.pluto.om.window.PortletWindowListCtrl;
024: import org.apache.pluto.om.entity.PortletEntity;
025: import org.apache.pluto.om.common.ObjectID;
026: import org.apache.jetspeed.util.JetspeedObjectID;
027:
028: /**
029: * <P>
030: * The <CODE>PortletWindow</CODE> implementation represents a single window
031: * of an portlet instance as it can be shown only once on a single page.
032: * Adding the same portlet e.g. twice on a page results in two different windows.
033: * </P>
034: *
035: * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
036: * @version $Id: PortletWindowImpl.java 589933 2007-10-30 01:51:50Z woonsan $
037: **/
038: public class PortletWindowImpl implements PortletWindow,
039: PortletWindowCtrl, Serializable {
040: private ObjectID objectId = null;
041: private transient PortletEntity portletEntity = null;
042: private boolean instantlyRendered;
043:
044: public PortletWindowImpl(String id) {
045: this .objectId = JetspeedObjectID.createFromString(id);
046: }
047:
048: public PortletWindowImpl(ObjectID oid) {
049: this .objectId = oid;
050: }
051:
052: public PortletWindowImpl() {
053: super ();
054: }
055:
056: /**
057: * Returns the identifier of this portlet instance window as object id
058: *
059: * @return the object identifier
060: **/
061: public ObjectID getId() {
062: return objectId;
063: }
064:
065: /**
066: * Returns the portlet entity
067: *
068: * @return the portlet entity
069: **/
070: public PortletEntity getPortletEntity() {
071: return portletEntity;
072: }
073:
074: // controller impl
075: /**
076: * binds an identifier to this portlet window
077: *
078: * @param id the new identifier
079: */
080: public void setId(String id) {
081: objectId = JetspeedObjectID.createFromString(id);
082: }
083:
084: /**
085: * binds a portlet instance to this portlet window
086: *
087: * @param portletEntity a portlet entity object
088: **/
089: public void setPortletEntity(PortletEntity portletEntity) {
090: this .portletEntity = portletEntity;
091: ((PortletWindowListCtrl) portletEntity.getPortletWindowList())
092: .add(this );
093: }
094:
095: /**
096: * Sets flag that the content is instantly rendered from JPT.
097: */
098: public void setInstantlyRendered(boolean instantlyRendered) {
099: this .instantlyRendered = instantlyRendered;
100: }
101:
102: /**
103: * Checks if the content is instantly rendered from JPT.
104: */
105: public boolean isInstantlyRendered() {
106: return this.instantlyRendered;
107: }
108:
109: }
|