Example usage for com.liferay.portal.kernel.dao.search SearchContainer setEmptyResultsMessageCssClass

List of usage examples for com.liferay.portal.kernel.dao.search SearchContainer setEmptyResultsMessageCssClass

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.search SearchContainer setEmptyResultsMessageCssClass.

Prototype

public void setEmptyResultsMessageCssClass(String emptyResultsMessageCssClass) 

Source Link

Usage

From source file:com.liferay.site.navigation.admin.web.internal.display.context.SiteNavigationAdminDisplayContext.java

License:Open Source License

public SearchContainer getSearchContainer() throws Exception {
    if (_searchContainer != null) {
        return _searchContainer;
    }/*from  w  w  w  . j  a  v a2  s  . co m*/

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

    SearchContainer searchContainer = new SearchContainer(_liferayPortletRequest, getPortletURL(), null,
            "there-are-no-navigation-menus");

    if (Validator.isNull(getKeywords())) {
        if (isShowAddButton()) {
            searchContainer
                    .setEmptyResultsMessageCssClass("there-are-no-navigation-menus-you-can-add-a-menu-by-"
                            + "clicking-the-plus-button-on-the-bottom-right-corner");
            searchContainer.setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn");
        }
    } else {
        searchContainer.setSearch(true);
    }

    OrderByComparator<SiteNavigationMenu> orderByComparator = SiteNavigationMenuPortletUtil
            .getOrderByComparator(getOrderByCol(), getOrderByType());

    searchContainer.setOrderByCol(getOrderByCol());
    searchContainer.setOrderByComparator(orderByComparator);
    searchContainer.setOrderByType(getOrderByType());

    EmptyOnClickRowChecker emptyOnClickRowChecker = new EmptyOnClickRowChecker(_liferayPortletResponse);

    searchContainer.setRowChecker(emptyOnClickRowChecker);

    List<SiteNavigationMenu> menus = null;
    int menusCount = 0;

    if (Validator.isNotNull(getKeywords())) {
        menus = SiteNavigationMenuServiceUtil.getSiteNavigationMenus(themeDisplay.getScopeGroupId(),
                getKeywords(), searchContainer.getStart(), searchContainer.getEnd(), orderByComparator);

        menusCount = SiteNavigationMenuServiceUtil.getSiteNavigationMenusCount(themeDisplay.getScopeGroupId(),
                getKeywords());
    } else {
        menus = SiteNavigationMenuServiceUtil.getSiteNavigationMenus(themeDisplay.getScopeGroupId(),
                searchContainer.getStart(), searchContainer.getEnd(), orderByComparator);

        menusCount = SiteNavigationMenuServiceUtil.getSiteNavigationMenusCount(themeDisplay.getScopeGroupId());
    }

    searchContainer.setResults(menus);
    searchContainer.setTotal(menusCount);

    _searchContainer = searchContainer;

    return _searchContainer;
}

From source file:com.liferay.site.teams.web.internal.display.context.SiteTeamsDisplayContext.java

License:Open Source License

public SearchContainer getSearchContainer() throws PortalException {
    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    SearchContainer searchContainer = new TeamSearch(_renderRequest, getPortletURL());

    searchContainer.setEmptyResultsMessage("there-are-no-site-teams");

    if (Validator.isNull(getKeywords())) {
        if (isShowAddButton()) {
            searchContainer.setEmptyResultsMessage("there-are-no-site-teams.-you-can-add-a-site-team-by-"
                    + "clicking-the-plus-button-on-the-bottom-right-corner");
            searchContainer.setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn");
        }//w  ww .  j av a  2 s . c o  m
    } else {
        searchContainer.setSearch(true);
    }

    searchContainer.setId("teams");
    searchContainer.setRowChecker(new EmptyOnClickRowChecker(_renderResponse));

    searchContainer.setTotal(getTotal());

    List results = TeamServiceUtil.search(themeDisplay.getScopeGroupId(), getKeywords(), getKeywords(),
            new LinkedHashMap<String, Object>(), searchContainer.getStart(), searchContainer.getEnd(),
            searchContainer.getOrderByComparator());

    searchContainer.setResults(results);

    return searchContainer;
}