Results 1 to 9 of 9

Thread: The new roo... how to set column width in generated views?

  1. #1
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    139

    Question The new roo... how to set column width in generated views?

    In the old roo view, it was obvious (even to me, a non-jsp person)
    to find and change the column width in the generated tables.

    With the new roo, it apparently delegates to a table.jspx,
    which looks for something called columnMaxLength, but how/where do I set that in the original table/list.jspx ?

    This is probably obvious to any jsp user, but i'm just starting on that technology.

    Related question:
    Must I resize the column width for a in each view where the field appears?
    It would seem that the string width would be property of the field/model,
    and could be passed on to the views.
    The database knows the max string length for each field, is that info just lost?

  2. #2
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    139

    Default

    Read a little on jsp extension tags...

    I have made it work a bit by changing form/fields/table.jspx to declare:
    Code:
      <jsp:directive.attribute name="columnMaxLengths"/>
    replacing the latter:
    Code:
         <c:set var="columnMaxLengths" scope="request" />
    and then including the attribute: columnMaxLengths="25,25,5,5,5"
    in the table:table tag.

    But I'm still wondering what is the correct/expected usage in the Spring jspx?
    And where does one go to learn about the Spring.jspx tags?

  3. #3
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    You are starting at the right location. If you want to change the table UI you are best off to include some CSS class or id definitions into the table.tagx tag and then manage the look and feel through CSS.

    Roo delivers these tags in pure XML format so you can easily customize them. To learn about the tags themselves, you can simply take a look into one. They should be quite simple to understand and use default expression language as well as a few external tag libraries (like the default JSTL 'c' tags).

    HTH,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  4. #4
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    139

    Lightbulb

    Stefan, thanks for the encouragement.
    The answer ["what is the correct/expected usage in the Spring jspx?"] is:

    To set the column width of a column, include the parameter: maxLength="number" in the table:column tag

    Code:
    <table:column id="c_my_pkg_MyClass_someField" property="someField" maxLength="45" z="xbMIJLPTzPZw5B38JQhrZq1fwQA="/>
    Presumably this will survive (be merged) after another DBRE... ?

  5. #5
    Join Date
    Oct 2010
    Location
    Almere, The Netherlands
    Posts
    32

    Question

    Quote Originally Posted by Stefan Schmidt View Post
    Roo delivers these tags in pure XML format so you can easily customize them.
    How are you going to handle changes to these default ROO tags which might be customized with updates and new releases?

  6. #6
    Join Date
    Dec 2007
    Location
    Stockholm, Sweden
    Posts
    190

    Default

    Harald ,

    if you see the attribute z="xbMIJLPTzPZw5B38JQhrZq1fwQA=" in the above code, if ROO shell detects that it is user defined, it puts the value of userdefined in it. If there are changes in the code and it is not this fancy looking string, it does not change the tag, otherwise it does and puts in a new computed string
    Shahzada Hatim
    @geoaxis/twitter
    http://hatimonline.com

  7. #7
    Join Date
    Oct 2010
    Location
    Almere, The Netherlands
    Posts
    32

    Default

    Quote Originally Posted by hatim View Post
    Harald ,

    if you see the attribute z="xbMIJLPTzPZw5B38JQhrZq1fwQA=" in the above code, if ROO shell detects that it is user defined, it puts the value of userdefined in it. If there are changes in the code and it is not this fancy looking string, it does not change the tag, otherwise it does and puts in a new computed string
    Hatim, I am talking about the tags in the tag folder, not the generated views. The views use the z attribute so that ROO can handle them. I've started to modify the tags which are being used by the views.

  8. #8
    Join Date
    Dec 2007
    Location
    Stockholm, Sweden
    Posts
    190

    Default

    my bad, didn't pay attention to tag.

    Well I don't see how you can partially replace a tag as there are no extension points and you can do any thing with the tag.

    I would guess you can maintain your own changed tags in a custom folder and with the next update of tag manually insert the diff into your custom tags where ever it applies.
    Shahzada Hatim
    @geoaxis/twitter
    http://hatimonline.com

  9. #9
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Harald,

    If you upgrade to a new version of Roo later on, it will not automatically override your existing tags. It will detect that tags with the relevant names already exist in the project and therefore not touch them.

    You can also develop an add-on which takes care of what Hatim just described in a more automated way. It could contain only your custom tags and copy them into any project by overriding the original tags if you want. The relevant development guide is already in Roo master and will be published with the next release.

    HTH,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Posting Permissions

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