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