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