Examples of UIMenu


Examples of org.apache.myfaces.tobago.component.UIMenu

    writer.writeIdAttribute(column.getClientId(facesContext));
    writer.writeClassAttribute(Classes.create(sheet, "selectorMenu"));
    writer.endElement(HtmlElements.DIV);

    if (UISheet.MULTI.equals(sheet.getSelectable())) {
      UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
          facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "selectorMenu");
      menu.setTransient(true);
      FacetUtils.setDropDownMenu(column, menu);
      menu.setImage("image/sheetSelectorMenu.gif");
      menu.setLabel("vv"); //todo remove this after fixing the image above

      String sheetId = column.getParent().getClientId(facesContext);

      createMenuItem(facesContext, menu, "sheetMenuSelect",
          "Tobago.Sheets.get('" + sheetId + "').selectAll()", "t_selectAll");
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

  @Override
  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    super.prepareRender(facesContext, component);

    final UIMenu menu = (UIMenu) component;
    final boolean firstLevel = !RendererTypes.MENU.equals(menu.getParent().getRendererType());
    if (firstLevel) {
      ComponentUtils.addCurrentMarkup(menu, Markup.TOP);
    }
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

  }

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {

    final UIMenu menu = (UIMenu) component;
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    final boolean disabled = menu.isDisabled();
    final boolean firstLevel = !RendererTypes.MENU.equals(menu.getParent().getRendererType());
    final boolean isParentMenu = menu.getChildCount() > 0; // todo: may be not correct

    writer.startElement(HtmlElements.LI, menu);
    writer.writeClassAttribute(Classes.create(menu));
    if (menu.getImage() != null) {
      Style style = new Style();
      style.setBackgroundImage("url('"
          + ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, menu.getImage(), menu.isDisabled())
          + "')");
      writer.writeStyleAttribute(style);
    }
    writer.startElement(HtmlElements.A, menu);
    writer.writeAttribute(HtmlAttributes.HREF, "#", false);
    if (isParentMenu && !firstLevel) {
      writer.writeClassAttribute(Classes.create(menu, "subitem-ancor"));
    }
    if (component != null && !component.isTransient()) {
      writer.writeIdAttribute(component.getClientId(facesContext));
    }

    LabelWithAccessKey label = new LabelWithAccessKey(menu);
    if (label.getText() != null) {
      if (label.getAccessKey() != null) {
        if (LOG.isInfoEnabled()
            && !AccessKeyMap.addAccessKey(facesContext, label.getAccessKey())) {
          LOG.info("duplicated accessKey : " + label.getAccessKey());
        }
        if (!disabled && label.getAccessKey() != null) {
          writer.writeAttribute(HtmlAttributes.ACCESSKEY, Character.toString(label.getAccessKey()), false);
        }
      }
      HtmlRendererUtils.writeLabelWithAccessKey(writer, label);
    }
    writer.endElement(HtmlElements.A);
    if (isParentMenu) {
      if (!firstLevel) {
        writer.startElement(HtmlElements.IMG, menu);
        String arrow = ResourceManagerUtils
            .getImageOrDisabledImageWithPath(facesContext, "image/MenuArrow.gif", menu.isDisabled());
        writer.writeAttribute(HtmlAttributes.SRC, arrow, false);
        writer.writeClassAttribute(Classes.create(menu, "subitem-arrow"));
        writer.endElement(HtmlElements.IMG);
      }
      writer.startElement(HtmlElements.OL, menu);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

  }

  @Override
  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {

    UIMenu menu = (UIMenu) component;
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    boolean isParentMenu = menu.getChildCount() > 0; // todo: may be not correct
    if (isParentMenu) {
      writer.endElement(HtmlElements.OL);
    }
    writer.endElement(HtmlElements.LI);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

  private UIToolBar createToolBar(FacesContext facesContext, UISheet sheet) {
    final Application application = facesContext.getApplication();
    final UICommand dropDown = (UICommand) CreateComponentUtils.createComponent(
        facesContext, UICommand.COMPONENT_TYPE, null, "dropDown");
    final UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
        facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "menu");
    FacetUtils.setDropDownMenu(dropDown, menu);
    final String sheetId = sheet.getClientId(facesContext);

    createMenuItem(facesContext, menu, "sheetMenuSelect", Markup.SHEET_SELECT_ALL, sheetId);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

    // all: sub menu to select any tab directly
    UICommand all = (UICommand) CreateComponentUtils.createComponent(
        facesContext, UICommand.COMPONENT_TYPE, null, viewRoot.createUniqueId());
    all.setOmit(true); // avoid submit

    UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
        facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, viewRoot.createUniqueId());
    menu.setTransient(true);
    ComponentUtils.addCurrentMarkup(menu, Markup.TOP);
    FacetUtils.setDropDownMenu(all, menu);
    int index = 0;
    for (UIComponent child : tabGroup.getChildren()) {
      if (child instanceof UITab) {
        UITab tab = (UITab) child;
        if (tab.isRendered()) {
          UIMenuCommand entry = (UIMenuCommand) CreateComponentUtils.createComponent(
              facesContext, UIMenuCommand.COMPONENT_TYPE, RendererTypes.MENU_COMMAND, viewRoot.createUniqueId());
          entry.setTransient(true);
          entry.setOmit(true); // avoid submit
          LabelWithAccessKey label = new LabelWithAccessKey(tab);
          entry.setLabel(label.getText());
          if (tab.isDisabled()) {
            entry.setDisabled(true);
          } else {
            ComponentUtils.putDataAttribute(entry, "tobago-index", index); // XXX todo, define a DataAttribute
          }
          menu.getChildren().add(entry);
        }
        index++;
      }
    }
    UIToolBar toolBar = (UIToolBar) application.createComponent(UIToolBar.COMPONENT_TYPE);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

    next.setOnclick("/**/"); // XXX avoid submit

    // all: sub menu to select any tab directly
    UICommand all = (UICommand) CreateComponentUtils.createComponent(
        facesContext, UICommand.COMPONENT_TYPE, null, "all");
    UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
        facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "menu");
    FacetUtils.setDropDownMenu(all, menu);
    int index = 0;
    for (UIComponent child : (List<UIComponent>) tabGroup.getChildren()) {
      if (child instanceof UITab) {
        UITab tab = (UITab) child;
        if (tab.isRendered()) {
          UIMenuCommand entry = (UIMenuCommand) CreateComponentUtils.createComponent(
              facesContext, UIMenuCommand.COMPONENT_TYPE, RendererTypes.MENU_COMMAND, "entry-" + index);
          LabelWithAccessKey label = new LabelWithAccessKey(tab);
          entry.setLabel(label.getText());
          if (tab.isDisabled()) {
            entry.setDisabled(true);
          } else {
            entry.setOnclick(JQueryUtils.selectId(clientId)
                + ".find('.tobago-tab[tabgroupindex=" + index + "]')"
                + ".click();"
                + "if (event.stopPropagation === undefined) { "
                + "  event.cancelBubble = true; " // IE
                + "} else { "
                + "  event.stopPropagation(); " // other
                + "}"); // todo: register a onclick handler with jQuery
          }
          menu.getChildren().add(entry);
        }
        index++;
      }
    }
    UIToolBar toolBar = (UIToolBar) application.createComponent(UIToolBar.COMPONENT_TYPE);
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

    writer.writeIdAttribute(column.getClientId(facesContext));
    writer.writeClassAttribute(Classes.create(sheet, "selectorMenu"));
    writer.endElement(HtmlElements.DIV);

    if (UISheet.MULTI.equals(sheet.getSelectable())) {
      UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
          facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "selectorMenu");
      menu.setTransient(true);
      FacetUtils.setDropDownMenu(column, menu);
      menu.setImage("image/sheetSelectorMenu.gif");
      menu.setLabel("vv"); //todo remove this after fixing the image above

      String sheetId = column.getParent().getClientId(facesContext);

      createMenuItem(facesContext, menu, "sheetMenuSelect",
          "Tobago.Sheets.get('" + sheetId + "').selectAll()", "t_selectAll");
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UIMenu component = (UIMenu) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (image != null) {
      component.setValueExpression("image", image);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.component.UIMenu

    writer.writeIdAttribute(column.getClientId(facesContext));
    writer.writeClassAttribute(Classes.create(sheet, "selectorMenu"));
    writer.endElement(HtmlElements.DIV);

    if (UISheet.MULTI.equals(sheet.getSelectable())) {
      UIMenu menu = (UIMenu) CreateComponentUtils.createComponent(
          facesContext, UIMenu.COMPONENT_TYPE, RendererTypes.MENU, "selectorMenu");
      menu.setTransient(true);
      FacetUtils.setDropDownMenu(column, menu);
      menu.setImage("image/sheetSelectorMenu.gif");
      menu.setLabel("vv"); //todo remove this after fixing the image above

      String sheetId = column.getParent().getClientId(facesContext);

      createMenuItem(facesContext, menu, "sheetMenuSelect",
          "Tobago.Sheets.get('" + sheetId + "').selectAll()", "t_selectAll");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.