summaryrefslogtreecommitdiffstats
path: root/tests/testbench
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-20 19:29:04 +0300
committerArtur Signell <artur@vaadin.com>2012-08-22 13:58:50 +0300
commit667ef9c144bf3522100e5c8eac4d76a3c4faf65b (patch)
tree186994e13b55cda64fc5df96b5464d0905a8006b /tests/testbench
parent514bffe7a6aa2c599ab9f4ba239295d63f229125 (diff)
downloadvaadin-framework-667ef9c144bf3522100e5c8eac4d76a3c4faf65b.tar.gz
vaadin-framework-667ef9c144bf3522100e5c8eac4d76a3c4faf65b.zip
Refactored margin handlers (#8292)
Only layouts actually supporting margins now implement MarginHandler CssLayout should be simplified before 7.0.0 so margin support was removed. GridLayout, VerticalLayout and HorizontalLayout were the only other layouts which actually supported margin. MarginInfo is now passed directly in the state.
Diffstat (limited to 'tests/testbench')
-rw-r--r--tests/testbench/com/vaadin/tests/Parameters.java4
-rw-r--r--tests/testbench/com/vaadin/tests/components/AbstractLayoutTest.java9
-rw-r--r--tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java5
-rw-r--r--tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java6
-rw-r--r--tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java3
-rw-r--r--tests/testbench/com/vaadin/tests/layouts/GridLayoutInsidePanel.java6
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket1435.java3
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket1572.java9
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket1710.java12
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket1805.java4
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket2021.java3
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket2040.java4
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket2405.java4
-rw-r--r--tests/testbench/com/vaadin/tests/tickets/Ticket2998.java3
14 files changed, 45 insertions, 30 deletions
diff --git a/tests/testbench/com/vaadin/tests/Parameters.java b/tests/testbench/com/vaadin/tests/Parameters.java
index 4fb224eb19..e9824d9c40 100644
--- a/tests/testbench/com/vaadin/tests/Parameters.java
+++ b/tests/testbench/com/vaadin/tests/Parameters.java
@@ -27,7 +27,7 @@ import com.vaadin.terminal.RequestHandler;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.terminal.WrappedResponse;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
@@ -90,7 +90,7 @@ public class Parameters extends com.vaadin.Application.LegacyApplication
final Panel panel2 = new Panel("Parameter Handler");
params.setSizeFull();
panel2.setContent(new VerticalLayout());
- ((Layout) panel2.getContent()).setMargin(true);
+ ((MarginHandler) panel2.getContent()).setMargin(true);
params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
panel2.addComponent(params);
diff --git a/tests/testbench/com/vaadin/tests/components/AbstractLayoutTest.java b/tests/testbench/com/vaadin/tests/components/AbstractLayoutTest.java
index af62e5e4a4..c04be3d724 100644
--- a/tests/testbench/com/vaadin/tests/components/AbstractLayoutTest.java
+++ b/tests/testbench/com/vaadin/tests/components/AbstractLayoutTest.java
@@ -2,11 +2,12 @@ package com.vaadin.tests.components;
import java.util.LinkedHashMap;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.AbstractLayout;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Component;
import com.vaadin.ui.Layout.AlignmentHandler;
-import com.vaadin.ui.Layout.MarginInfo;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Layout.SpacingHandler;
public abstract class AbstractLayoutTest<T extends AbstractLayout> extends
@@ -17,7 +18,7 @@ public abstract class AbstractLayoutTest<T extends AbstractLayout> extends
@Override
public void execute(T c, MarginInfo value, Object data) {
- c.setMargin(value);
+ ((MarginHandler) c).setMargin(value);
}
};
@@ -42,7 +43,9 @@ public abstract class AbstractLayoutTest<T extends AbstractLayout> extends
@Override
protected void createActions() {
super.createActions();
- createMarginsSelect(CATEGORY_LAYOUT_FEATURES);
+ if (MarginHandler.class.isAssignableFrom(getTestClass())) {
+ createMarginsSelect(CATEGORY_LAYOUT_FEATURES);
+ }
if (SpacingHandler.class.isAssignableFrom(getTestClass())) {
createSpacingSelect(CATEGORY_LAYOUT_FEATURES);
}
diff --git a/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java b/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java
index 0bc4f45545..0655c09102 100644
--- a/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java
+++ b/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java
@@ -4,6 +4,7 @@ import java.util.Arrays;
import com.vaadin.data.Item;
import com.vaadin.data.util.BeanItem;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.tests.util.Person;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
@@ -13,6 +14,7 @@ import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Layout.MarginHandler;
/**
* Example of nested forms
@@ -37,7 +39,8 @@ public class NestedPersonForm extends Form {
setItemDataSource(beanItem, Arrays.asList("firstName", "lastName",
"address", "email", "phoneNumber"));
getFooter().addComponent(getButtonsLayout());
- getFooter().setMargin(false, false, true, true);
+ ((MarginHandler) getFooter()).setMargin(new MarginInfo(false, false,
+ true, true));
}
/**
diff --git a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
index 1ea800821b..a35b78c219 100644
--- a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
+++ b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java
@@ -8,6 +8,7 @@ import com.vaadin.Application;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.event.Action;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.terminal.Page;
@@ -103,7 +104,6 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
mainLayout.addComponent(getTopMenu());
CssLayout margin = new CssLayout();
- margin.setMargin(false, true, true, true);
margin.setSizeFull();
tabs = new TabSheet();
tabs.setSizeFull();
@@ -239,7 +239,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
HorizontalLayout hl = new HorizontalLayout();
hl.setSpacing(true);
- hl.setMargin(true, false, false, false);
+ hl.setMargin(new MarginInfo(true, false, false, false));
l.addComponent(hl);
AbstractSelect cb = new ComboBox();
@@ -270,7 +270,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication {
HorizontalLayout hl = new HorizontalLayout();
hl.setSpacing(true);
- hl.setMargin(true, false, false, false);
+ hl.setMargin(new MarginInfo(true, false, false, false));
l.addComponent(hl);
DateField df = new DateField();
diff --git a/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java b/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java
index 792bcb1aab..ed35d39ef7 100644
--- a/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java
+++ b/tests/testbench/com/vaadin/tests/layouts/CssLayoutCustomCss.java
@@ -12,6 +12,7 @@ import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.NativeButton;
public class CssLayoutCustomCss extends TestBase implements ClickListener {
@@ -48,7 +49,7 @@ public class CssLayoutCustomCss extends TestBase implements ClickListener {
@Override
public void valueChange(ValueChangeEvent event) {
- layout.setMargin(cb.getValue());
+ ((MarginHandler) layout).setMargin(cb.getValue());
}
});
diff --git a/tests/testbench/com/vaadin/tests/layouts/GridLayoutInsidePanel.java b/tests/testbench/com/vaadin/tests/layouts/GridLayoutInsidePanel.java
index 1c864fdb47..e200c40744 100644
--- a/tests/testbench/com/vaadin/tests/layouts/GridLayoutInsidePanel.java
+++ b/tests/testbench/com/vaadin/tests/layouts/GridLayoutInsidePanel.java
@@ -3,7 +3,7 @@ package com.vaadin.tests.layouts;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Panel;
public class GridLayoutInsidePanel extends TestBase {
@@ -27,7 +27,7 @@ public class GridLayoutInsidePanel extends TestBase {
"A label which defines the size of the GL"));
Panel p = new Panel("Panel 1");
- ((Layout) p.getContent()).setMargin(false);
+ ((MarginHandler) p.getContent()).setMargin(false);
p.setSizeUndefined();
p.getContent().setSizeUndefined();
@@ -41,7 +41,7 @@ public class GridLayoutInsidePanel extends TestBase {
"A label which defines the size of the GL"));
Panel p = new Panel("Panel 2", gl);
- ((Layout) p.getContent()).setMargin(false);
+ ((MarginHandler) p.getContent()).setMargin(false);
p.setSizeUndefined();
p.getContent().setSizeUndefined();
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1435.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1435.java
index 438f7e2d5f..d6d3b132c3 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1435.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1435.java
@@ -10,6 +10,7 @@ import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Table;
@@ -159,7 +160,7 @@ public class Ticket1435 extends Application.LegacyApplication {
private void initContainer() {
container.setStyleName("custompanel");
container.setSizeFull();
- ((Layout) container.getContent()).setMargin(false);
+ ((MarginHandler) container.getContent()).setMargin(false);
container.getContent().setSizeFull();
root.addComponent(container);
root.setExpandRatio(container, 1);
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1572.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1572.java
index b9fd2debd5..87ea7e86a8 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1572.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1572.java
@@ -1,5 +1,6 @@
package com.vaadin.tests.tickets;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.GridLayout;
@@ -82,19 +83,19 @@ public class Ticket1572 extends com.vaadin.Application.LegacyApplication {
state.setValue("Margin on");
break;
case 2:
- gl.setMargin(true, false, false, false);
+ gl.setMargin(new MarginInfo(true, false, false, false));
state.setValue("Margin top");
break;
case 3:
- gl.setMargin(false, true, false, false);
+ gl.setMargin(new MarginInfo(false, true, false, false));
state.setValue("Margin right");
break;
case 4:
- gl.setMargin(false, false, true, false);
+ gl.setMargin(new MarginInfo(false, false, true, false));
state.setValue("Margin bottom");
break;
case 5:
- gl.setMargin(false, false, false, true);
+ gl.setMargin(new MarginInfo(false, false, false, true));
state.setValue("Margin left");
break;
default:
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1710.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1710.java
index 01792aeb89..1f2c9624c3 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1710.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1710.java
@@ -5,6 +5,7 @@ import java.util.Iterator;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.MethodProperty;
+import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.terminal.SystemError;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.AbstractComponent;
@@ -393,10 +394,13 @@ public class Ticket1710 extends com.vaadin.Application.LegacyApplication {
}
private void updateMarginsAndSpacing() {
- testedLayout.setMargin(marginTop.getValue().booleanValue(),
- marginRight.getValue().booleanValue(), marginBottom
- .getValue().booleanValue(), marginLeft.getValue()
- .booleanValue());
+ if (testedLayout instanceof Layout.MarginHandler) {
+ ((Layout.MarginHandler) testedLayout).setMargin(new MarginInfo(
+ marginTop.getValue().booleanValue(), marginRight
+ .getValue().booleanValue(), marginBottom
+ .getValue().booleanValue(), marginLeft
+ .getValue().booleanValue()));
+ }
if (testedLayout instanceof Layout.SpacingHandler) {
((Layout.SpacingHandler) testedLayout).setSpacing(spacing
.getValue().booleanValue());
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1805.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1805.java
index a40f5b25b9..e5fcf59db8 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket1805.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1805.java
@@ -6,7 +6,7 @@ import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
@@ -17,7 +17,7 @@ public class Ticket1805 extends com.vaadin.Application.LegacyApplication {
final LegacyWindow main = new LegacyWindow(getClass().getName()
.substring(getClass().getName().lastIndexOf(".") + 1));
setMainWindow(main);
- ((Layout) main.getContent()).setMargin(false);
+ ((MarginHandler) main.getContent()).setMargin(false);
Label description = new Label(
"GridLayout with 100% (no height), is wanted to "
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2021.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2021.java
index c36bb5c25e..f6d8ce5e01 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2021.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2021.java
@@ -9,6 +9,7 @@ import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextArea;
@@ -78,7 +79,7 @@ public class Ticket2021 extends Application.LegacyApplication {
p3.setHeight("500px");
// p3.setContent(new GridLayout());
p3.getContent().setSizeFull();
- ((Layout) p3.getContent()).setMargin(false);
+ ((MarginHandler) p3.getContent()).setMargin(false);
GridLayout gl = new GridLayout();
gl.setSizeFull();
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2040.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2040.java
index ac8928d110..d98656b9ca 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2040.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2040.java
@@ -2,7 +2,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
@@ -17,7 +17,7 @@ public class Ticket2040 extends com.vaadin.Application.LegacyApplication {
setMainWindow(main);
main.getContent().setSizeFull();
- ((Layout) main.getContent()).setMargin(true);
+ ((MarginHandler) main.getContent()).setMargin(true);
setTheme("tests-tickets");
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2405.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2405.java
index 16a552e37a..c5ef9ec0b0 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2405.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2405.java
@@ -8,7 +8,7 @@ import com.vaadin.ui.Embedded;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
@@ -31,7 +31,7 @@ public class Ticket2405 extends Application.LegacyApplication {
setMainWindow(root);
root.getContent().setSizeFull();
- ((Layout) root.getContent()).setMargin(false);
+ ((MarginHandler) root.getContent()).setMargin(false);
// Top area, containing playback and volume controls, play status, view
// modes and search
diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java
index ee60c0ce7e..2d2970d36e 100644
--- a/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java
+++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java
@@ -19,6 +19,7 @@ import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
@@ -252,7 +253,7 @@ public class Ticket2998 extends Application.LegacyApplication {
// set theme and some layout stuff
setMainWindow(w);
w.getContent().setSizeFull();
- ((Layout) w.getContent()).setMargin(false);
+ ((MarginHandler) w.getContent()).setMargin(false);
Panel p = new Panel("Workout Log");
p.setStyleName(Reindeer.PANEL_LIGHT);