public ContentPaneTest() {
super(SplitPane.ORIENTATION_HORIZONTAL, new Extent(250, Extent.PX));
setStyleName("DefaultResizable");
final ContentPane rootContentPane = InteractiveApp.getApp().getDefaultWindow().getContent();
final Label contentLabel = new Label(StyleUtil.QUASI_LATIN_TEXT_1 + StyleUtil.QUASI_LATIN_TEXT_1);
ButtonColumn controlsColumn = new ButtonColumn();
controlsColumn.setStyleName("TestControlsColumn");
add(controlsColumn);
final ContentPane testContentPane = new ContentPane();
add(testContentPane);
controlsColumn.add(new Label("Root Content Pane"));
controlsColumn.addButton("Reset", new ActionListener() {
public void actionPerformed(ActionEvent e) {
rootContentPane.setBackground(null);
rootContentPane.setForeground(null);
rootContentPane.setFont(null);
}
});
controlsColumn.addButton("Change Background", new ActionListener() {
public void actionPerformed(ActionEvent e) {
rootContentPane.setBackground(StyleUtil.randomColor());
}
});
controlsColumn.addButton("Change Foreground", new ActionListener() {
public void actionPerformed(ActionEvent e) {
rootContentPane.setForeground(StyleUtil.randomColor());
}
});
controlsColumn.addButton("Change Font", new ActionListener() {
public void actionPerformed(ActionEvent e) {
rootContentPane.setFont(StyleUtil.randomFont());
}
});
controlsColumn.add(new Label("Test Content Pane"));
controlsColumn.addButton("Reset", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackground(null);
testContentPane.setForeground(null);
testContentPane.setFont(null);
}
});
controlsColumn.addButton("Change Background", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackground(StyleUtil.randomColor());
}
});
controlsColumn.addButton("Change Foreground", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setForeground(StyleUtil.randomColor());
}
});
controlsColumn.addButton("Background Image", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
}
});
controlsColumn.addButton("Background Image @ 50px", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PX_REPEAT);
}
});
controlsColumn.addButton("Background Image @ 1%", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_1_PERCENT_REPEAT);
}
});
controlsColumn.addButton("Background Image @ 50%", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE_50_PERCENT_REPEAT);
}
});
controlsColumn.addButton("Background Null", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setBackgroundImage(null);
}
});
controlsColumn.addButton("Change Font", new ActionListener() {
public void actionPerformed(ActionEvent e) {
testContentPane.setFont(StyleUtil.randomFont());
}
});
controlsColumn.addButton("Add Label", new ActionListener() {
public void actionPerformed(ActionEvent e) {
removeAllContent(testContentPane);
testContentPane.add(contentLabel);
}
});
controlsColumn.addButton("Add SplitPane", new ActionListener() {
public void actionPerformed(ActionEvent e) {
removeAllContent(testContentPane);
SplitPane splitPane = new SplitPane();
splitPane.setResizable(true);
Label label;
SplitPaneLayoutData layoutData;
layoutData = new SplitPaneLayoutData();
layoutData.setBackground(new Color(0xafafff));
label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
label.setLayoutData(layoutData);
splitPane.add(label);
layoutData = new SplitPaneLayoutData();
layoutData.setBackground(new Color(0xafffaf));
label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
label.setLayoutData(layoutData);
splitPane.add(label);
testContentPane.add(splitPane);
}
});
controlsColumn.addButton("Add SplitPane / ContentPane / Button", new ActionListener() {
public void actionPerformed(ActionEvent e) {
removeAllContent(testContentPane);
SplitPane splitPane = new SplitPane();
splitPane.setResizable(true);
Label label;
SplitPaneLayoutData layoutData;
layoutData = new SplitPaneLayoutData();
layoutData.setBackground(new Color(0xafafff));
ContentPane subContentPane = new ContentPane();
subContentPane.setLayoutData(layoutData);
splitPane.add(subContentPane);
SplitPane splitPane2 = new SplitPane(SplitPane.ORIENTATION_VERTICAL);
subContentPane.add(splitPane2);
ContentPane subContentPane2 = new ContentPane();
splitPane2.add(subContentPane2);
subContentPane2.add(new Label("Test!"));
ContentPane subContentPane3 = new ContentPane();
splitPane2.add(subContentPane3);
final Button button = new Button("Alpha");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button.setText("Alpha".equals(button.getText()) ? "Omega" : "Alpha");
}
});
subContentPane3.add(button);
layoutData = new SplitPaneLayoutData();
layoutData.setBackground(new Color(0xafffaf));
label = new Label(StyleUtil.QUASI_LATIN_TEXT_1);
label.setLayoutData(layoutData);
splitPane.add(label);
testContentPane.add(splitPane);
}
});