Examples of EditableValueHolder


Examples of javax.faces.component.EditableValueHolder

        String id = c.getId();
        c.setId(id);

        // hack
        if (c instanceof EditableValueHolder) {
            EditableValueHolder evh = (EditableValueHolder) c;
            String clientId = c.getClientId(faces);
            SavedState ss = (SavedState) this.getChildState().get(clientId);
            if (ss != null) {
                ss.apply(evh);
            } else {
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

        }

        // only process if it's been created
        if (parent.getParent() == null) {
            // cast to a ValueHolder
            EditableValueHolder evh = (EditableValueHolder) parent;
            ValueExpression ve = null;
            Validator v = null;
            if (this.binding != null) {
                ve = this.binding.getValueExpression(ctx, Validator.class);
                v = (Validator) ve.getValue(ctx);
            }
            if (v == null) {
                v = this.createValidator(ctx);
                if (ve != null) {
                    ve.setValue(ctx, v);
                }
            }
            if (v == null) {
                throw new TagException(this.tag, "No Validator was created");
            }
            this.setAttributes(ctx, v);
            evh.addValidator(v);
        }
    }
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

   */
  public void apply(FaceletContext ctx, UIComponent parent)
      throws IOException, FacesException, FaceletException, ELException {
    if (parent instanceof EditableValueHolder) {
      if (ComponentSupport.isNew(parent)) {
        EditableValueHolder evh = (EditableValueHolder) parent;
        ValueExpression b = null;
        if (this.binding != null) {
          b = this.binding.getValueExpression(ctx, ValueChangeListener.class);
        }
        ValueChangeListener listener = new LazyValueChangeListener(
            this.listenerType, b);
        evh.addValueChangeListener(listener);
      }
    } else {
      throw new TagException(this.tag,
          "Parent is not of type EditableValueHolder, type is: "
              + parent);
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

        c.setId(id);

        // hack
        if (c instanceof EditableValueHolder)
        {
            EditableValueHolder evh = (EditableValueHolder) c;
            String clientId = c.getClientId(faces);
            SavedState ss = _getChildState().get(clientId);
            if (ss != null)
            {
                ss.apply(evh);
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

  }

  protected String getCurrentValue(FacesContext facesContext, UIComponent component) {

    if (component instanceof EditableValueHolder) {
      EditableValueHolder editableValueHolder = (EditableValueHolder) component;
      Object submittedValue = editableValueHolder.getSubmittedValue();
      if (submittedValue != null || !editableValueHolder.isValid()) {
        return (String) submittedValue;
      }
    }
    String currentValue = null;
    Object currentObj = getValue(component);
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

        else
        {
            // tag is enabled --> create the validator and attach it
           
            // cast to a ValueHolder
            EditableValueHolder evh = (EditableValueHolder) parent;
            ValueExpression ve = null;
            Validator v = null;
            if (_delegate.getBinding() != null)
            {
                ve = _delegate.getBinding().getValueExpression(faceletContext, Validator.class);
                v = (Validator) ve.getValue(faceletContext);
            }
            if (v == null)
            {
                v = this.createValidator(faceletContext);
                if (ve != null)
                {
                    ve.setValue(faceletContext, v);
                }
            }
            if (v == null)
            {
                throw new TagException(_delegate.getTag(), "No Validator was created");
            }
            _delegate.setAttributes(faceletContext, v);
            evh.addValidator(v);
        }
    }
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

        if(foreignComponent == null)
            throw new FacesException("Unable to find component '" + foreignComponentName + "' (calling findComponent on component '" + uiComponent.getId() + "')");

        if(false == foreignComponent instanceof EditableValueHolder)
            throw new FacesException("Component '" + foreignComponent.getId() + "' does not implement EditableValueHolder");
        EditableValueHolder foreignEditableValueHolder = (EditableValueHolder)foreignComponent;

        if (foreignEditableValueHolder.isRequired() && foreignEditableValueHolder.getValue()== null ) {
            return;
        }

        Object foreignValue;
        if (foreignEditableValueHolder.isValid())
        {
            foreignValue = foreignEditableValueHolder.getValue();
        }
        else
        {
            try
            {
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

        Boolean.TRUE.equals(attrs.get("disabled")))
      return;

    // Just clue in component that we have been "submitted" so
    // that it doesn't short-circuit anything
    EditableValueHolder evh = (EditableValueHolder) component;
    evh.setSubmittedValue(Boolean.TRUE);

    // Because these components weren't around during processDecodes(),
    // they didn't get decoded.  So, run that now.
    component.getFacet("month").processDecodes(context);
    component.getFacet("year").processDecodes(context);
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

  public Object getConvertedValue(
    FacesContext context,
    UIComponent  component,
    Object       submittedValue)
  {
    EditableValueHolder monthComp = (EditableValueHolder) component.getFacet("month");
    EditableValueHolder yearComp = (EditableValueHolder) component.getFacet("year");
    EditableValueHolder dayComp = (EditableValueHolder) component.getFacet("day");

    if (!monthComp.isValid() ||
        !yearComp.isValid() ||
        !dayComp.isValid())
    {
      // =-=AEW What to do????????
      //setValid(false);
      return null;
    }

    int year = ((Number) yearComp.getValue()).intValue();
    // We'll be 1970 - 2069.  Good enough for a demo.
    if (year < 70)
      year += 100;

    int month = ((Number) monthComp.getValue()).intValue() - 1;
    int day = ((Number) dayComp.getValue()).intValue();

    Date oldValue = (Date) ((EditableValueHolder) component).getValue();
    //Date newValue = (Date) oldValue.clone();
    Calendar calendar = Calendar.getInstance();
    calendar.setLenient(true);
View Full Code Here

Examples of javax.faces.component.EditableValueHolder

     */
    private void saveDescendantState(UIComponent component, FacesContext context)
    {
        if (component instanceof EditableValueHolder)
        {
            EditableValueHolder input = (EditableValueHolder) component;
            String clientId = component.getClientId(context);
            SavedState state = (SavedState) _saved.get(clientId);
            if (state == null)
            {
                state = new SavedState();
                _saved.put(clientId, state);
            }
            state.setValue(input.getLocalValue());
            state.setValid(input.isValid());
            state.setSubmittedValue(input.getSubmittedValue());
            state.setLocalValueSet(input.isLocalValueSet());
        }

        List kids = component.getChildren();
        for (int i = 0; i < kids.size(); i++)
        {
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.