summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2014-11-15 16:49:09 +0200
committerVaadin Code Review <review@vaadin.com>2016-02-29 12:49:43 +0000
commit4ee39c397a85618e65d2e5dcd3ec556569a73719 (patch)
tree5f5609f5e4a4557aed759eab21e694feb138af2c /shared
parent116a51cc9cd00c9314a24a342f1f741ad76973b1 (diff)
downloadvaadin-framework-4ee39c397a85618e65d2e5dcd3ec556569a73719.tar.gz
vaadin-framework-4ee39c397a85618e65d2e5dcd3ec556569a73719.zip
MarginInfo CTOR with two booleans: vertical, horizontal (#14113).
Change-Id: Iad15b95abeb24e7dd1e06b1d9f70844cb061cb49
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/ui/MarginInfo.java20
1 files changed, 15 insertions, 5 deletions
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;
+ }
+
}