@Override
  protected String getLinkStyleClass(MenuItem menuitem) {
    String icon = menuitem.getIcon();
    if (icon == null) {
      icon = "ui-icon-carat-r";
    }
    String iconPos = menuitem.getIconPos();
    iconPos = (iconPos == null) ? "ui-btn-icon-right" : "ui-btn-icon-" + iconPos;
    String styleClass = AbstractMenu.MOBILE_MENUITEM_LINK_CLASS + " " + icon + " " + iconPos;
    String userStyleClass = menuitem.getStyleClass();
    if (userStyleClass != null) {
      styleClass = styleClass + " " + userStyleClass;
    }

    return styleClass;
  }
Esempio n. 2
0
  protected void encodeMenuItemContent(FacesContext context, AbstractMenu menu, MenuItem menuitem)
      throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String icon = menuitem.getIcon();
    Object value = menuitem.getValue();

    if (icon != null) {
      writer.startElement("span", null);
      writer.writeAttribute("class", AbstractMenu.MENUITEM_ICON_CLASS + " " + icon, null);
      writer.endElement("span");
    }

    writer.startElement("span", null);
    writer.writeAttribute("class", AbstractMenu.MENUITEM_TEXT_CLASS, null);

    if (value != null) {
      if (menuitem.isEscape()) writer.writeText(value, "value");
      else writer.write(value.toString());
    } else if (menuitem.shouldRenderChildren()) {
      renderChildren(context, (UIComponent) menuitem);
    }

    writer.endElement("span");
  }