Examples of UISelectManyCheckbox


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

import java.util.List;

public class SelectManyCheckboxRenderer extends SelectManyRendererBase {

  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    UISelectManyCheckbox select = (UISelectManyCheckbox) component;
    super.prepareRender(facesContext, select);
    if (select.isInline()) {
      ComponentUtils.addCurrentMarkup(select, Markup.INLINE);
    }
  }
View Full Code Here

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

      ComponentUtils.addCurrentMarkup(select, Markup.INLINE);
    }
  }

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    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();
    boolean required = select.isRequired();
    Style style = new Style(facesContext, select);
    // fixme: use CSS, not the Style Attribute for "display"
    style.setDisplay(null);

    writer.startElement(HtmlElements.OL, select);
    writer.writeIdAttribute(id);
    writer.writeStyleAttribute(style);
    writer.writeClassAttribute(Classes.create(select));
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, select);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    boolean first = true;
    Object[] values = select.getSelectedValues();
    for (SelectItem item : items) {
      String itemId = id + NamingContainer.SEPARATOR_CHAR + NamingContainer.SEPARATOR_CHAR + item.getValue().toString();
      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);
      writer.writeAttribute(HtmlAttributes.REQUIRED, required);
      if (first) {
        HtmlRendererUtils.renderFocus(id, select.isFocus(), ComponentUtils.isError(select), facesContext, writer);
        first = false;
      }
      Integer tabIndex = select.getTabIndex();
      if (tabIndex != null) {
        writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
      }
      HtmlRendererUtils.renderCommandFacet(select, itemId, facesContext, writer);
      writer.endElement(HtmlElements.INPUT);
View Full Code Here

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

  }

  @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

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

import java.util.List;

public class SelectManyCheckboxRenderer extends SelectManyRendererBase {

  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    UISelectManyCheckbox select = (UISelectManyCheckbox) component;
    super.prepareRender(facesContext, select);
    if (select.isInline()) {
      ComponentUtils.addCurrentMarkup(select, Markup.INLINE);
    }
  }
View Full Code Here

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

      ComponentUtils.addCurrentMarkup(select, Markup.INLINE);
    }
  }

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    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.writeIdAttribute(id);
    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

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

import java.util.List;

public class SelectManyCheckboxRenderer extends SelectManyRendererBase {

  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    UISelectManyCheckbox select = (UISelectManyCheckbox) component;
    super.prepareRender(facesContext, select);
    if (select.isInline()) {
      select.setCurrentMarkup(Markup.INLINE.add(select.getCurrentMarkup()));
    }
  }
View Full Code Here

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

      select.setCurrentMarkup(Markup.INLINE.add(select.getCurrentMarkup()));
    }
  }

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    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

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

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UISelectManyCheckbox component = (UISelectManyCheckbox) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (validatorMessage != null) {
      component.setValueExpression("validatorMessage", validatorMessage);
    }

    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (validator != null) {
      component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
    }
    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (valueChangeListener != null) {
      component.addValueChangeListener(new javax.faces.event.MethodExpressionValueChangeListener(valueChangeListener));
    }
    if (converter != null) {
      if (!converter.isLiteralText()) {
        component.setValueExpression("converter", converter);
      } else {
        component.setConverter(application.createConverter(converter.getExpressionString()));
      }
    }
    if (inline != null) {
      if (!inline.isLiteralText()) {
        component.setValueExpression("inline", inline);
      } else {
        component.setInline(Boolean.parseBoolean(inline.getExpressionString()));
      }
    }
    if (value != null) {
      component.setValueExpression("value", value);
    }

    if (focus != null) {
      if (!focus.isLiteralText()) {
        component.setValueExpression("focus", focus);
      } else {
        component.setFocus(Boolean.parseBoolean(focus.getExpressionString()));
      }
    }
    if (required != null) {
      if (!required.isLiteralText()) {
        component.setValueExpression("required", required);
      } else {
        component.setRequired(Boolean.parseBoolean(required.getExpressionString()));
      }
    }
    if (converterMessage != null) {
      component.setValueExpression("converterMessage", converterMessage);
    }

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

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

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

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

    if (readonly != null) {
      if (!readonly.isLiteralText()) {
        component.setValueExpression("readonly", readonly);
      } else {
        component.setReadonly(Boolean.parseBoolean(readonly.getExpressionString()));
      }
    }
    if (disabled != null) {
      if (!disabled.isLiteralText()) {
        component.setValueExpression("disabled", disabled);
      } else {
        component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
      }
    }
  }
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.