summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/AbstractOrderedLayout.java
diff options
context:
space:
mode:
authorMatti Hosio <mhosio@vaadin.com>2014-12-12 13:04:31 +0200
committerMatti Hosio <mhosio@vaadin.com>2014-12-12 16:18:20 +0200
commita025d511bfe4e81993d33fc424a9bed754586a52 (patch)
tree46598f43edf5182fc0f867edc2fbcd01e50ecaea /server/src/com/vaadin/ui/AbstractOrderedLayout.java
parentc4aab1fe917b3cae5a41c8acc1e7cbea07700106 (diff)
downloadvaadin-framework-a025d511bfe4e81993d33fc424a9bed754586a52.tar.gz
vaadin-framework-a025d511bfe4e81993d33fc424a9bed754586a52.zip
Embed DesignSynchronizable methods to Component interface (#7749)
Change-Id: I06de4d2065dee107da40c2a4941e7d9e22f0832b
Diffstat (limited to 'server/src/com/vaadin/ui/AbstractOrderedLayout.java')
-rw-r--r--server/src/com/vaadin/ui/AbstractOrderedLayout.java73
1 files changed, 34 insertions, 39 deletions
diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java
index afe7a65d67..d2a302cff5 100644
--- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -23,7 +23,6 @@ import java.util.logging.Logger;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
-import org.jsoup.nodes.Node;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
@@ -494,43 +493,40 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
setMargin(def.getMargin().getBitMask() != 0);
}
// handle children
- for (Node childComponent : design.childNodes()) {
- if (childComponent instanceof Element) {
- Attributes attr = childComponent.attributes();
- DesignSynchronizable newChild = designContext
- .createChild((Element) childComponent);
- addComponent(newChild);
- // handle alignment
- int bitMask = 0;
- if (attr.hasKey(":middle")) {
- bitMask += AlignmentInfo.Bits.ALIGNMENT_VERTICAL_CENTER;
- } else if (attr.hasKey(":bottom")) {
- bitMask += AlignmentInfo.Bits.ALIGNMENT_BOTTOM;
- } else {
- bitMask += AlignmentInfo.Bits.ALIGNMENT_TOP;
- }
- if (attr.hasKey(":center")) {
- bitMask += AlignmentInfo.Bits.ALIGNMENT_HORIZONTAL_CENTER;
- } else if (attr.hasKey(":right")) {
- bitMask += AlignmentInfo.Bits.ALIGNMENT_RIGHT;
- } else {
- bitMask += AlignmentInfo.Bits.ALIGNMENT_LEFT;
- }
- setComponentAlignment(newChild, new Alignment(bitMask));
- // handle expand ratio
- if (attr.hasKey(":expand")) {
- String value = attr.get(":expand");
- if (value.length() > 0) {
- try {
- float ratio = Float.valueOf(value);
- setExpandRatio(newChild, ratio);
- } catch (NumberFormatException nfe) {
- getLogger().info(
- "Failed to parse expand ratio " + value);
- }
- } else {
- setExpandRatio(newChild, 1.0f);
+ for (Element childComponent : design.children()) {
+ Attributes attr = childComponent.attributes();
+ Component newChild = designContext.createChild(childComponent);
+ addComponent(newChild);
+ // handle alignment
+ int bitMask = 0;
+ if (attr.hasKey(":middle")) {
+ bitMask += AlignmentInfo.Bits.ALIGNMENT_VERTICAL_CENTER;
+ } else if (attr.hasKey(":bottom")) {
+ bitMask += AlignmentInfo.Bits.ALIGNMENT_BOTTOM;
+ } else {
+ bitMask += AlignmentInfo.Bits.ALIGNMENT_TOP;
+ }
+ if (attr.hasKey(":center")) {
+ bitMask += AlignmentInfo.Bits.ALIGNMENT_HORIZONTAL_CENTER;
+ } else if (attr.hasKey(":right")) {
+ bitMask += AlignmentInfo.Bits.ALIGNMENT_RIGHT;
+ } else {
+ bitMask += AlignmentInfo.Bits.ALIGNMENT_LEFT;
+ }
+ setComponentAlignment(newChild, new Alignment(bitMask));
+ // handle expand ratio
+ if (attr.hasKey(":expand")) {
+ String value = attr.get(":expand");
+ if (value.length() > 0) {
+ try {
+ float ratio = Float.valueOf(value);
+ setExpandRatio(newChild, ratio);
+ } catch (NumberFormatException nfe) {
+ getLogger().info(
+ "Failed to parse expand ratio " + value);
}
+ } else {
+ setExpandRatio(newChild, 1.0f);
}
}
}
@@ -556,8 +552,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
// handle children
Element designElement = design;
for (Component child : this) {
- DesignSynchronizable childComponent = (DesignSynchronizable) child;
- Element childNode = designContext.createNode(childComponent);
+ Element childNode = designContext.createNode(child);
designElement.appendChild(childNode);
// handle alignment
Alignment alignment = getComponentAlignment(child);