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