1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.theme;
21  
22  import com.liferay.portal.kernel.language.LanguageUtil;
23  import com.liferay.portal.kernel.log.Log;
24  import com.liferay.portal.kernel.log.LogFactoryUtil;
25  import com.liferay.portal.kernel.util.Http;
26  import com.liferay.portal.kernel.util.StringPool;
27  import com.liferay.portal.kernel.util.Validator;
28  import com.liferay.portal.model.Account;
29  import com.liferay.portal.model.ColorScheme;
30  import com.liferay.portal.model.Company;
31  import com.liferay.portal.model.Contact;
32  import com.liferay.portal.model.Group;
33  import com.liferay.portal.model.Layout;
34  import com.liferay.portal.model.LayoutTypePortlet;
35  import com.liferay.portal.model.Theme;
36  import com.liferay.portal.model.User;
37  import com.liferay.portal.security.permission.PermissionChecker;
38  import com.liferay.portal.service.GroupLocalServiceUtil;
39  
40  import java.io.Serializable;
41  
42  import java.util.List;
43  import java.util.Locale;
44  import java.util.TimeZone;
45  
46  import javax.portlet.PortletURL;
47  
48  /**
49   * <a href="ThemeDisplay.java.html"><b><i>View Source</i></b></a>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   */
54  public class ThemeDisplay implements Serializable {
55  
56      public ThemeDisplay() {
57          if (_log.isDebugEnabled()) {
58              _log.debug("Creating new instance " + hashCode());
59          }
60  
61          _portletDisplay.setThemeDisplay(this);
62      }
63  
64      public Company getCompany() {
65          return _company;
66      }
67  
68      public void setCompany(Company company) {
69          _company = company;
70  
71          setAccount(company.getAccount());
72      }
73  
74      public long getCompanyId() {
75          return _company.getCompanyId();
76      }
77  
78      public String getCompanyLogo() {
79          return _companyLogo;
80      }
81  
82      public void setCompanyLogo(String companyLogo) {
83          _companyLogo = companyLogo;
84      }
85  
86      public int getCompanyLogoHeight() {
87          return _companyLogoHeight;
88      }
89  
90      public void setCompanyLogoHeight(int companyLogoHeight) {
91          _companyLogoHeight = companyLogoHeight;
92      }
93  
94      public int getCompanyLogoWidth() {
95          return _companyLogoWidth;
96      }
97  
98      public void setCompanyLogoWidth(int companyLogoWidth) {
99          _companyLogoWidth = companyLogoWidth;
100     }
101 
102     public String getRealCompanyLogo() {
103         return _realCompanyLogo;
104     }
105 
106     public void setRealCompanyLogo(String realCompanyLogo) {
107         _realCompanyLogo = realCompanyLogo;
108     }
109 
110     public int getRealCompanyLogoHeight() {
111         return _realCompanyLogoHeight;
112     }
113 
114     public void setRealCompanyLogoHeight(int realCompanyLogoHeight) {
115         _realCompanyLogoHeight = realCompanyLogoHeight;
116     }
117 
118     public int getRealCompanyLogoWidth() {
119         return _realCompanyLogoWidth;
120     }
121 
122     public void setRealCompanyLogoWidth(int realCompanyLogoWidth) {
123         _realCompanyLogoWidth = realCompanyLogoWidth;
124     }
125 
126     public Account getAccount() {
127         return _account;
128     }
129 
130     public void setAccount(Account account) {
131         _account = account;
132     }
133 
134     public User getDefaultUser() {
135         if (_defaultUser == null) {
136             _defaultUser = _company.getDefaultUser();
137         }
138 
139         return _defaultUser;
140     }
141 
142     public long getDefaultUserId() {
143         return getDefaultUser().getUserId();
144     }
145 
146     public User getUser() {
147         return _user;
148     }
149 
150     public void setUser(User user) {
151         _user = user;
152 
153         setContact(user.getContact());
154     }
155 
156     public long getUserId() {
157         return _user.getUserId();
158     }
159 
160     public User getRealUser() {
161         return _realUser;
162     }
163 
164     public void setRealUser(User realUser) {
165         _realUser = realUser;
166     }
167 
168     public long getRealUserId() {
169         return _realUser.getUserId();
170     }
171 
172     public String getDoAsUserId() {
173         return _doAsUserId;
174     }
175 
176     public void setDoAsUserId(String doAsUserId) {
177         _doAsUserId = doAsUserId;
178     }
179 
180     public String getDoAsUserLanguageId() {
181         return _doAsUserLanguageId;
182     }
183 
184     public void setDoAsUserLanguageId(String doAsUserLanguageId) {
185         _doAsUserLanguageId = doAsUserLanguageId;
186     }
187 
188     public long getDoAsGroupId() {
189         return _doAsGroupId;
190     }
191 
192     public void setDoAsGroupId(long doAsGroupId) {
193         _doAsGroupId = doAsGroupId;
194     }
195 
196     public long getRefererPlid() {
197         return _refererPlid;
198     }
199 
200     public void setRefererPlid(long refererPlid) {
201         _refererPlid = refererPlid;
202     }
203 
204     public boolean isImpersonated() {
205         if (getUserId() == getRealUserId()) {
206             return false;
207         }
208         else {
209             return true;
210         }
211     }
212 
213     public Contact getContact() {
214         return _contact;
215     }
216 
217     public void setContact(Contact contact) {
218         _contact = contact;
219     }
220 
221     public String getLayoutSetLogo() {
222         return _layoutSetLogo;
223     }
224 
225     public void setLayoutSetLogo(String layoutSetLogo) {
226         _layoutSetLogo = layoutSetLogo;
227     }
228 
229     public Layout getLayout() {
230         return _layout;
231     }
232 
233     public void setLayout(Layout layout) {
234         _layout = layout;
235     }
236 
237     public List<Layout> getLayouts() {
238         return _layouts;
239     }
240 
241     public void setLayouts(List<Layout> layouts) {
242         _layouts = layouts;
243     }
244 
245     public long getPlid() {
246         return _plid;
247     }
248 
249     public void setPlid(long plid) {
250         _plid = plid;
251     }
252 
253     public LayoutTypePortlet getLayoutTypePortlet() {
254         return _layoutTypePortlet;
255     }
256 
257     public void setLayoutTypePortlet(LayoutTypePortlet layoutTypePortlet) {
258         _layoutTypePortlet = layoutTypePortlet;
259     }
260 
261     public Group getScopeGroup() {
262         return _scopeGroup;
263     }
264 
265     /**
266      * @deprecated Use <code>getScopeGroupId</code>.
267      */
268     public long getPortletGroupId() {
269         return getScopeGroupId();
270     }
271 
272     public long getScopeGroupId() {
273         return _scopeGroupId;
274     }
275 
276     public void setScopeGroupId(long scopeGroupId) {
277         _scopeGroupId = scopeGroupId;
278 
279         if (_scopeGroupId > 0) {
280             try {
281                 _scopeGroup = GroupLocalServiceUtil.getGroup(_scopeGroupId);
282             }
283             catch (Exception e) {
284                 _log.error(e, e);
285             }
286         }
287     }
288 
289     public String getScopeGroupName() {
290         if (_scopeGroup == null) {
291             return StringPool.BLANK;
292         }
293         else {
294             return _scopeGroup.getDescriptiveName();
295         }
296     }
297 
298     public boolean isSignedIn() {
299         return _signedIn;
300     }
301 
302     public void setSignedIn(boolean signedIn) {
303         _signedIn = signedIn;
304     }
305 
306     public PermissionChecker getPermissionChecker() {
307         return _permissionChecker;
308     }
309 
310     public void setPermissionChecker(PermissionChecker permissionChecker) {
311         _permissionChecker = permissionChecker;
312     }
313 
314     public Locale getLocale() {
315         return _locale;
316     }
317 
318     public void setLocale(Locale locale) {
319         _locale = locale;
320     }
321 
322     public String getLanguageId() {
323         return _languageId;
324     }
325 
326     public void setLanguageId(String languageId) {
327         _languageId = languageId;
328     }
329 
330     public boolean isI18n() {
331         return _i18n;
332     }
333 
334     public String getI18nLanguageId() {
335         return _i18nLanguageId;
336     }
337 
338     public void setI18nLanguageId(String i18nLanguageId) {
339         _i18nLanguageId = i18nLanguageId;
340 
341         if (Validator.isNotNull(i18nLanguageId)) {
342             _i18n = true;
343         }
344     }
345 
346     public String translate(String key) {
347         return LanguageUtil.get(getCompanyId(), getLocale(), key);
348     }
349 
350     public String translate(String pattern, Object argument) {
351         return LanguageUtil.format(
352             getCompanyId(), getLocale(), pattern, argument);
353     }
354 
355     public String translate(String pattern, Object[] arguments) {
356         return LanguageUtil.format(
357             getCompanyId(), getLocale(), pattern, arguments);
358     }
359 
360     public TimeZone getTimeZone() {
361         return _timeZone;
362     }
363 
364     public void setTimeZone(TimeZone timeZone) {
365         _timeZone = timeZone;
366     }
367 
368     public Theme getTheme() {
369         return _theme;
370     }
371 
372     public String getThemeId() {
373         return _theme.getThemeId();
374     }
375 
376     public ColorScheme getColorScheme() {
377         return _colorScheme;
378     }
379 
380     public String getColorSchemeId() {
381         return _colorScheme.getColorSchemeId();
382     }
383 
384     public boolean isWapTheme() {
385         return _theme.isWapTheme();
386     }
387 
388     public void setLookAndFeel(Theme theme, ColorScheme colorScheme) {
389         setLookAndFeel(getPathContext(), theme, colorScheme);
390     }
391 
392     public void setLookAndFeel(
393         String contextPath, Theme theme, ColorScheme colorScheme) {
394 
395         _theme = theme;
396         _colorScheme = colorScheme;
397 
398         if ((theme != null) && (colorScheme != null)) {
399             String themeContextPath = contextPath;
400 
401             if (theme.isWARFile()) {
402                 themeContextPath = theme.getContextPath();
403             }
404 
405             String host = getCDNHost();
406 
407             if (Validator.isNull(host) && isFacebook()) {
408                 host = getPortalURL();
409             }
410 
411             setPathColorSchemeImages(
412                 host + themeContextPath +
413                     colorScheme.getColorSchemeImagesPath());
414 
415             setPathThemeCss(host + themeContextPath + theme.getCssPath());
416             setPathThemeImages(host + themeContextPath + theme.getImagesPath());
417             setPathThemeJavaScript(
418                 host + themeContextPath + theme.getJavaScriptPath());
419             setPathThemeRoot(themeContextPath + theme.getRootPath());
420             setPathThemeTemplates(
421                 host + themeContextPath + theme.getTemplatesPath());
422         }
423     }
424 
425     public boolean isThemeCssFastLoad() {
426         return _themeCssFastLoad;
427     }
428 
429     public void setThemeCssFastLoad(boolean themeCssFastLoad) {
430         _themeCssFastLoad = themeCssFastLoad;
431     }
432 
433     public boolean isThemeImagesFastLoad() {
434         return _themeImagesFastLoad;
435     }
436 
437     public void setThemeImagesFastLoad(boolean themeImagesFastLoad) {
438         _themeImagesFastLoad = themeImagesFastLoad;
439     }
440 
441     public boolean isThemeJsBarebone() {
442         return _themeJsBarebone;
443     }
444 
445     public void setThemeJsBarebone(boolean themeJsBarebone) {
446         _themeJsBarebone = themeJsBarebone;
447     }
448 
449     public boolean isThemeJsFastLoad() {
450         return _themeJsFastLoad;
451     }
452 
453     public void setThemeJsFastLoad(boolean themeJsFastLoad) {
454         _themeJsFastLoad = themeJsFastLoad;
455     }
456 
457     public boolean isFreeformLayout() {
458         return _freeformLayout;
459     }
460 
461     public void setFreeformLayout(boolean freeformLayout) {
462         _freeformLayout = freeformLayout;
463     }
464 
465     public String getServerName() {
466         return _serverName;
467     }
468 
469     public void setServerName(String serverName) {
470         _serverName = serverName;
471     }
472 
473     public int getServerPort() {
474         return _serverPort;
475     }
476 
477     public void setServerPort(int serverPort) {
478         _serverPort = serverPort;
479     }
480 
481     public boolean isSecure() {
482         return _secure;
483     }
484 
485     public void setSecure(boolean secure) {
486         _secure = secure;
487     }
488 
489     public String getLifecycle() {
490         return _lifecycle;
491     }
492 
493     public void setLifecycle(String lifecycle) {
494         _lifecycle = lifecycle;
495     }
496 
497     public boolean isLifecycleAction() {
498         return _lifecycleAction;
499     }
500 
501     public void setLifecycleAction(boolean lifecycleAction) {
502         _lifecycleAction = lifecycleAction;
503     }
504 
505     public boolean isLifecycleRender() {
506         return _lifecycleRender;
507     }
508 
509     public void setLifecycleRender(boolean lifecycleRender) {
510         _lifecycleRender = lifecycleRender;
511     }
512 
513     public boolean isLifecycleResource() {
514         return _lifecycleResource;
515     }
516 
517     public void setLifecycleResource(boolean lifecycleResource) {
518         _lifecycleResource = lifecycleResource;
519     }
520 
521     public boolean isStateExclusive() {
522         return _stateExclusive;
523     }
524 
525     public void setStateExclusive(boolean stateExclusive) {
526         _stateExclusive = stateExclusive;
527     }
528 
529     public boolean isStateMaximized() {
530         return _stateMaximized;
531     }
532 
533     public void setStateMaximized(boolean stateMaximized) {
534         _stateMaximized = stateMaximized;
535     }
536 
537     public boolean isStatePopUp() {
538         return _statePopUp;
539     }
540 
541     public void setStatePopUp(boolean statePopUp) {
542         _statePopUp = statePopUp;
543     }
544 
545     public boolean isFacebook() {
546         return _facebook;
547     }
548 
549     public String getFacebookCanvasPageURL() {
550         return _facebookCanvasPageURL;
551     }
552 
553     public void setFacebookCanvasPageURL(String facebookCanvasPageURL) {
554         _facebookCanvasPageURL = facebookCanvasPageURL;
555 
556         if (Validator.isNotNull(facebookCanvasPageURL)) {
557             _facebook = true;
558         }
559     }
560 
561     public boolean isWidget() {
562         return _widget;
563     }
564 
565     public void setWidget(boolean widget) {
566         _widget = widget;
567     }
568 
569     public String getCDNHost() {
570         return _cdnHost;
571     }
572 
573     public void setCDNHost(String cdnHost) {
574         _cdnHost = cdnHost;
575     }
576 
577     public String getPortalURL() {
578         return _portalURL;
579     }
580 
581     public void setPortalURL(String portalURL) {
582         _portalURL = portalURL;
583     }
584 
585     public String getPathApplet() {
586         return _pathApplet;
587     }
588 
589     public void setPathApplet(String pathApplet) {
590         _pathApplet = pathApplet;
591     }
592 
593     public String getPathCms() {
594         return _pathCms;
595     }
596 
597     public void setPathCms(String pathCms) {
598         _pathCms = pathCms;
599     }
600 
601     public String getPathColorSchemeImages() {
602         return _pathColorSchemeImages;
603     }
604 
605     public void setPathColorSchemeImages(String pathColorSchemeImages) {
606         _pathColorSchemeImages = pathColorSchemeImages;
607     }
608 
609     public String getPathContext() {
610         return _pathContext;
611     }
612 
613     public void setPathContext(String pathContext) {
614         _pathContext = pathContext;
615     }
616 
617     public String getPathFlash() {
618         return _pathFlash;
619     }
620 
621     public void setPathFlash(String pathFlash) {
622         _pathFlash = pathFlash;
623     }
624 
625     public String getPathFriendlyURLPrivateGroup() {
626         return _pathFriendlyURLPrivateGroup;
627     }
628 
629     public void setPathFriendlyURLPrivateGroup(
630         String pathFriendlyURLPrivateGroup) {
631 
632         _pathFriendlyURLPrivateGroup = pathFriendlyURLPrivateGroup;
633     }
634 
635     public String getPathFriendlyURLPrivateUser() {
636         return _pathFriendlyURLPrivateUser;
637     }
638 
639     public void setPathFriendlyURLPrivateUser(
640         String pathFriendlyURLPrivateUser) {
641 
642         _pathFriendlyURLPrivateUser = pathFriendlyURLPrivateUser;
643     }
644 
645     public String getPathFriendlyURLPublic() {
646         return _pathFriendlyURLPublic;
647     }
648 
649     public void setPathFriendlyURLPublic(String pathFriendlyURLPublic) {
650         _pathFriendlyURLPublic = pathFriendlyURLPublic;
651     }
652 
653     public String getPathImage() {
654         return _pathImage;
655     }
656 
657     public void setPathImage(String pathImage) {
658         if (isFacebook() &&
659             !pathImage.startsWith(Http.HTTP_WITH_SLASH) &&
660             !pathImage.startsWith(Http.HTTPS_WITH_SLASH)) {
661 
662             pathImage = getPortalURL() + pathImage;
663         }
664 
665         _pathImage = pathImage;
666     }
667 
668     public String getPathJavaScript() {
669         return _pathJavaScript;
670     }
671 
672     public void setPathJavaScript(String pathJavaScript) {
673         _pathJavaScript = pathJavaScript;
674     }
675 
676     public String getPathMain() {
677         return _pathMain;
678     }
679 
680     public void setPathMain(String pathMain) {
681         _pathMain = pathMain;
682     }
683 
684     public String getPathSound() {
685         return _pathSound;
686     }
687 
688     public void setPathSound(String pathSound) {
689         _pathSound = pathSound;
690     }
691 
692     public String getPathThemeCss() {
693         return _pathThemeCss;
694     }
695 
696     public void setPathThemeCss(String pathThemeCss) {
697         _pathThemeCss = pathThemeCss;
698     }
699 
700     /**
701      * @deprecated Use <code>getPathThemeImages</code>.
702      */
703     public String getPathThemeImage() {
704         return getPathThemeImages();
705     }
706 
707     public String getPathThemeImages() {
708         return _pathThemeImages;
709     }
710 
711     public void setPathThemeImages(String pathThemeImages) {
712         _pathThemeImages = pathThemeImages;
713     }
714 
715     public String getPathThemeJavaScript() {
716         return _pathThemeJavaScript;
717     }
718 
719     public void setPathThemeJavaScript(String pathThemeJavaScript) {
720         _pathThemeJavaScript = pathThemeJavaScript;
721     }
722 
723     public String getPathThemeRoot() {
724         return _pathThemeRoot;
725     }
726 
727     public void setPathThemeRoot(String pathThemeRoot) {
728         _pathThemeRoot = pathThemeRoot;
729     }
730 
731     public String getPathThemeTemplates() {
732         return _pathThemeTemplates;
733     }
734 
735     public void setPathThemeTemplates(String pathThemeTemplates) {
736         _pathThemeTemplates = pathThemeTemplates;
737     }
738 
739     public boolean isShowAddContentIcon() {
740         return _showAddContentIcon;
741     }
742 
743     public void setShowAddContentIcon(boolean showAddContentIcon) {
744         _showAddContentIcon = showAddContentIcon;
745     }
746 
747     public boolean isShowControlPanelIcon() {
748         return _showControlPanelIcon;
749     }
750 
751     public void setShowControlPanelIcon(boolean showControlPanelIcon) {
752         _showControlPanelIcon = showControlPanelIcon;
753     }
754 
755     public boolean isShowHomeIcon() {
756         return _showHomeIcon;
757     }
758 
759     public void setShowHomeIcon(boolean showHomeIcon) {
760         _showHomeIcon = showHomeIcon;
761     }
762 
763     public boolean isShowLayoutTemplatesIcon() {
764         return _showLayoutTemplatesIcon;
765     }
766 
767     public void setShowLayoutTemplatesIcon(boolean showLayoutTemplatesIcon) {
768         _showLayoutTemplatesIcon = showLayoutTemplatesIcon;
769     }
770 
771     public boolean isShowMyAccountIcon() {
772         return _showMyAccountIcon;
773     }
774 
775     public void setShowMyAccountIcon(boolean showMyAccountIcon) {
776         _showMyAccountIcon = showMyAccountIcon;
777     }
778 
779     public boolean isShowPageSettingsIcon() {
780         return _showPageSettingsIcon;
781     }
782 
783     public void setShowPageSettingsIcon(boolean showPageSettingsIcon) {
784         _showPageSettingsIcon = showPageSettingsIcon;
785     }
786 
787     public boolean isShowPortalIcon() {
788         return _showPortalIcon;
789     }
790 
791     public void setShowPortalIcon(boolean showPortalIcon) {
792         _showPortalIcon = showPortalIcon;
793     }
794 
795     public boolean isShowSignInIcon() {
796         return _showSignInIcon;
797     }
798 
799     public void setShowSignInIcon(boolean showSignInIcon) {
800         _showSignInIcon = showSignInIcon;
801     }
802 
803     public boolean isShowSignOutIcon() {
804         return _showSignOutIcon;
805     }
806 
807     public void setShowSignOutIcon(boolean showSignOutIcon) {
808         _showSignOutIcon = showSignOutIcon;
809     }
810 
811     public boolean isShowStagingIcon() {
812         return _showStagingIcon;
813     }
814 
815     public void setShowStagingIcon(boolean showStagingIcon) {
816         _showStagingIcon = showStagingIcon;
817     }
818 
819     public String getURLAddContent() {
820         return _urlAddContent;
821     }
822 
823     public void setURLAddContent(String urlAddContent) {
824         _urlAddContent = urlAddContent;
825     }
826 
827     public String getURLControlPanel() {
828         return _urlControlPanel;
829     }
830 
831     public void setURLControlPanel(String urlControlPanel) {
832         _urlControlPanel = urlControlPanel;
833     }
834 
835     public PortletURL getURLCreateAccount() {
836         return _urlCreateAccount;
837     }
838 
839     public void setURLCreateAccount(PortletURL urlCreateAccount) {
840         _urlCreateAccount = urlCreateAccount;
841     }
842 
843     public String getURLCurrent() {
844         return _urlCurrent;
845     }
846 
847     public void setURLCurrent(String urlCurrent) {
848         _urlCurrent = urlCurrent;
849     }
850 
851     public String getURLHome() {
852         return _urlHome;
853     }
854 
855     public void setURLHome(String urlHome) {
856         _urlHome = urlHome;
857     }
858 
859     public String getURLLayoutTemplates() {
860         return _urlLayoutTemplates;
861     }
862 
863     public void setURLLayoutTemplates(String urlLayoutTemplates) {
864         _urlLayoutTemplates = urlLayoutTemplates;
865     }
866 
867     public PortletURL getURLMyAccount() {
868         return _urlMyAccount;
869     }
870 
871     public void setURLMyAccount(PortletURL urlMyAccount) {
872         _urlMyAccount = urlMyAccount;
873     }
874 
875     public PortletURL getURLPageSettings() {
876         return _urlPageSettings;
877     }
878 
879     public void setURLPageSettings(PortletURL urlPageSettings) {
880         _urlPageSettings = urlPageSettings;
881     }
882 
883     public String getURLPortal() {
884         return _urlPortal;
885     }
886 
887     public void setURLPortal(String urlPortal) {
888         _urlPortal = urlPortal;
889     }
890 
891     public PortletURL getURLPublishToLive() {
892         return _urlPublishToLive;
893     }
894 
895     public void setURLPublishToLive(PortletURL urlPublishToLive) {
896         _urlPublishToLive = urlPublishToLive;
897     }
898 
899     public String getURLSignIn() {
900         return _urlSignIn;
901     }
902 
903     public void setURLSignIn(String urlSignIn) {
904         _urlSignIn = urlSignIn;
905     }
906 
907     public String getURLSignOut() {
908         return _urlSignOut;
909     }
910 
911     public void setURLSignOut(String urlSignOut) {
912         _urlSignOut = urlSignOut;
913     }
914 
915     public PortletURL getURLUpdateManager() {
916         return _urlUpdateManager;
917     }
918 
919     public void setURLUpdateManager(PortletURL urlUpdateManager) {
920         _urlUpdateManager = urlUpdateManager;
921     }
922 
923     public String getTilesTitle() {
924         return _tilesTitle;
925     }
926 
927     public void setTilesTitle(String tilesTitle) {
928         _tilesTitle = tilesTitle;
929     }
930 
931     public String getTilesContent() {
932         return _tilesContent;
933     }
934 
935     public void setTilesContent(String tilesContent) {
936         _tilesContent = tilesContent;
937     }
938 
939     public boolean isTilesSelectable() {
940         return _tilesSelectable;
941     }
942 
943     public void setTilesSelectable(boolean tilesSelectable) {
944         _tilesSelectable = tilesSelectable;
945     }
946 
947     public boolean isIncludeCalendarJs() {
948         return _includeCalendarJs;
949     }
950 
951     public void setIncludeCalendarJs(boolean includeCalendarJs) {
952         _includeCalendarJs = includeCalendarJs;
953     }
954 
955     public boolean isIncludePortletCssJs() {
956         return _includePortletCssJs;
957     }
958 
959     public void setIncludePortletCssJs(boolean includePortletCssJs) {
960         _includePortletCssJs = includePortletCssJs;
961     }
962 
963     public boolean isIncludeServiceJs() {
964         return _includeServiceJs;
965     }
966 
967     public void setIncludeServiceJs(boolean includeServiceJs) {
968         _includeServiceJs = includeServiceJs;
969     }
970 
971     public boolean isIncludedJs(String js) {
972         String path = getPathJavaScript();
973 
974         if (isIncludeCalendarJs() &&
975             js.equals(path + "/calendar/calendar_stripped.js")) {
976 
977             return true;
978         }
979         else if (isIncludePortletCssJs() &&
980                  js.equals(path + "/liferay/portlet_css.js")) {
981 
982             return true;
983         }
984         else if (isIncludeServiceJs() &&
985                  js.equals(path + "/liferay/service.js")) {
986 
987             return true;
988         }
989         else {
990             return false;
991         }
992     }
993 
994     public PortletDisplay getPortletDisplay() {
995         return _portletDisplay;
996     }
997 
998     /*public void setPortletDisplay(PortletDisplay portletDisplay) {
999         _portletDisplay = portletDisplay;
1000    }*/
1001
1002    public void recycle() {
1003        if (_log.isDebugEnabled()) {
1004            _log.debug("Recycling instance " + hashCode());
1005        }
1006
1007        _company = null;
1008        _companyLogo = StringPool.BLANK;
1009        _companyLogoHeight = 0;
1010        _companyLogoWidth = 0;
1011        _realCompanyLogo = StringPool.BLANK;
1012        _realCompanyLogoHeight = 0;
1013        _realCompanyLogoWidth = 0;
1014        _account = null;
1015        _defaultUser = null;
1016        _user = null;
1017        _realUser = null;
1018        _doAsUserId = StringPool.BLANK;
1019        _doAsUserLanguageId = StringPool.BLANK;
1020        _doAsGroupId = 0;
1021        _refererPlid = 0;
1022        _layoutSetLogo = StringPool.BLANK;
1023        _layout = null;
1024        _layouts = null;
1025        _plid = 0;
1026        _layoutTypePortlet = null;
1027        _scopeGroup = null;
1028        _scopeGroupId = 0;
1029        _signedIn = false;
1030        _permissionChecker = null;
1031        _locale = null;
1032        _languageId = null;
1033        _i18n = false;
1034        _i18nLanguageId = null;
1035        _timeZone = null;
1036        _theme = null;
1037        _colorScheme = null;
1038        _themeCssFastLoad = false;
1039        _themeImagesFastLoad = false;
1040        _themeJsBarebone = false;
1041        _themeJsFastLoad = false;
1042        _freeformLayout = false;
1043        _serverName = StringPool.BLANK;
1044        _serverPort = 0;
1045        _secure = false;
1046        _lifecycle = StringPool.BLANK;
1047        _lifecycleAction = false;
1048        _lifecycleRender = false;
1049        _lifecycleResource = false;
1050        _stateExclusive = false;
1051        _stateMaximized = false;
1052        _statePopUp = false;
1053        _facebook = false;
1054        _facebookCanvasPageURL = StringPool.BLANK;
1055        _widget = false;
1056        _cdnHost = StringPool.BLANK;
1057        _portalURL = StringPool.BLANK;
1058        _pathApplet = StringPool.BLANK;
1059        _pathCms = StringPool.BLANK;
1060        _pathColorSchemeImages = StringPool.BLANK;
1061        _pathContext = StringPool.BLANK;
1062        _pathFlash = StringPool.BLANK;
1063        _pathFriendlyURLPrivateGroup = StringPool.BLANK;
1064        _pathFriendlyURLPrivateUser = StringPool.BLANK;
1065        _pathFriendlyURLPublic = StringPool.BLANK;
1066        _pathImage = StringPool.BLANK;
1067        _pathJavaScript = StringPool.BLANK;
1068        _pathMain = StringPool.BLANK;
1069        _pathSound = StringPool.BLANK;
1070        _pathThemeCss = StringPool.BLANK;
1071        _pathThemeImages = StringPool.BLANK;
1072        _pathThemeJavaScript = StringPool.BLANK;
1073        _pathThemeRoot = StringPool.BLANK;
1074        _pathThemeTemplates = StringPool.BLANK;
1075        _showAddContentIcon = false;
1076        _showControlPanelIcon = false;
1077        _showHomeIcon = false;
1078        _showLayoutTemplatesIcon = false;
1079        _showMyAccountIcon = false;
1080        _showPageSettingsIcon = false;
1081        _showPortalIcon = false;
1082        _showSignInIcon = false;
1083        _showSignOutIcon = false;
1084        _showStagingIcon = false;
1085        _urlAddContent = StringPool.BLANK;
1086        _urlControlPanel = StringPool.BLANK;
1087        _urlCreateAccount = null;
1088        _urlCurrent = StringPool.BLANK;
1089        _urlHome = StringPool.BLANK;
1090        _urlLayoutTemplates = StringPool.BLANK;
1091        _urlMyAccount = null;
1092        _urlPageSettings = null;
1093        _urlPortal = StringPool.BLANK;
1094        _urlPublishToLive = null;
1095        _urlSignIn = StringPool.BLANK;
1096        _urlSignOut = StringPool.BLANK;
1097        _urlUpdateManager = null;
1098        _tilesTitle = StringPool.BLANK;
1099        _tilesContent = StringPool.BLANK;
1100        _tilesSelectable = false;
1101        _includeCalendarJs = false;
1102        _includePortletCssJs = false;
1103        _includeServiceJs = false;
1104        _portletDisplay.recycle();
1105    }
1106
1107    private static Log _log = LogFactoryUtil.getLog(ThemeDisplay.class);
1108
1109    private Company _company;
1110    private String _companyLogo = StringPool.BLANK;
1111    private int _companyLogoHeight;
1112    private int _companyLogoWidth;
1113    private String _realCompanyLogo = StringPool.BLANK;
1114    private int _realCompanyLogoHeight;
1115    private int _realCompanyLogoWidth;
1116    private Account _account;
1117    private User _defaultUser;
1118    private User _user;
1119    private User _realUser;
1120    private String _doAsUserId = StringPool.BLANK;
1121    private String _doAsUserLanguageId = StringPool.BLANK;
1122    private long _doAsGroupId = 0;
1123    private long _refererPlid;
1124    private Contact _contact;
1125    private String _layoutSetLogo = StringPool.BLANK;
1126    private Layout _layout;
1127    private List<Layout> _layouts;
1128    private long _plid;
1129    private LayoutTypePortlet _layoutTypePortlet;
1130    private Group _scopeGroup;
1131    private long _scopeGroupId;
1132    private boolean _signedIn;
1133    private transient PermissionChecker _permissionChecker;
1134    private Locale _locale;
1135    private String _languageId;
1136    private boolean _i18n;
1137    private String _i18nLanguageId;
1138    private TimeZone _timeZone;
1139    private Theme _theme;
1140    private ColorScheme _colorScheme;
1141    private boolean _themeCssFastLoad;
1142    private boolean _themeImagesFastLoad;
1143    private boolean _themeJsBarebone;
1144    private boolean _themeJsFastLoad;
1145    private boolean _freeformLayout;
1146    private String _serverName;
1147    private int _serverPort;
1148    private boolean _secure;
1149    private String _lifecycle;
1150    private boolean _lifecycleAction;
1151    private boolean _lifecycleRender;
1152    private boolean _lifecycleResource;
1153    private boolean _stateExclusive;
1154    private boolean _stateMaximized;
1155    private boolean _statePopUp;
1156    private boolean _facebook;
1157    private String _facebookCanvasPageURL;
1158    private boolean _widget;
1159    private String _cdnHost = StringPool.BLANK;
1160    private String _portalURL = StringPool.BLANK;
1161    private String _pathApplet = StringPool.BLANK;
1162    private String _pathCms = StringPool.BLANK;
1163    private String _pathColorSchemeImages = StringPool.BLANK;
1164    private String _pathContext = StringPool.BLANK;
1165    private String _pathFlash = StringPool.BLANK;
1166    private String _pathFriendlyURLPrivateGroup = StringPool.BLANK;
1167    private String _pathFriendlyURLPrivateUser = StringPool.BLANK;
1168    private String _pathFriendlyURLPublic = StringPool.BLANK;
1169    private String _pathImage = StringPool.BLANK;
1170    private String _pathJavaScript = StringPool.BLANK;
1171    private String _pathMain = StringPool.BLANK;
1172    private String _pathSound = StringPool.BLANK;
1173    private String _pathThemeCss = StringPool.BLANK;
1174    private String _pathThemeImages = StringPool.BLANK;
1175    private String _pathThemeJavaScript = StringPool.BLANK;
1176    private String _pathThemeRoot = StringPool.BLANK;
1177    private String _pathThemeTemplates = StringPool.BLANK;
1178    private boolean _showAddContentIcon;
1179    private boolean _showControlPanelIcon;
1180    private boolean _showHomeIcon;
1181    private boolean _showLayoutTemplatesIcon;
1182    private boolean _showMyAccountIcon;
1183    private boolean _showPageSettingsIcon;
1184    private boolean _showPortalIcon;
1185    private boolean _showSignInIcon;
1186    private boolean _showSignOutIcon;
1187    private boolean _showStagingIcon;
1188    private String _urlAddContent = StringPool.BLANK;
1189    private String _urlControlPanel = StringPool.BLANK;
1190    private transient PortletURL _urlCreateAccount = null;
1191    private String _urlCurrent = StringPool.BLANK;
1192    private String _urlHome = StringPool.BLANK;
1193    private String _urlLayoutTemplates = StringPool.BLANK;
1194    private transient PortletURL _urlMyAccount = null;
1195    private transient PortletURL _urlPageSettings = null;
1196    private String _urlPortal = StringPool.BLANK;
1197    private transient PortletURL _urlPublishToLive = null;
1198    private String _urlSignIn = StringPool.BLANK;
1199    private String _urlSignOut = StringPool.BLANK;
1200    private transient PortletURL _urlUpdateManager = null;
1201    private String _tilesTitle = StringPool.BLANK;
1202    private String _tilesContent = StringPool.BLANK;
1203    private boolean _tilesSelectable;
1204    private boolean _includeCalendarJs;
1205    private boolean _includePortletCssJs;
1206    private boolean _includeServiceJs;
1207    private PortletDisplay _portletDisplay = new PortletDisplay();
1208
1209}