Examples of CustomDateEditor


Examples of org.springframework.beans.propertyeditors.CustomDateEditor

   * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.bind.ServletRequestDataBinder)
   */
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, false));
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

   * @see org.springframework.web.servlet.mvc.BaseCommandController#initBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.bind.ServletRequestDataBinder)
   */
  protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, false));
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  private Throwable ex = null;

  protected void setUp() throws Exception {
    XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("concurrent.xml", getClass()));
    CustomDateEditor editor = new CustomDateEditor(df, false);
    factory.registerCustomEditor(Date.class, editor);
    this.factory = factory;
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  @Override
  protected void initBinder(HttpServletRequest request,
      ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
    binder.registerCustomEditor(Date.class, null, new CustomDateEditor(
        new SimpleDateFormat("MM/dd/yyyy"), false));
    binder.registerCustomEditor(Long.class, new CustomNumberEditor(Long.class,
        true));
    binder.registerCustomEditor(Boolean.class, new CustomBooleanEditor(true));
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  @Override
  protected void initBinder(HttpServletRequest request,
      ServletRequestDataBinder binder) throws Exception {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
    binder.registerCustomEditor(Date.class, null, new CustomDateEditor(
        new SimpleDateFormat("MM/dd/yyyy"), false));
    binder.registerCustomEditor(Long.class, new CustomNumberEditor(Long.class,
        true));
    binder.registerCustomEditor(Integer.class,
        new CustomNumberEditor(Integer.class, true));
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

   */
  @InitBinder
  public void initBinder(PortletRequestDataBinder binder, PortletPreferences preferences) {
    String formatString = preferences.getValue("dateFormat", PetService.DEFAULT_DATE_FORMAT);
    SimpleDateFormat dateFormat = new SimpleDateFormat(formatString);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
    binder.setAllowedFields(new String[] {"species", "breed", "name", "birthdate"});
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  public void testCustomEditorConfigurerWithRequiredTypeAsClassName() throws ParseException {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    CustomEditorConfigurer cec = new CustomEditorConfigurer();
    Map editors = new HashMap();
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
    editors.put(Date.class.getName(), new CustomDateEditor(df, true));
    cec.setCustomEditors(editors);
    cec.postProcessBeanFactory(bf);

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("date", "2.12.1975");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  public void testCustomEditorConfigurerWithRequiredTypeAsClass() throws ParseException {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    CustomEditorConfigurer cec = new CustomEditorConfigurer();
    Map editors = new HashMap();
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
    editors.put(Date.class, new CustomDateEditor(df, true));
    cec.setCustomEditors(editors);
    cec.postProcessBeanFactory(bf);

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("date", "2.12.1975");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  public void testWithCustomDateEditorEmptyNotAllowed() throws Exception {
    final DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
    TestController tc = new TestController() {
      protected void initBinder(PortletRequest request, PortletRequestDataBinder binder) {
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
      }
    };
    MockRenderRequest request = new MockRenderRequest();   
    MockRenderResponse response = new MockRenderResponse();
    String name = "test";
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomDateEditor

  public void testWithCustomDateEditorEmptyAllowed() throws Exception {
    final DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
    TestController tc = new TestController() {
      protected void initBinder(PortletRequest request, PortletRequestDataBinder binder) {
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
      }
    };
    MockRenderRequest request = new MockRenderRequest();   
    MockRenderResponse response = new MockRenderResponse();
    String name = "test";
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.