summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-04-03 18:34:02 +0300
committerArtur Signell <artur@vaadin.com>2012-04-05 00:09:13 +0300
commit6ac1b1580596b1fcac28cb6b16f1c431300fe32e (patch)
treec63a050928998d6a4e3352a82cceb492c08ab18b /tests
parent3caa0ba64421717313110b7a81d0bd119de10c70 (diff)
downloadvaadin-framework-6ac1b1580596b1fcac28cb6b16f1c431300fe32e.tar.gz
vaadin-framework-6ac1b1580596b1fcac28cb6b16f1c431300fe32e.zip
Updated CssLayout to use new state and hierarchy change events
Diffstat (limited to 'tests')
-rw-r--r--tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java b/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java
new file mode 100644
index 0000000000..b2712fc54c
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java
@@ -0,0 +1,68 @@
+package com.vaadin.tests.layouts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.NativeButton;
+
+public class CssLayoutCustomCss extends TestBase implements ClickListener {
+
+ protected Map<Component, String> css = new HashMap<Component, String>();
+ private CssLayout layout;
+
+ @Override
+ protected void setup() {
+ setTheme("tests-tickets");
+ layout = new CssLayout() {
+ @Override
+ protected String getCss(com.vaadin.ui.Component c) {
+ return css.get(c);
+ }
+ };
+ layout.setSizeFull();
+ addComponent(layout);
+
+ layout.addComponent(createButton("color:red"));
+ layout.addComponent(createButton("color: blue"));
+ layout.addComponent(createButton("color: green"));
+ }
+
+ private Component createButton(String string) {
+ NativeButton button = new NativeButton(string);
+ css.put(button, string);
+ button.addListener(this);
+ return button;
+ }
+
+ @Override
+ protected String getDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void buttonClick(ClickEvent event) {
+ Button b = event.getButton();
+ if (b.getCaption().contains("not ")) {
+ b.setCaption(b.getCaption().substring(4));
+ css.put(b, b.getCaption());
+ } else {
+ css.remove(b);
+ b.setCaption("not " + b.getCaption());
+ }
+ layout.requestRepaint();
+
+ }
+
+}