From 045be31b799051700573d5a8641f9fdd69f71e42 Mon Sep 17 00:00:00 2001 From: Knoobie Date: Tue, 16 May 2023 14:22:54 +0200 Subject: [PATCH] feat: deprecate Label and add NativeLabel as replacement (#16708) Adds NativeLabel as direct replacement for the HTML-based Label component / element. Fixes #4384 Fixes #3532 --- .../html/testbench/LabelElement.java | 2 + .../html/testbench/NativeLabelElement.java | 29 +++++ .../com/vaadin/flow/component/html/Label.java | 79 +++++++++++- .../flow/component/html/NativeLabel.java | 120 ++++++++++++++++++ .../html/HtmlComponentSmokeTest.java | 5 + .../flow/component/html/NativeLabelTest.java | 39 ++++++ .../ui/frontend/BrowserLoggingView.java | 4 +- ...ractAttachExistingElementByIdTemplate.java | 4 +- .../flow/uitest/ui/UrlValidationIT.java | 8 +- .../uitest/ui/AttachExistingElementView.java | 8 +- .../flow/uitest/ui/AttachListenerView.java | 4 +- .../ui/BackButtonServerRoundTripView.java | 6 +- .../vaadin/flow/uitest/ui/BodyScrollView.java | 4 +- .../ui/DebounceSynchronizePropertyView.java | 4 +- .../uitest/ui/ElementRemoveItselfView.java | 4 +- .../vaadin/flow/uitest/ui/EnabledView.java | 4 +- .../flow/uitest/ui/EventListenersView.java | 4 +- .../flow/uitest/ui/InMemoryChildrenView.java | 4 +- .../uitest/ui/JavaScriptReturnValueView.java | 4 +- .../flow/uitest/ui/JsApiGetByIdView.java | 6 +- .../flow/uitest/ui/MyExceptionHandler.java | 4 +- .../com/vaadin/flow/uitest/ui/PageView.java | 4 +- .../flow/uitest/ui/PostponeProceedView.java | 6 +- .../ui/RequestParametersHistoryView.java | 6 +- .../flow/uitest/ui/RequestParametersView.java | 6 +- .../vaadin/flow/uitest/ui/RerouteView.java | 6 +- .../uitest/ui/ServiceInitListenersView.java | 10 +- .../vaadin/flow/uitest/ui/VisibilityView.java | 4 +- .../uitest/ui/push/PushConfiguration.java | 6 +- .../components/NativeRadioButtonGroup.java | 4 +- .../RestoreViewWithAttachedByIdView.java | 6 +- .../UpdatableModelPropertiesView.java | 4 +- .../ui/template/UpgradeElementView.java | 4 +- .../uitest/ui/AttachExistingElementIT.java | 6 +- .../vaadin/flow/uitest/ui/ShadowRootIT.java | 5 +- .../spring/test/RootNavigationTarget.java | 7 +- .../flow/spring/test/TemplatePushView.java | 4 +- .../flow/spring/test/UIScopeTarget.java | 6 +- 38 files changed, 354 insertions(+), 86 deletions(-) create mode 100644 flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/NativeLabelElement.java create mode 100644 flow-html-components/src/main/java/com/vaadin/flow/component/html/NativeLabel.java create mode 100644 flow-html-components/src/test/java/com/vaadin/flow/component/html/NativeLabelTest.java diff --git a/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/LabelElement.java b/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/LabelElement.java index 242a3d41f03..554be7a3d1c 100644 --- a/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/LabelElement.java +++ b/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/LabelElement.java @@ -22,8 +22,10 @@ * A TestBench element representing a <label> element. * * @since 1.0 + * @deprecated Use {@link NativeLabelElement} instead. */ @Element("label") +@Deprecated(since = "24.1", forRemoval = true) public class LabelElement extends TestBenchElement { } diff --git a/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/NativeLabelElement.java b/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/NativeLabelElement.java new file mode 100644 index 00000000000..ec8741ec5a6 --- /dev/null +++ b/flow-html-components-testbench/src/main/java/com/vaadin/flow/component/html/testbench/NativeLabelElement.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2023 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.flow.component.html.testbench; + +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elementsbase.Element; + +/** + * A TestBench element representing a <label> element. + * + * @since 24.1 + */ +@Element("label") +public class NativeLabelElement extends TestBenchElement { + +} diff --git a/flow-html-components/src/main/java/com/vaadin/flow/component/html/Label.java b/flow-html-components/src/main/java/com/vaadin/flow/component/html/Label.java index 33956fdf51a..27a53d13ab4 100644 --- a/flow-html-components/src/main/java/com/vaadin/flow/component/html/Label.java +++ b/flow-html-components/src/main/java/com/vaadin/flow/component/html/Label.java @@ -17,22 +17,21 @@ import java.util.Optional; +import com.vaadin.flow.component.AttachEvent; import com.vaadin.flow.component.Component; import com.vaadin.flow.component.Html; import com.vaadin.flow.component.HtmlContainer; import com.vaadin.flow.component.PropertyDescriptor; import com.vaadin.flow.component.PropertyDescriptors; import com.vaadin.flow.component.Tag; +import com.vaadin.flow.server.VaadinService; +import com.vaadin.flow.shared.Registration; +import org.slf4j.LoggerFactory; /** * Component for a <label> element, which represents a * caption for an item in a user interface. *

- * Note that Label components are not meant for loose text in the page - they - * should be coupled with another component by using the - * {@link #setFor(Component)} or by adding them to it with the - * {@link #add(Component...)} method. - *

* Clicking on a label automatically transfers the focus to the associated * component. This is especially helpful when building forms with * {@link Input}s. @@ -46,12 +45,29 @@ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label * @since 1.0 + * @deprecated Use {@link NativeLabel} instead, if you need the HTML + * <label> element, which is normally not needed + * within a Vaadin Flow application's high-level components. This + * component was deprecated because it was confusing users of + * earlier Vaadin Versions and users migrating from Swing to the + * modern Vaadin Flow Framework. The {@link Label} component / + * <label> element is not meant for loose text in + * the page - it should only be coupled with another component by + * using the {@link #setFor(Component)} or by adding them to it with + * the {@link #add(Component...)} method, for example if you use + * {@link Input}. + * */ @Tag(Tag.LABEL) +@Deprecated(since = "24.1", forRemoval = true) public class Label extends HtmlContainer { private static final PropertyDescriptor> forDescriptor = PropertyDescriptors .optionalAttributeWithDefault("for", ""); + private static Boolean productionMode = null; + + private Registration checkForAttributeOnAttach; + /** * Creates a new empty label. */ @@ -118,4 +134,57 @@ public void setFor(String forId) { public Optional getFor() { return get(forDescriptor); } + + @Override + protected void onAttach(AttachEvent attachEvent) { + super.onAttach(attachEvent); + if (skipForAttributeCheck() || !attachEvent.isInitialAttach()) { + return; // skip check in production so that customer / clients / + // ops-teams are not complaining about this warning to the + // devs. This should be dealt with by devs in development + // mode. + } + if (checkForAttributeOnAttach == null) { + checkForAttributeOnAttach = attachEvent.getUI() + .beforeClientResponse(this, ctx -> { + // Label was not associated with a for-attribute + // AND + // Label was not associated by adding a nested component + if (getFor().isEmpty() + && getChildren().findAny().isEmpty()) { + LoggerFactory.getLogger(Label.class.getName()).warn( + "The Label '{}' was not associated with a component. " + + "Labels should not be used for loose text on the page. " + + "Consider alternatives like Text, Paragraph, Span or Div. " + + "See the JavaDocs and Deprecation Warning for more Information.", + getText()); + } + checkForAttributeOnAttach.remove(); + }); + } + } + + /** + * Checks if the application is running in production mode. + *

+ * When unsure, reports that production mode is true so spam-like logging + * does not take place in production. + * + * @return true if in production mode or the mode is unclear, false if in + * development mode + **/ + private static boolean skipForAttributeCheck() { + if (productionMode != null) { + return productionMode; + } + + var service = VaadinService.getCurrent(); + if (service == null) { + return true; + } + + productionMode = service.getDeploymentConfiguration() + .isProductionMode(); + return productionMode; + } } diff --git a/flow-html-components/src/main/java/com/vaadin/flow/component/html/NativeLabel.java b/flow-html-components/src/main/java/com/vaadin/flow/component/html/NativeLabel.java new file mode 100644 index 00000000000..64a96957136 --- /dev/null +++ b/flow-html-components/src/main/java/com/vaadin/flow/component/html/NativeLabel.java @@ -0,0 +1,120 @@ +/* + * Copyright 2000-2023 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.flow.component.html; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.Html; +import com.vaadin.flow.component.HtmlContainer; +import com.vaadin.flow.component.PropertyDescriptor; +import com.vaadin.flow.component.PropertyDescriptors; +import com.vaadin.flow.component.Tag; +import java.util.Optional; + +/** + * Component for a <label> element, which represents a + * caption for an input field in a user interface. + *

+ * Note that Label components are not meant for loose text in the page - they + * should be coupled with another component by using the + * {@link #setFor(Component)} or by adding them to it with the + * {@link #add(Component...)} method. + *

+ * Clicking on a label automatically transfers the focus to the associated + * component. This is especially helpful when building forms with + * {@link Input}s. + *

+ * For adding texts to the page without linking them to other components, + * consider using a {@link Span} or a {@link Div} instead. If the text should be + * interpreted as HTML, use a {@link Html} (but remember to guard against + * cross-site scripting attacks). + * + * @author Vaadin Ltd + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label + * @since 24.1 + */ +@Tag(Tag.LABEL) +public class NativeLabel extends HtmlContainer { + private static final PropertyDescriptor> forDescriptor = PropertyDescriptors + .optionalAttributeWithDefault("for", ""); + + /** + * Creates a new empty label. + */ + public NativeLabel() { + super(); + } + + /** + * Creates a new label with the given text content. + * + * @param text + * the text content + */ + public NativeLabel(String text) { + this(); + setText(text); + } + + /** + * Sets the component that this label describes. The component (or its id) + * should be defined in case the described component is not an ancestor of + * the label. + *

+ * The provided component must have an id set. This component will still use + * the old id if the id of the provided component is changed after this + * method has been called. + * + * @param forComponent + * the component that this label describes, not null + * , must have an id + * @throws IllegalArgumentException + * if the provided component has no id + */ + public void setFor(Component forComponent) { + if (forComponent == null) { + throw new IllegalArgumentException( + "The provided component cannot be null"); + } + setFor(forComponent.getId() + .orElseThrow(() -> new IllegalArgumentException( + "The provided component must have an id"))); + } + + /** + * Sets the id of the component that this label describes. The id should be + * defined in case the described component is not an ancestor of the label. + * + * @param forId + * the id of the described component, or null if + * there is no value + */ + public void setFor(String forId) { + set(forDescriptor, forId); + } + + /** + * Gets the id of the component that this label describes. + * + * @see #setFor(String) + * + * @return an optional id of the described component, or an empty optional + * if the attribute has not been set + */ + public Optional getFor() { + return get(forDescriptor); + } +} diff --git a/flow-html-components/src/test/java/com/vaadin/flow/component/html/HtmlComponentSmokeTest.java b/flow-html-components/src/test/java/com/vaadin/flow/component/html/HtmlComponentSmokeTest.java index f425ed3b20a..11e3023a2a3 100644 --- a/flow-html-components/src/test/java/com/vaadin/flow/component/html/HtmlComponentSmokeTest.java +++ b/flow-html-components/src/test/java/com/vaadin/flow/component/html/HtmlComponentSmokeTest.java @@ -206,6 +206,11 @@ private static boolean isSpecialSetter(Method method) { && method.getParameterTypes()[0] == Component.class) { return true; } + if (method.getDeclaringClass() == NativeLabel.class + && method.getName().equals("setFor") + && method.getParameterTypes()[0] == Component.class) { + return true; + } // Anchor.setTarget(AnchorTargetValue) - // https://github.com/vaadin/flow/issues/8346 diff --git a/flow-html-components/src/test/java/com/vaadin/flow/component/html/NativeLabelTest.java b/flow-html-components/src/test/java/com/vaadin/flow/component/html/NativeLabelTest.java new file mode 100644 index 00000000000..c3aac83605a --- /dev/null +++ b/flow-html-components/src/test/java/com/vaadin/flow/component/html/NativeLabelTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2023 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.flow.component.html; + +import org.junit.Assert; +import org.junit.Test; + +public class NativeLabelTest extends ComponentTest { + + // Actual test methods in super class + + @Override + protected void addProperties() { + addOptionalStringProperty("for"); + } + + @Test + public void setForComponent() { + NativeLabel otherComponent = new NativeLabel(); + otherComponent.setId("otherC"); + NativeLabel l = (NativeLabel) getComponent(); + l.setFor(otherComponent); + Assert.assertEquals(otherComponent.getId().get(), l.getFor().get()); + } + +} diff --git a/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/frontend/BrowserLoggingView.java b/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/frontend/BrowserLoggingView.java index 2a509b93fad..ce337f154fc 100644 --- a/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/frontend/BrowserLoggingView.java +++ b/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/frontend/BrowserLoggingView.java @@ -19,7 +19,7 @@ import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.dependency.JavaScript; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.Route; import com.vaadin.flow.shared.ui.LoadMode; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -29,7 +29,7 @@ @JavaScript(value = "./consoleLoggingProxy.js", loadMode = LoadMode.INLINE) public class BrowserLoggingView extends Div { public BrowserLoggingView() { - Label label = new Label("Just a label"); + NativeLabel label = new NativeLabel("Just a label"); label.setId("elementId"); add(label); } diff --git a/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/template/AbstractAttachExistingElementByIdTemplate.java b/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/template/AbstractAttachExistingElementByIdTemplate.java index 8a660d14875..ebc3767405f 100644 --- a/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/template/AbstractAttachExistingElementByIdTemplate.java +++ b/flow-tests/test-dev-mode/src/main/java/com/vaadin/flow/uitest/ui/template/AbstractAttachExistingElementByIdTemplate.java @@ -16,7 +16,7 @@ package com.vaadin.flow.uitest.ui.template; import com.vaadin.flow.component.html.Input; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.polymertemplate.EventHandler; import com.vaadin.flow.component.polymertemplate.Id; import com.vaadin.flow.component.polymertemplate.PolymerTemplate; @@ -29,7 +29,7 @@ public abstract class AbstractAttachExistingElementByIdTemplate private Input input; @Id("label") - private Label label; + private NativeLabel label; protected AbstractAttachExistingElementByIdTemplate(String id) { setId(id); diff --git a/flow-tests/test-dev-mode/src/test/java/com/vaadin/flow/uitest/ui/UrlValidationIT.java b/flow-tests/test-dev-mode/src/test/java/com/vaadin/flow/uitest/ui/UrlValidationIT.java index 47105d8c484..caa0bef771f 100644 --- a/flow-tests/test-dev-mode/src/test/java/com/vaadin/flow/uitest/ui/UrlValidationIT.java +++ b/flow-tests/test-dev-mode/src/test/java/com/vaadin/flow/uitest/ui/UrlValidationIT.java @@ -22,7 +22,7 @@ import org.junit.Assert; import org.junit.Test; -import com.vaadin.flow.component.html.testbench.LabelElement; +import com.vaadin.flow.component.html.testbench.NativeLabelElement; import com.vaadin.flow.testutil.ChromeBrowserTest; public class UrlValidationIT extends ChromeBrowserTest { @@ -36,7 +36,8 @@ public void devModeUriValidation_uriWithDirectoryChange_statusForbidden() throws Exception { // open a view and wait till the expected label is displayed open(); - waitUntil(input -> $(LabelElement.class).id("elementId").isDisplayed()); + waitUntil(input -> $(NativeLabelElement.class).id("elementId") + .isDisplayed()); // check the forbidden url sendRequestAndValidateResponseStatusBadRequest( "/VAADIN/build/%252E%252E"); @@ -47,7 +48,8 @@ public void staticResourceUriValidation_uriWithDirectoryChange_statusForbidden() throws Exception { // open a view and wait till the expected label is displayed open(); - waitUntil(input -> $(LabelElement.class).id("elementId").isDisplayed()); + waitUntil(input -> $(NativeLabelElement.class).id("elementId") + .isDisplayed()); // check the forbidden url sendRequestAndValidateResponseStatusBadRequest( "/VAADIN/build/%252E%252E/some-resource.css"); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachExistingElementView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachExistingElementView.java index 6c773ac4fbb..34feb6faaf4 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachExistingElementView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachExistingElementView.java @@ -19,7 +19,7 @@ import com.vaadin.flow.component.Component; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.H1; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.dom.ChildElementConsumer; import com.vaadin.flow.dom.Element; import com.vaadin.flow.dom.Node; @@ -30,7 +30,7 @@ @Route(value = "com.vaadin.flow.uitest.ui.AttachExistingElementView", layout = ViewTestLayout.class) public class AttachExistingElementView extends AbstractDivView { - private Label attachedLabel; + private NativeLabel attachedLabel; private class NonExistingElementCallback implements ChildElementConsumer { @@ -87,7 +87,7 @@ protected void onShow() { } private void handleLabel(Element label) { - attachedLabel = Component.from(label, Label.class); + attachedLabel = Component.from(label, NativeLabel.class); attachedLabel.setText("Client side label"); attachedLabel.setId("label"); @@ -120,7 +120,7 @@ private void handleHeader(Element header) { } private void handleLabelInShadow(Element label) { - Label lbl = Component.from(label, Label.class); + NativeLabel lbl = Component.from(label, NativeLabel.class); lbl.setText("Client side label in shadow root"); lbl.setId("label-in-shadow"); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachListenerView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachListenerView.java index 41d0272b4d2..1d697fbfd6b 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachListenerView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/AttachListenerView.java @@ -21,7 +21,7 @@ import com.vaadin.flow.component.HasComponents; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Input; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.Span; import com.vaadin.flow.router.Route; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -146,7 +146,7 @@ private Input createRadioButton(HasComponents parent, String id, input.setId(id); radioButtons.put(id, input); - Label label = new Label(text); + NativeLabel label = new NativeLabel(text); label.setFor(id); parent.add(input, label); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BackButtonServerRoundTripView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BackButtonServerRoundTripView.java index 189a73888fa..c56dac5aa59 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BackButtonServerRoundTripView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BackButtonServerRoundTripView.java @@ -4,7 +4,7 @@ import com.vaadin.flow.component.UI; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.BeforeEvent; import com.vaadin.flow.router.HasUrlParameter; @@ -20,10 +20,10 @@ public class BackButtonServerRoundTripView extends Div static final String BUTTON_ID = "button"; static final String QUERY_LABEL_ID = "query"; - private final Label queryLabel; + private final NativeLabel queryLabel; public BackButtonServerRoundTripView() { - queryLabel = new Label(); + queryLabel = new NativeLabel(); queryLabel.setId(QUERY_LABEL_ID); add(queryLabel); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BodyScrollView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BodyScrollView.java index cb8be57123f..6fa9c4131c2 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BodyScrollView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/BodyScrollView.java @@ -15,7 +15,7 @@ */ package com.vaadin.flow.uitest.ui; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.Route; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -23,7 +23,7 @@ public class BodyScrollView extends AbstractDivView { public BodyScrollView() { - add(new Label("Check scroll attribute")); + add(new NativeLabel("Check scroll attribute")); } } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/DebounceSynchronizePropertyView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/DebounceSynchronizePropertyView.java index 169160588fb..be8fd7f5bb9 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/DebounceSynchronizePropertyView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/DebounceSynchronizePropertyView.java @@ -19,7 +19,7 @@ import com.vaadin.flow.component.Component; import com.vaadin.flow.component.HtmlComponent; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.dom.DomEvent; import com.vaadin.flow.dom.DomEventListener; import com.vaadin.flow.dom.DomListenerRegistration; @@ -79,7 +79,7 @@ public void handleEvent(DomEvent event) { } }).addEventData("element.checked"); - Label label = new Label(caption); + NativeLabel label = new NativeLabel(caption); label.getElement().insertChild(0, checkbox); label.getElement().getStyle().set("display", "block"); return label; diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ElementRemoveItselfView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ElementRemoveItselfView.java index 87cf289f762..52747fee0d5 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ElementRemoveItselfView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ElementRemoveItselfView.java @@ -15,7 +15,7 @@ */ package com.vaadin.flow.uitest.ui; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.dom.Element; import com.vaadin.flow.uitest.servlet.ViewTestLayout; import com.vaadin.flow.router.Route; @@ -33,7 +33,7 @@ public ElementRemoveItselfView() { layout.appendChild(button); button.addEventListener("click", evt -> { layout.removeAllChildren(); - Label label = new Label("All removed!"); + NativeLabel label = new NativeLabel("All removed!"); label.setId("all-removed"); add(label); }); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EnabledView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EnabledView.java index 23ff37cfb1b..a9fac53f4ef 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EnabledView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EnabledView.java @@ -16,7 +16,7 @@ package com.vaadin.flow.uitest.ui; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.Route; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -32,7 +32,7 @@ public EnabledView() { div.setId("enabled"); div.getElement().setEnabled(false); - Label label = new Label("Nested element"); + NativeLabel label = new NativeLabel("Nested element"); label.setId("nested-label"); div.add(label); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EventListenersView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EventListenersView.java index f5a4e18ff71..9fe26b76670 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EventListenersView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/EventListenersView.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicInteger; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.uitest.servlet.ViewTestLayout; import com.vaadin.flow.router.Route; @@ -32,7 +32,7 @@ protected void onShow() { button.setId("click"); button.addClickListener(evt -> { int value = count.incrementAndGet(); - Label label = new Label(String.valueOf(value)); + NativeLabel label = new NativeLabel(String.valueOf(value)); label.addClassName("count"); add(label); add(button); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/InMemoryChildrenView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/InMemoryChildrenView.java index a057b134333..673dbfdecf9 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/InMemoryChildrenView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/InMemoryChildrenView.java @@ -17,7 +17,7 @@ import com.vaadin.flow.component.dependency.JavaScript; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.Route; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -27,7 +27,7 @@ public class InMemoryChildrenView extends AbstractDivView { @Override protected void onShow() { - Label label = new Label(); + NativeLabel label = new NativeLabel(); label.setId("in-memory"); label.setText("In memory element"); getElement().appendVirtualChild(label.getElement()); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JavaScriptReturnValueView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JavaScriptReturnValueView.java index 1d1807b8e50..3f3d7ad9eb0 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JavaScriptReturnValueView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JavaScriptReturnValueView.java @@ -23,7 +23,7 @@ import com.vaadin.flow.component.UI; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Input; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.component.page.PendingJavaScriptResult; import com.vaadin.flow.router.Route; @@ -140,7 +140,7 @@ public Input addOption(String caption, T value, String id) { input.getElement().setAttribute("checked", true); } - Label label = new Label(caption); + NativeLabel label = new NativeLabel(caption); label.setFor(input); getContent().add(new Div(input, label)); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JsApiGetByIdView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JsApiGetByIdView.java index b8cdb4fa48b..536624bc1c7 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JsApiGetByIdView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/JsApiGetByIdView.java @@ -16,7 +16,7 @@ package com.vaadin.flow.uitest.ui; import com.vaadin.flow.component.dependency.JavaScript; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.Route; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -25,11 +25,11 @@ public class JsApiGetByIdView extends AbstractDivView { public JsApiGetByIdView() { - Label label = new Label("Original label"); + NativeLabel label = new NativeLabel("Original label"); label.setId("source"); add(label); - Label target = new Label(); + NativeLabel target = new NativeLabel(); target.setId("target"); add(target); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/MyExceptionHandler.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/MyExceptionHandler.java index 5dc7d24f785..85f222677f9 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/MyExceptionHandler.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/MyExceptionHandler.java @@ -16,7 +16,7 @@ package com.vaadin.flow.uitest.ui; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.BeforeEnterEvent; import com.vaadin.flow.router.ErrorParameter; import com.vaadin.flow.router.HasErrorParameter; @@ -31,7 +31,7 @@ public class MyExceptionHandler extends Div implements HasErrorParameter { public MyExceptionHandler() { - Label label = new Label("My exception handler."); + NativeLabel label = new NativeLabel("My exception handler."); label.setId("custom-exception"); add(label); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PageView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PageView.java index 92cf60223ba..61ec9e85d3e 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PageView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PageView.java @@ -4,7 +4,7 @@ import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.IFrame; import com.vaadin.flow.component.html.Input; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.BeforeEnterEvent; import com.vaadin.flow.router.Route; @@ -81,7 +81,7 @@ public void beforeEnter(BeforeEnterEvent event) { })); })); - Label directionLbl = new Label(); + NativeLabel directionLbl = new NativeLabel(); directionLbl.setId("direction-value"); add(directionLbl); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PostponeProceedView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PostponeProceedView.java index 52ca61df50d..d555259db15 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PostponeProceedView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/PostponeProceedView.java @@ -17,7 +17,7 @@ import com.vaadin.flow.component.UI; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.component.html.Paragraph; import com.vaadin.flow.router.BeforeLeaveEvent; @@ -34,7 +34,7 @@ public class PostponeProceedView extends Div implements BeforeLeaveObserver { @Route(value = "com.vaadin.flow.uitest.ui.PostponeProceedView.ProceedResultView", layout = ViewTestLayout.class) public static class ProceedResultView extends Div { public ProceedResultView() { - Label label = new Label("Another view"); + NativeLabel label = new NativeLabel("Another view"); label.setId("target"); add(label); } @@ -43,7 +43,7 @@ public ProceedResultView() { @Route(value = "com.vaadin.flow.uitest.ui.PostponeProceedView.DelayedProceedTargetView", layout = ViewTestLayout.class) public static class DelayedProceedTargetView extends Div { public DelayedProceedTargetView() { - Label label = new Label("Delayed Proceed Target View"); + NativeLabel label = new NativeLabel("Delayed Proceed Target View"); label.setId("target"); add(label); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersHistoryView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersHistoryView.java index 50c2e3c072c..15f9822d242 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersHistoryView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersHistoryView.java @@ -17,7 +17,7 @@ import java.util.List; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.AfterNavigationEvent; import com.vaadin.flow.router.AfterNavigationObserver; @@ -36,12 +36,12 @@ public class RequestParametersHistoryView extends AbstractDivView static final String REQUEST_PARAM_ID = "requestParamDisplayLabel"; static final String BACK_BUTTON_ID = "backButton"; - private final Label requestParamLabel; + private final NativeLabel requestParamLabel; public RequestParametersHistoryView() { NativeButton backwardButton = createButton("Go back", BACK_BUTTON_ID, event -> getPage().getHistory().back()); - requestParamLabel = new Label(NO_INPUT_TEXT); + requestParamLabel = new NativeLabel(NO_INPUT_TEXT); requestParamLabel.setId(REQUEST_PARAM_ID); add(requestParamLabel, backwardButton); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersView.java index dd390bc84ab..cf0cf9e047f 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RequestParametersView.java @@ -19,7 +19,7 @@ import java.util.Collections; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.BeforeEnterEvent; import com.vaadin.flow.router.BeforeEnterObserver; import com.vaadin.flow.router.Route; @@ -31,10 +31,10 @@ public class RequestParametersView extends Div implements BeforeEnterObserver { static final String NO_INPUT_TEXT = "No input"; static final String REQUEST_PARAM_ID = "requestParamDisplayLabel"; - private final Label requestParamLabel; + private final NativeLabel requestParamLabel; public RequestParametersView() { - requestParamLabel = new Label(NO_INPUT_TEXT); + requestParamLabel = new NativeLabel(NO_INPUT_TEXT); requestParamLabel.setId(REQUEST_PARAM_ID); add(requestParamLabel); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RerouteView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RerouteView.java index 9034930dfef..3fd2ee9a16e 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RerouteView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/RerouteView.java @@ -20,7 +20,7 @@ import com.vaadin.flow.component.HtmlContainer; import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.html.Input; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.BeforeEnterEvent; import com.vaadin.flow.router.NotFoundException; @@ -68,7 +68,7 @@ public void beforeEnter(BeforeEnterEvent event) { public class CheckBox extends HtmlContainer { Input input; - Label captionLabel; + NativeLabel captionLabel; public CheckBox() { input = new Input(); @@ -81,7 +81,7 @@ public CheckBox() { public CheckBox(String caption) { this(); - captionLabel = new Label(caption); + captionLabel = new NativeLabel(caption); add(captionLabel); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ServiceInitListenersView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ServiceInitListenersView.java index d102160828a..c8afea37554 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ServiceInitListenersView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/ServiceInitListenersView.java @@ -16,7 +16,7 @@ package com.vaadin.flow.uitest.ui; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.BeforeEvent; import com.vaadin.flow.router.HasUrlParameter; import com.vaadin.flow.router.OptionalParameter; @@ -27,14 +27,14 @@ public class ServiceInitListenersView extends Div implements HasUrlParameter { private static final String OPTIONAL_PARAMETER_LABEL_TEXT_PREFIX = "Before init count: "; - private final Label optionalParameterLabel; + private final NativeLabel optionalParameterLabel; public ServiceInitListenersView() { - optionalParameterLabel = new Label(); + optionalParameterLabel = new NativeLabel(); add(optionalParameterLabel); - add(new Label( + add(new NativeLabel( "Init count: " + TestingServiceInitListener.getInitCount())); - add(new Label("Request count: " + add(new NativeLabel("Request count: " + TestingServiceInitListener.getRequestCount())); } diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/VisibilityView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/VisibilityView.java index 5f20faacb3a..7110841603b 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/VisibilityView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/VisibilityView.java @@ -16,7 +16,7 @@ package com.vaadin.flow.uitest.ui; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.Route; import com.vaadin.flow.uitest.servlet.ViewTestLayout; @@ -32,7 +32,7 @@ public VisibilityView() { div.setId("visibility"); div.setVisible(false); - Label label = new Label("Nested element"); + NativeLabel label = new NativeLabel("Nested element"); label.setId("nested-label"); div.add(label); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/PushConfiguration.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/PushConfiguration.java index 90fae1fe24b..4cd9753d19f 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/PushConfiguration.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/PushConfiguration.java @@ -8,7 +8,7 @@ import com.vaadin.flow.component.DetachEvent; import com.vaadin.flow.component.Html; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.Route; @@ -43,7 +43,7 @@ protected void onAttach(AttachEvent attachEvent) { Div clientCounterLabel = new Div(); clientCounterLabel.setText("0"); clientCounterLabel.setId("client-counter"); - Label label = new Label( + NativeLabel label = new NativeLabel( "Client counter (click 'increment' to update):"); label.setFor(clientCounterLabel); add(label, clientCounterLabel); @@ -58,7 +58,7 @@ protected void onAttach(AttachEvent attachEvent) { serverCounterLabel = new Div(); serverCounterLabel.setId("server-counter"); serverCounterLabel.setText(String.valueOf(counter2)); - label = new Label( + label = new NativeLabel( "Server counter (updates each 1s by server thread) :"); label.setFor(serverCounterLabel); add(label, serverCounterLabel); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/components/NativeRadioButtonGroup.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/components/NativeRadioButtonGroup.java index 69ac28d475b..2160f50da33 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/components/NativeRadioButtonGroup.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/push/components/NativeRadioButtonGroup.java @@ -8,7 +8,7 @@ import com.vaadin.flow.component.Text; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Input; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; public class NativeRadioButtonGroup extends Composite

{ private final String group; @@ -43,7 +43,7 @@ public Input addOption(String caption, T value) { input.getElement().setAttribute("checked", true); } - Label label = new Label(caption); + NativeLabel label = new NativeLabel(caption); label.setFor(input); getContent().add(new Div(input, label)); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/RestoreViewWithAttachedByIdView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/RestoreViewWithAttachedByIdView.java index 0463a1e259a..036e1e6dd04 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/RestoreViewWithAttachedByIdView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/RestoreViewWithAttachedByIdView.java @@ -19,7 +19,7 @@ import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.dependency.JsModule; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.component.polymertemplate.PolymerTemplate; import com.vaadin.flow.component.template.Id; @@ -32,7 +32,7 @@ public class RestoreViewWithAttachedByIdView extends AbstractDivView { private TemplateWithInjectedId template; - private Label label; + private NativeLabel label; private Component current; @@ -54,7 +54,7 @@ public TemplateWithInjectedId() { public RestoreViewWithAttachedByIdView() { template = new TemplateWithInjectedId(); - label = new Label("Switched component"); + label = new NativeLabel("Switched component"); label.setId("info"); template.setId("template"); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpdatableModelPropertiesView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpdatableModelPropertiesView.java index 79fcb4982f1..5a2b619aac3 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpdatableModelPropertiesView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpdatableModelPropertiesView.java @@ -21,7 +21,7 @@ import com.vaadin.flow.component.HasComponents; import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.dependency.JsModule; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.polymertemplate.EventHandler; import com.vaadin.flow.component.polymertemplate.PolymerTemplate; import com.vaadin.flow.router.Route; @@ -55,7 +55,7 @@ public interface UpdatablePropertiesModel extends TemplateModel { public UpdatableModelPropertiesView() { setId("template"); - Label label = new Label(); + NativeLabel label = new NativeLabel(); label.setId("property-value"); add(label); diff --git a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpgradeElementView.java b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpgradeElementView.java index d84c957090e..44d984a0673 100644 --- a/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpgradeElementView.java +++ b/flow-tests/test-root-context/src/main/java/com/vaadin/flow/uitest/ui/template/UpgradeElementView.java @@ -17,7 +17,7 @@ import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.dependency.JsModule; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.component.polymertemplate.EventHandler; import com.vaadin.flow.component.polymertemplate.PolymerTemplate; @@ -33,7 +33,7 @@ public static class UpgradeElement extends PolymerTemplate { @EventHandler private void valueUpdated() { - Label label = new Label(getModel().getText()); + NativeLabel label = new NativeLabel(getModel().getText()); label.setId("text-update"); getUI().get().add(label); } diff --git a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/AttachExistingElementIT.java b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/AttachExistingElementIT.java index e6703dd3b73..dcbf26bcafc 100644 --- a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/AttachExistingElementIT.java +++ b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/AttachExistingElementIT.java @@ -25,7 +25,7 @@ import org.openqa.selenium.WebElement; import com.vaadin.flow.component.html.testbench.DivElement; -import com.vaadin.flow.component.html.testbench.LabelElement; +import com.vaadin.flow.component.html.testbench.NativeLabelElement; import com.vaadin.flow.testcategory.IgnoreOSGi; import com.vaadin.flow.testutil.ChromeBrowserTest; @@ -87,8 +87,8 @@ public void attachExistingElement() { // attach a child in the shadow root of the div findElement(By.id("attach-label-inshadow")).click(); - LabelElement labelInShadow = $(DivElement.class) - .id("element-with-shadow").$(LabelElement.class) + NativeLabelElement labelInShadow = $(DivElement.class) + .id("element-with-shadow").$(NativeLabelElement.class) .id("label-in-shadow"); Assert.assertEquals("label", labelInShadow.getTagName().toLowerCase(Locale.ENGLISH)); diff --git a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/ShadowRootIT.java b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/ShadowRootIT.java index 2f67348c5b3..9dfafb3b87e 100644 --- a/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/ShadowRootIT.java +++ b/flow-tests/test-root-context/src/test/java/com/vaadin/flow/uitest/ui/ShadowRootIT.java @@ -21,7 +21,7 @@ import org.openqa.selenium.WebElement; import com.vaadin.flow.component.html.testbench.DivElement; -import com.vaadin.flow.component.html.testbench.LabelElement; +import com.vaadin.flow.component.html.testbench.NativeLabelElement; import com.vaadin.flow.testutil.ChromeBrowserTest; public class ShadowRootIT extends ChromeBrowserTest { @@ -35,7 +35,8 @@ public void checkShadowRoot() { WebElement shadowDiv = div.$(DivElement.class).id("shadow-div"); Assert.assertEquals("Div inside shadow DOM", shadowDiv.getText()); - WebElement shadowLabel = div.$(LabelElement.class).id("shadow-label"); + WebElement shadowLabel = div.$(NativeLabelElement.class) + .id("shadow-label"); Assert.assertEquals("Label inside shadow DOM", shadowLabel.getText()); findElement(By.id("remove")).click(); diff --git a/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/RootNavigationTarget.java b/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/RootNavigationTarget.java index 3655399381a..311b157a6d6 100644 --- a/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/RootNavigationTarget.java +++ b/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/RootNavigationTarget.java @@ -19,7 +19,7 @@ import com.vaadin.flow.component.AttachEvent; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.Route; import com.vaadin.flow.router.RouterLink; @@ -29,7 +29,7 @@ public class RootNavigationTarget extends Div { public RootNavigationTarget(@Autowired DataBean dataBean, @Autowired FooNavigationTarget section) { setId("main"); - Label label = new Label(dataBean.getMessage()); + NativeLabel label = new NativeLabel(dataBean.getMessage()); label.setId("message"); add(label); @@ -41,7 +41,8 @@ public RootNavigationTarget(@Autowired DataBean dataBean, @Override protected void onAttach(AttachEvent attachEvent) { - Label label = new Label(String.valueOf(getUI().get().getUIId())); + NativeLabel label = new NativeLabel( + String.valueOf(getUI().get().getUIId())); label.setId("ui-id"); add(label); diff --git a/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/TemplatePushView.java b/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/TemplatePushView.java index 1d0a401a75f..f3a0d5ff845 100644 --- a/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/TemplatePushView.java +++ b/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/TemplatePushView.java @@ -6,7 +6,7 @@ import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.UI; import com.vaadin.flow.component.dependency.JsModule; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.component.polymertemplate.Id; import com.vaadin.flow.component.polymertemplate.PolymerTemplate; @@ -21,7 +21,7 @@ public class TemplatePushView extends PolymerTemplate { @Id - private Label label; + private NativeLabel label; @Id private NativeButton elementTest; diff --git a/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/UIScopeTarget.java b/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/UIScopeTarget.java index c51272060e7..480a87dc3f8 100644 --- a/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/UIScopeTarget.java +++ b/flow-tests/vaadin-spring-tests/test-spring-common/src/main/java/com/vaadin/flow/spring/test/UIScopeTarget.java @@ -22,7 +22,7 @@ import com.vaadin.flow.component.AttachEvent; import com.vaadin.flow.component.html.Div; -import com.vaadin.flow.component.html.Label; +import com.vaadin.flow.component.html.NativeLabel; import com.vaadin.flow.router.Route; @Route("ui-scope") @@ -37,7 +37,7 @@ public static class InnerComponent extends Div { @Override protected void onAttach(AttachEvent attachEvent) { - Label label = new Label(String.valueOf(bean.getUid())); + NativeLabel label = new NativeLabel(String.valueOf(bean.getUid())); label.setId("inner"); add(label); } @@ -45,7 +45,7 @@ protected void onAttach(AttachEvent attachEvent) { public UIScopeTarget(@Autowired UIScopedBean bean, @Autowired InnerComponent component) { - Label label = new Label(String.valueOf(bean.getUid())); + NativeLabel label = new NativeLabel(String.valueOf(bean.getUid())); label.setId("main"); add(label);