controlsColumn = new ButtonColumn();
controlsColumn.add(new Label("Insert/Delete Cells"));
groupContainerColumn.add(controlsColumn);
final Grid grid = new Grid(4);
grid.setBorder(new Border(new Extent(1), Color.BLUE, Border.STYLE_SOLID));
while (nextCellNumber < 17) {
grid.add(createGridCellButton());
}
testColumn.add(grid);
controlsColumn.addButton("Clear Selection", new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectCellButton(null);
}
});
controlsColumn.addButton("Insert Cell Before Selected", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
grid.add(createGridCellButton(), grid.indexOf(selectedButton));
}
}
});
controlsColumn.addButton("Append New Cell", new ActionListener() {
public void actionPerformed(ActionEvent e) {
Button button = createGridCellButton();
grid.add(button);
selectCellButton(button);
}
});
controlsColumn.addButton("Append 10 New Cells", new ActionListener() {
public void actionPerformed(ActionEvent e) {
Button button = null;
for (int i = 0; i < 10; ++i) {
button = createGridCellButton();
grid.add(button);
}
selectCellButton(button);
}
});
controlsColumn.addButton("Delete Selected Cell", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
int index = grid.indexOf(selectedButton);
grid.remove(selectedButton);
if (grid.getComponentCount() != 0) {
if (index < grid.getComponentCount()) {
selectCellButton((Button) grid.getComponent(index));
} else {
selectCellButton((Button) grid.getComponent(grid.getComponentCount() - 1));
}
} else {
selectCellButton(null);
}
}
}
});
controlsColumn.addButton("Delete All Cells", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.removeAll();
}
});
controlsColumn.addButton("Add Row-Button Cell", new ActionListener() {
public void actionPerformed(ActionEvent e) {
Row row = new Row();
for (int i = 0; i < 3; ++i) {
Button button = new Button("Test (" + i + ") Test");
button.setStyleName("Default");
row.add(button);
}
grid.add(row);
}
});
controlsColumn = new ButtonColumn();
controlsColumn.add(new Label("Configure Grid"));
groupContainerColumn.add(controlsColumn);
controlsColumn.addButton("Swap Orientation", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.setOrientation(grid.getOrientation() == Grid.ORIENTATION_VERTICAL
? Grid.ORIENTATION_HORIZONTAL : Grid.ORIENTATION_VERTICAL);
}
});
controlsColumn.addButton("[+] Size", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.setSize(grid.getSize() + 1);
}
});
controlsColumn.addButton("[-] Size", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (grid.getSize() > 1) {
grid.setSize(grid.getSize() - 1);
}
}
});
controlsColumn.addButton("Change Foreground", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.setForeground(StyleUtil.randomColor());
}
});
controlsColumn.addButton("Change Background", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.setBackground(StyleUtil.randomColor());
}
});
controlsColumn.addButton("Change Border (All Attributes)", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.setBorder(StyleUtil.randomBorder());
}
});
controlsColumn.addButton("Change Border Color", new ActionListener() {
public void actionPerformed(ActionEvent e) {
Border border = grid.getBorder();
grid.setBorder(new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle()));
}
});
controlsColumn.addButton("Change Border Size", new ActionListener() {
public void actionPerformed(ActionEvent e) {
grid.setBorder(StyleUtil.nextBorderSize(grid.getBorder()));