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