diff options
Diffstat (limited to 'server')
6 files changed, 26 insertions, 15 deletions
diff --git a/server/src/com/vaadin/ui/AbsoluteLayout.java b/server/src/com/vaadin/ui/AbsoluteLayout.java index aac544ae18..01c1aea788 100644 --- a/server/src/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/com/vaadin/ui/AbsoluteLayout.java @@ -719,10 +719,9 @@ public class AbsoluteLayout extends AbstractLayout implements public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); // handle children - Element designElement = design; for (Component child : this) { Element childElement = designContext.createElement(child); - designElement.appendChild(childElement); + design.appendChild(childElement); child.writeDesign(childElement, designContext); // handle position ComponentPosition position = getPosition(child); diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 358fea1bad..5f9ce0edcd 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -930,17 +930,13 @@ public abstract class AbstractComponent extends AbstractClientConnector } // handle immediate if (attr.hasKey("immediate")) { - String str = attr.get("immediate"); - boolean immediate = "".equals(str) ? true : Boolean.valueOf(str); - setImmediate(immediate); - } else { - explicitImmediateValue = null; + setImmediate(DesignAttributeHandler.getBoolean(attr + .get("immediate"))); } + // handle locale if (attr.hasKey("locale")) { setLocale(getLocaleFromString(attr.get("locale"))); - } else { - setLocale(null); } // handle width and height readSize(attr); @@ -958,8 +954,10 @@ public abstract class AbstractComponent extends AbstractClientConnector } // handle responsive - setResponsive(attr.hasKey("responsive") - && !attr.get("responsive").equalsIgnoreCase("false")); + if (attr.hasKey("responsive")) { + setResponsive(DesignAttributeHandler.getBoolean(attr + .get("responsive"))); + } // check for unsupported attributes Set<String> supported = new HashSet<String>(); supported.addAll(getDefaultAttributes()); diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java index b5f02e5b2a..6d4b5ff2d7 100644 --- a/server/src/com/vaadin/ui/AbstractField.java +++ b/server/src/com/vaadin/ui/AbstractField.java @@ -1797,7 +1797,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements @Override public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); - AbstractField def = designContext.getDefaultInstance(this); + AbstractField def = (AbstractField) designContext + .getDefaultInstance(this); Attributes attr = design.attributes(); // handle readonly DesignAttributeHandler.writeAttribute("readonly", attr, diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index c347449ab8..ae8f3198bf 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -539,14 +539,13 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements design.attr("margin", ""); } // handle children - Element designElement = design; if (!designContext.shouldWriteChildren(this, def)) { return; } for (Component child : this) { Element childElement = designContext.createElement(child); - designElement.appendChild(childElement); + design.appendChild(childElement); // handle alignment Alignment alignment = getComponentAlignment(child); if (alignment.isMiddle()) { diff --git a/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java index 0a58fc549f..7b0c039e4a 100644 --- a/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -718,4 +718,19 @@ public class DesignAttributeHandler implements Serializable { } } + /** + * Converts the given string attribute value to its corresponding boolean. + * + * An empty string is considered true (true when attribute exists), + * otherwise "false" and "true" are supported, all other input will throw an + * exception + * + * @param booleanValue + * the boolean value from an attribute + * @return the parsed boolean + */ + public static boolean getBoolean(String booleanValue) { + return "".equals(booleanValue) ? true : Boolean.valueOf(booleanValue); + } + } diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestReadDesign.java b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestReadDesign.java index 760f1ca422..8fe4d9c220 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestReadDesign.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestReadDesign.java @@ -111,7 +111,6 @@ public class TestReadDesign extends TestCase { // explicitImmediate should then be null. design = createDesign("description", "test-description"); component.readDesign(design, ctx); - assertEquals(null, getExplicitImmediate(component)); // Synchronize with a design having immediate = false design = createDesign("immediate", "false"); component.readDesign(design, ctx); |