diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-18 23:16:02 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-19 14:25:46 +0300 |
commit | f6e082f5172d791a49d98a6b6b7770d3b38c8695 (patch) | |
tree | 439c6d53e57e8b24f81f341eb0fc93583a3c42bd /client | |
parent | d8baecb239b0d91f477c450d2a08a472b169a08d (diff) | |
download | vaadin-framework-f6e082f5172d791a49d98a6b6b7770d3b38c8695.tar.gz vaadin-framework-f6e082f5172d791a49d98a6b6b7770d3b38c8695.zip |
Use String.isEmpty()
Diffstat (limited to 'client')
21 files changed, 36 insertions, 36 deletions
diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index 4c2583e493..0ee4a4f708 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -416,7 +416,7 @@ public class ApplicationConfiguration implements EntryPoint { JsoConfiguration jsoConfiguration = getJsoConfiguration(id); serviceUrl = jsoConfiguration .getConfigString(ApplicationConstants.SERVICE_URL); - if (serviceUrl == null || "".equals(serviceUrl)) { + if (serviceUrl == null || serviceUrl.isEmpty()) { /* * Use the current url without query parameters and fragment as the * default value. diff --git a/client/src/main/java/com/vaadin/client/BrowserInfo.java b/client/src/main/java/com/vaadin/client/BrowserInfo.java index 1cbbb2145d..6e0b858990 100644 --- a/client/src/main/java/com/vaadin/client/BrowserInfo.java +++ b/client/src/main/java/com/vaadin/client/BrowserInfo.java @@ -197,13 +197,13 @@ public class BrowserInfo { } cssClass = prefix + browserIdentifier; - if (!"".equals(majorVersionClass)) { + if (!majorVersionClass.isEmpty()) { cssClass = cssClass + " " + prefix + majorVersionClass; } - if (!"".equals(minorVersionClass)) { + if (!minorVersionClass.isEmpty()) { cssClass = cssClass + " " + prefix + minorVersionClass; } - if (!"".equals(browserEngineClass)) { + if (!browserEngineClass.isEmpty()) { cssClass = cssClass + " " + prefix + browserEngineClass; } String osClass = getOperatingSystemClass(); diff --git a/client/src/main/java/com/vaadin/client/SuperDevMode.java b/client/src/main/java/com/vaadin/client/SuperDevMode.java index ce371c030d..e8eab082d1 100644 --- a/client/src/main/java/com/vaadin/client/SuperDevMode.java +++ b/client/src/main/java/com/vaadin/client/SuperDevMode.java @@ -184,7 +184,7 @@ public class SuperDevMode { * SuperDevMode */ protected static boolean recompileIfNeeded(String serverUrl) { - if (serverUrl == null || "".equals(serverUrl)) { + if (serverUrl == null || serverUrl.isEmpty()) { serverUrl = "http://localhost:9876/"; } else { if (serverUrl.contains(":")) { diff --git a/client/src/main/java/com/vaadin/client/VCaption.java b/client/src/main/java/com/vaadin/client/VCaption.java index 0ed0bc037c..8da36becfa 100644 --- a/client/src/main/java/com/vaadin/client/VCaption.java +++ b/client/src/main/java/com/vaadin/client/VCaption.java @@ -207,7 +207,7 @@ public class VCaption extends HTML { String c = owner.getState().caption; // A text forces the caption to be above the component. placedAfterComponent = false; - if (c == null || c.trim().equals("")) { + if (c == null || c.trim().isEmpty()) { // Not sure if c even can be null. Should not. // This is required to ensure that the caption uses space in all @@ -378,7 +378,7 @@ public class VCaption extends HTML { // Update caption text // A text forces the caption to be above the component. placedAfterComponent = false; - if (caption.trim().equals("")) { + if (caption.trim().isEmpty()) { // This is required to ensure that the caption uses space in all // browsers when it is set to the empty string. If there is an // icon, error indicator or required indicator they will ensure @@ -434,7 +434,7 @@ public class VCaption extends HTML { setMaxWidth(maxWidth); } else { String width = getElement().getStyle().getProperty("width"); - if (width != null && !width.equals("")) { + if (width != null && !width.isEmpty()) { setWidth(getRequiredWidth() + "px"); } } diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index d42ba541c6..c9e49f13c0 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -280,7 +280,7 @@ public class WidgetUtil { public static int setHeightExcludingPaddingAndBorder(Widget widget, String height, int paddingBorderGuess) { - if (height.equals("")) { + if (height.isEmpty()) { setHeight(widget, ""); return paddingBorderGuess; } else if (height.endsWith("px")) { @@ -307,7 +307,7 @@ public class WidgetUtil { public static int setWidthExcludingPaddingAndBorder(Widget widget, String width, int paddingBorderGuess) { - if (width.equals("")) { + if (width.isEmpty()) { setWidth(widget, ""); return paddingBorderGuess; } else if (width.endsWith("px")) { @@ -1477,7 +1477,7 @@ public class WidgetUtil { } s = s.trim(); - if ("".equals(s)) { + if (s.isEmpty()) { return null; } diff --git a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java index ad5a33c02e..dca4ad7b3a 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java @@ -508,7 +508,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy { if (part.equals(ROOT_ID)) { w = RootPanel.get(); - } else if (part.equals("")) { + } else if (part.isEmpty()) { if (w == null) { w = client.getUIConnector().getWidget(); } diff --git a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java index 314d167bfe..f18ecb0711 100644 --- a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java @@ -350,7 +350,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector // Loop through breakpoints and see which one applies to this width currentWidthRanges = resolveBreakpoint("width", width); - if (!"".equals(currentWidthRanges)) { + if (!currentWidthRanges.isEmpty()) { element.setAttribute("width-range", currentWidthRanges); } else { element.removeAttribute("width-range"); @@ -359,7 +359,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector // Loop through breakpoints and see which one applies to this height currentHeightRanges = resolveBreakpoint("height", height); - if (!"".equals(currentHeightRanges)) { + if (!currentHeightRanges.isEmpty()) { element.setAttribute("height-range", currentHeightRanges); } else { element.removeAttribute("height-range"); diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java index 8623bc1d76..7ce3e5c9b7 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java @@ -771,10 +771,10 @@ public abstract class AbstractComponentConnector extends AbstractConnector public boolean hasTooltip() { // Normally, there is a tooltip if description or errorMessage is set AbstractComponentState state = getState(); - if (state.description != null && !state.description.equals("")) { + if (state.description != null && !state.description.isEmpty()) { return true; } - return state.errorMessage != null && !state.errorMessage.equals(""); + return state.errorMessage != null && !state.errorMessage.isEmpty(); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java index 9e457fa150..33624b8703 100644 --- a/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/MediaBaseConnector.java @@ -78,7 +78,7 @@ public abstract class MediaBaseConnector extends AbstractComponentConnector { private void setAltText(String altText) { - if (altText == null || "".equals(altText)) { + if (altText == null || altText.isEmpty()) { altText = getDefaultAltHtml(); } else if (!getState().htmlContentAllowed) { altText = WidgetUtil.escapeHTML(altText); diff --git a/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java b/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java index 3ccdcdbee9..935706babd 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java @@ -429,7 +429,7 @@ public class VAbsoluteLayout extends ComplexPanel { if (css == null || !css.equals(position)) { css = position; top = right = bottom = left = zIndex = null; - if (!css.equals("")) { + if (!css.isEmpty()) { String[] properties = css.split(";"); for (int i = 0; i < properties.length; i++) { String[] keyValue = properties[i].split(":"); diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java index fd50c92aed..c9c6df01f4 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java @@ -207,7 +207,7 @@ public abstract class VAbstractTextualDate<R extends Enum<R>> @Override @SuppressWarnings("deprecation") public void onChange(ChangeEvent event) { - if (!text.getText().equals("")) { + if (!text.getText().isEmpty()) { try { String enteredDate = text.getText(); 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 784f2b116d..93ac755ee1 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java @@ -1141,7 +1141,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, // stays selected if (!"".equals(enteredItemValue) || selectedOptionKey != null - && !"".equals(selectedOptionKey)) { + && !selectedOptionKey.isEmpty()) { doItemAction(potentialExactMatch, true); } suggestionPopup.hide(); @@ -1165,7 +1165,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, } else { // currentSuggestion has key="" for nullselection if (currentSuggestion != null - && !currentSuggestion.key.equals("")) { + && !currentSuggestion.key.isEmpty()) { // An item (not null) selected String text = currentSuggestion.getReplacementString(); setText(text); @@ -1867,7 +1867,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, // when filtering, let the server decide the page unless we've // set the filter to empty and explicitly said that we want to see // the results starting from page 0. - if ("".equals(filter) && page != 0) { + if (filter.isEmpty() && page != 0) { // let server decide page = -1; } else { @@ -1964,7 +1964,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, + suggestion.key + ")"); } // special handling of null selection - if (suggestion.key.equals("")) { + if (suggestion.key.isEmpty()) { onNullSelected(); return; } @@ -2074,7 +2074,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, */ private void performSelection(String selectedKey, boolean forceUpdateText, boolean updatePromptAndSelectionIfMatchFound) { - if (selectedKey == null || "".equals(selectedKey)) { + if (selectedKey == null || selectedKey.isEmpty()) { currentSuggestion = null; // #13217 selectedOptionKey = null; setText(getEmptySelectionCaption()); @@ -2357,7 +2357,7 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, setText(text == null ? getEmptySelectionCaption() : text); setSelectedItemIcon(connector.getState().selectedItemIcon); selectedOptionKey = (connector.getState().selectedItemKey); - if (selectedOptionKey == null || "".equals(selectedOptionKey)) { + if (selectedOptionKey == null || selectedOptionKey.isEmpty()) { currentSuggestion = null; // #13217 selectedOptionKey = null; updatePlaceholder(); diff --git a/client/src/main/java/com/vaadin/client/ui/VLabel.java b/client/src/main/java/com/vaadin/client/ui/VLabel.java index f3d64108b4..3e596a21ab 100644 --- a/client/src/main/java/com/vaadin/client/ui/VLabel.java +++ b/client/src/main/java/com/vaadin/client/ui/VLabel.java @@ -50,7 +50,7 @@ public class VLabel extends HTML { @Override public void setWidth(String width) { super.setWidth(width); - if (width == null || width.equals("")) { + if (width == null || width.isEmpty()) { setStyleName(getElement(), CLASSNAME_UNDEFINED_WIDTH, true); } else { setStyleName(getElement(), CLASSNAME_UNDEFINED_WIDTH, false); diff --git a/client/src/main/java/com/vaadin/client/ui/VOverlay.java b/client/src/main/java/com/vaadin/client/ui/VOverlay.java index 5681df286f..4d0c8d2914 100644 --- a/client/src/main/java/com/vaadin/client/ui/VOverlay.java +++ b/client/src/main/java/com/vaadin/client/ui/VOverlay.java @@ -136,7 +136,7 @@ public class VOverlay extends Overlay { container.setId(id); String styles = ac.getUIConnector().getWidget().getParent() .getStyleName(); - if (styles != null && !styles.equals("")) { + if (styles != null && !styles.isEmpty()) { container.addClassName(styles); } container.addClassName(CLASSNAME_CONTAINER); diff --git a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java index 75bec94dca..b0f9a6a510 100644 --- a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java +++ b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java @@ -234,14 +234,14 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler, @Override public void setHeight(String height) { super.setHeight(height); - if (height == null || height.equals("")) { + if (height == null || height.isEmpty()) { rta.setHeight(""); } } @Override public void setWidth(String width) { - if (width.equals("")) { + if (width.isEmpty()) { /* * IE cannot calculate the width of the 100% iframe correctly if * there is no width specified for the parent. In this case we would 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 a6d4875ec1..d25508d29a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -59,7 +59,7 @@ public class VUpload extends SimplePanel { super.onBrowserEvent(event); if (event.getTypeInt() == Event.ONCHANGE) { if (isImmediateMode() && fu.getFilename() != null - && !"".equals(fu.getFilename())) { + && !fu.getFilename().isEmpty()) { submit(); } } else if (BrowserInfo.get().isIE() diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java index e027775793..da08413926 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java @@ -50,7 +50,7 @@ public abstract class AbstractColorPickerConnector refreshColor(); if (getState().showDefaultCaption && (getState().caption == null - || "".equals(getState().caption))) { + || getState().caption.isEmpty())) { setCaption(getState().color); } @@ -79,7 +79,7 @@ public abstract class AbstractColorPickerConnector */ protected String getCaption() { if (getState().showDefaultCaption && (getState().caption == null - || "".equals(getState().caption))) { + || getState().caption.isEmpty())) { return getState().color; } return getState().caption; diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index 9d37afc8a5..2b3db9aa65 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -210,7 +210,7 @@ public class ComboBoxConnector extends AbstractListingConnector page = 0; } } - int adjustment = getWidget().nullSelectionAllowed && "".equals(filter) + int adjustment = getWidget().nullSelectionAllowed && filter.isEmpty() ? 1 : 0; int startIndex = Math.max(0, page * getWidget().pageLength - adjustment); diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java index 8755bea650..d8e0544aaf 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java @@ -538,7 +538,7 @@ public class Slot extends SimplePanel { this.captionText.addClassName("v-captiontext"); caption.appendChild(this.captionText); } - if (captionText.trim().equals("")) { + if (captionText.trim().isEmpty()) { this.captionText.setInnerHTML(" "); } else { if (captionAsHtml) { diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 1148ab90ad..d226e0b5dc 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -715,7 +715,7 @@ public class VAbstractOrderedLayout extends FlowPanel { @Override public void setHeight(String height) { super.setHeight(height); - definedHeight = (height != null && !"".equals(height)); + definedHeight = height != null && !height.isEmpty(); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java index 5e22b9ef32..84ed73e537 100644 --- a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java @@ -96,7 +96,7 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector .setClassName(VPanel.CLASSNAME + "-deco"); getWidget().captionNode.setClassName(VPanel.CLASSNAME + "-caption"); boolean hasCaption = false; - if (getState().caption != null && !"".equals(getState().caption)) { + if (getState().caption != null && !getState().caption.isEmpty()) { getWidget().setCaption(getState().caption); hasCaption = true; } else { |