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

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

Introduction

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

Prototype

@JSON(include = false)
    public PortletDisplay getPortletDisplay() 

Source Link

Usage

From source file:com.liferay.portlet.configuration.sharing.web.internal.portlet.configuration.icon.WidgetPortletConfigurationIcon.java

License:Open Source License

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

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    PortletPreferences portletSetup = portletDisplay.getPortletSetup();

    boolean lfrWidgetShowAddAppLink = GetterUtil.getBoolean(
            portletSetup.getValue("lfrWidgetShowAddAppLink", null), PropsValues.THEME_PORTLET_SHARING_DEFAULT);

    if (lfrWidgetShowAddAppLink) {
        return true;
    }/*from   w w w  .ja v  a  2 s  . c o  m*/

    return false;
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.ConfigurationPortletConfigurationIcon.java

License:Open Source License

@Override
public String getOnClick(PortletRequest portletRequest, PortletResponse portletResponse) {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getURLConfigurationJS();
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.ConfigurationPortletConfigurationIcon.java

License:Open Source License

@Override
public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getURLConfiguration();
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.ConfigurationPortletConfigurationIcon.java

License:Open Source License

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

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.isShowConfigurationIcon();
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.ConfigurationTemplatesPortletConfigurationIcon.java

License:Open Source License

@Override
public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

    try {//from   w ww  .ja  v a2 s  .c  o  m
        String redirect = ParamUtil.getString(portletRequest, "redirect");
        String returnToFullPageURL = ParamUtil.getString(portletRequest, "returnToFullPageURL");

        PortletURL portletURL = PortletProviderUtil.getPortletURL(portletRequest,
                PortletConfigurationApplicationType.PortletConfiguration.CLASS_NAME,
                PortletProvider.Action.VIEW);

        portletURL.setParameter("mvcPath", "/edit_configuration_templates.jsp");
        portletURL.setParameter("redirect", redirect);
        portletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
        portletURL.setParameter("portletConfiguration", Boolean.TRUE.toString());

        ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        portletURL.setParameter("portletResource", portletDisplay.getId());

        portletURL.setWindowState(LiferayWindowState.POP_UP);

        return portletURL.toString();
    } catch (Exception e) {
    }

    return StringPool.BLANK;
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.ConfigurationTemplatesPortletConfigurationIcon.java

License:Open Source License

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

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    try {// ww w  .j  a  v a  2 s.  c  o m
        if (!GroupPermissionUtil.contains(permissionChecker, themeDisplay.getScopeGroupId(),
                ActionKeys.MANAGE_ARCHIVED_SETUPS)) {

            return false;
        }
    } catch (PortalException pe) {

        // LPS-52675

        if (_log.isDebugEnabled()) {
            _log.debug(pe, pe);
        }

        return false;
    }

    WindowState windowState = portletRequest.getWindowState();

    if (windowState.equals(LiferayWindowState.EXCLUSIVE)) {
        return false;
    }

    Layout layout = themeDisplay.getLayout();

    if (layout.isTypeControlPanel()) {
        return false;
    }

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.isShowConfigurationIcon();
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.PermissionsPortletConfigurationIcon.java

License:Open Source License

@Override
public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

    try {//from   w ww  .  j a  va2 s. c  om
        String returnToFullPageURL = ParamUtil.getString(portletRequest, "returnToFullPageURL");

        PortletURL portletURL = PortletProviderUtil.getPortletURL(portletRequest,
                PortletConfigurationApplicationType.PortletConfiguration.CLASS_NAME,
                PortletProvider.Action.VIEW);

        portletURL.setParameter("mvcPath", "/edit_permissions.jsp");
        portletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
        portletURL.setParameter("portletConfiguration", Boolean.TRUE.toString());

        ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        portletURL.setParameter("portletResource", portletDisplay.getId());
        portletURL.setParameter("resourcePrimKey",
                PortletPermissionUtil.getPrimaryKey(themeDisplay.getPlid(), portletDisplay.getId()));

        portletURL.setWindowState(LiferayWindowState.POP_UP);

        return portletURL.toString();
    } catch (Exception e) {
    }

    return StringPool.BLANK;
}

From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.PermissionsPortletConfigurationIcon.java

License:Open Source License

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

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String rootPortletId = portletDisplay.getRootPortletId();

    if (Validator.isNotNull(portletDisplay.getPortletResource())) {
        String portletResource = portletDisplay.getPortletResource();

        Portlet portlet = _portletLocalService.getPortletById(themeDisplay.getCompanyId(), portletResource);

        rootPortletId = portlet.getRootPortletId();
    }// www.j av  a  2s.c om

    boolean showPermissionsIcon = false;

    Layout layout = themeDisplay.getLayout();

    Group group = themeDisplay.getScopeGroup();

    if (!group.hasStagingGroup() || _STAGING_LIVE_GROUP_LOCKING_ENABLED) {
        try {
            if (PortletPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, rootPortletId,
                    ActionKeys.PERMISSIONS)) {

                showPermissionsIcon = true;
            }
        } catch (PortalException pe) {

            // LPS-52675

            if (_log.isDebugEnabled()) {
                _log.debug(pe, pe);
            }

            showPermissionsIcon = false;
        }
    }

    if (layout.isLayoutPrototypeLinkActive()) {
        showPermissionsIcon = false;
    }

    if (layout.isTypeControlPanel()) {
        showPermissionsIcon = false;
    }

    return showPermissionsIcon;
}

From source file:com.liferay.product.navigation.control.menu.web.internal.PortletBackLinkProductNavigationControlMenuEntry.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;
    }/* w w w  .  j  a v  a2  s  .c  om*/

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    if (!portletDisplay.isShowBackIcon()) {
        return false;
    }

    return super.isShow(request);
}

From source file:com.liferay.product.navigation.control.menu.web.internal.PortletBackLinkProductNavigationControlMenuEntry.java

License:Open Source License

protected String getPortletBackURL(HttpServletRequest request) {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getURLBack();
}