diff options
author | Leif Åstrand <legioth@gmail.com> | 2017-02-01 11:09:04 +0200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2017-02-01 11:09:04 +0200 |
commit | 07d56a9ca050d976dec4f598ed39471ae369c588 (patch) | |
tree | 167982734c11fa76b39cfad226b8f601174da17a /client/src | |
parent | 601de7e3ba5af6146ab0342bf3a924c9aa08a1b4 (diff) | |
download | vaadin-framework-07d56a9ca050d976dec4f598ed39471ae369c588.tar.gz vaadin-framework-07d56a9ca050d976dec4f598ed39471ae369c588.zip |
Add a maven plugin for formatting according to Eclipse settings
Running formatter:format will format all files in a submodule using an
embedded Eclipse compiler (based on Neon SR1)
according to the regular formatting settings file.
Diffstat (limited to 'client/src')
23 files changed, 155 insertions, 158 deletions
diff --git a/client/src/main/java/com/vaadin/client/AnimationUtil.java b/client/src/main/java/com/vaadin/client/AnimationUtil.java index d868122857..e2cf9e690a 100644 --- a/client/src/main/java/com/vaadin/client/AnimationUtil.java +++ b/client/src/main/java/com/vaadin/client/AnimationUtil.java @@ -66,15 +66,15 @@ public class AnimationUtil { listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e); }); callbackFunc.listener = listener; - + elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); - + // Store function reference for later removal if(!elem._vaadin_animationend_callbacks) { elem._vaadin_animationend_callbacks = []; } elem._vaadin_animationend_callbacks.push(callbackFunc); - + return callbackFunc; }-*/; @@ -137,7 +137,7 @@ public class AnimationUtil { return event.mozAnimationName; else if(event.oAnimationName) return event.oAnimationName; - + return ""; }-*/; @@ -145,22 +145,22 @@ public class AnimationUtil { public static native String getAnimationName(ComputedStyle cstyle) /*-{ var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; - + if(!cs.getPropertyValue) return ""; - + if(cs.getPropertyValue("-webkit-animation-name")) return cs.getPropertyValue("-webkit-animation-name"); - + else if(cs.getPropertyValue("animation-name")) return cs.getPropertyValue("animation-name"); - + else if(cs.getPropertyValue("-moz-animation-name")) return cs.getPropertyValue("-moz-animation-name"); - + else if(cs.getPropertyValue("-o-animation-name")) return cs.getPropertyValue("-o-animation-name"); - + return ""; }-*/; @@ -175,7 +175,7 @@ public class AnimationUtil { 'MozAnimation': 'animationend', 'WebkitAnimation': 'webkitAnimationEnd' } - + for(var a in anims){ if( el.style[a] !== undefined ){ return anims[a]; @@ -194,7 +194,7 @@ public class AnimationUtil { 'mozAnimation', 'webkitAnimation' ] - + 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/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java index 9d9a66173d..b9288d68c6 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java @@ -481,7 +481,7 @@ public class ApplicationConnection implements HasHandlers { return vi; } } - + client.getProfilingData = $entry(function() { var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); var pd = [ @@ -496,7 +496,7 @@ public class ApplicationConnection implements HasHandlers { pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; return pd; }); - + client.getElementByPath = $entry(function(id) { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); }); @@ -513,7 +513,7 @@ public class ApplicationConnection implements HasHandlers { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); }); client.initializing = false; - + $wnd.vaadin.clients[TTAppId] = client; }-*/; diff --git a/client/src/main/java/com/vaadin/client/CSSRule.java b/client/src/main/java/com/vaadin/client/CSSRule.java index e261d8af11..3651abf0a7 100644 --- a/client/src/main/java/com/vaadin/client/CSSRule.java +++ b/client/src/main/java/com/vaadin/client/CSSRule.java @@ -63,11 +63,11 @@ public class CSSRule { /*-{ 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++) { @@ -76,13 +76,13 @@ public class CSSRule { allMatches.concat(imports); } } - + var theRules = new Array(); if (sheet.cssRules) theRules = sheet.cssRules else if (sheet.rules) theRules = sheet.rules - + var j = theRules.length; for(var i=0; i<j; i++) { var r = theRules[i]; @@ -102,7 +102,7 @@ public class CSSRule { allMatches = allMatches.concat(imports); } } - + return allMatches; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ComputedStyle.java b/client/src/main/java/com/vaadin/client/ComputedStyle.java index fbd6ef6ce9..977da6bafc 100644 --- a/client/src/main/java/com/vaadin/client/ComputedStyle.java +++ b/client/src/main/java/com/vaadin/client/ComputedStyle.java @@ -44,11 +44,11 @@ public class ComputedStyle { if(elem.nodeType != 1) { return {}; } - + if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) { return $wnd.document.defaultView.getComputedStyle(elem, null); } - + if(elem.currentStyle) { return elem.currentStyle; } @@ -65,7 +65,7 @@ public class ComputedStyle { /*-{ var cs = this.@com.vaadin.client.ComputedStyle::computedStyle; var elem = this.@com.vaadin.client.ComputedStyle::elem; - + // 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. @@ -78,45 +78,45 @@ public class ComputedStyle { if(borderStyle == "none") return "0px"; } - + if(cs.getPropertyValue) { - + // Convert name to dashed format name = name.replace(/([A-Z])/g, "-$1").toLowerCase(); var ret = cs.getPropertyValue(name); - + } else { - + var ret = cs[name]; var style = elem.style; - + // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - + // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { // Remember the original values var left = style.left, rsLeft = elem.runtimeStyle.left; - + // Put in the new values to get a computed value out elem.runtimeStyle.left = cs.left; style.left = ret || 0; ret = style.pixelLeft + "px"; - + // Revert the changed values style.left = left; elem.runtimeStyle.left = rsLeft; } - + } - + // 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") { return "0px"; } - + // Some browsers return undefined width and height values as "auto", so // we need to retrieve those ourselves. if (name == "width" && ret == "auto") { @@ -124,9 +124,9 @@ public class ComputedStyle { } else if (name == "height" && ret == "auto") { ret = elem.clientHeight + "px"; } - + return ret; - + }-*/; /** diff --git a/client/src/main/java/com/vaadin/client/ResourceLoader.java b/client/src/main/java/com/vaadin/client/ResourceLoader.java index f58453ced5..c52e6f16d0 100644 --- a/client/src/main/java/com/vaadin/client/ResourceLoader.java +++ b/client/src/main/java/com/vaadin/client/ResourceLoader.java @@ -401,12 +401,12 @@ public class ResourceLoader { if (rules === undefined) { rules = sheet.rules; } - + if (rules === null) { // Style sheet loaded, but can't access length because of XSS -> assume there's something there return 1; } - + // Return length so we can distinguish 0 (probably 404 error) from normal case. return rules.length; } catch (err) { diff --git a/client/src/main/java/com/vaadin/client/SuperDevMode.java b/client/src/main/java/com/vaadin/client/SuperDevMode.java index 45dac5e89d..ce371c030d 100644 --- a/client/src/main/java/com/vaadin/client/SuperDevMode.java +++ b/client/src/main/java/com/vaadin/client/SuperDevMode.java @@ -125,13 +125,13 @@ public class SuperDevMode { private native static String getRecompileParameters(String moduleName) /*-{ var prop_map = $wnd.__gwt_activeModules[moduleName].bindings(); - + // convert map to URL parameter string var props = []; for (var key in prop_map) { props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key])) } - + return props.join('&') + '&'; }-*/; @@ -225,12 +225,12 @@ public class SuperDevMode { var mod = $wnd.__gwt_activeModules[moduleName]; if (!mod) return false; - + if (mod.superdevmode) { // Running in super dev mode already, it is supported return true; } - + return !!mod.canRedirect; }-*/; diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index 5a679e897d..47aba0271c 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -794,7 +794,7 @@ public class WidgetUtil { com.google.gwt.dom.client.Element el, String p) /*-{ try { - + if (el.currentStyle) { // IE return el.currentStyle[p]; @@ -809,7 +809,7 @@ public class WidgetUtil { } catch (e) { return ""; } - + }-*/; /** @@ -823,7 +823,7 @@ public class WidgetUtil { try { el.focus(); } catch (e) { - + } }-*/; @@ -1119,7 +1119,7 @@ public class WidgetUtil { if ($wnd.document.activeElement) { return $wnd.document.activeElement; } - + return null; }-*/; @@ -1190,11 +1190,11 @@ public class WidgetUtil { /*-{ var top = elem.offsetTop; var height = elem.offsetHeight; - + if (elem.parentNode != elem.offsetParent) { top -= elem.parentNode.offsetTop; } - + var cur = elem.parentNode; while (cur && (cur.nodeType == 1)) { if (top < cur.scrollTop) { @@ -1203,12 +1203,12 @@ public class WidgetUtil { if (top + height > cur.scrollTop + cur.clientHeight) { cur.scrollTop = (top + height) - cur.clientHeight; } - + var offsetTop = cur.offsetTop; if (cur.parentNode != cur.offsetParent) { offsetTop -= cur.parentNode.offsetTop; } - + top += offsetTop - cur.scrollTop; cur = cur.parentNode; } @@ -1648,7 +1648,7 @@ public class WidgetUtil { } var heightWithoutBorder = cloneElement.offsetHeight; parentElement.removeChild(cloneElement); - + return heightWithBorder - heightWithoutBorder; } }-*/; diff --git a/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java index b0c7149cf6..ba7fa39a7d 100644 --- a/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java @@ -526,7 +526,7 @@ public class AtmospherePushConnection implements PushConnection { JavaScriptObject config) /*-{ var self = this; - + config.url = uri; config.onOpen = $entry(function(response) { self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); @@ -552,7 +552,7 @@ public class AtmospherePushConnection implements PushConnection { config.onClientTimeout = $entry(function(request) { self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request); }); - + return $wnd.vaadinPush.atmosphere.subscribe(config); }-*/; 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 9596d7cbe4..90ced5e095 100644 --- a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java @@ -64,7 +64,7 @@ public class JavaScriptRendererConnector private static native JavaScriptObject createCellReferenceWrapper() /*-{ var reference = {}; - + var setProperty = function(name, getter, setter) { var descriptor = { get: getter @@ -74,25 +74,25 @@ public class JavaScriptRendererConnector } Object.defineProperty(reference, name, descriptor); }; - + setProperty("element", function() { return reference.target.@CellReference::getElement()(); }, null); - + setProperty("rowIndex", function() { return reference.target.@CellReference::getRowIndex()(); }, null); - + setProperty("columnIndex", function() { return reference.target.@CellReference::getColumnIndex()(); }, null); - + setProperty("colSpan", function() { return reference.target.@RendererCellReference::getColSpan()(); }, function(colSpan) { reference.target.@RendererCellReference::setColSpan(*)(colSpan); }); - + return reference; }-*/; diff --git a/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java b/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java index eaed705e1a..82c730ade4 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java @@ -44,7 +44,7 @@ public class DebugButton extends Button { public DebugButton(String caption) { this(null, null, caption); } - + public DebugButton(String caption, String title) { this(null, title, caption); } 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 5a3d57c55e..314d167bfe 100644 --- a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java @@ -165,26 +165,26 @@ public class ResponsiveConnector extends AbstractExtensionConnector */ private static native void searchForBreakPointsNative() /*-{ - + // Initialize variables @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache = []; @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache = []; - + var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; - + // Can't do squat if we can't parse 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++) { var sheet = sheets[i]; @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(sheet); } - + }-*/; /** @@ -197,15 +197,15 @@ public class ResponsiveConnector extends AbstractExtensionConnector private static native void searchStylesheetForBreakPoints( final JavaScriptObject sheet) /*-{ - + // Inline variables for easier reading var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; - + // Get all the rulesets from the stylesheet var theRules = new Array(); var IEOrEdge = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE()() || @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isEdge()(); - + try { if (sheet.cssRules) { theRules = sheet.cssRules @@ -218,18 +218,18 @@ public class ResponsiveConnector extends AbstractExtensionConnector ", probably because of cross domain issues: " + e); return; } - + // Loop through the rulesets for(var i = 0, len = theRules.length; i < len; i++) { var rule = theRules[i]; - + 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) { // Regular selector rule - + // Helper function var pushToCache = function(ranges, selector, min, max) { // Avoid adding duplicates @@ -245,46 +245,46 @@ public class ResponsiveConnector extends AbstractExtensionConnector ranges.push([selector, min, max]); } }; - + // Array of all of the separate selectors in this ruleset var haystack = rule.selectorText.split(","); - + // IE/Edge parses CSS like .class[attr="val"] into [attr="val"].class so we need to check for both var selectorRegEx = IEOrEdge ? /\[.*\]([\.|#]\S+)/ : /([\.|#]\S+?)\[.*\]/; - + // Loop all the selectors in this ruleset for(var k = 0, len2 = haystack.length; k < len2; k++) { - + // Split the haystack into parts. var widthRange = haystack[k].match(/\[width-range.*?\]/); var heightRange = haystack[k].match(/\[height-range.*?\]/); var selector = haystack[k].match(selectorRegEx); - + if (selector != null) { selector = selector[1]; - + // Check for width-ranges. if (widthRange != null) { var minMax = widthRange[0].match(/\[width-range~?=["|'](.*?)-(.*?)["|']\]/i); var min = minMax[1]; var max = minMax[2]; - + pushToCache(widthRanges, selector, min, max); } - + // Check for height-ranges. if (heightRange != null) { var minMax = heightRange[0].match(/\[height-range~?=["|'](.*?)-(.*?)["|']\]/i); var min = minMax[1]; var max = minMax[2]; - + pushToCache(heightRanges, selector, min, max); } } } } } - + }-*/; /** @@ -294,15 +294,15 @@ public class ResponsiveConnector extends AbstractExtensionConnector */ private native void getBreakPointsFor(final String selectors) /*-{ - + var selectors = selectors.split(","); - + var widthBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints = []; var heightBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints = []; - + 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++) { var bp = widthRanges[i]; for(var j = 0, len2 = selectors.length; j < len2; j++) { @@ -310,7 +310,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector widthBreakpoints.push(bp); } } - + for(var i = 0, len = heightRanges.length; i < len; i++) { var bp = heightRanges[i]; for(var j = 0, len2 = selectors.length; j < len2; j++) { @@ -318,10 +318,10 @@ public class ResponsiveConnector extends AbstractExtensionConnector heightBreakpoints.push(bp); } } - + // Only for debugging // console.log("Breakpoints for", selectors.join(","), widthBreakpoints, heightBreakpoints); - + }-*/; private String currentWidthRanges = ""; @@ -376,24 +376,24 @@ public class ResponsiveConnector extends AbstractExtensionConnector private native String resolveBreakpoint(String which, int size) /*-{ - + // Default to "width" breakpoints var breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints; - + // Use height breakpoints if we're measuring the 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++) { var bp = breakpoints[i]; - + var min = parseInt(bp[1]); var max = parseInt(bp[2]); - + if(!isNaN(min) && !isNaN(max)) { if(min <= size && size <= max) { ranges += " " + bp[1] + "-" + bp[2]; @@ -408,10 +408,10 @@ public class ResponsiveConnector extends AbstractExtensionConnector } } } - + // Trim the output and return it return ranges.replace(/^\s+/, ""); - + }-*/; } 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 d303a549be..386d1efc37 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 @@ -71,7 +71,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { var m = this; var target = $wnd; var parts = name.split('.'); - + for(var i = 0; i < parts.length - 1; i++) { var part = parts[i]; if (target[part] === undefined) { @@ -79,7 +79,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { } target = target[part]; } - + target[parts[parts.length - 1]] = $entry(function() { //Must make a copy because arguments is an array-like object (not instanceof Array), causing suboptimal JSON encoding var args = Array.prototype.slice.call(arguments, 0); @@ -94,7 +94,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { /*-{ var target = $wnd; var parts = name.split('.'); - + for(var i = 0; i < parts.length - 1; i++) { var part = parts[i]; if (target[part] === undefined) { @@ -104,7 +104,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { } target = target[part]; } - + $wnd.console.log('removing',parts[parts.length - 1],'from',target); delete target[parts[parts.length - 1]]; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java index e35accb1b1..ca19597841 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java @@ -209,10 +209,9 @@ public abstract class AbstractComponentConnector extends AbstractConnector @Override public void run() { - cancelParentTouchTimers(); // we're handling this event, - // our parent components - // don't need to bother with - // it anymore. + // we're handling this event, our parent components + // don't need to bother with it anymore. + cancelParentTouchTimers(); // The default context click // implementation only provides the // mouse coordinates relative to root diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java index e078f3f126..93ab05a883 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java @@ -124,8 +124,7 @@ public abstract class AbstractConnector // been set but before init() is called to enable e.g. // JavaScriptConnector to use connection when determining the tag name if (this instanceof ComponentConnector) { - setConnectorId( - ((ComponentConnector) this).getWidget().getElement(), + setConnectorId(((ComponentConnector) this).getWidget().getElement(), connectorId); } 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 05f2259e9b..d3bba9549c 100644 --- a/client/src/main/java/com/vaadin/client/ui/VButton.java +++ b/client/src/main/java/com/vaadin/client/ui/VButton.java @@ -172,14 +172,10 @@ public class VButton extends FocusWidget implements ClickHandler { : 0; // If clicks are currently disallowed or phantom, keep it from // bubbling or being passed to the superclass. + // the maximum interval observed for phantom click is 69, with + // majority under 50, so we select 100 to be safe if (disallowNextClick || isPhantomClickPossible - && (clickTime - lastClickTime < 100)) { // the maximum - // interval observed - // for phantom click - // is 69, with - // majority under - // 50, so we select - // 100 to be safe + && (clickTime - lastClickTime < 100)) { event.stopPropagation(); disallowNextClick = false; return; @@ -419,28 +415,28 @@ public class VButton extends FocusWidget implements ClickHandler { private static native int getHorizontalBorderAndPaddingWidth(Element elem) /*-{ // THIS METHOD IS ONLY USED FOR INTERNET EXPLORER, IT DOESN'T WORK WITH OTHERS - + var convertToPixel = function(elem, value) { // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - + // Remember the original values var left = elem.style.left, rsLeft = elem.runtimeStyle.left; - + // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; elem.style.left = value || 0; var ret = elem.style.pixelLeft; - + // Revert the changed values elem.style.left = left; elem.runtimeStyle.left = rsLeft; - + return ret; } - + var ret = 0; - + var sides = ["Right","Left"]; for(var i=0; i<2; i++) { var side = sides[i]; @@ -454,7 +450,7 @@ public class VButton extends FocusWidget implements ClickHandler { ret += parseInt(value.substr(0, value.length-2)); } } - + // Padding ------------------------------------------------------- value = elem.currentStyle["padding"+side]; if ( !/^\d+(px)?$/i.test( value ) && /^\d/.test( value ) ) { @@ -463,7 +459,7 @@ public class VButton extends FocusWidget implements ClickHandler { ret += parseInt(value.substr(0, value.length-2)); } } - + return ret; }-*/; 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 df4d67e258..6ecea2d116 100644 --- a/client/src/main/java/com/vaadin/client/ui/VComboBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VComboBox.java @@ -241,12 +241,12 @@ public class VComboBox extends Composite implements Field, KeyDownHandler, return $entry(function(e) { var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; - + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode); }); }-*/; diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java index 2b70569234..2a07cf8744 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -466,11 +466,11 @@ public class VDragAndDropWrapper extends VCustomComponent public final native void postFile(VHtml5File file) /*-{ - + this.setRequestHeader('Content-Type', 'multipart/form-data'); // Seems like IE10 will loose the file if we don't keep a reference to it... this.fileBeingUploaded = file; - + this.send(file); }-*/; @@ -626,19 +626,19 @@ public class VDragAndDropWrapper extends VCustomComponent protected native void hookHtml5Events(com.google.gwt.user.client.Element el) /*-{ var me = this; - + el.addEventListener("dragenter", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); - + el.addEventListener("dragleave", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); - + el.addEventListener("dragover", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); - + el.addEventListener("drop", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java index a992a068cc..13159e7aa3 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java @@ -53,7 +53,7 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { com.google.gwt.user.client.Element el) /*-{ var me = this; - + el.attachEvent("ondragstart", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragStart(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); @@ -69,19 +69,19 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { protected native void hookHtml5Events(com.google.gwt.user.client.Element el) /*-{ var me = this; - + el.attachEvent("ondragenter", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); - + el.attachEvent("ondragleave", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); - + el.attachEvent("ondragover", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); - + el.attachEvent("ondrop", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); diff --git a/client/src/main/java/com/vaadin/client/ui/VVideo.java b/client/src/main/java/com/vaadin/client/ui/VVideo.java index ae73af4f9b..3cca01c6e7 100644 --- a/client/src/main/java/com/vaadin/client/ui/VVideo.java +++ b/client/src/main/java/com/vaadin/client/ui/VVideo.java @@ -48,7 +48,7 @@ public class VVideo extends VMediaBase { el.addEventListener('loadedmetadata', $entry(function(e) { self.@com.vaadin.client.ui.VVideo::updateElementDynamicSize(II)(el.videoWidth, el.videoHeight); }), false); - + }-*/; /** diff --git a/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java index 857d13c4b5..88107fa4f2 100644 --- a/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -72,7 +72,8 @@ public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector childStyles.toArray(new String[childStyles.size()])); } - if (stateChangeEvent.hasPropertyChanged("height") || stateChangeEvent.hasPropertyChanged("width")) { + if (stateChangeEvent.hasPropertyChanged("height") + || stateChangeEvent.hasPropertyChanged("width")) { setChildWidgetPosition(child); } } 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 830f668a00..340be2eb85 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 @@ -97,15 +97,15 @@ public class VHtml5DragEvent extends NativeEvent { } } } - + // Zero sized files without a type are also likely to be folders var file = this.dataTransfer.files[fileIndex]; if (file.size == 0 && !file.type) { return false; } - + // TODO Make it detect folders on all browsers - + return true; }-*/; 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 416e8fde1c..3c7b7c0159 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -702,13 +702,13 @@ public class Escalator extends Widget /*-{ var vScroll = esc.@com.vaadin.client.widgets.Escalator::verticalScrollbar; var vScrollElem = vScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); - + var hScroll = esc.@com.vaadin.client.widgets.Escalator::horizontalScrollbar; var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); - + return $entry(function(e) { var target = e.target; - + // in case the scroll event was native (i.e. scrollbars were dragged, or // the scrollTop/Left was manually modified), the bundles have old cache // values. We need to make sure that the caches are kept up to date. @@ -729,29 +729,29 @@ public class Escalator extends Widget return $entry(function(e) { var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; - + // Delta mode 0 is in pixels; we don't need to do anything... - + // 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) { 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)) { var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; - + // Print warning message esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg); } - + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); }); }-*/; diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 68635b1825..19dfb79df6 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -2883,8 +2883,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, protected void setDefaultHeaderContent(HeaderCell selectionCell) { this.selectionCell = selectionCell; - // there is no checkbox yet -> create it if (selectAllCheckBox == null) { + // there is no checkbox yet -> create it selectAllCheckBox = GWT.create(CheckBox.class); selectAllCheckBox.setStylePrimaryName( getStylePrimaryName() + SELECT_ALL_CHECKBOX_CLASSNAME); @@ -2900,8 +2900,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, // Select all with space when "select all" cell is active addHeaderKeyUpHandler(this::onHeaderKeyUpEvent); - } else { // checkbox exists, but default header row has changed -> - // clear rows + } else { + // checkbox exists, but default header row has changed -> clear + // rows for (HeaderRow row : header.getRows()) { if (row.getCell(this) .getType() == GridStaticCellType.WIDGET) { @@ -4594,8 +4595,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, cellColumnIndex = cellColumnRightIndex - 1; } - else { // can't drop inside a spanned cell, or this is the - // dragged cell + else { + // can't drop inside a spanned cell, or this is the + // dragged cell while (colspan > 1) { cellColumnIndex++; colspan--; @@ -6156,7 +6158,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * * @param mode * a ColumnResizeMode value - * + * * @since 7.7.5 */ public void setColumnResizeMode(ColumnResizeMode mode) { |