Program: 50671
Project: 50671
Buggy source:
/** 
 * Add a field that supports multiple selection
 */
public void addMultiSelectField(){
  Cell<Boolean> booleanCell=(Cell<Boolean>)new CheckboxCell();
  Column<T,Boolean> selectedColumn=new Column<T,Boolean>(booleanCell){
    /** 
 * Get the value of the multi select field
 * @return the selected state of the row
 */
    @Override public Boolean getValue(    T object){
      return object.isSelected();
    }
  }
;
  SelectAllHeader header=new SelectAllHeader();
  header.addEventHandler(new ISelectAllEventHandler(){
    @Override public void onSelectAllEvent(    SelectAllEvent event){
      DataGrid dataGrid=SSDataGrid.this.dataGrid;
      Range rows=dataGrid.getVisibleRange();
      int end=rows.getStart() + rows.getLength();
      int numRecordsDisplayed=rows.getLength();
      if (end > dataGrid.getRowCount()) {
        end=dataGrid.getRowCount();
        numRecordsDisplayed=end % numRecordsDisplayed;
      }
      boolean allSelected=true;
      for (int i=rows.getStart(); i < end; i++) {
        if (!dataProvider.getList().get(i).isSelected()) {
          allSelected=false;
          break;
        }
      }
      for (int i=rows.getStart(); i < end; i++) {
        dataProvider.getList().get(i).setSelected(!allSelected);
      }
      dataProvider.refresh();
      for (int i=0; i < numRecordsDisplayed; i++) {
        setRowSelectedStyle(i,!allSelected);
      }
    }
  }
);
  dataGrid.addColumn(selectedColumn,header);
  dataGrid.setColumnWidth(selectedColumn,"String_Node_Str");
  selectedColumn.setFieldUpdater(new FieldUpdater<T,Boolean>(){
    /** 
 * Update the selection state 
 * @param index - the index of the row to be updated
 * @param object - The object currently being referenced
 * @param value - the selected state of the current row
 */
    @Override public void update(    int index,    T object,    Boolean value){
      setRowSelectedStyle((index - SSDataGrid.this.dataGrid.getVisibleRange().getStart()),value);
      object.setSelected(value);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Add a field that supports multiple selection
 */
public void addMultiSelectField(){
  Cell<Boolean> booleanCell=(Cell<Boolean>)new CheckboxCell();
  Column<T,Boolean> selectedColumn=new Column<T,Boolean>(booleanCell){
    /** 
 * Get the value of the multi select field
 * @return the selected state of the row
 */
    @Override public Boolean getValue(    T object){
      return object.isSelected();
    }
  }
;
  SelectAllHeader header=new SelectAllHeader();
  header.addEventHandler(new ISelectAllEventHandler(){
    /** 
 * Event triggered when the select all button is clicked
 * @param event - The event that was fired
 */
    @Override public void onSelectAllEvent(    SelectAllEvent event){
      DataGrid dataGrid=SSDataGrid.this.dataGrid;
      Range rows=dataGrid.getVisibleRange();
      int end=rows.getStart() + rows.getLength();
      int numRecordsDisplayed=rows.getLength();
      if (end > dataGrid.getRowCount()) {
        end=dataGrid.getRowCount();
        numRecordsDisplayed=end % numRecordsDisplayed;
      }
      boolean allSelected=true;
      for (int i=rows.getStart(); i < end; i++) {
        if (!dataProvider.getList().get(i).isSelected()) {
          allSelected=false;
          break;
        }
      }
      for (int i=rows.getStart(); i < end; i++) {
        dataProvider.getList().get(i).setSelected(!allSelected);
      }
      refresh();
    }
  }
);
  dataGrid.addColumn(selectedColumn,header);
  dataGrid.setColumnWidth(selectedColumn,"String_Node_Str");
  selectedColumn.setFieldUpdater(new FieldUpdater<T,Boolean>(){
    /** 
 * Update the selection state 
 * @param index - the index of the row to be updated
 * @param object - The object currently being referenced
 * @param value - the selected state of the current row
 */
    @Override public void update(    int index,    T object,    Boolean value){
      object.setSelected(value);
      refresh();
    }
  }
);
}