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