return "Manually set the absolute, min, max, and preferred size of a column.";
}
@Override
protected Widget onInitialize() {
CustomForm form = new CustomForm();
// Column selection
final TextBox columnBox = new TextBox();
columnBox.setText("3");
columnBox.setWidth("50px");
form.addLabeledWidget("Column Index:", columnBox);
// Width selection
final TextBox widthBox = new TextBox();
widthBox.setText("25");
widthBox.setWidth("50px");
form.addLabeledWidget("Width (pixels):", widthBox);
// Add button to set column size
{
Button button = new Button("Set Actual Column Width", new ClickHandler() {
public void onClick(ClickEvent event) {
try {
int column = Integer.parseInt(columnBox.getText());
int width = Integer.parseInt(widthBox.getText());
if (column >= 0) {
ScrollTableDemo.get().getScrollTable().setColumnWidth(column,
width);
}
} catch (NumberFormatException e) {
Window.alert("Please enter valid integers for the row and column.");
} catch (IndexOutOfBoundsException e) {
Window.alert("The row or column index you entered is out of bounds.");
}
}
});
form.addButton(button);
}
// Add button to set preferred column size
if (PagingScrollTableDemo.get() == null) {
Button button = new Button("Set Preferred Column Width",
new ClickHandler() {
public void onClick(ClickEvent event) {
try {
int column = Integer.parseInt(columnBox.getText());
int width = Integer.parseInt(widthBox.getText());
if (column >= 0) {
((ScrollTable) ScrollTableDemo.get().getScrollTable()).setPreferredColumnWidth(
column, width);
}
} catch (NumberFormatException e) {
Window.alert("Please enter valid integers for the row and column.");
} catch (IndexOutOfBoundsException e) {
Window.alert("The row or column index you entered is out of bounds.");
}
}
});
form.addButton(button);
}
// Add button to set min column size
if (PagingScrollTableDemo.get() == null) {
Button button = new Button("Set Minimum Column Width",
new ClickHandler() {
public void onClick(ClickEvent event) {
try {
int column = Integer.parseInt(columnBox.getText());
int width = Integer.parseInt(widthBox.getText());
if (column >= 0) {
((ScrollTable) ScrollTableDemo.get().getScrollTable()).setMinimumColumnWidth(
column, width);
}
} catch (NumberFormatException e) {
Window.alert("Please enter valid integers for the row and column.");
} catch (IndexOutOfBoundsException e) {
Window.alert("The row or column index you entered is out of bounds.");
}
}
});
form.addButton(button);
}
// Add button to set max column size
if (PagingScrollTableDemo.get() == null) {
Button button = new Button("Set Maximum Column Width",
new ClickHandler() {
public void onClick(ClickEvent event) {
try {
int column = Integer.parseInt(columnBox.getText());
int width = Integer.parseInt(widthBox.getText());
if (column >= 0) {
((ScrollTable) ScrollTableDemo.get().getScrollTable()).setMaximumColumnWidth(
column, width);
}
} catch (NumberFormatException e) {
Window.alert("Please enter valid integers for the row and column.");
} catch (IndexOutOfBoundsException e) {
Window.alert("The row or column index you entered is out of bounds.");
}
}
});
form.addButton(button);
}
return form;
}