Results 1 to 9 of 9

Thread: Rendered Fields Order

  1. #1
    Join Date
    Jun 2010
    Posts
    440

    Default Rendered Fields Order

    Hello,

    As you develop a form, it seems that Roo might change the field order.
    I wonder if there is a way to keep the field order in an specific way.

    Thx
    jD

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Roo reflects the order the fields are found in the .java file.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

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

    Default

    It depends on the Web front-end you are using. In case of Spring MVC / JSP (with Roo 1.1.0.M1 or 1.1.0.M2) you can change the order of fields in the jspx file. Roo will not reorder them if you keep the elements itself intact.

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

  4. #4

    Default

    It seems to me that with version 1.1.4 roo change the order I've specified in jspx everytime he have to update something on that file.

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

    Default

    @Macs, can you give an example (exact steps) of what you are doing and where you think Roo does something wrong?
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  6. #6

    Default

    Get an entity class exposed on the MVC, change some attributes adding them to the user managed bean, this will eliminate the same attribute from th AJ generated bean.
    Then go to the list.jspx and show.jspx and change the order of displayed columns to reflect a more rational information with your business.
    Now go back on the user managed bean and touch the file, Roo will update the two jspx reordering the columns setting first the attributes on the user managed bean, and then attributes on the AJ managed bean, ignoring the changed order you have given before and ignoring even the z="user-managed" attribute on the jspx tags.
    Last edited by Macs; Jul 6th, 2011 at 06:19 AM.

  7. #7

    Default

    adding to this problem I have two finder on that bean, and when i touch the bean the AJ controller that maps these finder is deleted every time. I have to touch the relative controller to get it recreated.

  8. #8
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    668

    Question Are you using DBRE?

    Quote Originally Posted by Macs View Post
    Get an entity class exposed on the MVC, change some attributes adding them to the user managed bean, this will eliminate the same attribute from th AJ generated bean.
    I'm trying to replicate your problem, but I'm struggling to understand the exact scenario. When you say "attribute", I presume you mean "field" in Roo terms? If so (i.e. some of your entities' fields are being introduced by AspectJ), can I assume you're using DBRE?

    Is it possible for you to post the code in question please?

  9. #9

    Default

    yes i'm using DBRE and attribute = field ( old OO naming convention) .
    Here a simplified and translated version of what I have in my DBRE.xml.

    Code:
        <table name="USER">
            <column name="ID" primaryKey="true" required="true" scale="0" size="12" type="3,NUMBER"/>
            <column name="LOGIN" primaryKey="false" required="true" scale="0" size="20" type="12,VARCHAR2"/>
            <column name="PASSWORD" primaryKey="false" required="true" scale="0" size="40" type="1,CHAR"/>
            <column name="ROLE" primaryKey="false" required="true" scale="0" size="20" type="12,VARCHAR2"/>
            <column name="IDCITY" primaryKey="false" required="true" scale="0" size="12" type="3,NUMBER"/>
            <column name="ENABLEDDATE" primaryKey="false" required="false" scale="0" size="7" type="93,DATE"/>
            <column name="DISABLEDDATE" primaryKey="false" required="false" scale="0" size="7" type="93,DATE"/>
            <column name="USERTYPE" primaryKey="false" required="true" scale="0" size="1" type="3,NUMBER"/>
            <column name="NAME" primaryKey="false" required="false" scale="0" size="30" type="12,VARCHAR2"/>
            <column name="SURNAME" primaryKey="false" required="false" scale="0" size="30" type="12,VARCHAR2"/>
            <column name="DESCRIPTIONUSERTYPE" primaryKey="false" required="true" scale="0" size="3" type="12,VARCHAR2"/>
            <foreign-key foreignTable="CITY" name="FK_USERCITY1" onDelete="restrict" onUpdate="cascade">
                <option key="exported" value="false"/>
                <reference foreign="ID" local="IDCITY"/>
            </foreign-key>
            <unique name="PK_USER">
                <unique-column name="ID"/>
            </unique>
            <unique name="TC_USER">
                <unique-column name="LOGIN"/>
            </unique>
        </table>
    on the generated java class add these personalizations:
    Code:
    @RooJavaBean
    @RooToString
    @RooDbManaged(automaticallyDelete = true)
    @RooEntity(versionField = "", table = "USER", schema = "XXX", finders = { "findUsersByLoginLike", "findUsersByIdcity" })
    public class UtentiDps {
    			
    	@Id
    	@SequenceGenerator(name="USER_ID_GENERATOR", sequenceName="USER_SEQ", allocationSize = 20)
    	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="USER_ID_GENERATOR")
    	private BigDecimal id;
    
        @Column(name = "PASSWORD", length = 40)
        @NotNull
        @Pattern(regexp = "{0}|((?=.*[\\d\\W])(?=.*[a-zA-Z]).{8,20})", message="{newpassword}")
        private String password;
    
    
    	@Column(name = "ROLE")
    	@NotNull
    	@Embedded
    	private RoleBean ruolo;	
    	
        @Column(name = "USERTYPE")
        @NotNull
        @Enumerated(EnumType.ORDINAL)
        private UserType usertype;
    	
          
        @Column(name = "ENABLEDDATE")
        @Temporal(TemporalType.TIMESTAMP)
        @DateTimeFormat(pattern = "dd/MM/yyyy")
        private Date enabledate;
        
        @Column(name = "DISABLEDDATE")
        @Temporal(TemporalType.TIMESTAMP)
        @DateTimeFormat(pattern = "dd/MM/yyyy")
        private Date disableddate;
        
    }
    You need all the cited classes or is enough?

Tags for this Thread

Posting Permissions

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