is there any suggest to add a custom PropertyEditor to grails?

View: New views
2 Messages — Rating Filter:   Alert me  

is there any suggest to add a custom PropertyEditor to grails?

by Eric Liu-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

    i have a geometry  class named :Point , and a PropertyEditor PointEditor. 

    and i try write config file :  resources.xml in config/spring directory:

<?xml version="1.0" encoding="UTF-8"?>
       xsi:schemaLocation="http://www.springframework.org/schema/beans

<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      <property name="customEditors">
<map>
  <entry key="my.Point" value="my.PointEditor"/>
</map>
   </property>
 </bean>
</beans>

  so when grails is running, i test in bootstrap.groovy , it can find the right editor for Point class.
 But when i use Point as property in a domain class , and generate controllors, use controllor's save method,it can't find the editor, is data binding something need config?

thanks!



Re: is there any suggest to add a custom PropertyEditor to grails?

by Graeme Rocher-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In Grails you just add a PropertyEditorRegistrar to your resources.xml
or resources.groovy you don't need the CustomEditorCOnfigurer

Cheers

On Sun, Nov 8, 2009 at 8:31 AM, Eric Liu <todayeric@...> wrote:

> Dear all,
>     i have a geometry  class named :Point , and a PropertyEditor
> PointEditor.
>     and i try write config file :  resources.xml in config/spring directory:
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
> <bean id="customEditorConfigurer"
> class="org.springframework.beans.factory.config.CustomEditorConfigurer">
>       <property name="customEditors">
> <map>
>   <entry key="my.Point" value="my.PointEditor"/>
> </map>
>    </property>
>  </bean>
> </beans>
>   so when grails is running, i test in bootstrap.groovy , it can find the
> right editor for Point class.
>  But when i use Point as property in a domain class , and generate
> controllors, use controllor's save method,it can't find the editor, is data
> binding something need config?
> thanks!
>
>



--
Graeme Rocher
Head of Grails Development
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email