diff options
author | Matti Hosio <mhosio@vaadin.com> | 2014-12-17 15:17:58 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-17 13:55:17 +0000 |
commit | 39edc4b3acf6b4596abf799705b1087b109e10ef (patch) | |
tree | dd1864a40fd1833f98622ee16225f6226859e567 | |
parent | 6d75a89e8d16e0fd1370fe080a5b5b78d1f4679d (diff) | |
download | vaadin-framework-39edc4b3acf6b4596abf799705b1087b109e10ef.tar.gz vaadin-framework-39edc4b3acf6b4596abf799705b1087b109e10ef.zip |
Do not write immediate to design if component is immediate by default (#7749)
Change-Id: Ia79844498c9f6ebc715d15039f7db8441e3565b9
-rw-r--r-- | server/src/com/vaadin/ui/AbstractComponent.java | 3 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestWriteDesign.java | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 5b7492dbdb..8517c216e3 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -1225,7 +1225,8 @@ public abstract class AbstractComponent extends AbstractClientConnector } // handle immediate if (explicitImmediateValue != null) { - design.attr("immediate", explicitImmediateValue.toString()); + DesignAttributeHandler.writeAttribute("immediate", attr, + explicitImmediateValue, def.isImmediate(), Boolean.class); } // handle locale if (getLocale() != null diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestWriteDesign.java b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestWriteDesign.java index 44c0e0b063..7f207a25ae 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestWriteDesign.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/TestWriteDesign.java @@ -34,6 +34,7 @@ import com.vaadin.server.UserError; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; import com.vaadin.ui.HorizontalSplitPanel; +import com.vaadin.ui.TabSheet; import com.vaadin.ui.declarative.DesignContext; /** @@ -137,6 +138,20 @@ public class TestWriteDesign extends TestCase { assertEquals("true", design.attr("immediate")); } + public void testSynchronizeImmediateByDefault() { + Element design = createDesign(); + TabSheet byDefaultImmediate = new TabSheet(); + // no immediate attribute should be written before setting immediate to + // false + byDefaultImmediate.writeDesign(design, ctx); + assertFalse(design.hasAttr("immediate")); + byDefaultImmediate.setImmediate(false); + byDefaultImmediate.writeDesign(design, ctx); + // we only changed one of the attributes, others are at default values + assertEquals(1, design.attributes().size()); + assertEquals("false", design.attr("immediate")); + } + public void testSynchronizeDescription() { Element design = createDesign(); AbstractComponent component = getComponent(); |