gwtXPDownloadsBlog

Examples

 

Model classes

Below classes is used during this demo. It is straightforward.

User class

package com.gdevelop.examples.demo.client;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import java.util.Date;

public class User {
  private transient PropertyChangeSupport changeSupport =
      new PropertyChangeSupport(this);

  private String userId;
  private String fullName;
  private Date dob;
  private String email;
  private int numberOfWrongPassword;
  private String password;
  private Boolean enabled;

  public User() {
  }
  public User(String userId, String fullName, Date dob, String email,
      int numberOfWrongPassword, Boolean enabled) {
    this.userId = userId;
    this.fullName = fullName;
    this.dob = dob;
    this.email = email;
    this.numberOfWrongPassword = numberOfWrongPassword;
    this.enabled = enabled;
  }

  /*
   * Property Change Support
   */
  public void addPropertyChangeListener(PropertyChangeListener listener){
    changeSupport.addPropertyChangeListener(listener);
  }
  public void addPropertyChangeListener(String propName,
      PropertyChangeListener listener){
    changeSupport.addPropertyChangeListener(propName, listener);
  }
  public void removePropertyChangeListener(PropertyChangeListener listener){
    changeSupport.removePropertyChangeListener(listener);
  }
  public void removePropertyChangeListener(String propName,
       PropertyChangeListener listener){
    changeSupport.removePropertyChangeListener(propName, listener);
  }

  public String getUserId(){
    return userId;
  }
  public void setUserId(String userId){
    String oldUserId = this.userId;
    this.userId = userId;
    changeSupport.firePropertyChange("userId", oldUserId, userId);
  }

  public String getFullName() {
    return fullName;
  }
  public void setFullName(String fullName) {
    String oldFullName = this.fullName;
    this.fullName = fullName;
    changeSupport.firePropertyChange("fullName", oldFullName, fullName);
  }

  public String getEmail(){
    return email;
  }
  public void setEmail(String email){
    String oldEmail = this.email;
    this.email = email;
    changeSupport.firePropertyChange("email", oldEmail, email);
  }

  public Date getDob() {
    return dob;
  }
  public void setDob(Date dob) {
    Date oldDob = this.dob;
    this.dob = dob;
    changeSupport.firePropertyChange("dob", oldDob, dob);
  }

  public int getNumberOfWrongPassword() {
    return numberOfWrongPassword;
  }
  public void setNumberOfWrongPassword(int numberOfWrongPassword) {
    int oldNumberOfWrongPassword = this.numberOfWrongPassword;
    this.numberOfWrongPassword = numberOfWrongPassword;
    changeSupport.firePropertyChange("numberOfWrongPassword",
      oldNumberOfWrongPassword, numberOfWrongPassword);
  }

  public String getPassword() {
    return password;
  }
  public void setPassword(String password) {
    String oldPassword = this.password;
    this.password = password;
    changeSupport.firePropertyChange("password", oldPassword, password);
  }

  public Boolean getEnabled() {
    return enabled;
  }
  public void setEnabled(Boolean enabled) {
    Boolean oldEnabled = this.enabled;
    this.enabled = enabled;
    changeSupport.firePropertyChange("enabled", oldEnabled, enabled);
  }

}

UserList class

package com.gdevelop.examples.demo.client;

import java.util.Date;

public class UserList extends SingleSelectionList{
  private static final long MILIS_PER_DAY = 24*60*60*1000;
  static UserList createExampleData(){
    UserList users = new UserList();
    // Admin user
    User user = new User("admin", "Administrator",
                      new Date(System.currentTimeMillis()-MILIS_PER_DAY*10000),
                      "admin@example.com", 0, true);
    user.setUserId("admin");
    users.add(user);
    // Generate some user
    for (int i=0; i<20; i++){
      user = new User("user_" + i, "User " + i,
       new Date(System.currentTimeMillis()-MILIS_PER_DAY*((int)(10000*Math.random()))),
       "user" + i + "@example.com", 0, true);
      users.add(user);
    }

    return users;
  }

  public UserList() {
  }

  public User getSelected() {
    return super.getSelected();
  }
}

gwtxp.xml files and Controller classes

In the demo screen, click on 'Source' table to see the gwtxp.xml file and Controller class.

View the demo

View the demo in another tab/window

Source code

Download the demo source code from the Downloads page.

Share and Enjoy:

  • Google Bookmarks
  • Twitter
  • Facebook
  • Digg
  • Technorati
  • Live
  • DZone
  • Reddit
  • del.icio.us
  • Mixx
  • Netvibes
  • StumbleUpon
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • email


Recent Comments:

  • Trung: There are no Benchmarks now. However, GWT RPC is NOT a generic, language-independent...
  • Jeff Schnitzer: This is very cool! Any metrics on how it compares, performancewise, to Hessian,...
  • Trung: Hi Ed, Thanks for your questions. It suggests me a new feature of SyncProxy. I just...
  • Ed: One more thing. Sorry to keep bothering. Will this work with http sessions?
  • Ed: Awesome! Thanks. I’ll try this today!