Here is my code for that (Message is my model object, but it can be all you 
want) :

   Column<Message, Boolean> select = new Column<Message, 
Boolean>(newCheckboxCell(
true)) {


  @Override

 public Boolean getValue(Message object)

 {

  return selectionModel.isSelected(object);

 }

 };

 select.setFieldUpdater(new FieldUpdater<Message, Boolean>() {

 public void update(int index, Message object, Boolean value)

 {

  // Called when the user clicks on a checkbox.

  selectionModel.setSelected(object, value);

 }

 });


 Header<Boolean> selectAllHeader = new Header<Boolean>(new CheckboxCell()) {


  @Override

 public Boolean getValue()

 {

  return selectionModel.getSelectedSet().size() == table.getRowCount();

 }

 };


 selectAllHeader.setUpdater(new ValueUpdater<Boolean>() {


  @Override

 public void update(Boolean value)

 {

  List<Message> displayedItems = table.getDisplayedItems();


  for (Message msg : displayedItems)

  {

  selectionModel.setSelected(msg, value);

  }

 }

 });


 table.addColumn(select, selectAllHeader);

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

Reply via email to