Example usage for com.liferay.portal.kernel.theme PortletDisplay getPortletName

List of usage examples for com.liferay.portal.kernel.theme PortletDisplay getPortletName

Introduction

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

Prototype

public String getPortletName() 

Source Link

Usage

From source file:blade.document.action.displaycontext.BladeActionDisplayContext.java

License:Apache License

/**
 * Read settings from page Documents And Media portlet "Show Actions" portlet configuration.<br/>
 * But for Documents And Media admin portlet, it will always be true.
 *///  w w w. ja  v a  2 s . c o m
private boolean _showAction() throws SettingsException {
    PortletDisplay portletDisplay = _themeDisplay.getPortletDisplay();

    String portletName = portletDisplay.getPortletName();

    if (portletName.equals(PortletKeys.DOCUMENT_LIBRARY_ADMIN)) {
        return true;
    }

    Settings settings = SettingsFactoryUtil
            .getSettings(new PortletInstanceSettingsLocator(_themeDisplay.getLayout(), portletDisplay.getId()));

    TypedSettings typedSettings = new TypedSettings(settings);

    return typedSettings.getBooleanValue("showActions");
}

From source file:com.liferay.asset.publisher.web.internal.portlet.toolbar.contributor.AssetPublisherPortletToolbarContributor.java

License:Open Source License

private boolean _isVisible(AssetPublisherDisplayContext assetPublisherDisplayContext,
        PortletRequest portletRequest) {

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

    if (!assetPublisherDisplayContext.isShowAddContentButton()) {
        return false;
    }/*from  w  w w.  ja  va2s  .c om*/

    Group scopeGroup = themeDisplay.getScopeGroup();

    if (scopeGroup.hasStagingGroup() && !scopeGroup.isStagingGroup()
            && PropsValues.STAGING_LIVE_GROUP_LOCKING_ENABLED) {

        return false;
    }

    Layout layout = themeDisplay.getLayout();

    if (layout.isLayoutPrototypeLinkActive() && assetPublisherDisplayContext.isSelectionStyleManual()) {

        return false;
    }

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String portletName = portletDisplay.getPortletName();

    if (portletName.equals(AssetPublisherPortletKeys.HIGHEST_RATED_ASSETS)) {

        return false;
    }

    if (portletName.equals(AssetPublisherPortletKeys.MOST_VIEWED_ASSETS)) {
        return false;
    }

    if (portletName.equals(AssetPublisherPortletKeys.RELATED_ASSETS)) {
        return false;
    }

    return true;
}

From source file:com.liferay.asset.publisher.web.servlet.taglib.ui.ScopeFormNavigatorEntry.java

License:Open Source License

@Override
public boolean isVisible(User user, Object object) {
    if (!isDynamicAssetSelection()) {
        return true;
    }//from  w  ww  . ja v a2 s .  c  o  m

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String rootPortletId = PortletIdCodec.decodePortletName(portletDisplay.getPortletName());

    if (rootPortletId.equals(AssetPublisherPortletKeys.RELATED_ASSETS)) {
        return false;
    }

    return true;
}

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.users.admin.web.internal.servlet.taglib.ui.navigation.user.entry.UserOrganizationsScreenNavigationEntry.java

License:Open Source License

@Override
public boolean isEditable(HttpServletRequest request, HttpServletResponse response) {

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String myAccountPortletId = PortletProviderUtil
            .getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME, PortletProvider.Action.VIEW);

    if (myAccountPortletId.equals(portletDisplay.getPortletName())) {
        return false;
    }/*from w  w  w.  ja  va 2s. c om*/

    return true;
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.navigation.user.entry.UserProfileAndPrivateAreaScreenNavigationEntry.java

License:Open Source License

@Override
public boolean isVisible(User user, User selUser) {
    if (selUser == null) {
        return false;
    }/*from ww  w  .  j  a v  a2s. c  om*/

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String myAccountPortletId = PortletProviderUtil
            .getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME, PortletProvider.Action.VIEW);

    if (myAccountPortletId.equals(portletDisplay.getPortletName())) {
        return false;
    }

    return true;
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.UserPersonalSiteFormNavigatorEntry.java

License:Open Source License

@Override
public boolean isVisible(User user, User selUser) {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String portletId = PortletProviderUtil.getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME,
            PortletProvider.Action.VIEW);

    if ((selUser != null) && portletId.equals(portletDisplay.getPortletName())) {

        return false;
    }/*from   w w w.j  av a2s. c o m*/

    return true;
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.UsersFormNavigatorContextProvider.java

License:Open Source License

private String _getPortletName() {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getPortletName();
}