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