}
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();
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);
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;
/** 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);
}
}
/** 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 "";
/*-{
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 "";
'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];
}
}
'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];
}
}
private static native boolean isDebugAvailable()
/*-{
- if($wnd.vaadin.debug) {
- return true;
- } else {
- return false;
- }
+ return $wnd.vaadin.debug;
}-*/;
/**
* 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
* }
* }
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()
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 = [];
}-*/;
final JavaScriptObject sheet, final String selector,
final boolean deep)
/*-{
- if(!$doc.styleSheets)
+ if (!$doc.styleSheets)
return null;
selector = selector.toLowerCase();
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;
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;
}-*/;
final native int size()
/*-{
var count = 0;
- for(var key in this) {
+ for (var key in this) {
count++;
}
return count;
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];
}
}
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]);
}
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]);
}
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;
}
}-*/;
// 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();
// 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";
}
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);
}
public native int size()
/*-{
var size = 0;
- for(var key in this) {
+ for (var key in this) {
if (Object.hasOwnProperty.call(this, key)) {
size++;
}
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;
}
public native JsArrayString dump()
/*-{
var array = [];
- for(var string in this) {
+ for (var string in this) {
if (this.hasOwnProperty(string)) {
array.push(string);
}
public native boolean isEmpty()
/*-{
- for(var string in this) {
+ for (var string in this) {
if (this.hasOwnProperty(string)) {
return false;
}
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);
}
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];
}
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];
}
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);
}
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 {
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;
/*-{
var buf = new Array();
var self = this;
- for(j in self) {
+ for (j in self) {
buf.push("<");
buf.push(j);
buf.push(">");
/*-{
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;
*/
public static native void browserDebugger()
/*-{
- if($wnd.console)
+ if ($wnd.console)
debugger;
}-*/;
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;
/*-{
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);
}
/*-{
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);
}
/*-{
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;
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);
}
}
// 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;
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.*?\]/);
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);
}
}
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)) {
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] = {};
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);
private static native void eval(String script)
/*-{
- if(script) {
+ if (script) {
(new $wnd.Function(script)).apply($wnd);
}
}-*/;
String baseClassName, String superClassName)
/*-{
var parentType = typeData[superClassName];
- if (parentType !== undefined ){
+ if (parentType !== undefined ) {
var ctor = function () {};
ctor.prototype = parentType;
typeData[baseClassName] = new ctor;
JavaScriptObject typeData, String beanName)
/*-{
var names = [];
- for(var name in typeData[beanName]) {
+ for (var name in typeData[beanName]) {
names.push(name);
}
return names;
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();
}
}-*/;
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";
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));
}
}
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));
}
}
*/
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
}
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;
}-*/;
*/
public native boolean iLayoutJS(com.google.gwt.user.client.Element el)
/*-{
- if(el && el.iLayoutJS) {
+ if (el && el.iLayoutJS) {
try {
el.iLayoutJS();
return true;
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) {
private static native void nativeBlur(Element e)
/*-{
- if(e && e.blur) {
+ if (e && e.blur) {
e.blur();
}
}-*/;
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);
}
*/
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;
/*-{
try {
this.dataTransfer.dropEffect = effect;
- } catch (e){}
+ } catch (e) {}
}-*/;
public final native String getEffectAllowed()
// 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
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;
}-*/;
/*-{
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;
/*-{
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
*/
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
}
*/
private static native JavaScriptObject getPreventTextSelectionIEHack()
/*-{
- return function(){ return false; };
+ return function() { return false; };
}-*/;
public void triggerLazyColumnAdjustment(boolean now) {
*/
private native JavaScriptObject applyDisableTextSelectionIEHack()
/*-{
- return function(){ return false; };
+ return function() { return false; };
}-*/;
/**
// 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
}
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'};");
}
});
+ " _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"
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';"
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 });";
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 });";