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