Top Banner
Taking Complete Control of Product Navigation in Liferay DXP Julio Camarero, Software Architect, WEM Lead @juliocamarero DEVCON | MODCONF 2016
45

Taking full control of Product Navigation in Liferay DXP

Apr 16, 2017

Download

Engineering

Julio Camarero
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Taking full control of Product Navigation in Liferay DXP

Taking Complete Control of Product Navigation in Liferay DXP

Julio Camarero, Software Architect, WEM Lead @juliocamarero

DEVCON | MODCONF 2016

Page 2: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

What is the Product Navigation?

Page 3: Taking full control of Product Navigation in Liferay DXP

#LSNA16 | @juliocamareroDEVCON | MODCONF 2016

Consistent Navigation across all sites even with different themes

Page 4: Taking full control of Product Navigation in Liferay DXP

#LSNA16 | @juliocamareroDEVCON | MODCONF 2016

<@liferay.control_menu />

… inside the portal_normal.ftl of your theme

Page 5: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Page 6: Taking full control of Product Navigation in Liferay DXP

#LSNA16 | @juliocamareroDEVCON | MODCONF 2016

<@liferay.user_personal_bar />

… inside the portal_normal.ftl of your theme

Page 7: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Does that mean I can’t change the look and feel?

Page 8: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Does that mean I can’t change the look and feel?

… of course not

Page 9: Taking full control of Product Navigation in Liferay DXP

#LRDEVCON | @juliocamarero

Site Themes vs Product Themes

Page 10: Taking full control of Product Navigation in Liferay DXP

#LSNA16 | @juliocamareroDEVCON | MODCONF 2016

how can I build a product theme?

Creating a control menu theme contributor and a product menu theme contributor.

(Each contributor is just a set of css files)

https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/theme-contributors

Page 11: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Control MenuThe right information, right when you need it

Page 12: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Control MenuControl Menu

Page 13: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Page 14: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Page 15: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Page 16: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

NavigationContext

Information Tools

Advanced Management

Page 17: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

NavigationContext

Information Tools

Advanced Management

Page 18: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

@Component( immediate = true, property = { "product.navigation.control.menu.category.key=" + ProductNavigationControlMenuCategoryKeys.TOOLS, "product.navigation.control.menu.entry.order:Integer=500" }, service = ProductNavigationControlMenuEntry.class) public class FavouritesProductNavigationControlMenuEntry

USERSITE

Category

Order

Create a Control Menu Entry

Page 19: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

@Overridepublic String getIcon(HttpServletRequest request) { return "star"; } @Overridepublic String getLabel(Locale locale) { return "favourites"; } @Overridepublic String getURL(HttpServletRequest request) { return “http://… “; }

Simple Icon

Page 20: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

public boolean isUseDialog() { return false; }

Page 21: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

@Overridepublic boolean includeIcon( HttpServletRequest request, HttpServletResponse response) throws IOException { RequestDispatcher requestDispatcher = _servletContext.getRequestDispatcher(“/render_my_icon.jsp”); requestDispatcher.include(request, response); return true; }

@Overridepublic boolean includeBody( HttpServletRequest request, HttpServletResponse response) throws IOException {

Custom UI (any template language)

Page 22: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

@Overridepublic boolean includeBody( HttpServletRequest request, HttpServletResponse response) throws IOException { RequestDispatcher requestDispatcher = _servletContext.getRequestDispatcher(“/render_my_body.jsp”); requestDispatcher.include(request, response); return true; }

Advanced Management (any template language)

Page 23: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

@Overridepublic boolean includeBody( HttpServletRequest request, HttpServletResponse response) throws IOException { RequestDispatcher requestDispatcher = _servletContext.getRequestDispatcher(“/render_my_body.jsp”); requestDispatcher.include(request, response); return true; }

Advanced Management (any template language)

Page 24: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Product MenuEverywhere you may need to go at one click distance

Page 25: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Product Menu

Page 26: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Categories and Subcategories

They are only shown to the right users and only if they have something inside

Page 27: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Categories and Subcategories

@Component( immediate = true, property = { "panel.category.key=" + PanelCategoryKeys.CONTROL_PANEL, "panel.category.order:Integer=200" }, service = PanelCategory.class) public class UsersPanelCategory extends BasePanelCategory { @Override public String getKey() { return PanelCategoryKeys.CONTROL_PANEL_USERS; } @Override public String getLabel(Locale locale) { return LanguageUtil.get(locale, "users"); } }

Page 28: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Categories with custom UI

@Overridepublic boolean include( HttpServletRequest request, HttpServletResponse response) throws IOException { // include the body of your panel } @Overridepublic boolean includeHeader( HttpServletRequest request, HttpServletResponse response) throws IOException { // include the header of your panel }

Page 29: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Existing PanelCategories

PanelCategoryKeys.ROOT

PanelCategoryKeys.CONTROL_PANEL PanelCategoryKeys.CONTROL_PANEL_USERS PanelCategoryKeys.CONTROL_PANEL_SITES PanelCategoryKeys.CONTROL_PANEL_APPS PanelCategoryKeys.CONTROL_PANEL_CONFIGURATION

PanelCategoryKeys.USER PanelCategoryKeys.USER_MY_ACCOUNT

PanelCategoryKeys.SITE_ADMINISTRATION PanelCategoryKeys.SITE_ADMINISTRATION_NAVIGATION PanelCategoryKeys.SITE_ADMINISTRATION_CONTENT PanelCategoryKeys.SITE_ADMINISTRATION_MEMBERS PanelCategoryKeys.SITE_ADMINISTRATION_CONFIGURATION PanelCategoryKeys.SITE_ADMINISTRATION_PUBLISHING

Page 30: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Create Panel Apps

@Component( immediate = true, property = { "panel.app.order:Integer=100", "panel.category.key=" + PanelCategoryKeys.CONTROL_PANEL_USERS }, service = PanelApp.class) public class UsersPanelApp extends BasePanelApp { @Override public String getPortletId() { return “myPortletName"; } @Override @Reference( target = “(javax.portlet.name=myPortletName)", unbind = "-" ) public void setPortlet(Portlet portlet) { super.setPortlet(portlet); } }

Page 31: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Add a Notifications Badget

@Overridepublic int getNotificationsCount(User user) { return user.getUnreadEmails(); }

Page 32: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Create a custom UI

public boolean include( HttpServletRequest request, HttpServletResponse response)

throws IOException { // render your UI …

return true; }

Page 33: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

User Personal BarActions for all your registered users

Page 34: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Control MenuUser Personal Bar

Page 35: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Page 36: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Just a portlet, you can deploy your own with a Portlet Provider:

@Component( immediate = true, property = { "model.class.name=" + PortalUserPersonalBarApplicationType.UserPersonalBar.CLASS_NAME }, service = ViewPortletProvider.class) public class MyPersonalPortletProvider extends BasePortletProvider implements ViewPortletProvider { @Override public String getPortletName() { return "myPortletName"; } }

Page 37: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Simulation MenuSee what the others will see

Page 38: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Simulation Menu

Page 39: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

@Component( immediate = true, property = { "panel.app.order:Integer=100", "panel.category.key=" + SimulationPanelCategory.SIMULATION }, service = PanelApp.class) public class LanguagePreviewPanelApp

public boolean include( HttpServletRequest request, HttpServletResponse response) {

… // render your UI

Order

Create a Simulation Panel

Page 40: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Interact with the Simulation Window

var iframe = A.one('#simulationDeviceIframe');

iframe.setAttribute('src', newUrlWithCustomParameters);

Page 41: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Easier than Ever! ;)

Page 42: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Page 43: Taking full control of Product Navigation in Liferay DXP

@juliocamareroDEVCON | MODCONF 2016

Command Line

blade create -l > controlmenuentry > panelapp > simulationpanelentry ...

blade create -t controlmenuentry favorite

gradle deploy

Page 44: Taking full control of Product Navigation in Liferay DXP

#LSNA16 | @juliocamareroDEVCON | MODCONF 2016

Some ResourcesProduct Navigation Tutorials: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/product-navigation

Theme Contributors Tutorial: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/theme-contributors

Page 45: Taking full control of Product Navigation in Liferay DXP

@juliocamarero

Thank you! :)Questions?