* Add spaces after 'if' and 'for' in JavaScript * Revert to old format * Remove whitespacestags/8.2.0.alpha3
@@ -53,7 +53,7 @@ public class ArraySerializer extends JsonSerializer { | |||
} | |||
w.println(";"); | |||
w.println("for(int i = 0 ; i < value.length; i++) {"); | |||
w.println("for (int i = 0 ; i < value.length; i++) {"); | |||
w.indent(); | |||
JType componentType = arrayType.getComponentType(); |
@@ -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]; | |||
} | |||
} |
@@ -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; | |||
}-*/; | |||
/** |
@@ -548,9 +548,9 @@ public class ApplicationConnection implements HasHandlers { | |||
* attaching js functions responsibility to create the variable like this: | |||
* | |||
* <code><pre> | |||
* 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 | |||
* } | |||
* } |
@@ -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() |
@@ -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<j; i++) { | |||
var r = theRules[i]; | |||
if(r.type == 1 || sheet.imports) { | |||
var selectors = r.selectorText.toLowerCase().split(","); | |||
var n = selectors.length; | |||
for(var m=0; m<n; m++) { | |||
if(selectors[m].replace(/^\s+|\s+$/g, "") == selector) { | |||
allMatches.unshift(r); | |||
break; // No need to loop other selectors for this rule | |||
} | |||
} | |||
} else if(deep && r.type == 3) { | |||
// Search @import stylesheet | |||
// $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)(r.styleSheet, selector, deep); | |||
allMatches = allMatches.concat(imports); | |||
} | |||
for (var i=0; i<j; i++) { | |||
var r = theRules[i]; | |||
if (r.type == 1 || sheet.imports) { | |||
var selectors = r.selectorText.toLowerCase().split(","); | |||
var n = selectors.length; | |||
for (var m=0; m<n; m++) { | |||
if (selectors[m].replace(/^\s+|\s+$/g, "") == selector) { | |||
allMatches.unshift(r); | |||
break; // No need to loop other selectors for this rule | |||
} | |||
} | |||
} else if (deep && r.type == 3) { | |||
// Search @import stylesheet | |||
// $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)(r.styleSheet, selector, deep); | |||
allMatches = allMatches.concat(imports); | |||
} | |||
} | |||
return allMatches; | |||
@@ -116,11 +116,11 @@ public class CSSRule { | |||
public native String getPropertyValue(final String propertyName) | |||
/*-{ | |||
var j = this.@com.vaadin.client.CSSRule::rules.length; | |||
for(var i=0; i<j; i++) { | |||
// $entry not needed as function is not exported | |||
var value = this.@com.vaadin.client.CSSRule::rules[i].style[propertyName]; | |||
if(value) | |||
return value; | |||
for (var i=0; i<j; i++) { | |||
// $entry not needed as function is not exported | |||
var value = this.@com.vaadin.client.CSSRule::rules[i].style[propertyName]; | |||
if (value) | |||
return value; | |||
} | |||
return null; | |||
}-*/; |
@@ -57,7 +57,7 @@ final class ComponentDetailMap extends JavaScriptObject { | |||
final native int size() | |||
/*-{ | |||
var count = 0; | |||
for(var key in this) { | |||
for (var key in this) { | |||
count++; | |||
} | |||
return count; | |||
@@ -65,8 +65,8 @@ final class ComponentDetailMap extends JavaScriptObject { | |||
final native void clear() | |||
/*-{ | |||
for(var key in this) { | |||
if(this.hasOwnProperty(key)) { | |||
for (var key in this) { | |||
if (this.hasOwnProperty(key)) { | |||
delete this[key]; | |||
} | |||
} | |||
@@ -74,7 +74,7 @@ final class ComponentDetailMap extends JavaScriptObject { | |||
private final native void fillWithValues(Collection<ComponentDetail> 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<ComponentDetail> valuesAsJsArray() | |||
/*-{ | |||
var result = []; | |||
for(var key in this) { | |||
for (var key in this) { | |||
if (this.hasOwnProperty(key)) { | |||
result.push(this[key]); | |||
} |
@@ -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"; | |||
} | |||
@@ -49,7 +49,7 @@ public final class FastStringMap<T> 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<T> 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++; | |||
} |
@@ -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<String> 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]; | |||
} |
@@ -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); | |||
} |
@@ -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 { |
@@ -362,13 +362,13 @@ public final class UIDL extends JavaScriptObject implements Iterable<Object> { | |||
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<Object> { | |||
/*-{ | |||
var buf = new Array(); | |||
var self = this; | |||
for(j in self) { | |||
for (j in self) { | |||
buf.push("<"); | |||
buf.push(j); | |||
buf.push(">"); |
@@ -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; |
@@ -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); | |||
} |
@@ -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; |
@@ -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)) { |
@@ -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); | |||
} | |||
}-*/; |
@@ -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; |
@@ -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(); | |||
} | |||
}-*/; |
@@ -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)); | |||
} | |||
} |
@@ -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 += "<div>" + captions[i] + "</div>"; | |||
// TODO apply same CSS classname as in suggestionmenu | |||
} |
@@ -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; |
@@ -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) { |
@@ -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(); | |||
} | |||
}-*/; |
@@ -345,8 +345,7 @@ public class VUI extends SimplePanel implements ResizeHandler, | |||
private static native void loadAppIdListFromDOM(List<String> 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); | |||
} |
@@ -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() |
@@ -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 |
@@ -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; | |||
}-*/; | |||
@@ -246,7 +246,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; |
@@ -100,13 +100,13 @@ public class VDateField extends FlowPanel implements Field, HasEnabled { | |||
/*-{ | |||
try { | |||
var date = new Date(2000,1,1,1); // don't use current date here | |||
if(y && y >= 0) date.setFullYear(y); | |||
if(m && m >= 1) date.setMonth(m-1); | |||
if(d && d >= 0) date.setDate(d); | |||
if(h >= 0) date.setHours(h); | |||
if(mi >= 0) date.setMinutes(mi); | |||
if(s >= 0) date.setSeconds(s); | |||
if(ms >= 0) date.setMilliseconds(ms); | |||
if (y && y >= 0) date.setFullYear(y); | |||
if (m && m >= 1) date.setMonth(m-1); | |||
if (d && d >= 0) date.setDate(d); | |||
if (h >= 0) date.setHours(h); | |||
if (mi >= 0) date.setMinutes(mi); | |||
if (s >= 0) date.setSeconds(s); | |||
if (ms >= 0) date.setMilliseconds(ms); | |||
return date.getTime(); | |||
} catch (e) { | |||
// TODO print some error message on the console |
@@ -2303,12 +2303,12 @@ public class VFilterSelect extends Composite | |||
*/ | |||
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 += "<div>" + captions[i] + "</div>"; | |||
// TODO apply same CSS classname as in suggestionmenu | |||
} |
@@ -8220,7 +8220,7 @@ public class VScrollTable extends FlowPanel | |||
*/ | |||
private static native JavaScriptObject getPreventTextSelectionIEHack() | |||
/*-{ | |||
return function(){ return false; }; | |||
return function() { return false; }; | |||
}-*/; | |||
public void triggerLazyColumnAdjustment(boolean now) { |
@@ -1970,7 +1970,7 @@ public class VTree extends FocusElementPanel | |||
*/ | |||
private native JavaScriptObject applyDisableTextSelectionIEHack() | |||
/*-{ | |||
return function(){ return false; }; | |||
return function() { return false; }; | |||
}-*/; | |||
/** |
@@ -735,13 +735,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.v7.client.widgets.Escalator::body; | |||
deltaY *= brc.@com.vaadin.v7.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 |
@@ -36,7 +36,7 @@ public class MenuItemStyleRemoved extends AbstractReindeerTestUI { | |||
} | |||
JavaScript.getCurrent() | |||
.execute("var x=document." + method + ";" | |||
+ " var i; for(i=0; i < x.length; i++)" | |||
+ " var i; for (i=0; i < x.length; i++)" | |||
+ " {x[i].className += ' custom-menu-item'};"); | |||
} | |||
}); |
@@ -43,7 +43,7 @@ public class TrackMessageSizeUI extends AbstractTestUIWithLog { | |||
+ " _handleProtocol = function(a,message) {return message;};" | |||
+ " var response = {partialMessage: ''};\n" | |||
+ " var messages = [];\n" | |||
+ " for(var i = 0; i < data.length; i++) {\n" | |||
+ " for (var i = 0; i < data.length; i++) {\n" | |||
+ " if (!_trackMessageSize(data[i], request, response))\n" | |||
+ " messages = messages.concat(response.messages);\n" | |||
+ " }\n" |
@@ -117,11 +117,11 @@ public class TestUtils { | |||
public static void installPerformanceReporting(TextArea targetTextArea) { | |||
targetTextArea.setId("performanceTestTarget"); | |||
JavaScript | |||
.eval("window.reportVaadinPerformance = function(topic, serverLimit, clientLimit, bootstrapTime) {" | |||
JavaScript.eval( | |||
"window.reportVaadinPerformance = function(topic, serverLimit, clientLimit, bootstrapTime) {" | |||
+ "var element = document.getElementById('performanceTestTarget');" | |||
+ "var text = topic + ': \\n';" | |||
+ "for(var k in window.vaadin.clients) {" | |||
+ "for (var k in window.vaadin.clients) {" | |||
+ "var p = window.vaadin.clients[k].getProfilingData();" | |||
+ "text += ' Server time: ' + (p[3] > serverLimit?'FAIL':'OK') + ' (' + p[3] +')\\n';" | |||
+ "text += ' Client time: ' + (p[0] > clientLimit?'FAIL':'OK') + ' (' + p[0] +')\\n';" |
@@ -29,7 +29,7 @@ public class CssLayoutRemoveComponentTest extends SingleBrowserTestPhantomJS2 { | |||
openTestURL(); | |||
String script = "document.mutationEventCount = 0;" | |||
+ "var observer = new MutationObserver(function(mutations){" | |||
+ "var observer = new MutationObserver(function(mutations) {" | |||
+ "mutations.forEach(function(mutation) { document.mutationEventCount += mutation.removedNodes.length; });" | |||
+ "});" | |||
+ "observer.observe(arguments[0].parentNode, { childList: true });"; |
@@ -30,7 +30,7 @@ public class VerticalLayoutRemoveComponentTest | |||
openTestURL(); | |||
String script = "document.mutationEventCount = 0;" | |||
+ "var observer = new MutationObserver(function(mutations){" | |||
+ "var observer = new MutationObserver(function(mutations) {" | |||
+ "mutations.forEach(function(mutation) { document.mutationEventCount += mutation.removedNodes.length; });" | |||
+ "});" | |||
+ "observer.observe(arguments[0], { childList: true });"; |