diff options
5 files changed, 20 insertions, 10 deletions
diff --git a/server/src/com/vaadin/ui/FormLayout.java b/server/src/com/vaadin/ui/FormLayout.java index f6f711d658..c817300e53 100644 --- a/server/src/com/vaadin/ui/FormLayout.java +++ b/server/src/com/vaadin/ui/FormLayout.java @@ -36,7 +36,7 @@ public class FormLayout extends AbstractOrderedLayout { public FormLayout() { super(); setSpacing(true); - setMargin(new MarginInfo(true, false, true, false)); + setMargin(new MarginInfo(true, false)); setWidth(100, UNITS_PERCENTAGE); } diff --git a/shared/src/com/vaadin/shared/ui/MarginInfo.java b/shared/src/com/vaadin/shared/ui/MarginInfo.java index a8979b36cf..92f7956015 100644 --- a/shared/src/com/vaadin/shared/ui/MarginInfo.java +++ b/shared/src/com/vaadin/shared/ui/MarginInfo.java @@ -68,7 +68,11 @@ public class MarginInfo implements Serializable { * enable or disable left margin */ public MarginInfo(boolean top, boolean right, boolean bottom, boolean left) { - setMargins(top, right, bottom, left); + doSetMargins(top, right, bottom, left); + } + + public MarginInfo(boolean vertical, boolean horizontal) { + this(vertical, horizontal, vertical, horizontal); } /** @@ -96,10 +100,7 @@ public class MarginInfo implements Serializable { */ public void setMargins(boolean top, boolean right, boolean bottom, boolean left) { - bitMask = top ? TOP : 0; - bitMask += right ? RIGHT : 0; - bitMask += bottom ? BOTTOM : 0; - bitMask += left ? LEFT : 0; + doSetMargins(top, right, bottom, left); } /** @@ -188,4 +189,13 @@ public class MarginInfo implements Serializable { + hasBottom() + ", " + hasLeft() + ")"; } + + private void doSetMargins(boolean top, boolean right, boolean bottom, + boolean left) { + bitMask = top ? TOP : 0; + bitMask += right ? RIGHT : 0; + bitMask += bottom ? BOTTOM : 0; + bitMask += left ? LEFT : 0; + } + } diff --git a/uitest/src/com/vaadin/tests/components/AbstractLayoutTest.java b/uitest/src/com/vaadin/tests/components/AbstractLayoutTest.java index c04be3d724..56c04180b8 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractLayoutTest.java +++ b/uitest/src/com/vaadin/tests/components/AbstractLayoutTest.java @@ -63,8 +63,8 @@ public abstract class AbstractLayoutTest<T extends AbstractLayout> extends options.put("right", new MarginInfo(false, true, false, false)); options.put("top", new MarginInfo(true, false, false, false)); options.put("bottom", new MarginInfo(false, false, true, false)); - options.put("left-right", new MarginInfo(false, true, false, true)); - options.put("top-bottom", new MarginInfo(true, false, true, false)); + options.put("left-right", new MarginInfo(false, true)); + options.put("top-bottom", new MarginInfo(true, false)); createSelectAction("Margins", category, options, "off", marginCommand); } diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java index 15f964f110..6fd7bf362b 100644 --- a/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java +++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VaadinTunesLayout.java @@ -55,7 +55,7 @@ public class VaadinTunesLayout extends AbstractTestUI { // modes and search HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); - top.setMargin(new MarginInfo(false, true, false, true)); // Enable + top.setMargin(new MarginInfo(false, true)); // Enable // horizontal // margins top.setSpacing(true); diff --git a/uitest/src/com/vaadin/tests/themes/valo/Forms.java b/uitest/src/com/vaadin/tests/themes/valo/Forms.java index 91fe473d60..32aef68520 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/Forms.java +++ b/uitest/src/com/vaadin/tests/themes/valo/Forms.java @@ -171,7 +171,7 @@ public class Forms extends VerticalLayout implements View { }); HorizontalLayout footer = new HorizontalLayout(); - footer.setMargin(new MarginInfo(true, false, true, false)); + footer.setMargin(new MarginInfo(true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); |