From 0f4702c6d1e03e2522c556487aba74ea01f25837 Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Fri, 20 Oct 2017 09:00:01 +0200 Subject: Add spaces after 'if' and 'for' in JavaScript (#10199) * Add spaces after 'if' and 'for' in JavaScript * Revert to old format * Remove whitespaces --- .../main/java/com/vaadin/client/AnimationUtil.java | 36 +++++----- .../vaadin/client/ApplicationConfiguration.java | 6 +- .../com/vaadin/client/ApplicationConnection.java | 4 +- .../main/java/com/vaadin/client/BrowserInfo.java | 2 +- .../src/main/java/com/vaadin/client/CSSRule.java | 76 +++++++++++----------- .../java/com/vaadin/client/ComponentDetailMap.java | 10 +-- .../main/java/com/vaadin/client/ComputedStyle.java | 16 ++--- .../main/java/com/vaadin/client/FastStringMap.java | 4 +- .../main/java/com/vaadin/client/FastStringSet.java | 12 ++-- .../vaadin/client/JavaScriptConnectorHelper.java | 4 +- .../java/com/vaadin/client/ResourceLoader.java | 2 +- client/src/main/java/com/vaadin/client/UIDL.java | 12 ++-- .../src/main/java/com/vaadin/client/ValueMap.java | 4 +- .../main/java/com/vaadin/client/WidgetUtil.java | 8 +-- .../connectors/JavaScriptRendererConnector.java | 2 +- .../client/extensions/ResponsiveConnector.java | 36 +++++----- .../JavaScriptManagerConnector.java | 6 +- .../com/vaadin/client/metadata/TypeDataStore.java | 4 +- .../vaadin/client/ui/ShortcutActionHandler.java | 4 +- .../main/java/com/vaadin/client/ui/VButton.java | 12 ++-- .../main/java/com/vaadin/client/ui/VComboBox.java | 4 +- .../java/com/vaadin/client/ui/VCustomLayout.java | 4 +- .../main/java/com/vaadin/client/ui/VMenuBar.java | 6 +- .../main/java/com/vaadin/client/ui/VPopupView.java | 2 +- client/src/main/java/com/vaadin/client/ui/VUI.java | 3 +- .../com/vaadin/client/ui/dd/VHtml5DragEvent.java | 4 +- .../java/com/vaadin/client/widgets/Escalator.java | 4 +- .../java/com/vaadin/client/widgets/Overlay.java | 4 +- 28 files changed, 142 insertions(+), 149 deletions(-) (limited to 'client/src') diff --git a/client/src/main/java/com/vaadin/client/AnimationUtil.java b/client/src/main/java/com/vaadin/client/AnimationUtil.java index d6807f6803..9b01b2c93d 100644 --- a/client/src/main/java/com/vaadin/client/AnimationUtil.java +++ b/client/src/main/java/com/vaadin/client/AnimationUtil.java @@ -70,7 +70,7 @@ public class AnimationUtil { elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); // Store function reference for later removal - if(!elem._vaadin_animationend_callbacks) { + if (!elem._vaadin_animationend_callbacks) { elem._vaadin_animationend_callbacks = []; } elem._vaadin_animationend_callbacks.push(callbackFunc); @@ -98,9 +98,9 @@ public class AnimationUtil { public static native boolean removeAnimationEndListener(Element elem, AnimationEndListener animationEndListener) /*-{ - if(elem._vaadin_animationend_callbacks) { + if (elem._vaadin_animationend_callbacks) { var callbacks = elem._vaadin_animationend_callbacks; - for(var i=0; i < callbacks.length; i++) { + for (var i=0; i < callbacks.length; i++) { if (callbacks[i].listener == animationEndListener) { elem.removeEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbacks[i], false); return true; @@ -113,9 +113,9 @@ public class AnimationUtil { /** For internal use only. May be removed or replaced in the future. */ public static native void removeAllAnimationEndListeners(Element elem) /*-{ - if(elem._vaadin_animationend_callbacks) { + if (elem._vaadin_animationend_callbacks) { var callbacks = elem._vaadin_animationend_callbacks; - for(var i=0; i < callbacks.length; i++) { + for (var i=0; i < callbacks.length; i++) { elem.removeEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbacks[i], false); } } @@ -129,13 +129,13 @@ public class AnimationUtil { /** For internal use only. May be removed or replaced in the future. */ public static native String getAnimationName(NativeEvent event) /*-{ - if(event.webkitAnimationName) + if (event.webkitAnimationName) return event.webkitAnimationName; - else if(event.animationName) + if (event.animationName) return event.animationName; - else if(event.mozAnimationName) + if (event.mozAnimationName) return event.mozAnimationName; - else if(event.oAnimationName) + if (event.oAnimationName) return event.oAnimationName; return ""; @@ -146,19 +146,19 @@ public class AnimationUtil { /*-{ var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; - if(!cs.getPropertyValue) + if (!cs.getPropertyValue) return ""; - if(cs.getPropertyValue("-webkit-animation-name")) + if (cs.getPropertyValue("-webkit-animation-name")) return cs.getPropertyValue("-webkit-animation-name"); - else if(cs.getPropertyValue("animation-name")) + if (cs.getPropertyValue("animation-name")) return cs.getPropertyValue("animation-name"); - else if(cs.getPropertyValue("-moz-animation-name")) + if (cs.getPropertyValue("-moz-animation-name")) return cs.getPropertyValue("-moz-animation-name"); - else if(cs.getPropertyValue("-o-animation-name")) + if (cs.getPropertyValue("-o-animation-name")) return cs.getPropertyValue("-o-animation-name"); return ""; @@ -176,8 +176,8 @@ public class AnimationUtil { 'WebkitAnimation': 'webkitAnimationEnd' } - for(var a in anims){ - if( el.style[a] !== undefined ){ + for (var a in anims) { + if ( el.style[a] !== undefined ) { return anims[a]; } } @@ -195,8 +195,8 @@ public class AnimationUtil { 'webkitAnimation' ] - for(var i=0; i < anims.length; i++) { - if( el.style[anims[i]] !== undefined ){ + for (var i=0; i < anims.length; i++) { + if ( el.style[anims[i]] !== undefined ) { return anims[i]; } } diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index 262f23f0fd..9c3bc4d2ff 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -874,11 +874,7 @@ public class ApplicationConfiguration implements EntryPoint { private static native boolean isDebugAvailable() /*-{ - if($wnd.vaadin.debug) { - return true; - } else { - return false; - } + return $wnd.vaadin.debug; }-*/; /** diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java index 79432fb0a2..855f878278 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java @@ -548,9 +548,9 @@ public class ApplicationConnection implements HasHandlers { * attaching js functions responsibility to create the variable like this: * *
-     * if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();}
+     * if (!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();}
      * postRequestHooks.myHook = function(appId) {
-     *          if(appId == "MyAppOfInterest") {
+     *          if (appId == "MyAppOfInterest") {
      *                  // do the staff you need on xhr activity
      *          }
      * }
diff --git a/client/src/main/java/com/vaadin/client/BrowserInfo.java b/client/src/main/java/com/vaadin/client/BrowserInfo.java
index e16b0b4ba0..60be48a7c4 100644
--- a/client/src/main/java/com/vaadin/client/BrowserInfo.java
+++ b/client/src/main/java/com/vaadin/client/BrowserInfo.java
@@ -97,7 +97,7 @@ public class BrowserInfo {
 
     private native boolean detectTouchDevice()
     /*-{
-        try { document.createEvent("TouchEvent");return true;} catch(e){return false;};
+        try { document.createEvent("TouchEvent");return true;} catch(e) {return false;};
     }-*/;
 
     private native boolean detectChromeTouchDevice()
diff --git a/client/src/main/java/com/vaadin/client/CSSRule.java b/client/src/main/java/com/vaadin/client/CSSRule.java
index 3651abf0a7..b351d9c36b 100644
--- a/client/src/main/java/com/vaadin/client/CSSRule.java
+++ b/client/src/main/java/com/vaadin/client/CSSRule.java
@@ -42,13 +42,13 @@ public class CSSRule {
     private native void fetchRule(final String selector, final boolean deep)
     /*-{
     var sheets = $doc.styleSheets;
-    for(var i = 0; i < sheets.length; i++) {
-    var sheet = sheets[i];
-    if(sheet.href && sheet.href.indexOf("VAADIN/themes")>-1) {
-    // $entry not needed as function is not exported
-    this.@com.vaadin.client.CSSRule::rules = @com.vaadin.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet, selector, deep);
-    return;
-    }
+    for (var i = 0; i < sheets.length; i++) {
+        var sheet = sheets[i];
+        if (sheet.href && sheet.href.indexOf("VAADIN/themes")>-1) {
+            // $entry not needed as function is not exported
+            this.@com.vaadin.client.CSSRule::rules = @com.vaadin.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet, selector, deep);
+            return;
+        }
     }
     this.@com.vaadin.client.CSSRule::rules = [];
     }-*/;
@@ -61,7 +61,7 @@ public class CSSRule {
             final JavaScriptObject sheet, final String selector,
             final boolean deep)
     /*-{
-    if(!$doc.styleSheets)
+    if (!$doc.styleSheets)
     return null;
     
     selector = selector.toLowerCase();
@@ -69,38 +69,38 @@ public class CSSRule {
     var allMatches = [];
     
     // IE handles imported sheet differently
-    if(deep && sheet.imports && sheet.imports.length > 0) {
-    for(var i=0; i < sheet.imports.length; i++) {
-    // $entry not needed as function is not exported
-    var imports = @com.vaadin.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet.imports[i], selector, deep);
-    allMatches.concat(imports);
-    }
+    if (deep && sheet.imports && sheet.imports.length > 0) {
+        for (var i=0; i < sheet.imports.length; i++) {
+            // $entry not needed as function is not exported
+            var imports = @com.vaadin.client.CSSRule::searchForRule(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;Z)(sheet.imports[i], selector, deep);
+            allMatches.concat(imports);
+        }
     }
     
     var theRules = new Array();
     if (sheet.cssRules)
-    theRules = sheet.cssRules
+        theRules = sheet.cssRules
     else if (sheet.rules)
-    theRules = sheet.rules
+        theRules = sheet.rules
     
     var j = theRules.length;
-    for(var i=0; i list)
     /*-{
-        for(var key in this) {
+        for (var key in this) {
             // $entry not needed as function is not exported
             list.@java.util.Collection::add(Ljava/lang/Object;)(this[key]);
         }
@@ -89,7 +89,7 @@ final class ComponentDetailMap extends JavaScriptObject {
     public native JsArrayObject valuesAsJsArray()
     /*-{
         var result = [];
-        for(var key in this) {
+        for (var key in this) {
             if (this.hasOwnProperty(key)) {
                 result.push(this[key]);
             }
diff --git a/client/src/main/java/com/vaadin/client/ComputedStyle.java b/client/src/main/java/com/vaadin/client/ComputedStyle.java
index e9108f2ee6..7d2b3fb732 100644
--- a/client/src/main/java/com/vaadin/client/ComputedStyle.java
+++ b/client/src/main/java/com/vaadin/client/ComputedStyle.java
@@ -41,15 +41,15 @@ public class ComputedStyle {
 
     private static native JavaScriptObject getComputedStyle(Element elem)
     /*-{
-      if(elem.nodeType != 1) {
+      if (elem.nodeType != 1) {
           return {};
       }
 
-      if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) {
+      if ($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) {
           return $wnd.document.defaultView.getComputedStyle(elem, null);
       }
 
-      if(elem.currentStyle) {
+      if (elem.currentStyle) {
           return elem.currentStyle;
       }
     }-*/;
@@ -70,17 +70,17 @@ public class ComputedStyle {
         // Border values need to be checked separately. The width might have a
         // meaningful value even if the border style is "none". In that case the
         // value should be 0.
-        if(name.indexOf("border") > -1 && name.indexOf("Width") > -1) {
+        if (name.indexOf("border") > -1 && name.indexOf("Width") > -1) {
             var borderStyleProp = name.substring(0,name.length-5) + "Style";
-            if(cs.getPropertyValue)
+            if (cs.getPropertyValue)
                 var borderStyle = cs.getPropertyValue(borderStyleProp);
             else // IE
                 var borderStyle = cs[borderStyleProp];
-            if(borderStyle == "none")
+            if (borderStyle == "none")
                 return "0px";
         }
 
-        if(cs.getPropertyValue) {
+        if (cs.getPropertyValue) {
 
             // Convert name to dashed format
             name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -114,7 +114,7 @@ public class ComputedStyle {
 
         // Normalize margin values. This is not totally valid, but in most cases
         // it is what the user wants to know.
-        if(name.indexOf("margin") > -1 && ret == "auto") {
+        if (name.indexOf("margin") > -1 && ret == "auto") {
             return "0px";
         }
 
diff --git a/client/src/main/java/com/vaadin/client/FastStringMap.java b/client/src/main/java/com/vaadin/client/FastStringMap.java
index c7e0f82357..a858585dd9 100644
--- a/client/src/main/java/com/vaadin/client/FastStringMap.java
+++ b/client/src/main/java/com/vaadin/client/FastStringMap.java
@@ -49,7 +49,7 @@ public final class FastStringMap extends JavaScriptObject {
     public native JsArrayString getKeys()
     /*-{
         var keys = [];
-        for(var key in this) {
+        for (var key in this) {
             if (Object.hasOwnProperty.call(this, key)) {
                 keys.push(key);
             }
@@ -60,7 +60,7 @@ public final class FastStringMap extends JavaScriptObject {
     public native int size()
     /*-{
         var size = 0;
-        for(var key in this) {
+        for (var key in this) {
             if (Object.hasOwnProperty.call(this, key)) {
                 size++;
             }
diff --git a/client/src/main/java/com/vaadin/client/FastStringSet.java b/client/src/main/java/com/vaadin/client/FastStringSet.java
index 87d45094e9..db3f6075dc 100644
--- a/client/src/main/java/com/vaadin/client/FastStringSet.java
+++ b/client/src/main/java/com/vaadin/client/FastStringSet.java
@@ -37,14 +37,14 @@ public final class FastStringSet extends JavaScriptObject {
 
     public native void addAll(JsArrayString array)
     /*-{
-        for(var i = 0; i < array.length; i++) {
+        for (var i = 0; i < array.length; i++) {
             this[array[i]] = true;
         }
     }-*/;
 
     public native void addAll(FastStringSet set)
     /*-{
-        for(var string in set) {
+        for (var string in set) {
             if (Object.hasOwnProperty.call(set, string)) {
                 this[string] = true;
             }
@@ -54,7 +54,7 @@ public final class FastStringSet extends JavaScriptObject {
     public native JsArrayString dump()
     /*-{
         var array = [];
-        for(var string in this) {
+        for (var string in this) {
             if (this.hasOwnProperty(string)) {
                 array.push(string);
             }
@@ -69,7 +69,7 @@ public final class FastStringSet extends JavaScriptObject {
 
     public native boolean isEmpty()
     /*-{
-        for(var string in this) {
+        for (var string in this) {
             if (this.hasOwnProperty(string)) {
                 return false;
             }
@@ -83,7 +83,7 @@ public final class FastStringSet extends JavaScriptObject {
 
     public native void addAllTo(Collection target)
     /*-{
-        for(var string in this) {
+        for (var string in this) {
             if (Object.hasOwnProperty.call(this, string)) {
                 target.@java.util.Collection::add(Ljava/lang/Object;)(string);
             }
@@ -92,7 +92,7 @@ public final class FastStringSet extends JavaScriptObject {
 
     public native void removeAll(FastStringSet valuesToRemove)
     /*-{
-        for(var string in valuesToRemove) {
+        for (var string in valuesToRemove) {
             if (Object.hasOwnProperty.call(valuesToRemove, string)) {
                 delete this[string];
             }
diff --git a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
index 842526f65a..0fb88389d6 100644
--- a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
+++ b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java
@@ -396,7 +396,7 @@ public class JavaScriptConnectorHelper {
             JavaScriptObject input)
     /*-{
         // Copy all fields to existing state object
-        for(var key in input) {
+        for (var key in input) {
             if (input.hasOwnProperty(key)) {
                 state[key] = input[key];
             }
@@ -438,7 +438,7 @@ public class JavaScriptConnectorHelper {
         if (!targets) {
             return;
         }
-        for(var i = 0; i < targets.length; i++) {
+        for (var i = 0; i < targets.length; i++) {
             var target = targets[i];
             target[methodName].apply(target, parameters);
         }
diff --git a/client/src/main/java/com/vaadin/client/ResourceLoader.java b/client/src/main/java/com/vaadin/client/ResourceLoader.java
index 62c41b6067..95212920a5 100644
--- a/client/src/main/java/com/vaadin/client/ResourceLoader.java
+++ b/client/src/main/java/com/vaadin/client/ResourceLoader.java
@@ -397,7 +397,7 @@ public class ResourceLoader {
 
     private static native int getStyleSheetLength(String url)
     /*-{
-        for(var i = 0; i < $doc.styleSheets.length; i++) {
+        for (var i = 0; i < $doc.styleSheets.length; i++) {
             if ($doc.styleSheets[i].href === url) {
                 var sheet = $doc.styleSheets[i];
                 try {
diff --git a/client/src/main/java/com/vaadin/client/UIDL.java b/client/src/main/java/com/vaadin/client/UIDL.java
index 2c66568d65..70f49fd99a 100644
--- a/client/src/main/java/com/vaadin/client/UIDL.java
+++ b/client/src/main/java/com/vaadin/client/UIDL.java
@@ -362,13 +362,13 @@ public final class UIDL extends JavaScriptObject implements Iterable {
     private native int typeOfChild(int index)
     /*-{
         var t = typeof this[index + 2];
-        if(t == "object") {
-            if(typeof(t.length) == "number") {
+        if (t == "object") {
+            if (typeof(t.length) == "number") {
                 return 1;
-            } else {
-                return 2;
             }
-        } else if (t == "string") {
+            return 2;
+        }
+        if (t == "string") {
             return 0;
         }
         return -1;
@@ -509,7 +509,7 @@ public final class UIDL extends JavaScriptObject implements Iterable {
         /*-{
             var buf = new Array();
             var self = this;
-            for(j in self) {
+            for (j in self) {
                 buf.push("<");
                 buf.push(j);
                 buf.push(">");
diff --git a/client/src/main/java/com/vaadin/client/ValueMap.java b/client/src/main/java/com/vaadin/client/ValueMap.java
index 33943173b0..63cbed4aeb 100644
--- a/client/src/main/java/com/vaadin/client/ValueMap.java
+++ b/client/src/main/java/com/vaadin/client/ValueMap.java
@@ -50,9 +50,9 @@ public final class ValueMap extends JavaScriptObject {
     /*-{
         var a = new Array();
         var attr = this;
-        for(var j in attr) {
+        for (var j in attr) {
             // workaround for the infamous chrome hosted mode hack (__gwt_ObjectId)
-            if(attr.hasOwnProperty(j))
+            if (attr.hasOwnProperty(j))
                 a.push(j);
         }
         return a;
diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java
index 7f552950f2..56f8a1273b 100644
--- a/client/src/main/java/com/vaadin/client/WidgetUtil.java
+++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java
@@ -60,7 +60,7 @@ public class WidgetUtil {
      */
     public static native void browserDebugger()
     /*-{
-        if($wnd.console)
+        if ($wnd.console)
             debugger;
     }-*/;
 
@@ -112,7 +112,7 @@ public class WidgetUtil {
     public static native Element getElementFromPoint(int clientX, int clientY)
     /*-{
         var el = $wnd.document.elementFromPoint(clientX, clientY);
-        if(el != null && el.nodeType == 3) {
+        if (el != null && el.nodeType == 3) {
             el = el.parentNode;
         }
         return el;
@@ -680,7 +680,7 @@ public class WidgetUtil {
     /*-{
          var cs = element.ownerDocument.defaultView.getComputedStyle(element);
          var heightPx = cs.height;
-         if(heightPx == 'auto'){
+         if (heightPx == 'auto') {
              // Fallback for inline elements
              return @com.vaadin.client.WidgetUtil::getRequiredHeightBoundingClientRectDouble(Lcom/google/gwt/dom/client/Element;)(element);
          }
@@ -700,7 +700,7 @@ public class WidgetUtil {
     /*-{
          var cs = element.ownerDocument.defaultView.getComputedStyle(element);
          var widthPx = cs.width;
-         if(widthPx == 'auto'){
+         if (widthPx == 'auto') {
              // Fallback for inline elements
              return @com.vaadin.client.WidgetUtil::getRequiredWidthBoundingClientRectDouble(Lcom/google/gwt/dom/client/Element;)(element);
          }
diff --git a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
index dd14d98916..77450a08fb 100644
--- a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
@@ -248,7 +248,7 @@ public class JavaScriptRendererConnector
             /*-{
                 var rawEvents = wrapper.getConsumedEvents();
                 var events = [];
-                for(var i = 0; i < rawEvents.length; i++) {
+                for (var i = 0; i < rawEvents.length; i++) {
                   events[i] = ""+rawEvents[i];
                 }
                 return events;
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 3af049c635..9d22396e4d 100644
--- a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java
+++ b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java
@@ -174,13 +174,13 @@ public class ResponsiveConnector extends AbstractExtensionConnector
         var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache;
     
         // Can't do squat if we can't parse stylesheets
-        if(!$doc.styleSheets)
+        if (!$doc.styleSheets)
             return;
     
         var sheets = $doc.styleSheets;
     
         // Loop all stylesheets on the page and process them individually
-        for(var i = 0, len = sheets.length; i < len; i++) {
+        for (var i = 0, len = sheets.length; i < len; i++) {
             var sheet = sheets[i];
             @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(sheet);
         }
@@ -220,21 +220,21 @@ public class ResponsiveConnector extends AbstractExtensionConnector
         }
     
         // Loop through the rulesets
-        for(var i = 0, len = theRules.length; i < len; i++) {
+        for (var i = 0, len = theRules.length; i < len; i++) {
             var rule = theRules[i];
     
-            if(rule.type == 3) {
+            if (rule.type == 3) {
                 // @import rule, traverse recursively
                 @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(rule.styleSheet);
     
-            } else if(rule.type == 1 || !rule.type) {
+            } else if (rule.type == 1 || !rule.type) {
                 // Regular selector rule
     
                 // Helper function
                 var pushToCache = function(ranges, selector, min, max) {
                     // Avoid adding duplicates
                     var duplicate = false;
-                    for(var l = 0, len3 = ranges.length; l < len3; l++) {
+                    for (var l = 0, len3 = ranges.length; l < len3; l++) {
                         var bp = ranges[l];
                         if (selector == bp[0] && min == bp[1] && max == bp[2]) {
                             duplicate = true;
@@ -253,7 +253,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector
                 var selectorRegEx = IEOrEdge ? /\[.*\]([\.|#]\S+)/ : /([\.|#]\S+?)\[.*\]/;
     
                 // Loop all the selectors in this ruleset
-                for(var k = 0, len2 = haystack.length; k < len2; k++) {
+                for (var k = 0, len2 = haystack.length; k < len2; k++) {
     
                     // Split the haystack into parts.
                     var widthRange = haystack[k].match(/\[width-range.*?\]/);
@@ -303,18 +303,18 @@ public class ResponsiveConnector extends AbstractExtensionConnector
         var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache;
         var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache;
     
-        for(var i = 0, len = widthRanges.length; i < len; i++) {
+        for (var i = 0, len = widthRanges.length; i < len; i++) {
             var bp = widthRanges[i];
-            for(var j = 0, len2 = selectors.length; j < len2; j++) {
-                if(bp[0] == selectors[j])
+            for (var j = 0, len2 = selectors.length; j < len2; j++) {
+                if (bp[0] == selectors[j])
                     widthBreakpoints.push(bp);
             }
         }
     
-        for(var i = 0, len = heightRanges.length; i < len; i++) {
+        for (var i = 0, len = heightRanges.length; i < len; i++) {
             var bp = heightRanges[i];
-            for(var j = 0, len2 = selectors.length; j < len2; j++) {
-                if(bp[0] == selectors[j])
+            for (var j = 0, len2 = selectors.length; j < len2; j++) {
+                if (bp[0] == selectors[j])
                     heightBreakpoints.push(bp);
             }
         }
@@ -381,25 +381,25 @@ public class ResponsiveConnector extends AbstractExtensionConnector
         var breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints;
     
         // Use height breakpoints if we're measuring the height
-        if(which == "height")
+        if (which == "height")
             breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints;
     
         // Output string that goes into either the "width-range" or "height-range" attribute in the element
         var ranges = "";
     
         // Loop the breakpoints
-        for(var i = 0, len = breakpoints.length; i < len; i++) {
+        for (var i = 0, len = breakpoints.length; i < len; i++) {
             var bp = breakpoints[i];
     
             var min = parseInt(bp[1]);
             var max = parseInt(bp[2]);
     
-            if(!isNaN(min) && !isNaN(max)) {
-                if(min <= size && size <= max) {
+            if (!isNaN(min) && !isNaN(max)) {
+                if (min <= size && size <= max) {
                     ranges += " " + bp[1] + "-" + bp[2];
                 }
             } else if (!isNaN(min)) {
-                if(min <= size) {
+                if (min <= size) {
                     ranges += " " + bp[1] + "-";
                 }
             } else if (!isNaN(max)) {
diff --git a/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
index dc3933b2ff..b84169b681 100644
--- a/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
+++ b/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
@@ -72,7 +72,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector {
         var target = $wnd;
         var parts = name.split('.');
     
-        for(var i = 0; i < parts.length - 1; i++) {
+        for (var i = 0; i < parts.length - 1; i++) {
             var part = parts[i];
             if (target[part] === undefined) {
                 target[part] = {};
@@ -95,7 +95,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector {
         var target = $wnd;
         var parts = name.split('.');
     
-        for(var i = 0; i < parts.length - 1; i++) {
+        for (var i = 0; i < parts.length - 1; i++) {
             var part = parts[i];
             if (target[part] === undefined) {
                 $wnd.console.log(part,'not defined in',target);
@@ -111,7 +111,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector {
 
     private static native void eval(String script)
     /*-{
-        if(script) {
+        if (script) {
             (new $wnd.Function(script)).apply($wnd);
         }
     }-*/;
diff --git a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java
index a85ed4516e..df31d5c53b 100644
--- a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java
+++ b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java
@@ -348,7 +348,7 @@ public class TypeDataStore {
             String baseClassName, String superClassName)
     /*-{
         var parentType = typeData[superClassName];
-        if (parentType !== undefined ){
+        if (parentType !== undefined ) {
             var ctor = function () {};
             ctor.prototype = parentType;
             typeData[baseClassName] = new ctor;
@@ -406,7 +406,7 @@ public class TypeDataStore {
             JavaScriptObject typeData, String beanName)
     /*-{
         var names = [];
-        for(var name in typeData[beanName]) {
+        for (var name in typeData[beanName]) {
             names.push(name);
         }
         return names;
diff --git a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java
index dbde2df222..01a0146280 100644
--- a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java
+++ b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java
@@ -150,14 +150,14 @@ public class ShortcutActionHandler {
 
     private static native void blur(Element e)
     /*-{
-        if(e.blur) {
+        if (e.blur) {
             e.blur();
        }
     }-*/;
 
     private static native void focus(Element e)
     /*-{
-        if(e.blur) {
+        if (e.blur) {
             e.focus();
        }
     }-*/;
diff --git a/client/src/main/java/com/vaadin/client/ui/VButton.java b/client/src/main/java/com/vaadin/client/ui/VButton.java
index 725931008e..da9ed91a18 100644
--- a/client/src/main/java/com/vaadin/client/ui/VButton.java
+++ b/client/src/main/java/com/vaadin/client/ui/VButton.java
@@ -32,8 +32,8 @@ import com.vaadin.client.Util;
 import com.vaadin.client.WidgetUtil;
 import com.vaadin.client.WidgetUtil.ErrorUtil;
 
-public class VButton extends FocusWidget implements ClickHandler,
-        HasErrorIndicatorElement {
+public class VButton extends FocusWidget
+        implements ClickHandler, HasErrorIndicatorElement {
 
     public static final String CLASSNAME = "v-button";
     private static final String CLASSNAME_PRESSED = "v-pressed";
@@ -458,15 +458,15 @@ public class VButton extends FocusWidget implements ClickHandler,
          var ret = 0;
 
         var sides = ["Right","Left"];
-        for(var i=0; i<2; i++) {
+        for (var i=0; i<2; i++) {
             var side = sides[i];
             var value;
             // Border -------------------------------------------------------
-            if(elem.currentStyle["border"+side+"Style"] != "none") {
+            if (elem.currentStyle["border"+side+"Style"] != "none") {
                 value = elem.currentStyle["border"+side+"Width"];
                 if ( !/^\d+(px)?$/i.test( value ) && /^\d/.test( value ) ) {
                     ret += convertToPixel(elem, value);
-                } else if(value.length > 2) {
+                } else if (value.length > 2) {
                     ret += parseInt(value.substr(0, value.length-2));
                 }
             }
@@ -475,7 +475,7 @@ public class VButton extends FocusWidget implements ClickHandler,
             value = elem.currentStyle["padding"+side];
             if ( !/^\d+(px)?$/i.test( value ) && /^\d/.test( value ) ) {
                 ret += convertToPixel(elem, value);
-            } else if(value.length > 2) {
+            } else if (value.length > 2) {
                 ret += parseInt(value.substr(0, value.length-2));
             }
         }
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 5d98fd25d6..b28c5cb518 100644
--- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java
+++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java
@@ -2446,12 +2446,12 @@ public class VComboBox extends Composite implements Field, KeyDownHandler,
      */
     public native int minWidth(String captions)
     /*-{
-        if(!captions || captions.length <= 0)
+        if (!captions || captions.length <= 0)
                 return 0;
         captions = captions.split("|");
         var d = $wnd.document.createElement("div");
         var html = "";
-        for(var i=0; i < captions.length; i++) {
+        for (var i=0; i < captions.length; i++) {
                 html += "
" + captions[i] + "
"; // TODO apply same CSS classname as in suggestionmenu } diff --git a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java index 5f681db01a..a3e7217685 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -196,7 +196,7 @@ public class VCustomLayout extends ComplexPanel { private native boolean uriEndsWithSlash() /*-{ var path = $wnd.location.pathname; - if(path.charAt(path.length - 1) == "/") + if (path.charAt(path.length - 1) == "/") return true; return false; }-*/; @@ -428,7 +428,7 @@ public class VCustomLayout extends ComplexPanel { */ public native boolean iLayoutJS(com.google.gwt.user.client.Element el) /*-{ - if(el && el.iLayoutJS) { + if (el && el.iLayoutJS) { try { el.iLayoutJS(); return true; diff --git a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java index 293206760d..0b87139478 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -1649,12 +1649,10 @@ public class VMenuBar extends SimpleFocusablePanel private native String getText(Element element) /*-{ var n = element.childNodes.length; - if(n > 0){ + if (n > 0) { return element.childNodes[n - 1].nodeValue; } - else{ - return ""; - } + return ""; }-*/; private Element getLastChildElement(CustomMenuItem item) { diff --git a/client/src/main/java/com/vaadin/client/ui/VPopupView.java b/client/src/main/java/com/vaadin/client/ui/VPopupView.java index de720e2d0b..7686703925 100644 --- a/client/src/main/java/com/vaadin/client/ui/VPopupView.java +++ b/client/src/main/java/com/vaadin/client/ui/VPopupView.java @@ -193,7 +193,7 @@ public class VPopupView extends HTML private static native void nativeBlur(Element e) /*-{ - if(e && e.blur) { + if (e && e.blur) { e.blur(); } }-*/; diff --git a/client/src/main/java/com/vaadin/client/ui/VUI.java b/client/src/main/java/com/vaadin/client/ui/VUI.java index 28b9fd06c6..cf5de33866 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUI.java +++ b/client/src/main/java/com/vaadin/client/ui/VUI.java @@ -345,8 +345,7 @@ public class VUI extends SimplePanel implements ResizeHandler, private static native void loadAppIdListFromDOM(List list) /*-{ - var j; - for(j in $wnd.vaadin.vaadinConfigurations) { + for (var j in $wnd.vaadin.vaadinConfigurations) { // $entry not needed as function is not exported list.@java.util.Collection::add(Ljava/lang/Object;)(j); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java index 195229b478..98f95fa075 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java @@ -51,7 +51,7 @@ public class VHtml5DragEvent extends NativeEvent { */ public final native String getFileAsString(int index) /*-{ - if(this.dataTransfer.files.length > 0 && this.dataTransfer.files[0].getAsText) { + if (this.dataTransfer.files.length > 0 && this.dataTransfer.files[0].getAsText) { return this.dataTransfer.files[index].getAsText("UTF-8"); } return null; @@ -61,7 +61,7 @@ public class VHtml5DragEvent extends NativeEvent { /*-{ try { this.dataTransfer.dropEffect = effect; - } catch (e){} + } catch (e) {} }-*/; public final native String getEffectAllowed() diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index 61887dd980..de4afcf2e1 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -761,13 +761,13 @@ public class Escalator extends Widget // A delta mode of 1 means we're scrolling by lines instead of pixels // We need to scale the number of lines by the default line height - if(e.deltaMode === 1) { + if (e.deltaMode === 1) { var brc = esc.@com.vaadin.client.widgets.Escalator::body; deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); } // Other delta modes aren't supported - if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { + if ((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; // Print warning message diff --git a/client/src/main/java/com/vaadin/client/widgets/Overlay.java b/client/src/main/java/com/vaadin/client/widgets/Overlay.java index 5836041de4..1ec7456f93 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Overlay.java +++ b/client/src/main/java/com/vaadin/client/widgets/Overlay.java @@ -357,10 +357,10 @@ public class Overlay extends PopupPanel { try { var b = $wnd.document.body; var cstyle = b.currentStyle ? b.currentStyle : getComputedStyle(b); - if(cstyle && cstyle.position == 'relative') { + if (cstyle && cstyle.position == 'relative') { return b.getBoundingClientRect()[axis]; } - } catch(e){} + } catch(e) {} return 0; }-*/; -- cgit v1.2.3