Examples of UISelectBoolean


Examples of javax.faces.component.UISelectBoolean


    protected void setProperties(UIComponent component) {
        super.setProperties(component);

        UISelectBoolean select;
        try {
            select = (UISelectBoolean) component;
        } catch (ClassCastException cce) {
            throw new FacesException("Tag <" + getClass().getName() + "> expected UISelectBoolean. " +
                                     "Got <" + component.getClass().getName() + ">");
        }

        if (converter != null) {
            if (FacesUtils.isExpression(converter)) {
                select.setValueBinding("converter", createValueBinding(converter));
            } else {
                select.setConverter(getApplication().createConverter(converter));
            }
        }

        if (immediate != null) {
            if (FacesUtils.isExpression(immediate)) {
                select.setValueBinding("immediate", createValueBinding(immediate));
            } else {
                select.setImmediate(BooleanUtils.toBoolean(immediate));
            }
        }

        if (required != null) {
            if (FacesUtils.isExpression(required)) {
                select.setValueBinding("required", createValueBinding(required));
            } else {
                select.setRequired(BooleanUtils.toBoolean(required));
            }
        }

        if (validator != null) {
            if (FacesUtils.isExpression(validator)) {
                MethodBinding vb = getApplication().createMethodBinding(validator,
                                                                        new Class[]{ FacesContext.class, UIComponent.class, Object.class });
                select.setValidator(vb);
            } else {
                throw new FacesException("Tag <" + getClass().getName() + "> validator must be an expression. " +
                                         "Got <" + validator + ">");
            }
        }

        if (value != null) {
            if (FacesUtils.isExpression(value)) {
                select.setValueBinding("value", createValueBinding(value));
            } else {
                select.setValue(value);
            }
        }

        if (valueChangeListener != null) {
            if (FacesUtils.isExpression(valueChangeListener)) {
                MethodBinding vb = getApplication().createMethodBinding(valueChangeListener,
                                                                        new Class[]{ ValueChangeEvent.class });
                select.setValueChangeListener(vb);
            } else {
                throw new FacesException("Tag <" + getClass().getName() + "> valueChangeListener must be an expression. " +
                                         "Got <" + valueChangeListener + ">");
            }
        }
View Full Code Here

Examples of javax.faces.component.UISelectBoolean


    protected void setProperties(UIComponent component) {
        super.setProperties(component);

        UISelectBoolean select;
        try {
            select = (UISelectBoolean) component;
        } catch (ClassCastException cce) {
            throw new FacesException("Tag <" + getClass().getName() + "> expected UISelectBoolean. " +
                                     "Got <" + component.getClass().getName() + ">");
        }

        if (converter != null) {
            if (FacesUtils.isExpression(converter)) {
                select.setValueBinding("converter", createValueBinding(converter));
            } else {
                select.setConverter(getApplication().createConverter(converter));
            }
        }

        if (immediate != null) {
            if (FacesUtils.isExpression(immediate)) {
                select.setValueBinding("immediate", createValueBinding(immediate));
            } else {
                select.setImmediate(BooleanUtils.toBoolean(immediate));
            }
        }

        if (required != null) {
            if (FacesUtils.isExpression(required)) {
                select.setValueBinding("required", createValueBinding(required));
            } else {
                select.setRequired(BooleanUtils.toBoolean(required));
            }
        }

        if (validator != null) {
            if (FacesUtils.isExpression(validator)) {
                MethodBinding vb = getApplication().createMethodBinding(validator,
                                                                        new Class[]{ FacesContext.class, UIComponent.class, Object.class });
                select.setValidator(vb);
            } else {
                throw new FacesException("Tag <" + getClass().getName() + "> validator must be an expression. " +
                                         "Got <" + validator + ">");
            }
        }

        if (value != null) {
            if (FacesUtils.isExpression(value)) {
                select.setValueBinding("value", createValueBinding(value));
            } else {
                select.setValue(value);
            }
        }

        if (valueChangeListener != null) {
            if (FacesUtils.isExpression(valueChangeListener)) {
                MethodBinding vb = getApplication().createMethodBinding(valueChangeListener,
                                                                        new Class[]{ ValueChangeEvent.class });
                select.setValueChangeListener(vb);
            } else {
                throw new FacesException("Tag <" + getClass().getName() + "> valueChangeListener must be an expression. " +
                                         "Got <" + valueChangeListener + ">");
            }
        }
View Full Code Here

Examples of javax.faces.component.UISelectBoolean

  }

  public void encodeEndTobago(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {

    UISelectBoolean component = (UISelectBoolean) uiComponent;

    TobagoResponseWriter writer
        = (TobagoResponseWriter) facesContext.getResponseWriter();

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

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

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

      writer.startElement("table", component);
      writer.writeAttribute("border", "0", null);
      writer.writeAttribute("cellspacing", "0", null);
      writer.writeAttribute("cellpadding", "0", null);
      writer.writeAttribute("summary", "", null);
      writer.writeAttribute("title", null, ATTR_TIP);

      writer.startElement("tr", null);
      writer.startElement("td", null);
    }

    Boolean currentValue = (Boolean) component.getValue();
    boolean checked = currentValue != null && currentValue.booleanValue();

    writer.startElement("input", component);
    writer.writeAttribute("type", "checkbox", null);
    writer.writeAttribute("value", "true", null);
    writer.writeAttribute("checked", checked);
    writer.writeNameAttribute(component.getClientId(facesContext));
    writer.writeComponentClass();
    writer.writeIdAttribute(component.getClientId(facesContext));
    writer.writeAttribute("disabled",
        ComponentUtil.getBooleanAttribute(component, ATTR_DISABLED));
    writer.writeAttribute("title", null, ATTR_TIP);
    writer.endElement("input");
View Full Code Here

Examples of javax.faces.component.UISelectBoolean

  boolean bIsOptional = getObligation().equalsIgnoreCase(Section.OBLIGATION_OPTIONAL);
 
  setOpen(true);
  UIComponent component = editorForm.findComponent(sCheckboxId);
  if ((component != null) && (component instanceof UISelectBoolean)) {
    UISelectBoolean checkbox = (UISelectBoolean)component;
    checkbox.setSelected(getOpen());
  }
  if (!bIsExclusive && !bIsOptional) {
    component = editorForm.findComponent(sImgId);
    if ((component != null) && (component instanceof UIGraphic)) {
      setGraphicUrl((UIGraphic)component);
View Full Code Here

Examples of javax.faces.component.UISelectBoolean

      }
    }
  } else {
    component = editorForm.findComponent(sCheckboxId);
    if ((component != null) && (component instanceof UISelectBoolean)) {
      UISelectBoolean checkbox = (UISelectBoolean)component;
      setOpen(checkbox.isSelected());
    }
  }
 
  // set the graphic for regular sections upon the open status
  if (!bIsExclusive && !bIsOptional) {
View Full Code Here

Examples of javax.faces.component.UISelectBoolean

    String sFKey = sKey.replace('.','_');
    sFKey = sKey.replace(':','_');
    String sId  = sIdPfx+"-"+sFKey;
    UIComponent component = editorForm.findComponent(sId);
    if ((component != null) && (component instanceof UISelectBoolean)) {
      UISelectBoolean checkBox = (UISelectBoolean)component;
     
      // add the code key to the parameter's multiple values if selected
      if (checkBox.isSelected() && (sKey.length() > 0)) {
        values.add(new ContentValue(sKey));
      }
    }
  }
}
View Full Code Here

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

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);
      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

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);
      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
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.