in src/org/pushingpixels/lightbeam/panels/TablePanel.java [414:460]
public PerformanceScenario getRowDeletionScenario() {
return new PerformanceScenario() {
int[] perms;
int origRowCount;
@Override
public String getName() {
return "Deleting rows in large table";
}
@Override
public void setup() {
table.scrollRectToVisible(table.getCellRect(0, 0, true));
table.setRowSelectionAllowed(true);
table.setColumnSelectionAllowed(false);
table.getSelectionModel().clearSelection();
table.getSelectionModel().setSelectionMode(
ListSelectionModel.SINGLE_INTERVAL_SELECTION);
this.perms = LightBeamUtils.getPermutation(table.getRowCount()
- 10 * this.getIterationCount(), this
.getIterationCount());
this.origRowCount = table.getRowCount();
}
@Override
public int getIterationCount() {
return 10;
}
@Override
public void runSingleIteration(int iterationNumber) {
MyTableModel model = (MyTableModel) table.getModel();
int start = this.perms[iterationNumber];
// scroll to the beginning
table.scrollRectToVisible(table.getCellRect(start, 0, true));
// and delete 10 rows
model.deleteRows(start, 10);
table.paintImmediately(table.getVisibleRect());
}
@Override
public void tearDown() {
table.setModel(new MyTableModel(this.origRowCount));
}
};
}