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