Search in sources :

Example 1 with JexlHttpServletRequestContext

use of com.revolsys.ui.web.config.JexlHttpServletRequestContext in project com.revolsys.open by revolsys.

the class MenuViewController method bootstrapNavbar.

private void bootstrapNavbar(final HttpServletRequest request, final HttpServletResponse response, final Navbar navBar) throws IOException {
    if (navBar != null) {
        try (final OutputStream out = response.getOutputStream();
            XmlWriter writer = new XmlWriter(out, false)) {
            writer.setIndent(false);
            final JexlHttpServletRequestContext jexlContext = new JexlHttpServletRequestContext(request);
            final List<Menu> menus = new ArrayList<>();
            for (final Menu menuItem : navBar.getMenus()) {
                if (menuItem.isVisible()) {
                    menus.add(menuItem);
                }
            }
            final String title = navBar.getTitle();
            if (Property.hasValue(title) || !menus.isEmpty()) {
                BootstrapUtil.navbarStart(writer, navBar, jexlContext);
                bootstrapMenu(writer, menus, 1, jexlContext);
                BootstrapUtil.navbarEnd(writer);
            }
            writer.flush();
        }
    }
}
Also used : OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) Menu(com.revolsys.ui.model.Menu) XmlWriter(com.revolsys.record.io.format.xml.XmlWriter) JexlHttpServletRequestContext(com.revolsys.ui.web.config.JexlHttpServletRequestContext)

Aggregations

XmlWriter (com.revolsys.record.io.format.xml.XmlWriter)1 Menu (com.revolsys.ui.model.Menu)1 JexlHttpServletRequestContext (com.revolsys.ui.web.config.JexlHttpServletRequestContext)1 OutputStream (java.io.OutputStream)1 ArrayList (java.util.ArrayList)1