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