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