Package javax.faces.component

Examples of javax.faces.component.EditableValueHolder


            Object value;

            if (component instanceof EditableValueHolder)
            {

                EditableValueHolder holder = (EditableValueHolder) component;

                if (holder.isLocalValueSet())
                {
                    value = holder.getLocalValue();
                }
                else
                {
                    value = getValue(component);
                }
View Full Code Here


        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

   * @return
   */
  public String getValueAsString(FacesContext context, UIComponent component) {
    // First - get submitted value for input components
    if (component instanceof EditableValueHolder) {
      EditableValueHolder input = (EditableValueHolder) component;
      String submittedValue = (String) input.getSubmittedValue();
      if (null != submittedValue) {
        return submittedValue;
      }
    }
    // If no submitted value presented - convert same for UIInput/UIOutput
View Full Code Here

      SavedState ss = childState.get(clientId);
      if (ss == null) {
        ss=NullState;
      }
      if (c instanceof EditableValueHolder) {
        EditableValueHolder evh = (EditableValueHolder) c;
        ss.apply(evh);
      }
      if (c instanceof IterationStateHolder) {
        IterationStateHolder ish = (IterationStateHolder) c;
        ss.apply(ish);
View Full Code Here

    @SuppressWarnings({"unchecked"})
    public void applyAttachedObject(FacesContext context, UIComponent parent) {

        FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
        EditableValueHolder evh = (EditableValueHolder) parent;
        if (owner.isDisabled(ctx)) {
            Set<String> disabledIds = (Set<String>)
                  RequestStateManager.get(context, RequestStateManager.DISABLED_VALIDATORS);
            if (disabledIds == null) {
                disabledIds = new HashSet<String>(3);
                RequestStateManager.set(context,
                                        RequestStateManager.DISABLED_VALIDATORS,
                                        disabledIds);
            }
            disabledIds.add(owner.getValidatorId(ctx));
            return;
        }

        ValueExpression ve = null;
        Validator v = null;
        if (owner.getBinding() != null) {
            ve = owner.getBinding().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(owner.getTag(), "No Validator was created");
        }
        owner.setAttributes(ctx, v);
        evh.addValidator(v);

    }
View Full Code Here

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

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

   */
  public void validate(FacesContext context, UIComponent component,
      Object convertedValue) throws ValidatorException {
    if (component instanceof EditableValueHolder) {
      // Validate input component
      EditableValueHolder input = (EditableValueHolder) component;
      try {
        ValueExpression valueExpression = component
            .getValueExpression("value");
        if (null != valueExpression) {
          // TODO - check EL Exceptions ?
          String[] messages = HibernateValidator.getInstance(context)
              .validate(context, valueExpression, convertedValue, getProfiles());
          if (null != messages) {
            input.setValid(false);
            // send all validation messages.
            for (String msg : messages) {
              // TODO - create Summary message ?
              String summaryString = getSummary()!=null?getSummary():msg;
             
View Full Code Here

      Validator validator) {
    Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren();
    while (facetsAndChildren.hasNext()) {
      UIComponent child = facetsAndChildren.next();
      if (child instanceof EditableValueHolder) {
        EditableValueHolder input = (EditableValueHolder) child;
        setupValidator(input,validator);
      }
      setupValidators(child, validator);
    }
  }
View Full Code Here

            Object value;

            if(component instanceof EditableValueHolder) {

                EditableValueHolder holder = (EditableValueHolder) component;
               
                if(holder.isLocalValueSet()) {
                    value = holder.getLocalValue();
                } else {
                    value = getValue(component);
                }
            }
            else {
View Full Code Here

        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

TOP

Related Classes of javax.faces.component.EditableValueHolder

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.