groupContainerColumn.add(controlsColumn);
controlsColumn.addButton("[+] Column Span", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
if (layoutData.getColumnSpan() < 1) {
layoutData.setColumnSpan(1);
} else {
layoutData.setColumnSpan(layoutData.getColumnSpan() + 1);
}
selectedButton.setLayoutData(layoutData);
retitle(selectedButton);
}
}
});
controlsColumn.addButton("[-] Column Span", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
if (layoutData.getColumnSpan() > 1) {
layoutData.setColumnSpan(layoutData.getColumnSpan() - 1);
} else {
layoutData.setColumnSpan(1);
}
selectedButton.setLayoutData(layoutData);
retitle(selectedButton);
}
}
});
controlsColumn.addButton("[+] Row Span", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
if (layoutData.getRowSpan() < 1) {
layoutData.setRowSpan(1);
} else {
layoutData.setRowSpan(layoutData.getRowSpan() + 1);
}
selectedButton.setLayoutData(layoutData);
retitle(selectedButton);
}
}
});
controlsColumn.addButton("[-] Row Span", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
if (layoutData.getRowSpan() > 1) {
layoutData.setRowSpan(layoutData.getRowSpan() - 1);
} else {
layoutData.setRowSpan(1);
}
selectedButton.setLayoutData(layoutData);
retitle(selectedButton);
}
}
});
controlsColumn.addButton("Column Span: FILL", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setColumnSpan(GridLayoutData.SPAN_FILL);
selectedButton.setLayoutData(layoutData);
retitle(selectedButton);
}
}
});
controlsColumn.addButton("Row Span: FILL", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setRowSpan(GridLayoutData.SPAN_FILL);
selectedButton.setLayoutData(layoutData);
retitle(selectedButton);
}
}
});
controlsColumn.addButton("Set Insets 0px", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setInsets(new Insets(0));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Insets 2px", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setInsets(new Insets(2));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Insets 10/5px", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setInsets(new Insets(10, 5));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Insets 10/20/30/40px", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setInsets(new Insets(10, 20, 30, 40));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Alignment = Default", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setAlignment(null);
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Alignment = Leading/Top", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setAlignment(new Alignment(Alignment.LEADING, Alignment.TOP));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Alignment = Trailing/Bottom", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setAlignment(new Alignment(Alignment.TRAILING, Alignment.BOTTOM));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Alignment = Left/Top", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setAlignment(new Alignment(Alignment.LEFT, Alignment.TOP));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Alignment = Right/Bottom", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setAlignment(new Alignment(Alignment.RIGHT, Alignment.BOTTOM));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Alignment = Center/Center", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setAlignment(new Alignment(Alignment.CENTER, Alignment.CENTER));
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Background Image", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Background Image (5px)", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_5_PX_REPEAT);
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Set Background Image (1%)", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_1_PERCENT_REPEAT);
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn.addButton("Clear BackgroundImage", new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectedButton != null) {
GridLayoutData layoutData = (GridLayoutData) selectedButton.getLayoutData();
layoutData.setBackgroundImage(null);
selectedButton.setLayoutData(layoutData);
}
}
});
controlsColumn = new ButtonColumn();
controlsColumn.add(new Label("Configure Rows/Columns"));
groupContainerColumn.add(controlsColumn);
controlsColumn.addButton("Clear Widths of First 16 Columns", new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < 16; ++i) {
grid.setColumnWidth(i, null);
}
}
});
controlsColumn.addButton("Set First 16 Columns to 100px Width", new ActionListener() {
public void actionPerformed(ActionEvent e) {
Extent width = new Extent(100);
for (int i = 0; i < 16; ++i) {
grid.setColumnWidth(i, width);
}
}
});
controlsColumn.addButton("Set First 16 Columns to Random Width", new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < 16; ++i) {
grid.setColumnWidth(i, new Extent( ((int) (Math.random() * 100)) + 50));
}
}
});
controlsColumn.addButton("Clear Heights of First 16 Rows", new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < 16; ++i) {
grid.setRowHeight(i, null);
}
}
});
controlsColumn.addButton("Set First 16 Rows to 100px Height", new ActionListener() {
public void actionPerformed(ActionEvent e) {
Extent height = new Extent(100);
for (int i = 0; i < 16; ++i) {
grid.setRowHeight(i, height);
}
}
});
controlsColumn.addButton("Set First 16 Rows to Random Height", new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (int i = 0; i < 16; ++i) {
grid.setRowHeight(i, new Extent( ((int) (Math.random() * 100)) + 50));
}
}
});
controlsColumn = new ButtonColumn();
controlsColumn.add(new Label("Additional Tests"));
groupContainerColumn.add(controlsColumn);
controlsColumn.addButton("Grid/Column/Grid FillImage Test", new ActionListener() {
public void actionPerformed(ActionEvent e) {
WindowPane windowPane = new WindowPane();
windowPane.setTitle("Grid/Column/Grid FillImage Test");
windowPane.setInsets(new Insets(10));
windowPane.setStyleName("Default");
windowPane.setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
InteractiveApp.getApp().getDefaultWindow().getContent().add(windowPane);
GridLayoutData gld;
ColumnLayoutData cld;
Grid grid0 = new Grid();
grid0.setInsets(new Insets(5));
grid0.add(new Label("Grid 0 Label"));
grid0.add(new Label("Grid 0 Label"));
grid0.add(new Label("Grid 0 Label"));
Column column = new Column();
column.setInsets(new Insets(5));
grid0.add(column);
column.add(new Label("Column Label"));
column.add(new Label("Column Label"));
column.add(new Label("Column Label"));
gld = new GridLayoutData();
gld.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PX_REPEAT);
column.setLayoutData(gld);
grid0.add(column);
Grid grid1 = new Grid();
grid1.setInsets(new Insets(5));