1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet;
16  
17  import com.liferay.portal.kernel.portlet.LiferayRenderResponse;
18  import com.liferay.portal.theme.PortletDisplay;
19  import com.liferay.portal.theme.ThemeDisplay;
20  import com.liferay.portal.util.WebKeys;
21  
22  import java.util.Collection;
23  
24  import javax.portlet.PortletMode;
25  import javax.portlet.PortletRequest;
26  
27  import javax.servlet.http.HttpServletResponse;
28  
29  /**
30   * <a href="RenderResponseImpl.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   * @author Eduardo Lundgren
34   */
35  public class RenderResponseImpl
36      extends MimeResponseImpl implements LiferayRenderResponse {
37  
38      public String getLifecycle() {
39          return PortletRequest.RENDER_PHASE;
40      }
41  
42      public String getResourceName() {
43          return _resourceName;
44      }
45  
46      public String getTitle() {
47          return _title;
48      }
49  
50      public Boolean getUseDefaultTemplate() {
51          return _useDefaultTemplate;
52      }
53  
54      public void setResourceName(String resourceName) {
55          _resourceName = resourceName;
56      }
57  
58      public void setNextPossiblePortletModes(
59          Collection<PortletMode> portletModes) {
60      }
61  
62      public void setTitle(String title) {
63          _title = title;
64  
65          // See LEP-2188
66  
67          ThemeDisplay themeDisplay =
68              (ThemeDisplay)_portletRequestImpl.getAttribute(
69                  WebKeys.THEME_DISPLAY);
70  
71          PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
72  
73          portletDisplay.setTitle(_title);
74      }
75  
76      public void setUseDefaultTemplate(Boolean useDefaultTemplate) {
77          _useDefaultTemplate = useDefaultTemplate;
78      }
79  
80      protected void init(
81          PortletRequestImpl portletRequestImpl, HttpServletResponse response,
82          String portletName, long companyId, long plid) {
83  
84          super.init(portletRequestImpl, response, portletName, companyId, plid);
85  
86          _portletRequestImpl = portletRequestImpl;
87      }
88  
89      private PortletRequestImpl _portletRequestImpl;
90      private String _title;
91      private Boolean _useDefaultTemplate;
92      private String _resourceName;
93  
94  }