Package org.springframework.webflow.engine.builder

Examples of org.springframework.webflow.engine.builder.BinderConfiguration$Binding


  /**
     * Test that the value for the {bar} property returned by the <code>getFooBar</code>
     * method matches the expected value parsed from the WSDL.
   */
  public void testGetFooBar() {
        Binding binding = null;
        FooBindingExtensions exts = null;
        binding = fBindings[0];
        exts = (FooBindingExtensions)binding
        .getComponentExtensionContext(FooConstants.NS_URI_FOO);
        assertNotNull("The Binding '" + binding.getName() + "' does not contain an FooBindingExtensions object.",
            exts);
        Integer actual = exts.getFooBar();
        assertEquals("Unexpected number of errors", 1, testErrorHandler.numErrors);
        assertEquals("Unexpected error key", "Errors: FOO-001 \n", testErrorHandler.getSummaryOfMessageKeys());

      binding = fBindings[1];
        exts = (FooBindingExtensions)binding
          .getComponentExtensionContext(FooConstants.NS_URI_FOO);
        assertNotNull("The Binding '" + binding.getName() + "' does not contain an FooBindingExtensions object.",
                exts);
       
        actual = exts.getFooBar();
        assertNotNull("The value for bar was null", actual);
        assertEquals("Unexpected value for bar.", 3, actual.intValue());
View Full Code Here


  /**
     * Test that the value for the {baz} property returned by the <code>getFooBaz</code>
     * method matches the expected value parsed from the WSDL.
   */
  public void testGetFooBaz() {
        Binding binding1 = fBindings[1];
        FooBindingExtensions exts = (FooBindingExtensions)binding1
          .getComponentExtensionContext(FooConstants.NS_URI_FOO);
        assertNotNull("The Binding '" + binding1.getName() + "' does not contain an FooBindingExtensions object.",
                exts);
       
        String actual = exts.getFooBaz();
        assertNotNull("The value for bar was null", actual);
        assertEquals("Unexpected value for baz.", "john", actual);
View Full Code Here

    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
    view.setExpressionParser(DefaultExpressionParserFactory.getExpressionParser());
    BinderConfiguration binderConfiguration = new BinderConfiguration();
    binderConfiguration.addBinding(new Binding("stringProperty", null, true));
    view.setBinderConfiguration(binderConfiguration);
    view.processUserEvent();
    assertTrue(view.hasFlowEvent());
    assertEquals("submit", view.getFlowEvent().getId());
    assertEquals("foo", bindBean.getStringProperty());
View Full Code Here

      return createViewFactory(viewId, binderModel);
    }
  }

  private ViewFactory createViewFactory(Expression viewId, BinderModel binderModel) {
    BinderConfiguration binderConfiguration = createBinderConfiguration(binderModel);
    return getLocalContext().getViewFactoryCreator().createViewFactory(viewId,
        getLocalContext().getExpressionParser(), getLocalContext().getConversionService(), binderConfiguration);
  }
View Full Code Here

        getLocalContext().getExpressionParser(), getLocalContext().getConversionService(), binderConfiguration);
  }

  private BinderConfiguration createBinderConfiguration(BinderModel binderModel) {
    if (binderModel != null && binderModel.getBindings() != null) {
      BinderConfiguration binderConfiguration = new BinderConfiguration();
      List bindings = binderModel.getBindings();
      for (Iterator it = bindings.iterator(); it.hasNext();) {
        BindingModel bindingModel = (BindingModel) it.next();
        boolean required;
        if (StringUtils.hasText(bindingModel.getRequired())) {
          required = ((Boolean) fromStringTo(Boolean.class).execute(bindingModel.getRequired()))
              .booleanValue();
        } else {
          required = false;
        }
        Binding binding = new Binding(bindingModel.getProperty(), bindingModel.getConverter(), required);
        binderConfiguration.addBinding(binding);
      }
      return binderConfiguration;
    } else {
      return null;
    }
View Full Code Here

    context.getMockExternalContext().setNativeResponse(new MockHttpServletResponse());
    context.getMockFlowExecutionContext().setKey(new MockFlowExecutionKey("c1v1"));
    org.springframework.web.servlet.View mvcView = new MockView();
    AbstractMvcView view = new MockMvcView(mvcView, context);
    view.setExpressionParser(createExpressionParser());
    BinderConfiguration binderConfiguration = new BinderConfiguration();
    binderConfiguration.addBinding(new Binding("stringProperty", null, true));
    view.setBinderConfiguration(binderConfiguration);
    view.processUserEvent();
    assertTrue(view.hasFlowEvent());
    assertEquals("submit", view.getFlowEvent().getId());
    assertEquals("foo", bindBean.getStringProperty());
View Full Code Here

    DefaultConversionService conversionService = new DefaultConversionService();
    StringToDate stringToDate = new StringToDate();
    stringToDate.setPattern("MM-dd-yyyy");
    conversionService.addConverter("customDateConverter", stringToDate);
    view.setConversionService(conversionService);
    BinderConfiguration binderConfiguration = new BinderConfiguration();
    binderConfiguration.addBinding(new Binding("dateProperty", "customDateConverter", true));
    view.setBinderConfiguration(binderConfiguration);
    view.processUserEvent();
    assertTrue(view.hasFlowEvent());
    assertEquals("submit", view.getFlowEvent().getId());
    Calendar cal = Calendar.getInstance();
View Full Code Here

      protected String toString(Object object) throws Exception {
        return "$" + object;
      }
    });
    BinderConfiguration binder = new BinderConfiguration();
    binder.addBinding(new Binding("datum2", "customConverter", true));
    model.setBinderConfiguration(binder);
    assertEquals("$3", model.getFieldValue("datum2"));
  }
View Full Code Here

      return createViewFactory(viewId, binderModel);
    }
  }

  private ViewFactory createViewFactory(Expression viewId, BinderModel binderModel) {
    BinderConfiguration binderConfiguration = createBinderConfiguration(binderModel);
    return getLocalContext().getViewFactoryCreator().createViewFactory(viewId,
        getLocalContext().getExpressionParser(), getLocalContext().getConversionService(), binderConfiguration,
        getLocalContext().getValidator(), getLocalContext().getValidationHintResolver());
  }
View Full Code Here

        getLocalContext().getValidator(), getLocalContext().getValidationHintResolver());
  }

  private BinderConfiguration createBinderConfiguration(BinderModel binderModel) {
    if (binderModel != null && binderModel.getBindings() != null) {
      BinderConfiguration binderConfiguration = new BinderConfiguration();
      List<BindingModel> bindings = binderModel.getBindings();
      for (BindingModel bindingModel : bindings) {
        boolean required = false;
        if (StringUtils.hasText(bindingModel.getRequired())) {
          required = ((Boolean) fromStringTo(Boolean.class).execute(bindingModel.getRequired()));
        }
        Binding binding = new Binding(bindingModel.getProperty(), bindingModel.getConverter(), required);
        binderConfiguration.addBinding(binding);
      }
      return binderConfiguration;
    } else {
      return null;
    }
View Full Code Here

TOP

Related Classes of org.springframework.webflow.engine.builder.BinderConfiguration$Binding

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.