This is very cool! Thanks, John LaBanca [EMAIL PROTECTED]
On Fri, Nov 28, 2008 at 2:54 PM, dflorey <[EMAIL PROTECTED]> wrote: > > Uuups, only working in hosted mode :-( > > On 27 Nov., 13:07, dflorey <[EMAIL PROTECTED]> wrote: > > Hi, > > I've used that Generator stuff in gwt for the first time and I've to > > admit that it is really cool! > > I've been using it to simplify the creation of model based gen2- > > tables. Instead of defining the TableDefinition programmatically you > > now have the alternative to do it with annotations in your domain > > class. > > Example: > > > > public static class Ancestor extends AbstractTreeTableItem implements > > RowValue { > > private String firstName, lastName; > > private double iq; > > private Date dateOfBirth; > > > > public Ancestor(String firstName, String lastName, int iq, Date > > dateOfBirth) { > > this.firstName = firstName; > > this.lastName = lastName; > > this.iq = iq; > > this.dateOfBirth = dateOfBirth; > > } > > > > @ColumnDefinition(column = 0, header = "First name", filterable = > > false) > > public String getFirstName() { > > return firstName; > > } > > > > @ColumnDefinition(column = 1, header = "Last name") > > public String getLastName() { > > return lastName; > > } > > > > @ColumnDefinition(column = 2, header = "IQ", numberFormat = > > NumberColumnFormat.SCIENTIFIC_FORMAT) > > public double getIq() { > > return iq; > > } > > > > @ColumnDefinition(column = 3, header = "Date of birth", > > dateTimeFormat = DateColumnFormat.SHORT_DATE_FORMAT) > > public Date getDateOfBirth() { > > return dateOfBirth; > > } > > > > @Override > > public String getDisplayName() { > > return firstName + " " + lastName; > > } > > > > @Override > > public String getId() { > > return firstName + lastName + dateOfBirth; > > } > > > > } > > > > Note that you have to implement the RowValue marker interface. Now you > > are ready to create your TableDefinition like this: > > > > TableDefinition<Ancestor> tableDefinition = GWT.create > > (Ancestor.class); > > > > Very cool! Thanks for this brilliant toolkit!! > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---