Package org.apache.myfaces.tobago.component

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


    if (!(component instanceof UISelectBoolean)) {
      LOG.error("Wrong type: Need " + UISelectBoolean.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    UISelectBoolean selectBoolean = (UISelectBoolean) component;

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    UIComponent label = ComponentUtil.provideLabel(facesContext, selectBoolean);

    boolean inline = ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_INLINE);

    if (label != null && !inline) {

      writer.startElement(HtmlConstants.TABLE, selectBoolean);
      writer.writeAttribute(HtmlAttributes.BORDER, 0);
      writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
      writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
      writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
      writer.writeAttributeFromComponent(HtmlAttributes.TITLE, ATTR_TIP);

      writer.startElement(HtmlConstants.TR, null);
      writer.startElement(HtmlConstants.TD, null);
    }

    String currentValue = getCurrentValue(facesContext, selectBoolean);
    boolean checked = "true".equals(currentValue);

    writer.startElement(HtmlConstants.INPUT, selectBoolean);
    writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
    writer.writeAttribute(HtmlAttributes.VALUE, "true", false);
    writer.writeAttribute(HtmlAttributes.CHECKED, checked);
    if (ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_READONLY)) {
      if (checked) {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=true", false);
      } else {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=false", false);
      }
    }
    writer.writeNameAttribute(selectBoolean.getClientId(facesContext));
    writer.writeClassAttribute();
    writer.writeIdAttribute(selectBoolean.getClientId(facesContext));
    writer.writeAttribute(HtmlAttributes.DISABLED,
        ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_DISABLED));
    Integer tabIndex = selectBoolean.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectBoolean);
    if (title != null) {
View Full Code Here


    if (!(component instanceof UISelectBoolean)) {
      LOG.error("Wrong type: Need " + UISelectBoolean.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    UISelectBoolean selectBoolean = (UISelectBoolean) component;

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    UIComponent label = ComponentUtil.provideLabel(facesContext, selectBoolean);

    boolean inline = ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_INLINE);

    if (label != null && !inline) {

      writer.startElement(HtmlConstants.TABLE, selectBoolean);
      writer.writeAttribute(HtmlAttributes.BORDER, 0);
      writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
      writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
      writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
      HtmlRendererUtil.renderTip(component, writer);

      writer.startElement(HtmlConstants.TR, null);
      writer.startElement(HtmlConstants.TD, null);
    }

    String currentValue = getCurrentValue(facesContext, selectBoolean);
    boolean checked = "true".equals(currentValue);

    writer.startElement(HtmlConstants.INPUT, selectBoolean);
    writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
    writer.writeAttribute(HtmlAttributes.VALUE, "true", false);
    writer.writeAttribute(HtmlAttributes.CHECKED, checked);
    if (ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_READONLY)) {
      writer.writeAttribute(HtmlAttributes.READONLY, true);
      if (checked) {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=true", false);
      } else {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=false", false);
      }
    }
    writer.writeNameAttribute(selectBoolean.getClientId(facesContext));
    writer.writeClassAttribute();
    writer.writeIdAttribute(selectBoolean.getClientId(facesContext));
    writer.writeAttribute(HtmlAttributes.DISABLED,
        ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_DISABLED));
    Integer tabIndex = selectBoolean.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectBoolean);
    if (title != null) {
View Full Code Here

    if (!(component instanceof UISelectBoolean)) {
      LOG.error("Wrong type: Need " + UISelectBoolean.class.getName() + ", but was " + component.getClass().getName());
      return;
    }

    UISelectBoolean selectBoolean = (UISelectBoolean) component;

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    UIComponent label = ComponentUtil.provideLabel(facesContext, selectBoolean);

    boolean inline = ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_INLINE);

    if (label != null && !inline) {

      writer.startElement(HtmlConstants.TABLE, selectBoolean);
      writer.writeAttribute(HtmlAttributes.BORDER, 0);
      writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
      writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
      writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
      HtmlRendererUtil.renderTip(component, writer);

      writer.startElement(HtmlConstants.TR, null);
      writer.startElement(HtmlConstants.TD, null);
    }

    String currentValue = getCurrentValue(facesContext, selectBoolean);
    boolean checked = "true".equals(currentValue);

    writer.startElement(HtmlConstants.INPUT, selectBoolean);
    writer.writeAttribute(HtmlAttributes.TYPE, "checkbox", false);
    writer.writeAttribute(HtmlAttributes.VALUE, "true", false);
    writer.writeAttribute(HtmlAttributes.CHECKED, checked);
    if (ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_READONLY)) {
      writer.writeAttribute(HtmlAttributes.READONLY, true);
      if (checked) {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=true", false);
      } else {
        writer.writeAttribute(HtmlAttributes.ONCLICK, "this.checked=false", false);
      }
    }
    writer.writeNameAttribute(selectBoolean.getClientId(facesContext));
    writer.writeClassAttribute();
    writer.writeIdAttribute(selectBoolean.getClientId(facesContext));
    writer.writeAttribute(HtmlAttributes.DISABLED,
        ComponentUtil.getBooleanAttribute(selectBoolean, ATTR_DISABLED));
    Integer tabIndex = selectBoolean.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, selectBoolean);
    if (title != null) {
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.component.UISelectBoolean

Copyright © 2018 www.massapicom. 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.