Danish
Danish

Reputation: 913

Liferay control panel menu portlets

How does liferay list out the portlet to be shown in the control panel menu? Can any body list the classes and JSP involved in the same?

Upvotes: 0

Views: 627

Answers (2)

Danish
Danish

Reputation: 913

All of the portlets are saved in the portlet table while we deploy them. Then once the control panel is accessed then liferay loads all of the portlet which are having the control panel entry in them. For better explanation see the below code in

com.liferay.portal.util.PortalImpl

@Override
public Set<Portlet> getControlPanelPortlets(long companyId, String category)
    throws SystemException {

    Set<Portlet> portletsSet = new TreeSet<Portlet>(
        new PortletControlPanelWeightComparator());

    if (Validator.isNull(category)) {
        return portletsSet;
    }

    List<Portlet> portletsList = PortletLocalServiceUtil.getPortlets(
        companyId);

    for (Portlet portlet : portletsList) {
        String portletCategory = portlet.getControlPanelEntryCategory();

        if (category.equals(portletCategory) ||
            (category.endsWith(StringPool.PERIOD) &&
             StringUtil.startsWith(portletCategory, category))) {

            portletsSet.add(portlet);
        }
    }

    return portletsSet;
}

@Override
public List<Portlet> getControlPanelPortlets(
        String category, ThemeDisplay themeDisplay)
    throws SystemException {

    Set<Portlet> portlets = getControlPanelPortlets(
        themeDisplay.getCompanyId(), category);

    return filterControlPanelPortlets(portlets, themeDisplay);
}

The above code is called from the

\portal-web\docroot\html\portlet\control_panel_menu\view.jsp 
Map<String, List<Portlet>> siteAdministrationCategoriesMap = PortalUtil.getSiteAdministrationCategoriesMap(request);

Help taken from pankaj-kathiriya answer. Thanks for the same.

Upvotes: 0

Pankaj Kathiriya
Pankaj Kathiriya

Reputation: 4210

Refer to file in your liferay source at location : \portal-web\docroot\html\portlet\control_panel_menu\view.jsp

You will get idea how liferay shows its control panel menu.

Link for code of this jsp.

Upvotes: 1

Related Questions