From 78a9aa10777eb2ef594a573ad86f245c0eb602c6 Mon Sep 17 00:00:00 2001 From: Mika Murtojarvi Date: Wed, 19 Aug 2015 10:50:35 +0300 Subject: [PATCH] Revert "Write true as attribute="" (#17519)" This reverts commit cdc07e55c12dc4ffbe509e15c4f4f165fb4a1670. Change-Id: Iad07a0292639d89c8f029c690005e7f1041eb79f --- .../src/com/vaadin/ui/AbstractComponent.java | 12 ++--- .../ui/declarative/DesignFormatter.java | 6 +-- .../menubar/MenuBarDeclarativeTest.java | 21 ++++---- .../AbstractComponentSetResponsiveTest.java | 2 +- .../tests/design/DesignFormatterTest.java | 2 +- .../component/DeclarativeMarginTestBase.java | 10 ++-- .../AbstractComponentDeclarativeTest.java | 16 +++--- .../AbstractFieldDeclarativeTest.java | 8 +-- .../AbstractSelectDeclarativeTest.java | 8 +-- .../OptionGroupDeclarativeTests.java | 2 +- .../AbstractSplitPanelDeclarativeTest.java | 2 +- .../AbstractTextFieldDeclarativeTest.java | 2 +- .../component/audio/AudioDeclarativeTest.java | 2 +- .../component/audio/VideoDeclarativeTest.java | 2 +- .../checkbox/CheckboxDeclarativeTest.java | 2 +- .../AbstractColorPickerDeclarativeTest.java | 4 +- .../datefield/DateFieldDeclarativeTest.java | 2 +- .../GridColumnDeclarativeTest.java | 8 +-- .../GridDeclarativeAttributeTest.java | 4 +- .../GridHeaderFooterDeclarativeTest.java | 52 ++++++++++--------- .../GridInlineDataDeclarativeTest.java | 14 ++--- .../popupview/PopupViewDeclarativeTest.java | 2 +- .../ProgressBarDeclarativeTest.java | 2 +- .../RichTextAreaDeclarativeTest.java | 2 +- .../component/table/TableDeclarativeTest.java | 8 +-- .../tabsheet/TabSheetDeclarativeTest.java | 8 +-- .../treetable/TreeTableDeclarativeTest.java | 2 +- .../window/WindowDeclarativeTest.java | 4 +- 28 files changed, 104 insertions(+), 105 deletions(-) diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index f499cb1fec..18c3509af7 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -1170,16 +1170,16 @@ public abstract class AbstractComponent extends AbstractClientConnector // first try the full shorthands if (widthFull && heightFull) { - attributes.put("size-full", ""); + attributes.put("size-full", "true"); } else if (widthAuto && heightAuto) { - attributes.put("size-auto", ""); + attributes.put("size-auto", "true"); } else { // handle width if (!hasEqualWidth(defaultInstance)) { if (widthFull) { - attributes.put("width-full", ""); + attributes.put("width-full", "true"); } else if (widthAuto) { - attributes.put("width-auto", ""); + attributes.put("width-auto", "true"); } else { String widthString = DesignAttributeHandler.getFormatter() .format(getWidth()) + getWidthUnits().getSymbol(); @@ -1190,9 +1190,9 @@ public abstract class AbstractComponent extends AbstractClientConnector if (!hasEqualHeight(defaultInstance)) { // handle height if (heightFull) { - attributes.put("height-full", ""); + attributes.put("height-full", "true"); } else if (heightAuto) { - attributes.put("height-auto", ""); + attributes.put("height-auto", "true"); } else { String heightString = DesignAttributeHandler.getFormatter() .format(getHeight()) + getHeightUnits().getSymbol(); diff --git a/server/src/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/com/vaadin/ui/declarative/DesignFormatter.java index 73c45caed4..b1d2520631 100644 --- a/server/src/com/vaadin/ui/declarative/DesignFormatter.java +++ b/server/src/com/vaadin/ui/declarative/DesignFormatter.java @@ -94,11 +94,7 @@ public class DesignFormatter implements Serializable { public String convertToPresentation(Boolean value, Class targetType, Locale locale) throws Converter.ConversionException { - if (value.booleanValue()) { - return ""; - } else { - return "false"; - } + return String.valueOf(value.booleanValue()); } @Override diff --git a/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java b/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java index d058ae1dcd..3bc1ebfbf9 100644 --- a/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java @@ -38,10 +38,10 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { @Test // #16328 public void testReadWrite() throws IOException { - String design = "" - + "Save" + String design = "" + + "Save" + "Open" - + "Close" + + "Close" + "Help" + "About" + "SubItem" @@ -69,19 +69,19 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { @Test // #16328 public void testTicketSpec1() throws IOException { - String design = " " + String design = " " + "File" + "Save" + "Open" - + "" - + "Exit" + + "" + + "Exit" + "Not for everybody" + "" + "Other" + "Sub" - + "Option 1 - no html" - + "Option 2" - + "Option 3" // + + "Option 1 - no html" + + "Option 2" + + "Option 3" // + "" // + "" // + "foo" @@ -124,7 +124,8 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase { + "File" + "Save" + "Open" - + "" + "Exit" // + + "" + + "Exit" // + ""; MenuBar menuBar = new MenuBar(); menuBar.setHtmlContentAllowed(true); diff --git a/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java b/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java index 1119301c55..83b3e577dc 100644 --- a/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java +++ b/server/tests/src/com/vaadin/tests/design/AbstractComponentSetResponsiveTest.java @@ -29,7 +29,7 @@ public class AbstractComponentSetResponsiveTest extends label.setContentMode(ContentMode.HTML); label.setResponsive(true); - String design = ""; + String design = ""; testWrite(design, label); testRead(design, label); diff --git a/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java b/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java index acee3e2ca8..00af20ea8c 100644 --- a/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java +++ b/server/tests/src/com/vaadin/tests/design/DesignFormatterTest.java @@ -78,7 +78,7 @@ public class DesignFormatterTest { @Test public void testBoolean() { - assertEquals("", formatter.format(true)); + assertEquals("true", formatter.format(true)); assertEquals("false", formatter.format(false)); assertEquals(true, formatter.parse("true", boolean.class)); diff --git a/server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java b/server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java index 42715e52ae..9fcb64acca 100644 --- a/server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java +++ b/server/tests/src/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java @@ -52,19 +52,19 @@ public abstract class DeclarativeMarginTestBase"; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java index 71021a06e1..4f45168a32 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractcomponent/AbstractComponentDeclarativeTest.java @@ -71,7 +71,7 @@ public class AbstractComponentDeclarativeTest extends public void testProperties() { String design = "test-error\" immediate=\"\"/>"; + + "error=\"
test-error
\" immediate=\"true\"/>"; component.setId("testId"); component.setPrimaryStyleName("test-style"); component.setCaption("test-caption"); @@ -139,7 +139,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testSizeFull() { - String design = ""; + String design = ""; component.setSizeFull(); testRead(design, component); testWrite(design, component); @@ -147,7 +147,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testSizeAuto() { - String design = ""; + String design = ""; component.setSizeUndefined(); testRead(design, component); testWrite(design, component); @@ -155,7 +155,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testHeightFull() { - String design = ""; + String design = ""; component.setHeight("100%"); component.setWidth("20px"); testRead(design, component); @@ -164,7 +164,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testHeightAuto() { - String design = ""; + String design = ""; // we need to have default height of 100% -> use split panel AbstractComponent component = new HorizontalSplitPanel(); component.setHeight(null); @@ -175,7 +175,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testWidthFull() { - String design = "Foo"; + String design = "Foo"; AbstractComponent component = new Button(); component.setCaptionAsHtml(true); component.setCaption("Foo"); @@ -187,7 +187,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testWidthAuto() { - String design = ""; + String design = ""; component.setCaptionAsHtml(false); component.setHeight("20px"); component.setWidth(null); @@ -197,7 +197,7 @@ public class AbstractComponentDeclarativeTest extends @Test public void testResponsive() { - String design = ""; + String design = ""; Responsive.makeResponsive(component); testRead(design, component); testWrite(design, component); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java index b4afde5923..55231e5494 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java @@ -33,9 +33,9 @@ public class AbstractFieldDeclarativeTest extends @Test public void testPlainText() { - String design = ""; + String design = ""; AbstractField tf = new TextField(); tf.setBuffered(true); tf.setBuffered(true); @@ -51,7 +51,7 @@ public class AbstractFieldDeclarativeTest extends testWrite(design, tf); // Test with readonly=false - design = design.replace("readonly=''", ""); + design = design.replace("readonly='true'", ""); tf.setReadOnly(false); testRead(design, tf); testWrite(design, tf); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java index b294ffad72..b3867a7a3a 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractselect/AbstractSelectDeclarativeTest.java @@ -42,7 +42,7 @@ public class AbstractSelectDeclarativeTest extends DeclarativeTestBase { public String getDesignSingleSelectNewItemsAllowed() { - return ""; } @@ -57,7 +57,7 @@ public class AbstractSelectDeclarativeTest extends } public String getDesignMultiSelect() { - return ""; + return ""; } public AbstractSelect getExpectedMultiSelect() { @@ -210,7 +210,7 @@ public class AbstractSelectDeclarativeTest extends attributes.put("item-caption-mode", "property"); attributes.put("item-caption-property-id", "name"); attributes.put("item-icon-property-id", "icon"); - attributes.put("null-selection-allowed", ""); + attributes.put("null-selection-allowed", "true"); attributes.put("null-selection-item-id", "No items selected"); return new Element(Tag.valueOf("v-combo-box"), "", attributes); } @@ -231,7 +231,7 @@ public class AbstractSelectDeclarativeTest extends assertEquals("Wrong caption for the combo box.", "A combo box", e.attr("caption")); Assert.assertTrue("Adding new items should be allowed.", - "".equals(e.attr("new-items-allowed"))); + "true".equals(e.attr("new-items-allowed"))); assertEquals("Wrong item caption mode.", "icon_only", e.attr("item-caption-mode")); assertEquals("Wrong item icon property id.", "icon", diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java b/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java index efcdc3e997..4d75e0b59f 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractselect/OptionGroupDeclarativeTests.java @@ -111,7 +111,7 @@ public class OptionGroupDeclarativeTests extends //@formatter:off String expected = - "" + "" + "" + "" + "" diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java index 11d97d191b..2d6db6d19a 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java @@ -38,7 +38,7 @@ public class AbstractSplitPanelDeclarativeTest extends @Test public void testWithBothChildren() { String design = " " + ""; AbstractSplitPanel sp = new HorizontalSplitPanel(); diff --git a/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java index b8e570bc89..a3594b7159 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstracttextfield/AbstractTextFieldDeclarativeTest.java @@ -34,7 +34,7 @@ public class AbstractTextFieldDeclarativeTest extends @Test public void testAttributes() { String design = ""; AbstractTextField tf = new TextField(); diff --git a/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java index ec2b5241f3..4390499c4e 100644 --- a/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java @@ -43,7 +43,7 @@ public class AudioDeclarativeTest extends DeclarativeTestBase