Package org.apache.myfaces.tobago.component

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


  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    if (!(component instanceof UIInput)) {
      LOG.error("Wrong type: Need " + UIInput.class.getName() + ", but was " + component.getClass().getName());
      return;
    }
    UIInput input = (UIInput) component;

    String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, input);

    final boolean password = ComponentUtil.getBooleanAttribute(input, ATTR_PASSWORD);
    String currentValue = getCurrentValue(facesContext, input);
    if (LOG.isDebugEnabled()) {
      LOG.debug("currentValue = '"
          + (password && currentValue != null ? StringUtils.leftPad("", currentValue.length(), '*') : currentValue)
          + "'");
    }
    String type = password ? "password" : "text";

    // Todo: check for valid binding
    boolean renderAjaxSuggest = input.getSuggestMethod() != null;
    String id = input.getClientId(facesContext);
    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
    writer.startElement(HtmlConstants.INPUT, input);
    writer.writeAttribute(HtmlAttributes.TYPE, type, false);
    writer.writeNameAttribute(id);
    writer.writeIdAttribute(id);
    if (currentValue != null) {
      writer.writeAttribute(HtmlAttributes.VALUE, currentValue, true);
    }
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, title, true);
    }
    int maxLength = 0;
    for (Validator validator : input.getValidators()) {
      if (validator instanceof LengthValidator) {
        LengthValidator lengthValidator = (LengthValidator) validator;
        maxLength = lengthValidator.getMaximum();
      }
    }
    if (maxLength > 0) {
      writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
    }
    writer.writeAttribute(HtmlAttributes.READONLY, ComponentUtil.getBooleanAttribute(input, ATTR_READONLY));
    writer.writeAttribute(HtmlAttributes.DISABLED, ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED));
    Integer tabIndex = input.getTabIndex();
    if (tabIndex != null) {
      writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
    }
    writer.writeStyleAttribute();

View Full Code Here


      return;
    }

    AjaxUtils.checkParamValidity(context, component, UIInput.class);

    UIInput input = (UIInput) component;

    MethodBinding mb;
    Object o = input.getSuggestMethod();
    if (o instanceof MethodBinding) {
      mb = (MethodBinding) o;
    } else {
      // should never occur
      return;
View Full Code Here

    parse("day", new Long(1L), "24:00:00");
    parse("year", new Long(1L), "8765:45:36");
  }

  private void format(String unit, Long aLong, String string) {
    UIInput input = new UIInput();
    String info = "Formatting numbers:"
        + " unit='" + unit + "'"
        + " long='" + aLong + "'";
    String result;
    if (unit != null) {
      input.getAttributes().put(ATTR_UNIT, unit);
    }
    result = converter.getAsString(null, input, aLong);
    assertEquals(info, string, result);
  }
View Full Code Here

    result = converter.getAsString(null, input, aLong);
    assertEquals(info, string, result);
  }

  private void parse(String unit, Long aLong, String string) {
    UIInput input = new UIInput();
    String info = "Parsing numbers:"
        + " unit='" + unit + "'"
        + " string='" + string + "'";
    Long result;
    if (unit != null) {
      input.getAttributes().put(ATTR_UNIT, unit);
    }
    result = (Long) converter.getAsObject(null, input, string);
    assertEquals(info, aLong, result);
  }
View Full Code Here

  private List<UIColumn> createSolarArrayColumns() {

    List<UIColumn> columns = new ArrayList<UIColumn>(3);

    UIInput textbox = (UIInput)
        ComponentUtil.createComponent(UIInput.COMPONENT_TYPE, RENDERER_TYPE_IN);
    ComponentUtil.setStringProperty(
        textbox, ATTR_VALUE, "#{luminary.population}");
    columns.add(ComponentUtil.createColumn(
        "#{overviewBundle.solarArrayPopulation}", "true", null, textbox));
View Full Code Here

TOP

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

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.