Package org.apache.myfaces.tobago.component

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


  }

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
    UIDatePicker picker = (UIDatePicker) component;
    UIDate dateInput = (UIDate) picker.getForComponent();
    if (dateInput == null) {
      LOG.error("The required UIDate component wasn't found for component id='" + component.getId());
      return;
    }
    // this can't be done in "onComponentPopulated()" of the picker, it seems to be to early
    final ValueExpression readonlyExpression = dateInput.getValueExpression(Attributes.READONLY);
    if (readonlyExpression != null) {
      picker.setValueExpression(Attributes.DISABLED, readonlyExpression);
    } else {
      final ValueExpression disabledExpression = dateInput.getValueExpression(Attributes.DISABLED);
      if (disabledExpression != null) {
        picker.setValueExpression(Attributes.DISABLED, disabledExpression);
      } else {
        picker.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
      }
    }
    UIPopup popup = (UIPopup) picker.getFacets().get(Facets.POPUP);
    picker.setRenderedPartially(new String[] {popup.getId()});
    Converter converter = getConverter(facesContext, dateInput);
View Full Code Here


  }

  @Override
  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    UIDatePicker link = (UIDatePicker) component;
    UIDate dateInput = (UIDate) link.getForComponent();
    if (dateInput != null) {
      super.encodeEnd(facesContext, component);
    } else {
      LOG.error("The required UIDate component wasn't found for component id='" + component.getId());
    }
View Full Code Here

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UIDate component = (UIDate) 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 (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (validator != null) {
      component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
    }
    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 (placeholder != null) {
      component.setValueExpression("placeholder", placeholder);
    }

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

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

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

    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

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UIDate component = (UIDate) 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 (accessKey != null) {
      if (!accessKey.isLiteralText()) {
        component.setValueExpression("accessKey", accessKey);
      } else {
        component.setAccessKey(accessKey.getExpressionString().charAt(0));
      }
    }
    if (labelWithAccessKey != null) {
      component.setValueExpression("labelWithAccessKey", labelWithAccessKey);
    }

    if (tabIndex != null) {
      if (!tabIndex.isLiteralText()) {
        component.setValueExpression("tabIndex", tabIndex);
      } else {
        component.setTabIndex(Integer.parseInt(tabIndex.getExpressionString()));
      }
    }
    if (validator != null) {
      component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
    }
    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 (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

  }

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
    UIDatePicker picker = (UIDatePicker) component;
    UIDate dateInput = (UIDate) picker.getForComponent();
    if (dateInput == null) {
      LOG.error("No required UIDate component found.");
      return;
    }
    if (FacesUtils.hasValueBindingOrValueExpression(dateInput, Attributes.READONLY)) {
      FacesUtils.copyValueBindingOrValueExpression(picker, Attributes.DISABLED,
          dateInput, Attributes.READONLY);
    } else {
      if (FacesUtils.hasValueBindingOrValueExpression(dateInput, Attributes.DISABLED)) {
        FacesUtils.copyValueBindingOrValueExpression(picker, Attributes.DISABLED,
            dateInput, Attributes.DISABLED);
      } else {
        picker.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
      }
    }
    Map<String, Object> attributes = picker.getAttributes();
    UIPopup popup = (UIPopup) picker.getFacets().get(Facets.PICKER_POPUP);
View Full Code Here

  }

  @Override
  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    UIDatePicker link = (UIDatePicker) component;
    UIDate dateInput = (UIDate) link.getForComponent();
    if (dateInput != null) {
      super.encodeEnd(facesContext, component);
    } else {
      LOG.error("No required UIDate component found.");
    }
View Full Code Here

  }

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
    UIDatePicker picker = (UIDatePicker) component;
    UIDate dateInput = (UIDate) picker.getForComponent();
    if (dateInput == null) {
      LOG.error("The required UIDate component wasn't found for component id='" + component.getId());
      return;
    }
    // this can't be done in "onComponentPopulated()" of the picker, it seems to be to early
    if (FacesUtils.hasValueBindingOrValueExpression(dateInput, Attributes.READONLY)) {
      FacesUtils.copyValueBindingOrValueExpression(dateInput, Attributes.READONLY, picker, Attributes.DISABLED);
    } else {
      if (FacesUtils.hasValueBindingOrValueExpression(dateInput, Attributes.DISABLED)) {
        FacesUtils.copyValueBindingOrValueExpression(dateInput, Attributes.DISABLED, picker, Attributes.DISABLED);
      } else {
        picker.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
      }
    }
    Map<String, Object> attributes = picker.getAttributes();
    UIPopup popup = (UIPopup) picker.getFacets().get(Facets.PICKER_POPUP);
View Full Code Here

  }

  @Override
  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
    UIDatePicker link = (UIDatePicker) component;
    UIDate dateInput = (UIDate) link.getForComponent();
    if (dateInput != null) {
      super.encodeEnd(facesContext, component);
    } else {
      LOG.error("The required UIDate component wasn't found for component id='" + component.getId());
    }
View Full Code Here

  }

  @Override
  public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
    final UIDatePicker picker = (UIDatePicker) component;
    final UIDate dateInput = (UIDate) picker.getForComponent();
    if (dateInput == null) {
      LOG.error("The required UIDate component wasn't found for component id='" + component.getId());
      return;
    }
    // this can't be done in "onComponentPopulated()" of the picker, it seems to be to early
    final ValueExpression readonlyExpression = dateInput.getValueExpression(Attributes.READONLY);
    if (readonlyExpression != null) {
      picker.setValueExpression(Attributes.DISABLED, readonlyExpression);
    } else {
      final ValueExpression disabledExpression = dateInput.getValueExpression(Attributes.DISABLED);
      if (disabledExpression != null) {
        picker.setValueExpression(Attributes.DISABLED, disabledExpression);
      } else {
        picker.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
      }
    }
    final UIPopup popup = (UIPopup) picker.getFacets().get(Facets.POPUP);
    picker.setRenderedPartially(new String[] {popup.getId()});
    final Converter converter = getConverter(facesContext, dateInput);
View Full Code Here

  }

  @Override
  public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
    final UIDatePicker link = (UIDatePicker) component;
    final UIDate dateInput = (UIDate) link.getForComponent();
    if (dateInput != null) {
      super.encodeEnd(facesContext, component);
    } else {
      LOG.error("The required UIDate component wasn't found for component id='" + component.getId());
    }
View Full Code Here

TOP

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

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.