Example usage for com.liferay.portal.kernel.theme ThemeDisplay getThemeSetting

List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getThemeSetting

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.theme ThemeDisplay getThemeSetting.

Prototype

public String getThemeSetting(String key) 

Source Link

Document

Returns the theme's configurable settings, which are declared in liferay-look-and-feel.xml and are configurable in the user interface.

Usage

From source file:com.liferay.portlet.configuration.icon.maximize.internal.MaximizePortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    if (!GetterUtil.getBoolean(themeDisplay.getThemeSetting("show-maximize-minimize-application-links"))) {

        return false;
    }//from w w  w.ja va2s. c  om

    Layout layout = themeDisplay.getLayout();

    if (!layout.isTypePortlet()) {
        return false;
    }

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    LayoutTypeController layoutTypeController = layoutTypePortlet.getLayoutTypeController();

    if (layoutTypeController.isFullPageDisplayable()) {
        return false;
    }

    Portlet portlet = (Portlet) portletRequest.getAttribute(WebKeys.RENDER_PORTLET);

    if (!portlet.hasWindowState(portletRequest.getResponseContentType(), WindowState.MAXIMIZED)) {

        return false;
    }

    Group group = themeDisplay.getScopeGroup();

    if (!themeDisplay.isSignedIn() || (group.hasStagingGroup() && !group.isStagingGroup())
            || !hasUpdateLayoutPermission(themeDisplay)) {

        if (!PropsValues.LAYOUT_GUEST_SHOW_MAX_ICON) {
            return false;
        }
    }

    return true;
}

From source file:com.liferay.portlet.configuration.icon.minimize.internal.MinimizePortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    if (!GetterUtil.getBoolean(themeDisplay.getThemeSetting("show-maximize-minimize-application-links"))) {

        return false;
    }/*w ww .j a v  a2  s.co  m*/

    Layout layout = themeDisplay.getLayout();

    if (!layout.isTypePortlet()) {
        return false;
    }

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    LayoutTypeController layoutTypeController = layoutTypePortlet.getLayoutTypeController();

    if (layoutTypeController.isFullPageDisplayable()) {
        return false;
    }

    Portlet portlet = (Portlet) portletRequest.getAttribute(WebKeys.RENDER_PORTLET);

    if (!portlet.hasWindowState(portletRequest.getResponseContentType(), WindowState.MINIMIZED)) {

        return false;
    }

    Group group = themeDisplay.getScopeGroup();

    if (!themeDisplay.isSignedIn() || (group.hasStagingGroup() && !group.isStagingGroup())
            || !hasUpdateLayoutPermission(themeDisplay)) {

        if (!PropsValues.LAYOUT_GUEST_SHOW_MIN_ICON) {
            return false;
        }
    }

    return true;
}