From 39edc4b3acf6b4596abf799705b1087b109e10ef Mon Sep 17 00:00:00 2001 From: Matti Hosio Date: Wed, 17 Dec 2014 15:17:58 +0200 Subject: Do not write immediate to design if component is immediate by default (#7749) Change-Id: Ia79844498c9f6ebc715d15039f7db8441e3565b9 --- server/src/com/vaadin/ui/AbstractComponent.java | 3 ++- .../component/abstractcomponent/TestWriteDesign.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'server') 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(); -- cgit v1.2.3