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