Examples of DataBinder


Examples of com.et.mvc.binding.DataBinder

        }
       
        int bindCount = 0//success bind field count
       
        for(Field f: ctx.getParameterType().getDeclaredFields()){
            DataBinder binder = DataBinders.getDataBinder(f.getType());
            if (binder != null){
                BindingContext bc = new BindingContext();
                bc.setParameterName(f.getName());
                bc.setParameterType(f.getType());
                bc.setRequest(ctx.getRequest());
                bc.setPrefix(ctx.getPrefix());

                Object value = binder.bind(bc);
                if (value != null) {
                  bindCount ++;
                }
                f.setAccessible(true);
                f.set(obj, value);
View Full Code Here

Examples of com.et.mvc.binding.DataBinder

        ctx.setParameterName(f.getName());
        ctx.setParameterType(f.getType());
        ctx.setRequest(request);
        ctx.setPrefix(prefix);
       
        DataBinder binder = DataBinders.getDataBinder(f.getType());
        if (binder != null) {
          String pname = ctx.getParameterName();
          if (!ctx.getPrefix().equals("")) {
            pname = ctx.getPrefix() + "." + pname;
          }
          if (request.getParameterMap().containsKey(pname)) {
            f.setAccessible(true);
            f.set(model, binder.bind(ctx));
          }
        } else {
              BindingContext bc = new BindingContext();
              bc.setParameterName(f.getName());
              bc.setParameterType(f.getType());
View Full Code Here

Examples of com.et.mvc.binding.DataBinder

                    ctx.setPrefix(bind.prefix());
                }
                else{
                    ctx.setPrefix("");
                }
                DataBinder binder = DataBinders.getDataBinder(types[i]);
                if (binder == null){
                    binder = new ObjectBinder();
                }
                parameters[i] = binder.bind(ctx);
            }
        }

        Object result = getActionMethod().invoke(this, parameters);
       
View Full Code Here

Examples of grails.databinding.DataBinder

        if (grailsApplication == null) {
            grailsApplication = Holders.findApplication();
        }
        try {
            final DataBindingSource bindingSource = createDataBindingSource(grailsApplication, object.getClass(), source);
            final DataBinder grailsWebDataBinder = getGrailsWebDataBinder(grailsApplication);
            grailsWebDataBinder.bind(object, bindingSource, filter, include, exclude);
        } catch (InvalidRequestBodyException e) {
            String messageCode = "invalidRequestBody";
            Class objectType = object.getClass();
            String defaultMessage = "An error occurred parsing the body of the request";
            String[] codes = getMessageCodes(messageCode, objectType);
View Full Code Here

Examples of grails.databinding.DataBinder

    public static MimeType resolveMimeType(Object bindingSource, MimeTypeResolver mimeTypeResolver) {
        return MimeTypeUtils.resolveMimeType(bindingSource, mimeTypeResolver);
    }

    private static DataBinder getGrailsWebDataBinder(final GrailsApplication grailsApplication) {
        DataBinder dataBinder = null;
        if (grailsApplication != null) {
            final ApplicationContext mainContext = grailsApplication.getMainContext();
            if (mainContext != null && mainContext.containsBean(DATA_BINDER_BEAN_NAME)) {
                dataBinder = mainContext.getBean(DATA_BINDER_BEAN_NAME, DataBinder.class);
            }
View Full Code Here

Examples of org.jboss.errai.databinding.client.api.DataBinder

  public Binding bind(final Widget widget, final String property, final Converter converter) {
    validatePropertyExpr(property);

    int dotPos = property.indexOf(".");
    if (dotPos > 0) {
      DataBinder nested = createNestedBinder(property);
      nested.bind(widget, property.substring(dotPos + 1), converter);
      Binding binding = new Binding(property, widget, converter, null);
      bindings.put(property, binding);
      return binding;
    }
View Full Code Here

Examples of org.jboss.errai.databinding.client.api.DataBinder

    validatePropertyExpr(property);

    int dotPos = property.indexOf(".");
    if (dotPos > 0) {
      String bindableProperty = property.substring(0, dotPos);
      DataBinder binder = binders.get(bindableProperty);
      if (binder != null) {
        binder.unbind(property.substring(dotPos + 1));
      }
    }
    binding.removeHandler();
    bindings.remove(property, binding);
View Full Code Here

Examples of org.jboss.errai.databinding.client.api.DataBinder

      Object actualValue = proxy.get(property);

      if ((knownValue == null && actualValue != null) ||
          (knownValue != null && !knownValue.equals(actualValue))) {

        DataBinder nestedBinder = binders.get(property);
        if (nestedBinder != null) {
          nestedBinder.setModel(actualValue, InitialState.FROM_MODEL);
          proxy.set(property, nestedBinder.getModel());
        }
        updateWidgetsAndFireEvent(property, knownValue, actualValue);
      }
    }
  }
View Full Code Here

Examples of org.jboss.errai.databinding.client.api.DataBinder

  public <P> void addPropertyChangeHandler(String property, PropertyChangeHandler<P> handler) {
    validatePropertyExpr(property);

    int dotPos = property.indexOf(".");
    if (dotPos > 0) {
      DataBinder nested = createNestedBinder(property);
      nested.addPropertyChangeHandler(property.substring(dotPos + 1), handler);
    }
    else if (property.equals("*")) {
      propertyChangeHandlerSupport.addPropertyChangeHandler(handler);
    }
    else if (property.equals("**")) {
      for (DataBinder nested : binders.values()) {
        nested.addPropertyChangeHandler(property, handler);
      }
      propertyChangeHandlerSupport.addPropertyChangeHandler(handler);
    }

    propertyChangeHandlerSupport.addPropertyChangeHandler(property, handler);
View Full Code Here

Examples of org.jboss.errai.databinding.client.api.DataBinder

    validatePropertyExpr(property);

    int dotPos = property.indexOf(".");
    if (dotPos > 0) {
      String bindableProperty = property.substring(0, dotPos);
      DataBinder nested = binders.get(bindableProperty);
      if (nested != null) {
        nested.removePropertyChangeHandler(property.substring(dotPos + 1), handler);
      }
    }
    else if (property.equals("*")) {
      propertyChangeHandlerSupport.removePropertyChangeHandler(handler);
    }
    else if (property.equals("**")) {
      for (DataBinder nested : binders.values()) {
        nested.removePropertyChangeHandler(property, handler);
      }
      propertyChangeHandlerSupport.removePropertyChangeHandler(handler);
    }

    propertyChangeHandlerSupport.removePropertyChangeHandler(property, handler);
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.