List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getPortletDisplay
@JSON(include = false)
public PortletDisplay getPortletDisplay()
From source file:com.liferay.product.navigation.control.menu.web.internal.PortletHeaderProductNavigationControlMenuEntry.java
License:Open Source License
@Override public boolean includeIcon(HttpServletRequest request, HttpServletResponse response) throws IOException { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); request.setAttribute(ProductNavigationControlMenuWebKeys.PORTLET_DESCRIPTION, portletDisplay.getDescription()); request.setAttribute(ProductNavigationControlMenuWebKeys.PORTLET_TITLE, portletDisplay.getTitle()); return super.includeIcon(request, response); }
From source file:com.liferay.product.navigation.control.menu.web.internal.PortletHeaderProductNavigationControlMenuEntry.java
License:Open Source License
@Override public boolean isShow(HttpServletRequest request) throws PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); if (!layout.isTypeControlPanel()) { return false; }/*from w ww . j a va2s . c o m*/ PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); if (portletDisplay == null) { return false; } return super.isShow(request); }
From source file:com.liferay.product.navigation.product.menu.web.internal.product.navigation.control.menu.ProductMenuProductNavigationControlMenuEntry.java
License:Open Source License
@Override public boolean includeIcon(HttpServletRequest request, HttpServletResponse response) throws IOException { Map<String, String> values = new HashMap<>(); String portletNamespace = _portal .getPortletNamespace(ProductNavigationProductMenuPortletKeys.PRODUCT_NAVIGATION_PRODUCT_MENU); values.put("portletNamespace", portletNamespace); values.put("title", HtmlUtil.escape(LanguageUtil.get(request, "menu"))); String productMenuState = SessionClicks.get(request, ProductNavigationProductMenuWebKeys.PRODUCT_NAVIGATION_PRODUCT_MENU_STATE, "closed"); if (Objects.equals(productMenuState, "open")) { values.put("cssClass", "active"); values.put("dataURL", StringPool.BLANK); } else {//from w ww . ja v a 2s . c o m values.put("cssClass", StringPool.BLANK); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); PortletURL portletURL = PortletURLFactoryUtil.create(request, ProductNavigationProductMenuPortletKeys.PRODUCT_NAVIGATION_PRODUCT_MENU, RenderRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/portlet/product_menu.jsp"); portletURL.setParameter("selPpid", portletDisplay.getId()); try { portletURL.setWindowState(LiferayWindowState.EXCLUSIVE); } catch (WindowStateException wse) { ReflectionUtil.throwException(wse); } values.put("dataURL", "data-url='" + portletURL.toString() + "'"); } Writer writer = response.getWriter(); writer.write(StringUtil.replace(_TMPL_CONTENT, "${", "}", values)); return true; }
From source file:com.liferay.rss.web.internal.display.context.RSSDisplayContext.java
License:Open Source License
public RSSDisplayContext(HttpServletRequest request, RSSWebCacheConfiguration rssWebCacheConfiguration) throws ConfigurationException { _request = request;/*from w w w. j a va 2 s. co m*/ _rssWebCacheConfiguration = rssWebCacheConfiguration; ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); _rssPortletInstanceConfiguration = portletDisplay .getPortletInstanceConfiguration(RSSPortletInstanceConfiguration.class); }
From source file:com.liferay.site.navigation.breadcrumb.web.internal.display.context.SiteNavigationBreadcrumbDisplayContext.java
License:Open Source License
public SiteNavigationBreadcrumbDisplayContext(HttpServletRequest request) throws ConfigurationException { _request = request;/*from w w w.j av a 2 s . co m*/ ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); _siteNavigationBreadcrumbPortletInstanceConfiguration = portletDisplay .getPortletInstanceConfiguration(SiteNavigationBreadcrumbPortletInstanceConfiguration.class); }
From source file:com.liferay.site.navigation.directory.web.internal.display.context.SitesDirectoryDisplayContext.java
License:Open Source License
public SitesDirectoryDisplayContext(HttpServletRequest request) throws ConfigurationException { _request = request;/*from ww w. j av a 2 s . c om*/ ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); _sitesDirectoryPortletInstanceConfiguration = portletDisplay .getPortletInstanceConfiguration(SitesDirectoryPortletInstanceConfiguration.class); }
From source file:com.liferay.site.navigation.menu.web.internal.display.context.SiteNavigationMenuDisplayContext.java
License:Open Source License
public SiteNavigationMenuDisplayContext(HttpServletRequest request) throws ConfigurationException { _request = request;/*from www. j a va 2s. co m*/ ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); _siteNavigationMenuPortletInstanceConfiguration = portletDisplay .getPortletInstanceConfiguration(SiteNavigationMenuPortletInstanceConfiguration.class); }
From source file:com.liferay.site.navigation.menu.web.internal.display.context.SiteNavigationMenuDisplayContext.java
License:Open Source License
public String getEventName() { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); return portletDisplay.getNamespace() + "selectLayout"; }
From source file:com.liferay.site.navigation.menu.web.internal.portlet.contributor.SiteNavigationMenuPortletToolbarContributor.java
License:Open Source License
private MenuItem _createMenuItem(ThemeDisplay themeDisplay, PortletRequest portletRequest) throws Exception { URLMenuItem urlMenuItem = new URLMenuItem(); urlMenuItem.setLabel(LanguageUtil.get(_portal.getHttpServletRequest(portletRequest), "add-page")); PortletURL portletURL = PortletProviderUtil.getPortletURL(portletRequest, Layout.class.getName(), PortletProvider.Action.EDIT); portletURL.setParameter("mvcPath", "/add_layout.jsp"); portletURL.setParameter("groupId", String.valueOf(themeDisplay.getScopeGroupId())); Layout layout = themeDisplay.getLayout(); portletURL.setParameter("privateLayout", String.valueOf(layout.isPrivateLayout())); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); portletURL.setParameter("portletResource", portletDisplay.getPortletName()); urlMenuItem.setURL(portletURL.toString()); return urlMenuItem; }
From source file:com.liferay.staging.configuration.web.internal.portlet.configuration.icon.StagingPortletConfigurationIcon.java
License:Open Source License
@Override public String getOnClick(PortletRequest portletRequest, PortletResponse portletResponse) { StringBundler sb = new StringBundler(11); sb.append("Liferay.Portlet.openWindow({bodyCssClass: "); sb.append("'dialog-with-footer', namespace: '"); ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); sb.append(portletDisplay.getNamespace()); sb.append("', portlet: '#p_p_id_"); sb.append(portletDisplay.getId());//from w ww . j av a2 s .c o m sb.append("_', portletId: '"); sb.append(portletDisplay.getId()); sb.append("', title: '"); sb.append(LanguageUtil.get(themeDisplay.getLocale(), "staging")); sb.append("', uri: '"); sb.append(HtmlUtil.escapeJS(portletDisplay.getURLStaging())); sb.append("'}); return false;"); return sb.toString(); }