Results 1 to 5 of 5

Thread: Roo 1.1.4 not using converters in list?

  1. #1
    Join Date
    Nov 2010
    Posts
    9

    Default Roo 1.1.4 not using converters in list?

    It appears that in 1.1.4, list (and table) end up using toString to populate the table cells. I believe 1.1.3 was properly using converters. Is this a change in 1.1.4? What is the reasoning behind it?

  2. #2
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    667

    Default

    Can you give us the steps to reproduce this please, and the details of what cells you are looking at on which screen?

  3. #3
    Join Date
    Nov 2010
    Posts
    9

    Default

    Quote Originally Posted by Andrew Swan View Post
    Can you give us the steps to reproduce this please, and the details of what cells you are looking at on which screen?
    Andrew, this is evident in the Pet Clinic sample. I ran the clinic.roo script to generate the application. Then, simply create an Owner and a Pet. Assigned the Owner to that Pet and go to List All Pets. In the Pets table, notice the Owner column. The values are "Address: ..." which is the representation built by the generated toString method. The converter builds a string in the form of "First Last ..."

  4. #4
    Join Date
    Sep 2004
    Posts
    50

    Default

    faktor,

    I had a similar problem when upgrading one project from Roo 1.1.3 to 1.1.4. Other projects I upgraded did not have the same problem though, I do not know why, I think it is because I have made changes to the domain finders and controllers in the project that was giving me problems. These changes I think updated the ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file (this did not happen with the other projects but maybe future changes to these projects may cause a similra problem).

    The conversions that were registered in the protected void installFormatters(FormatterRegistry registry) method in the ApplicationConversionServiceFactoryBean.java file that previously worked but were being ignored.

    The ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file had created new methods:

    public void installLabelConverters(FormatterRegistry registry)
    public void afterPropertiesSet()

    and a converter class for each domain class.

    I subsequently removed all my previous methods that were referred to in the protected void installFormatters(FormatterRegistry registry) method and added the newly created methods:

    public void installLabelConverters(FormatterRegistry registry)
    public void afterPropertiesSet() - using the @Override annotation on this method

    and added the converter class for each domain class

    from ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file and updated the class converters according to my requirements.

    This deleted the ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file and everything worked as before. I am sure this is not the best solution but worked.

    Hope this helps

  5. #5
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    667

    Lightbulb Suggested fix

    I've replicated the problem in Roo 1.1.1 through 1.1.4 using the clinic.roo script (UPDATE: it's already logged as ROO-1861).

    In 1.1.4 at least, the converter is correctly used in the "Create/Update/Show Pet" views, just not in the pet list views (as you noted above).

    UPDATE: the problem is in the "table" tag used by the list views. If you change this line:

    Code:
    <spring:eval expression="item[column]" var="colTxt"/>
    ... to this:

    Code:
    <c:set var="colTxt">
        <spring:eval expression="item[column]" />
    </c:set>
    ... then it should work. Can you give this a try and let me know if it works for you too?

    UPDATE: fix committed for the next release; you can manually apply the above workaround in the meantime if necessary.
    Last edited by Andrew Swan; May 27th, 2011 at 01:27 AM. Reason: Added proposed fix

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •