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