summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-09-21 10:51:51 +0200
committerHenri Sara <henri.sara@gmail.com>2017-09-21 11:51:51 +0300
commit867006d2f81aa813c36f614fc6f1b98a5937c5f3 (patch)
treefb2c34b1b58db8b3610a4a47010196069e90c436 /client
parent719b12e44afc8b62458b1e29d1503e28544acc24 (diff)
downloadvaadin-framework-867006d2f81aa813c36f614fc6f1b98a5937c5f3.tar.gz
vaadin-framework-867006d2f81aa813c36f614fc6f1b98a5937c5f3.zip
Use String.isEmpty() (#10045)
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java4
-rw-r--r--client/src/main/java/com/vaadin/client/ResourceLoader.java6
-rw-r--r--client/src/main/java/com/vaadin/client/VErrorMessage.java2
-rw-r--r--client/src/main/java/com/vaadin/client/WidgetUtil.java2
-rw-r--r--client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java6
-rw-r--r--client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java2
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java6
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VAccordion.java6
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VComboBox.java8
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VLink.java6
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VNotification.java4
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VUpload.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VWindow.java4
-rw-r--r--client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java2
-rw-r--r--client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java2
18 files changed, 34 insertions, 34 deletions
diff --git a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
index f0a6e7057a..05449f1126 100644
--- a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
+++ b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
@@ -331,7 +331,7 @@ public class JavaScriptConnectorHelper {
}
private ServerConnector getConnector(String connectorId) {
- if (connectorId == null || connectorId.length() == 0) {
+ if (connectorId == null || connectorId.isEmpty()) {
return connector;
}
@@ -364,7 +364,7 @@ public class JavaScriptConnectorHelper {
// TODO Resolve conflicts using argument count and types
String interfaceList = "";
for (String iface : interfaces) {
- if (interfaceList.length() != 0) {
+ if (!interfaceList.isEmpty()) {
interfaceList += ", ";
}
interfaceList += getJsInterfaceName(iface);
diff --git a/client/src/main/java/com/vaadin/client/ResourceLoader.java b/client/src/main/java/com/vaadin/client/ResourceLoader.java
index 53967a74f7..12922dca00 100644
--- a/client/src/main/java/com/vaadin/client/ResourceLoader.java
+++ b/client/src/main/java/com/vaadin/client/ResourceLoader.java
@@ -141,7 +141,7 @@ public class ResourceLoader {
for (int i = 0; i < scripts.getLength(); i++) {
ScriptElement element = ScriptElement.as(scripts.getItem(i));
String src = element.getSrc();
- if (src != null && src.length() != 0) {
+ if (src != null && !src.isEmpty()) {
loadedResources.add(src);
}
}
@@ -152,11 +152,11 @@ public class ResourceLoader {
String rel = linkElement.getRel();
String href = linkElement.getHref();
if ("stylesheet".equalsIgnoreCase(rel) && href != null
- && href.length() != 0) {
+ && !href.isEmpty()) {
loadedResources.add(href);
}
if ("import".equalsIgnoreCase(rel) && href != null
- && href.length() != 0) {
+ && !href.isEmpty()) {
loadedResources.add(href);
}
}
diff --git a/client/src/main/java/com/vaadin/client/VErrorMessage.java b/client/src/main/java/com/vaadin/client/VErrorMessage.java
index b87704f3e0..0baa1baff1 100644
--- a/client/src/main/java/com/vaadin/client/VErrorMessage.java
+++ b/client/src/main/java/com/vaadin/client/VErrorMessage.java
@@ -49,7 +49,7 @@ public class VErrorMessage extends FlowPanel {
public void updateMessage(String htmlErrorMessage) {
clear();
- if (htmlErrorMessage == null || htmlErrorMessage.length() == 0) {
+ if (htmlErrorMessage == null || htmlErrorMessage.isEmpty()) {
add(new HTML(" "));
} else {
// pre-formatted on the server as div per child
diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java
index 3390881b72..d24a1d53a5 100644
--- a/client/src/main/java/com/vaadin/client/WidgetUtil.java
+++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java
@@ -934,7 +934,7 @@ public class WidgetUtil {
public static void forceWebkitRedraw(Element element) {
Style style = element.getStyle();
String s = style.getProperty("webkitTransform");
- if (s == null || s.length() == 0) {
+ if (s == null || s.isEmpty()) {
style.setProperty("webkitTransform", "scale(1)");
} else {
style.setProperty("webkitTransform", "");
diff --git a/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java b/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java
index f01c693c4c..ddab95d2c9 100644
--- a/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java
+++ b/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java
@@ -42,9 +42,9 @@ public class SelectorPredicate {
}
/**
- * Generate a list of predicates from a single predicate string
+ * Generates a list of predicates from a single predicate string.
*
- * @param str
+ * @param path
* a comma separated string of predicates
* @return a List of Predicate objects
*/
@@ -52,7 +52,7 @@ public class SelectorPredicate {
List<SelectorPredicate> predicates = new ArrayList<>();
String predicateStr = extractPredicateString(path);
- if (null == predicateStr || predicateStr.length() == 0) {
+ if (null == predicateStr || predicateStr.isEmpty()) {
return predicates;
}
diff --git a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
index c7abe8c15f..77e1ee0a09 100644
--- a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
+++ b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
@@ -424,7 +424,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
ComponentConnector root, Element actualRoot) {
String[] pathComponents = path.split(SUBPART_SEPARATOR);
List<ComponentConnector> connectors;
- if (pathComponents[0].length() > 0) {
+ if (!pathComponents[0].isEmpty()) {
connectors = findConnectorsByPath(pathComponents[0],
Arrays.asList(root));
} else {
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java
index ae24ed850f..44a60b9fd5 100644
--- a/client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridDropTargetConnector.java
@@ -273,7 +273,7 @@ public class GridDropTargetConnector extends DropTargetExtensionConnector {
if ("thead".equalsIgnoreCase(parentTagName)) {
// for empty grid or ON_TOP mode, drop as last row,
// otherwise as above first visible row
- if (visibleRowRange.length() == 0
+ if (visibleRowRange.isEmpty()
|| getState().dropMode == DropMode.ON_TOP) {
return tableWrapper;
} else {
@@ -283,7 +283,7 @@ public class GridDropTargetConnector extends DropTargetExtensionConnector {
} else if ("tfoot".equalsIgnoreCase(parentTagName)) {
// for empty grid or ON_TOP mode, drop as last row,
// otherwise as below last visible row
- if (visibleRowRange.length() == 0
+ if (visibleRowRange.isEmpty()
|| getState().dropMode == DropMode.ON_TOP) {
return tableWrapper;
} else {
@@ -299,7 +299,7 @@ public class GridDropTargetConnector extends DropTargetExtensionConnector {
// the drag is on top of the tablewrapper
// if no rows in grid, or if the drop mode is ON_TOP, then there is no
// target row for the drop
- if (visibleRowRange.length() == 0
+ if (visibleRowRange.isEmpty()
|| getState().dropMode == DropMode.ON_TOP) {
return tableWrapper;
} else { // if dragged under the last row to empty space, drop target
diff --git a/client/src/main/java/com/vaadin/client/ui/VAccordion.java b/client/src/main/java/com/vaadin/client/ui/VAccordion.java
index 73f48639f3..16c16935d0 100644
--- a/client/src/main/java/com/vaadin/client/ui/VAccordion.java
+++ b/client/src/main/java/com/vaadin/client/ui/VAccordion.java
@@ -376,13 +376,13 @@ public class VAccordion extends VTabsheetBase {
* Updates a tabs stylename from the child UIDL
*
* @param uidl
- * The child uidl of the tab
+ * The child UIDL of the tab
*/
private void updateTabStyleName(String newStyleName) {
- if (newStyleName != null && newStyleName.length() != 0) {
+ if (newStyleName != null && !newStyleName.isEmpty()) {
if (!newStyleName.equals(styleName)) {
// If we have a new style name
- if (styleName != null && styleName.length() != 0) {
+ if (styleName != null && !styleName.isEmpty()) {
// Remove old style name if present
removeStyleDependentName(styleName);
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java b/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java
index 427c4011a5..a957690526 100644
--- a/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java
+++ b/client/src/main/java/com/vaadin/client/ui/VCheckBoxGroup.java
@@ -124,7 +124,7 @@ public class VCheckBoxGroup extends FocusableFlowPanelComposite
}
String iconUrl = item.getString(ListingJsonConstants.JSONKEY_ITEM_ICON);
- if (iconUrl != null && iconUrl.length() != 0) {
+ if (iconUrl != null && !iconUrl.isEmpty()) {
Icon icon = client.getIcon(iconUrl);
itemHtml = icon.getElement().getString() + itemHtml;
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VComboBox.java b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
index ebb993702c..c872026ac7 100644
--- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java
+++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
@@ -1287,7 +1287,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
String height = getElement().getStyle().getHeight();
String preferredHeight = getPreferredHeight(pageLength);
- return !(height == null || height.length() == 0
+ return !(height == null || height.isEmpty()
|| height.equals(preferredHeight));
}
@@ -2038,7 +2038,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
if (selectedItemIcon != null) {
panel.remove(selectedItemIcon);
}
- if (iconUri == null || iconUri.length() == 0) {
+ if (iconUri == null || iconUri.isEmpty()) {
if (selectedItemIcon != null) {
selectedItemIcon = null;
afterSelectedItemIconChange();
@@ -2422,7 +2422,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
for (ComboBoxSuggestion suggestion : currentSuggestions) {
// Collect captions so we can calculate minimum width for
// textarea
- if (captions.length() > 0) {
+ if (!captions.isEmpty()) {
captions += "|";
}
captions += WidgetUtil
@@ -2658,7 +2658,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
@Override
public void setWidth(String width) {
super.setWidth(width);
- if (width.length() != 0) {
+ if (!width.isEmpty()) {
tb.setWidth("100%");
}
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VLink.java b/client/src/main/java/com/vaadin/client/ui/VLink.java
index ede020e572..84aac0f17e 100644
--- a/client/src/main/java/com/vaadin/client/ui/VLink.java
+++ b/client/src/main/java/com/vaadin/client/ui/VLink.java
@@ -98,15 +98,15 @@ public class VLink extends HTML implements ClickHandler, HasEnabled {
}
if (targetWidth > 0) {
- features += (features.length() > 0 ? "," : "") + "width="
+ features += (features.isEmpty() ? "" : ",") + "width="
+ targetWidth;
}
if (targetHeight > 0) {
- features += (features.length() > 0 ? "," : "") + "height="
+ features += (features.isEmpty() ? "" : ",") + "height="
+ targetHeight;
}
- if (features.length() > 0) {
+ if (!features.isEmpty()) {
// if 'special features' are set, use window.open(), unless
// a modifier key is held (ctrl to open in new tab etc)
Event e = DOM.eventGetCurrentEvent();
diff --git a/client/src/main/java/com/vaadin/client/ui/VNotification.java b/client/src/main/java/com/vaadin/client/ui/VNotification.java
index e5358a3db7..0eaee0102c 100644
--- a/client/src/main/java/com/vaadin/client/ui/VNotification.java
+++ b/client/src/main/java/com/vaadin/client/ui/VNotification.java
@@ -247,7 +247,7 @@ public class VNotification extends VOverlay {
removeStyleDependentName(temporaryStyle);
temporaryStyle = null;
}
- if (style != null && style.length() > 0) {
+ if (style != null && !style.isEmpty()) {
temporaryStyle = style;
addStyleName(style);
addStyleDependentName(style);
@@ -635,7 +635,7 @@ public class VNotification extends VOverlay {
html.append("</p>");
}
- if (html.length() > 0) {
+ if (html.length() != 0) {
// Add error description
if (details != null) {
diff --git a/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java b/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java
index 15b0d6f043..4f0bed52ed 100644
--- a/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java
+++ b/client/src/main/java/com/vaadin/client/ui/VRadioButtonGroup.java
@@ -143,7 +143,7 @@ public class VRadioButtonGroup extends FocusableFlowPanelComposite
}
String iconUrl = item.getString(ListingJsonConstants.JSONKEY_ITEM_ICON);
- if (iconUrl != null && iconUrl.length() != 0) {
+ if (iconUrl != null && !iconUrl.isEmpty()) {
Icon icon = client.getIcon(iconUrl);
itemHtml = icon.getElement().getString() + itemHtml;
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java
index d25508d29a..dd4c295492 100644
--- a/client/src/main/java/com/vaadin/client/ui/VUpload.java
+++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java
@@ -332,7 +332,7 @@ public class VUpload extends SimplePanel {
VConsole.log("Submit cancelled (disabled or already submitted)");
return;
}
- if (fu.getFilename().length() == 0) {
+ if (fu.getFilename().isEmpty()) {
VConsole.log("Submitting empty selection (no file)");
}
// flush possibly pending variable changes, so they will be handled
diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java
index c6d817587b..9e4aad0d2c 100644
--- a/client/src/main/java/com/vaadin/client/ui/VWindow.java
+++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java
@@ -1204,7 +1204,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
// Override PopupPanel which sets the width to the contents
getElement().getStyle().setProperty("width", width);
// Update v-has-width in case undefined window is resized
- setStyleName("v-has-width", width != null && width.length() > 0);
+ setStyleName("v-has-width", width != null && !width.isEmpty());
}
@Override
@@ -1212,7 +1212,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
// Override PopupPanel which sets the height to the contents
getElement().getStyle().setProperty("height", height);
// Update v-has-height in case undefined window is resized
- setStyleName("v-has-height", height != null && height.length() > 0);
+ setStyleName("v-has-height", height != null && !height.isEmpty());
}
private void onDragEvent(Event event) {
diff --git a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index 815509c44b..c837570c85 100644
--- a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -615,7 +615,7 @@ public class LayoutDependencyTree {
}
private static String getSizeDefinition(String size) {
- if (size == null || size.length() == 0) {
+ if (size == null || size.isEmpty()) {
return "undefined";
} else if (size.endsWith("%")) {
return "relative";
diff --git a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
index 4e28fb6349..dc8d30e517 100644
--- a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
@@ -252,7 +252,7 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
childStyle.setPosition(Position.ABSOLUTE);
Style wrapperStyle = contentElement.getStyle();
- if (window.getElement().getStyle().getWidth().length() == 0
+ if (window.getElement().getStyle().getWidth().isEmpty()
&& !content.isRelativeWidth()) {
/*
* Need to lock width to make undefined width work even with
diff --git a/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java b/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java
index 8a84208ea8..1473af44ae 100644
--- a/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java
+++ b/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java
@@ -56,7 +56,7 @@ public class ApplicationConnectionURLGenerationTest {
SharedUtil.addGetParameters(URIS[i], "a=b&c=d"));
// Fragments
- if (URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i].length() > 0) {
+ if (!URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i].isEmpty()) {
assertEquals(URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i], SharedUtil
.addGetParameters(URIS[i] + "#fragment", "a=b&c=d"));