Examples of UISelectManyCheckbox


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

      LOG.error("Wrong type: Need " + UISelectManyCheckbox.class.getName() + ", but was "
          + component.getClass().getName());
      return;
    }

    UISelectManyCheckbox select = (UISelectManyCheckbox) component;
    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    String id = select.getClientId(facesContext);
    List<SelectItem> items = RenderUtils.getItemsToRender(select);
    String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, select);
    boolean disabled = select.isDisabled();
    boolean readonly = select.isReadonly();
    Style style = new Style(facesContext, select);
    // fixme: use CSS, not the Style Attribute for "display"
    style.setDisplay(null);

    writer.startElement(HtmlElements.OL, select);
    writer.writeStyleAttribute(style);
    writer.writeClassAttribute(Classes.create(select));
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }

    Object[] values = select.getSelectedValues();
    List<String> clientIds = new ArrayList<String>();
    for (SelectItem item : items) {
      String itemId = id + NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR + item.getValue().toString();
      clientIds.add(itemId);
      writer.startElement(HtmlElements.LI, select);
      writer.startElement(HtmlElements.INPUT, select);
      writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.CHECKBOX, false);
      boolean checked = RenderUtils.contains(values, item.getValue());
      writer.writeAttribute(HtmlAttributes.CHECKED, checked);
      writer.writeNameAttribute(id);
      writer.writeIdAttribute(itemId);
      String formattedValue = RenderUtils.getFormattedValue(facesContext, select, item.getValue());
      writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
      writer.writeAttribute(HtmlAttributes.DISABLED, item.isDisabled() || disabled);
      writer.writeAttribute(HtmlAttributes.READONLY, readonly);
      if (readonly) {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=" + checked, false);
      }
      Integer tabIndex = select.getTabIndex();
      if (tabIndex != null) {
        writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
      }
      writer.endElement(HtmlElements.INPUT);
View Full Code Here

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

    HtmlRendererUtils.checkForCommandFacet(select, clientIds, facesContext, writer);
  }

  @Override
  public Measure getHeight(FacesContext facesContext, Configurable component) {
    UISelectManyCheckbox select = (UISelectManyCheckbox) component;
    Measure heightOfOne = super.getHeight(facesContext, component);
    if (select.isInline()) {
      return heightOfOne;
    } else {
      List<SelectItem> items = RenderUtils.getItemsToRender((UISelectMany) component);
      return heightOfOne.multiply(items.size());
    }
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.