diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-21 10:51:51 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-21 11:51:51 +0300 |
commit | 867006d2f81aa813c36f614fc6f1b98a5937c5f3 (patch) | |
tree | fb2c34b1b58db8b3610a4a47010196069e90c436 /uitest/src/main | |
parent | 719b12e44afc8b62458b1e29d1503e28544acc24 (diff) | |
download | vaadin-framework-867006d2f81aa813c36f614fc6f1b98a5937c5f3.tar.gz vaadin-framework-867006d2f81aa813c36f614fc6f1b98a5937c5f3.zip |
Use String.isEmpty() (#10045)
Diffstat (limited to 'uitest/src/main')
11 files changed, 16 insertions, 16 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/Parameters.java b/uitest/src/main/java/com/vaadin/tests/Parameters.java index bb38110bcc..647c6575f1 100644 --- a/uitest/src/main/java/com/vaadin/tests/Parameters.java +++ b/uitest/src/main/java/com/vaadin/tests/Parameters.java @@ -119,7 +119,7 @@ public class Parameters extends com.vaadin.server.LegacyApplication final String[] values = entry.getValue(); String v = ""; for (int j = 0; j < values.length; j++) { - if (v.length() > 0) { + if (!v.isEmpty()) { v += ", "; } v += "'" + values[j] + "'"; diff --git a/uitest/src/main/java/com/vaadin/tests/TestForContainerFilterable.java b/uitest/src/main/java/com/vaadin/tests/TestForContainerFilterable.java index 707aa51d6f..0f4c0440ea 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestForContainerFilterable.java +++ b/uitest/src/main/java/com/vaadin/tests/TestForContainerFilterable.java @@ -76,11 +76,11 @@ public class TestForContainerFilterable extends CustomComponent { @Override public void buttonClick(ClickEvent event) { ic.removeAllContainerFilters(); - if (fooFilter.getValue().length() > 0) { + if (!fooFilter.getValue().isEmpty()) { ic.addContainerFilter("foo", fooFilter.getValue(), false, false); } - if (barFilter.getValue().length() > 0) { + if (!barFilter.getValue().isEmpty()) { ic.addContainerFilter("bar", barFilter.getValue(), true, true); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index 1410a3cfae..71a6ee9f0d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -52,7 +52,7 @@ public class OrderedLayoutCases extends AbstractReindeerTestUI { public void valueChange(ValueChangeEvent event) { String value = event.getProperty().getValue() .toString(); - if (value.length() == 0) { + if (value.isEmpty()) { setCaption(null); } else if (value.equals("Long")) { setCaption( diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TextFieldRelativeWidth.java b/uitest/src/main/java/com/vaadin/tests/components/table/TextFieldRelativeWidth.java index fbc31c1295..7bb2d30910 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/TextFieldRelativeWidth.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/TextFieldRelativeWidth.java @@ -57,7 +57,7 @@ public class TextFieldRelativeWidth extends AbstractReindeerTestUI { Object itemId = idc.addItemAt(size - 1); Item newItem = idc.getItem(itemId); TextField tf = new TextField(); - if (inputPrompt != null && inputPrompt.length() > 0) { + if (inputPrompt != null && !inputPrompt.isEmpty()) { tf.setInputPrompt(inputPrompt); } tf.setWidth("100%"); @@ -70,7 +70,7 @@ public class TextFieldRelativeWidth extends AbstractReindeerTestUI { newItem = idc.getItem(itemId); tf = new TextField(); - if (inputPromptChild != null && inputPromptChild.length() > 0) { + if (inputPromptChild != null && !inputPromptChild.isEmpty()) { tf.setInputPrompt(inputPromptChild); } tf.setWidth("100%"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java index 3db3e208af..c8945e0e38 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java @@ -110,7 +110,7 @@ public class TextChangeEvents extends AbstractTestUIWithLog { } private String findMatch(String currentTextContent) { - if (currentTextContent.length() > 0) { + if (!currentTextContent.isEmpty()) { for (int i = 0; i < names.length; i++) { if (names[i].startsWith(currentTextContent)) { return names[i]; diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java index 9967980d16..0ae27ac6c1 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java @@ -78,7 +78,7 @@ public class TextFieldWithPropertyFormatter extends TestBase { @Override public BigDecimal parse(String formattedValue) throws Exception { if (formattedValue != null - && formattedValue.trim().length() != 0) { + && !formattedValue.trim().isEmpty()) { BigDecimal value = (BigDecimal) df.parse(formattedValue); value = value.setScale(2, BigDecimal.ROUND_HALF_UP); return value; diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java index 6c86b16dda..cef3749a50 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java @@ -138,7 +138,7 @@ public class TextFieldsValueChangeMode extends AbstractTestUIWithLog { } private String findMatch(String currentTextContent) { - if (currentTextContent.length() > 0) { + if (!currentTextContent.isEmpty()) { for (int i = 0; i < names.length; i++) { if (names[i].startsWith(currentTextContent)) { return names[i]; diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java index 6699cefa39..b15a7c004a 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/layouttester/BaseLayoutTestUI.java @@ -220,7 +220,7 @@ public abstract class BaseLayoutTestUI extends AbstractReindeerTestUI { comp.setIcon(ICONS[i]); } if (ErrorMessage != null) { - if (ErrorMessage.length() == 0) { + if (ErrorMessage.isEmpty()) { comp.setComponentError(new UserError(null)); } else { comp.setComponentError(new UserError(ErrorMessage)); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/MyPickerWidget.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/MyPickerWidget.java index 6a0aee9670..49ec4da0b2 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/MyPickerWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7a2/MyPickerWidget.java @@ -35,7 +35,7 @@ public class MyPickerWidget extends ComplexPanel { } public void setButtonText(String buttonText, boolean adjustSpace) { - if (buttonText == null || buttonText.length() == 0) { + if (buttonText == null || buttonText.isEmpty()) { buttonText = "..."; } button.setText(buttonText); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java index 403cee1882..6d7a67cfa8 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java @@ -153,7 +153,7 @@ public class CommonParts extends VerticalLayout implements View { title.setPlaceholder("Title for the notification"); title.addValueChangeListener(event -> { if (title.getValue() == null - || title.getValue().length() == 0) { + || title.getValue().isEmpty()) { notification.setCaption(null); } else { notification.setCaption(title.getValue()); @@ -167,7 +167,7 @@ public class CommonParts extends VerticalLayout implements View { description.addStyleName(ValoTheme.TEXTAREA_SMALL); description.addValueChangeListener(listener -> { if (description.getValue() == null - || description.getValue().length() == 0) { + || description.getValue().isEmpty()) { notification.setDescription(null); } else { notification.setDescription(description.getValue()); @@ -218,11 +218,11 @@ public class CommonParts extends VerticalLayout implements View { + item.getText().toLowerCase(); } } - if (styleString.trim().length() > 0) { + if (!styleString.trim().isEmpty()) { notification.setStyleName( (typeString + " " + styleString.trim()) .trim()); - } else if (typeString.length() > 0) { + } else if (!typeString.isEmpty()) { notification.setStyleName(typeString.trim()); } else { notification.setStyleName(null); diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents.java b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents.java index fc9ccfe04f..406309f471 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents.java @@ -122,7 +122,7 @@ public class TextChangeEvents extends TestBase { } private String findMatch(String currentTextContent) { - if (currentTextContent.length() > 0) { + if (!currentTextContent.isEmpty()) { for (int i = 0; i < names.length; i++) { if (names[i].startsWith(currentTextContent)) { return names[i]; |