* Handle click events from the buttons in this panel.
*
* @param sender
*/
public void onClick(Widget sender) {
FixedWidthGrid dataTable = ScrollTableDemo.getDataTable();
try {
if (sender == setTextButton) {
// Set cell text
int column = Integer.parseInt(columnIndexBox.getText());
int row = Integer.parseInt(rowIndexBox.getText());
dataTable.setText(row, column, textBox.getText());
} else if (sender == setHtmlButton) {
// Set cell HTML
int column = Integer.parseInt(columnIndexBox.getText());
int row = Integer.parseInt(rowIndexBox.getText());
dataTable.setHTML(row, column, textBox.getText());
} else if (sender == add1RowButton) {
// Insert 1 row
int row = Integer.parseInt(rowIndexBox.getText());
ScrollTableDemo.insertDataRow(row);
} else if (sender == add10RowButton) {
// Insert 10 rows
int row = Integer.parseInt(rowIndexBox.getText());
for (int i = row; i < row + 10; i++) {
ScrollTableDemo.insertDataRow(i);
}
} else if (sender == add100RowButton) {
// Insert 100 rows
int row = Integer.parseInt(rowIndexBox.getText());
for (int i = row; i < row + 100; i++) {
ScrollTableDemo.insertDataRow(i);
}
} else if (sender == removeRowButton) {
// Remove a row
int row = Integer.parseInt(rowIndexBox.getText());
dataTable.removeRow(row);
} else if (sender == resizeColumnCountButton) {
// Set column count
int column = Integer.parseInt(columnIndexBox.getText());
dataTable.resizeColumns(column);
}
} catch (IndexOutOfBoundsException e) {
Window.alert("The cell index you entered is out of bounds.");
} catch (NumberFormatException e) {
Window.alert("Please enter valid integers for the row and column.");