1   /**
2    * Copyright (c) 2000-2009 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     /**
239      * @deprecated Use <code>getScopeGroupId</code>.
240      */
241     public long getPortletGroupId() {
242         return getScopeGroupId();
243     }
244 
245     public long getScopeGroupId() {
246         return _scopeGroupId;
247     }
248 
249     public void setScopeGroupId(long scopeGroupId) {
250         _scopeGroupId = scopeGroupId;
251     }
252 
253     public boolean isSignedIn() {
254         return _signedIn;
255     }
256 
257     public void setSignedIn(boolean signedIn) {
258         _signedIn = signedIn;
259     }
260 
261     public PermissionChecker getPermissionChecker() {
262         return _permissionChecker;
263     }
264 
265     public void setPermissionChecker(PermissionChecker permissionChecker) {
266         _permissionChecker = permissionChecker;
267     }
268 
269     public Locale getLocale() {
270         return _locale;
271     }
272 
273     public void setLocale(Locale locale) {
274         _locale = locale;
275     }
276 
277     public String getLanguageId() {
278         return _languageId;
279     }
280 
281     public void setLanguageId(String languageId) {
282         _languageId = languageId;
283     }
284 
285     public boolean isI18n() {
286         return _i18n;
287     }
288 
289     public String getI18nLanguageId() {
290         return _i18nLanguageId;
291     }
292 
293     public void setI18nLanguageId(String i18nLanguageId) {
294         _i18nLanguageId = i18nLanguageId;
295 
296         if (Validator.isNotNull(i18nLanguageId)) {
297             _i18n = true;
298         }
299     }
300 
301     public String getI18nPath() {
302         return _i18nPath;
303     }
304 
305     public void setI18nPath(String i18nPath) {
306         _i18nPath = i18nPath;
307 
308         if (Validator.isNotNull(i18nPath)) {
309             _i18n = true;
310         }
311     }
312 
313     public String translate(String key) {
314         return LanguageUtil.get(getCompanyId(), getLocale(), key);
315     }
316 
317     public String translate(String pattern, Object argument) {
318         return LanguageUtil.format(
319             getCompanyId(), getLocale(), pattern, argument);
320     }
321 
322     public String translate(String pattern, Object[] arguments) {
323         return LanguageUtil.format(
324             getCompanyId(), getLocale(), pattern, arguments);
325     }
326 
327     public TimeZone getTimeZone() {
328         return _timeZone;
329     }
330 
331     public void setTimeZone(TimeZone timeZone) {
332         _timeZone = timeZone;
333     }
334 
335     public Theme getTheme() {
336         return _theme;
337     }
338 
339     public String getThemeId() {
340         return _theme.getThemeId();
341     }
342 
343     public ColorScheme getColorScheme() {
344         return _colorScheme;
345     }
346 
347     public String getColorSchemeId() {
348         return _colorScheme.getColorSchemeId();
349     }
350 
351     public boolean isWapTheme() {
352         return _theme.isWapTheme();
353     }
354 
355     public void setLookAndFeel(Theme theme, ColorScheme colorScheme) {
356         setLookAndFeel(getPathContext(), theme, colorScheme);
357     }
358 
359     public void setLookAndFeel(
360         String contextPath, Theme theme, ColorScheme colorScheme) {
361 
362         _theme = theme;
363         _colorScheme = colorScheme;
364 
365         if ((theme != null) && (colorScheme != null)) {
366             String themeContextPath = contextPath;
367 
368             if (theme.isWARFile()) {
369                 themeContextPath = theme.getContextPath();
370             }
371 
372             String host = getCDNHost();
373 
374             if (Validator.isNull(host) && isFacebook()) {
375                 host = getPortalURL();
376             }
377 
378             setPathColorSchemeImages(
379                 host + themeContextPath +
380                     colorScheme.getColorSchemeImagesPath());
381 
382             setPathThemeCss(host + themeContextPath + theme.getCssPath());
383             setPathThemeImages(host + themeContextPath + theme.getImagesPath());
384             setPathThemeJavaScript(
385                 host + themeContextPath + theme.getJavaScriptPath());
386             setPathThemeRoot(themeContextPath + theme.getRootPath());
387             setPathThemeTemplates(
388                 host + themeContextPath + theme.getTemplatesPath());
389         }
390     }
391 
392     public boolean isThemeCssFastLoad() {
393         return _themeCssFastLoad;
394     }
395 
396     public void setThemeCssFastLoad(boolean themeCssFastLoad) {
397         _themeCssFastLoad = themeCssFastLoad;
398     }
399 
400     public boolean isThemeImagesFastLoad() {
401         return _themeImagesFastLoad;
402     }
403 
404     public void setThemeImagesFastLoad(boolean themeImagesFastLoad) {
405         _themeImagesFastLoad = themeImagesFastLoad;
406     }
407 
408     public boolean isThemeJsBarebone() {
409         return _themeJsBarebone;
410     }
411 
412     public void setThemeJsBarebone(boolean themeJsBarebone) {
413         _themeJsBarebone = themeJsBarebone;
414     }
415 
416     public boolean isThemeJsFastLoad() {
417         return _themeJsFastLoad;
418     }
419 
420     public void setThemeJsFastLoad(boolean themeJsFastLoad) {
421         _themeJsFastLoad = themeJsFastLoad;
422     }
423 
424     public boolean isFreeformLayout() {
425         return _freeformLayout;
426     }
427 
428     public void setFreeformLayout(boolean freeformLayout) {
429         _freeformLayout = freeformLayout;
430     }
431 
432     public String getServerName() {
433         return _serverName;
434     }
435 
436     public void setServerName(String serverName) {
437         _serverName = serverName;
438     }
439 
440     public int getServerPort() {
441         return _serverPort;
442     }
443 
444     public void setServerPort(int serverPort) {
445         _serverPort = serverPort;
446     }
447 
448     public boolean isSecure() {
449         return _secure;
450     }
451 
452     public void setSecure(boolean secure) {
453         _secure = secure;
454     }
455 
456     public String getLifecycle() {
457         return _lifecycle;
458     }
459 
460     public void setLifecycle(String lifecycle) {
461         _lifecycle = lifecycle;
462     }
463 
464     public boolean isLifecycleAction() {
465         return _lifecycleAction;
466     }
467 
468     public void setLifecycleAction(boolean lifecycleAction) {
469         _lifecycleAction = lifecycleAction;
470     }
471 
472     public boolean isLifecycleRender() {
473         return _lifecycleRender;
474     }
475 
476     public void setLifecycleRender(boolean lifecycleRender) {
477         _lifecycleRender = lifecycleRender;
478     }
479 
480     public boolean isLifecycleResource() {
481         return _lifecycleResource;
482     }
483 
484     public void setLifecycleResource(boolean lifecycleResource) {
485         _lifecycleResource = lifecycleResource;
486     }
487 
488     public boolean isStateExclusive() {
489         return _stateExclusive;
490     }
491 
492     public void setStateExclusive(boolean stateExclusive) {
493         _stateExclusive = stateExclusive;
494     }
495 
496     public boolean isStateMaximized() {
497         return _stateMaximized;
498     }
499 
500     public void setStateMaximized(boolean stateMaximized) {
501         _stateMaximized = stateMaximized;
502     }
503 
504     public boolean isStatePopUp() {
505         return _statePopUp;
506     }
507 
508     public void setStatePopUp(boolean statePopUp) {
509         _statePopUp = statePopUp;
510     }
511 
512     public boolean isFacebook() {
513         return _facebook;
514     }
515 
516     public String getFacebookCanvasPageURL() {
517         return _facebookCanvasPageURL;
518     }
519 
520     public void setFacebookCanvasPageURL(String facebookCanvasPageURL) {
521         _facebookCanvasPageURL = facebookCanvasPageURL;
522 
523         if (Validator.isNotNull(facebookCanvasPageURL)) {
524             _facebook = true;
525         }
526     }
527 
528     public boolean isWidget() {
529         return _widget;
530     }
531 
532     public void setWidget(boolean widget) {
533         _widget = widget;
534     }
535 
536     public String getCDNHost() {
537         return _cdnHost;
538     }
539 
540     public void setCDNHost(String cdnHost) {
541         _cdnHost = cdnHost;
542     }
543 
544     public String getPortalURL() {
545         return _portalURL;
546     }
547 
548     public void setPortalURL(String portalURL) {
549         _portalURL = portalURL;
550     }
551 
552     public String getPathApplet() {
553         return _pathApplet;
554     }
555 
556     public void setPathApplet(String pathApplet) {
557         _pathApplet = pathApplet;
558     }
559 
560     public String getPathCms() {
561         return _pathCms;
562     }
563 
564     public void setPathCms(String pathCms) {
565         _pathCms = pathCms;
566     }
567 
568     public String getPathColorSchemeImages() {
569         return _pathColorSchemeImages;
570     }
571 
572     public void setPathColorSchemeImages(String pathColorSchemeImages) {
573         _pathColorSchemeImages = pathColorSchemeImages;
574     }
575 
576     public String getPathContext() {
577         return _pathContext;
578     }
579 
580     public void setPathContext(String pathContext) {
581         _pathContext = pathContext;
582     }
583 
584     public String getPathFlash() {
585         return _pathFlash;
586     }
587 
588     public void setPathFlash(String pathFlash) {
589         _pathFlash = pathFlash;
590     }
591 
592     public String getPathFriendlyURLPrivateGroup() {
593         return _pathFriendlyURLPrivateGroup;
594     }
595 
596     public void setPathFriendlyURLPrivateGroup(
597         String pathFriendlyURLPrivateGroup) {
598 
599         _pathFriendlyURLPrivateGroup = pathFriendlyURLPrivateGroup;
600     }
601 
602     public String getPathFriendlyURLPrivateUser() {
603         return _pathFriendlyURLPrivateUser;
604     }
605 
606     public void setPathFriendlyURLPrivateUser(
607         String pathFriendlyURLPrivateUser) {
608 
609         _pathFriendlyURLPrivateUser = pathFriendlyURLPrivateUser;
610     }
611 
612     public String getPathFriendlyURLPublic() {
613         return _pathFriendlyURLPublic;
614     }
615 
616     public void setPathFriendlyURLPublic(String pathFriendlyURLPublic) {
617         _pathFriendlyURLPublic = pathFriendlyURLPublic;
618     }
619 
620     public String getPathImage() {
621         return _pathImage;
622     }
623 
624     public void setPathImage(String pathImage) {
625         if (isFacebook() &&
626             !pathImage.startsWith(Http.HTTP_WITH_SLASH) &&
627             !pathImage.startsWith(Http.HTTPS_WITH_SLASH)) {
628 
629             pathImage = getPortalURL() + pathImage;
630         }
631 
632         _pathImage = pathImage;
633     }
634 
635     public String getPathJavaScript() {
636         return _pathJavaScript;
637     }
638 
639     public void setPathJavaScript(String pathJavaScript) {
640         _pathJavaScript = pathJavaScript;
641     }
642 
643     public String getPathMain() {
644         return _pathMain;
645     }
646 
647     public void setPathMain(String pathMain) {
648         _pathMain = pathMain;
649     }
650 
651     public String getPathSound() {
652         return _pathSound;
653     }
654 
655     public void setPathSound(String pathSound) {
656         _pathSound = pathSound;
657     }
658 
659     public String getPathThemeCss() {
660         return _pathThemeCss;
661     }
662 
663     public void setPathThemeCss(String pathThemeCss) {
664         _pathThemeCss = pathThemeCss;
665     }
666 
667     /**
668      * @deprecated Use <code>getPathThemeImages</code>.
669      */
670     public String getPathThemeImage() {
671         return getPathThemeImages();
672     }
673 
674     public String getPathThemeImages() {
675         return _pathThemeImages;
676     }
677 
678     public void setPathThemeImages(String pathThemeImages) {
679         _pathThemeImages = pathThemeImages;
680     }
681 
682     public String getPathThemeJavaScript() {
683         return _pathThemeJavaScript;
684     }
685 
686     public void setPathThemeJavaScript(String pathThemeJavaScript) {
687         _pathThemeJavaScript = pathThemeJavaScript;
688     }
689 
690     public String getPathThemeRoot() {
691         return _pathThemeRoot;
692     }
693 
694     public void setPathThemeRoot(String pathThemeRoot) {
695         _pathThemeRoot = pathThemeRoot;
696     }
697 
698     public String getPathThemeTemplates() {
699         return _pathThemeTemplates;
700     }
701 
702     public void setPathThemeTemplates(String pathThemeTemplates) {
703         _pathThemeTemplates = pathThemeTemplates;
704     }
705 
706     public boolean isShowAddContentIcon() {
707         return _showAddContentIcon;
708     }
709 
710     public void setShowAddContentIcon(boolean showAddContentIcon) {
711         _showAddContentIcon = showAddContentIcon;
712     }
713 
714     public boolean isShowHomeIcon() {
715         return _showHomeIcon;
716     }
717 
718     public void setShowHomeIcon(boolean showHomeIcon) {
719         _showHomeIcon = showHomeIcon;
720     }
721 
722     public boolean isShowLayoutTemplatesIcon() {
723         return _showLayoutTemplatesIcon;
724     }
725 
726     public void setShowLayoutTemplatesIcon(boolean showLayoutTemplatesIcon) {
727         _showLayoutTemplatesIcon = showLayoutTemplatesIcon;
728     }
729 
730     public boolean isShowMyAccountIcon() {
731         return _showMyAccountIcon;
732     }
733 
734     public void setShowMyAccountIcon(boolean showMyAccountIcon) {
735         _showMyAccountIcon = showMyAccountIcon;
736     }
737 
738     public boolean isShowPageSettingsIcon() {
739         return _showPageSettingsIcon;
740     }
741 
742     public void setShowPageSettingsIcon(boolean showPageSettingsIcon) {
743         _showPageSettingsIcon = showPageSettingsIcon;
744     }
745 
746     public boolean isShowPortalIcon() {
747         return _showPortalIcon;
748     }
749 
750     public void setShowPortalIcon(boolean showPortalIcon) {
751         _showPortalIcon = showPortalIcon;
752     }
753 
754     public boolean isShowSignInIcon() {
755         return _showSignInIcon;
756     }
757 
758     public void setShowSignInIcon(boolean showSignInIcon) {
759         _showSignInIcon = showSignInIcon;
760     }
761 
762     public boolean isShowSignOutIcon() {
763         return _showSignOutIcon;
764     }
765 
766     public void setShowSignOutIcon(boolean showSignOutIcon) {
767         _showSignOutIcon = showSignOutIcon;
768     }
769 
770     public boolean isShowStagingIcon() {
771         return _showStagingIcon;
772     }
773 
774     public void setShowStagingIcon(boolean showStagingIcon) {
775         _showStagingIcon = showStagingIcon;
776     }
777 
778     public String getURLAddContent() {
779         return _urlAddContent;
780     }
781 
782     public void setURLAddContent(String urlAddContent) {
783         _urlAddContent = urlAddContent;
784     }
785 
786     public PortletURL getURLCreateAccount() {
787         return _urlCreateAccount;
788     }
789 
790     public void setURLCreateAccount(PortletURL urlCreateAccount) {
791         _urlCreateAccount = urlCreateAccount;
792     }
793 
794     public String getURLCurrent() {
795         return _urlCurrent;
796     }
797 
798     public void setURLCurrent(String urlCurrent) {
799         _urlCurrent = urlCurrent;
800     }
801 
802     public String getURLHome() {
803         return _urlHome;
804     }
805 
806     public void setURLHome(String urlHome) {
807         _urlHome = urlHome;
808     }
809 
810     public String getURLLayoutTemplates() {
811         return _urlLayoutTemplates;
812     }
813 
814     public void setURLLayoutTemplates(String urlLayoutTemplates) {
815         _urlLayoutTemplates = urlLayoutTemplates;
816     }
817 
818     public PortletURL getURLMyAccount() {
819         return _urlMyAccount;
820     }
821 
822     public void setURLMyAccount(PortletURL urlMyAccount) {
823         _urlMyAccount = urlMyAccount;
824     }
825 
826     public PortletURL getURLPageSettings() {
827         return _urlPageSettings;
828     }
829 
830     public void setURLPageSettings(PortletURL urlPageSettings) {
831         _urlPageSettings = urlPageSettings;
832     }
833 
834     public String getURLPortal() {
835         return _urlPortal;
836     }
837 
838     public void setURLPortal(String urlPortal) {
839         _urlPortal = urlPortal;
840     }
841 
842     public PortletURL getURLPublishToLive() {
843         return _urlPublishToLive;
844     }
845 
846     public void setURLPublishToLive(PortletURL urlPublishToLive) {
847         _urlPublishToLive = urlPublishToLive;
848     }
849 
850     public String getURLSignIn() {
851         return _urlSignIn;
852     }
853 
854     public void setURLSignIn(String urlSignIn) {
855         _urlSignIn = urlSignIn;
856     }
857 
858     public String getURLSignOut() {
859         return _urlSignOut;
860     }
861 
862     public void setURLSignOut(String urlSignOut) {
863         _urlSignOut = urlSignOut;
864     }
865 
866     public PortletURL getURLUpdateManager() {
867         return _urlUpdateManager;
868     }
869 
870     public void setURLUpdateManager(PortletURL urlUpdateManager) {
871         _urlUpdateManager = urlUpdateManager;
872     }
873 
874     public String getTilesTitle() {
875         return _tilesTitle;
876     }
877 
878     public void setTilesTitle(String tilesTitle) {
879         _tilesTitle = tilesTitle;
880     }
881 
882     public String getTilesContent() {
883         return _tilesContent;
884     }
885 
886     public void setTilesContent(String tilesContent) {
887         _tilesContent = tilesContent;
888     }
889 
890     public boolean isTilesSelectable() {
891         return _tilesSelectable;
892     }
893 
894     public void setTilesSelectable(boolean tilesSelectable) {
895         _tilesSelectable = tilesSelectable;
896     }
897 
898     public boolean isIncludeCalendarJs() {
899         return _includeCalendarJs;
900     }
901 
902     public void setIncludeCalendarJs(boolean includeCalendarJs) {
903         _includeCalendarJs = includeCalendarJs;
904     }
905 
906     public boolean isIncludePortletCssJs() {
907         return _includePortletCssJs;
908     }
909 
910     public void setIncludePortletCssJs(boolean includePortletCssJs) {
911         _includePortletCssJs = includePortletCssJs;
912     }
913 
914     public boolean isIncludeServiceJs() {
915         return _includeServiceJs;
916     }
917 
918     public void setIncludeServiceJs(boolean includeServiceJs) {
919         _includeServiceJs = includeServiceJs;
920     }
921 
922     public boolean isIncludedJs(String js) {
923         String path = getPathJavaScript();
924 
925         if (isIncludeCalendarJs() &&
926             js.startsWith(path + "/calendar/calendar_stripped.js")) {
927 
928             return true;
929         }
930         else if (isIncludePortletCssJs() &&
931                  js.startsWith(path + "/liferay/portlet_css.js")) {
932 
933             return true;
934         }
935         else if (isIncludeServiceJs() &&
936                  js.startsWith(path + "/liferay/service.js")) {
937 
938             return true;
939         }
940         else {
941             return false;
942         }
943     }
944 
945     public PortletDisplay getPortletDisplay() {
946         return _portletDisplay;
947     }
948 
949     /*public void setPortletDisplay(PortletDisplay portletDisplay) {
950         _portletDisplay = portletDisplay;
951     }*/
952 
953     public void recycle() {
954         if (_log.isDebugEnabled()) {
955             _log.debug("Recycling instance " + hashCode());
956         }
957 
958         _company = null;
959         _companyLogo = StringPool.BLANK;
960         _companyLogoHeight = 0;
961         _companyLogoWidth = 0;
962         _realCompanyLogo = StringPool.BLANK;
963         _realCompanyLogoHeight = 0;
964         _realCompanyLogoWidth = 0;
965         _account = null;
966         _defaultUser = null;
967         _user = null;
968         _realUser = null;
969         _doAsUserId = StringPool.BLANK;
970         _layoutSetLogo = StringPool.BLANK;
971         _layout = null;
972         _layouts = null;
973         _plid = 0;
974         _layoutTypePortlet = null;
975         _scopeGroupId = 0;
976         _signedIn = false;
977         _permissionChecker = null;
978         _locale = null;
979         _languageId = null;
980         _i18n = false;
981         _i18nLanguageId = null;
982         _i18nPath = null;
983         _timeZone = null;
984         _theme = null;
985         _colorScheme = null;
986         _themeCssFastLoad = false;
987         _themeImagesFastLoad = false;
988         _themeJsBarebone = false;
989         _themeJsFastLoad = false;
990         _freeformLayout = false;
991         _serverName = StringPool.BLANK;
992         _serverPort = 0;
993         _secure = false;
994         _lifecycle = StringPool.BLANK;
995         _lifecycleAction = false;
996         _lifecycleRender = false;
997         _lifecycleResource = false;
998         _stateExclusive = false;
999         _stateMaximized = false;
1000        _statePopUp = false;
1001        _facebook = false;
1002        _facebookCanvasPageURL = StringPool.BLANK;
1003        _widget = false;
1004        _cdnHost = StringPool.BLANK;
1005        _portalURL = StringPool.BLANK;
1006        _pathApplet = StringPool.BLANK;
1007        _pathCms = StringPool.BLANK;
1008        _pathColorSchemeImages = StringPool.BLANK;
1009        _pathContext = StringPool.BLANK;
1010        _pathFlash = StringPool.BLANK;
1011        _pathFriendlyURLPrivateGroup = StringPool.BLANK;
1012        _pathFriendlyURLPrivateUser = StringPool.BLANK;
1013        _pathFriendlyURLPublic = StringPool.BLANK;
1014        _pathImage = StringPool.BLANK;
1015        _pathJavaScript = StringPool.BLANK;
1016        _pathMain = StringPool.BLANK;
1017        _pathSound = StringPool.BLANK;
1018        _pathThemeCss = StringPool.BLANK;
1019        _pathThemeImages = StringPool.BLANK;
1020        _pathThemeJavaScript = StringPool.BLANK;
1021        _pathThemeRoot = StringPool.BLANK;
1022        _pathThemeTemplates = StringPool.BLANK;
1023        _showAddContentIcon = false;
1024        _showHomeIcon = false;
1025        _showLayoutTemplatesIcon = false;
1026        _showMyAccountIcon = false;
1027        _showPageSettingsIcon = false;
1028        _showPortalIcon = false;
1029        _showSignInIcon = false;
1030        _showSignOutIcon = false;
1031        _showStagingIcon = false;
1032        _urlAddContent = StringPool.BLANK;
1033        _urlCreateAccount = null;
1034        _urlCurrent = StringPool.BLANK;
1035        _urlHome = StringPool.BLANK;
1036        _urlLayoutTemplates = StringPool.BLANK;
1037        _urlMyAccount = null;
1038        _urlPageSettings = null;
1039        _urlPortal = StringPool.BLANK;
1040        _urlPublishToLive = null;
1041        _urlSignIn = StringPool.BLANK;
1042        _urlSignOut = StringPool.BLANK;
1043        _urlUpdateManager = null;
1044        _tilesTitle = StringPool.BLANK;
1045        _tilesContent = StringPool.BLANK;
1046        _tilesSelectable = false;
1047        _includeCalendarJs = false;
1048        _includePortletCssJs = false;
1049        _includeServiceJs = false;
1050        _portletDisplay.recycle();
1051    }
1052
1053    private static Log _log = LogFactoryUtil.getLog(ThemeDisplay.class);
1054
1055    private Company _company;
1056    private String _companyLogo = StringPool.BLANK;
1057    private int _companyLogoHeight;
1058    private int _companyLogoWidth;
1059    private String _realCompanyLogo = StringPool.BLANK;
1060    private int _realCompanyLogoHeight;
1061    private int _realCompanyLogoWidth;
1062    private Account _account;
1063    private User _defaultUser;
1064    private User _user;
1065    private User _realUser;
1066    private String _doAsUserId = StringPool.BLANK;
1067    private Contact _contact;
1068    private String _layoutSetLogo = StringPool.BLANK;
1069    private Layout _layout;
1070    private List<Layout> _layouts;
1071    private long _plid;
1072    private LayoutTypePortlet _layoutTypePortlet;
1073    private long _scopeGroupId;
1074    private boolean _signedIn;
1075    private transient PermissionChecker _permissionChecker;
1076    private Locale _locale;
1077    private String _languageId;
1078    private boolean _i18n;
1079    private String _i18nLanguageId;
1080    private String _i18nPath;
1081    private TimeZone _timeZone;
1082    private Theme _theme;
1083    private ColorScheme _colorScheme;
1084    private boolean _themeCssFastLoad;
1085    private boolean _themeImagesFastLoad;
1086    private boolean _themeJsBarebone;
1087    private boolean _themeJsFastLoad;
1088    private boolean _freeformLayout;
1089    private String _serverName;
1090    private int _serverPort;
1091    private boolean _secure;
1092    private String _lifecycle;
1093    private boolean _lifecycleAction;
1094    private boolean _lifecycleRender;
1095    private boolean _lifecycleResource;
1096    private boolean _stateExclusive;
1097    private boolean _stateMaximized;
1098    private boolean _statePopUp;
1099    private boolean _facebook;
1100    private String _facebookCanvasPageURL;
1101    private boolean _widget;
1102    private String _cdnHost = StringPool.BLANK;
1103    private String _portalURL = StringPool.BLANK;
1104    private String _pathApplet = StringPool.BLANK;
1105    private String _pathCms = StringPool.BLANK;
1106    private String _pathColorSchemeImages = StringPool.BLANK;
1107    private String _pathContext = StringPool.BLANK;
1108    private String _pathFlash = StringPool.BLANK;
1109    private String _pathFriendlyURLPrivateGroup = StringPool.BLANK;
1110    private String _pathFriendlyURLPrivateUser = StringPool.BLANK;
1111    private String _pathFriendlyURLPublic = StringPool.BLANK;
1112    private String _pathImage = StringPool.BLANK;
1113    private String _pathJavaScript = StringPool.BLANK;
1114    private String _pathMain = StringPool.BLANK;
1115    private String _pathSound = StringPool.BLANK;
1116    private String _pathThemeCss = StringPool.BLANK;
1117    private String _pathThemeImages = StringPool.BLANK;
1118    private String _pathThemeJavaScript = StringPool.BLANK;
1119    private String _pathThemeRoot = StringPool.BLANK;
1120    private String _pathThemeTemplates = StringPool.BLANK;
1121    private boolean _showAddContentIcon;
1122    private boolean _showHomeIcon;
1123    private boolean _showLayoutTemplatesIcon;
1124    private boolean _showMyAccountIcon;
1125    private boolean _showPageSettingsIcon;
1126    private boolean _showPortalIcon;
1127    private boolean _showSignInIcon;
1128    private boolean _showSignOutIcon;
1129    private boolean _showStagingIcon;
1130    private String _urlAddContent = StringPool.BLANK;
1131    private transient PortletURL _urlCreateAccount = null;
1132    private String _urlCurrent = StringPool.BLANK;
1133    private String _urlHome = StringPool.BLANK;
1134    private String _urlLayoutTemplates = StringPool.BLANK;
1135    private transient PortletURL _urlMyAccount = null;
1136    private transient PortletURL _urlPageSettings = null;
1137    private String _urlPortal = StringPool.BLANK;
1138    private transient PortletURL _urlPublishToLive = null;
1139    private String _urlSignIn = StringPool.BLANK;
1140    private String _urlSignOut = StringPool.BLANK;
1141    private transient PortletURL _urlUpdateManager = null;
1142    private String _tilesTitle = StringPool.BLANK;
1143    private String _tilesContent = StringPool.BLANK;
1144    private boolean _tilesSelectable;
1145    private boolean _includeCalendarJs;
1146    private boolean _includePortletCssJs;
1147    private boolean _includeServiceJs;
1148    private PortletDisplay _portletDisplay = new PortletDisplay();
1149
1150}