I believe requestfactory and new feature such as cell widget and cell
table should be development paradigm to work in tandem, but I found
that they might not work as  expected, I don't know it's a bug or just
I don't know how to use it right.

The symptom is when using entity proxy as the <T> in celltable and
selectionModel creation process, onSelectionChange event won't be
triggered; if I get rid of keyProvider in selectionModel and celltable
creation ,the onSelectionChange will be triggered, but I still can not
get the selected object by using ' selected =
selectionModel.getSelectedObject();'
Below is entity proxy,celltable creation code snippet:

*ContactProxy.java
@ProxyFor(Contact.class)
public interface ContactProxy extends EntityProxy {
  Long getId();

  String getName();

  String getAddress();

  void setName(String name);

  void setAddress(String address);

  void setId(Long id);
}
______________________________________

*cellTable creation
  private void createTable() {
    table = new CellTable<ContactProxy>(keyProvider);

    // Create name column
    TextColumn<ContactProxy> nameColumn = new
TextColumn<ContactProxy>() {
      public String getValue(ContactProxy object) {
        return object.getName();
      }
    };

    // Create address column
    TextColumn<ContactProxy> addressColumn = new
TextColumn<ContactProxy>() {
      public String getValue(ContactProxy object) {
        return object.getAddress();
      }
    };

    // Add a selection model to handle user selection.
    final SingleSelectionModel<ContactProxy> selectionModel =
        new SingleSelectionModel<ContactProxy>(keyProvider);
    table.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(new
SelectionChangeEvent.Handler() {
      public void onSelectionChange(SelectionChangeEvent event) {

        ContactProxy selected = selectionModel.getSelectedObject();
        Window.alert("ok" + selected.getId());
        if (selected != null) {
 
clientFactory.setSelectedContactId(selected.getId().toString());
        }
      }
    });

    table.addColumn(nameColumn, "Name");
    table.addColumn(addressColumn, "Address");

  }


my guess is selectionModel does not welcome interface, is that right?
thank you .

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to