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 | |
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.
57 files changed, 340 insertions, 313 deletions
diff --git a/buildhelpers/pom.xml b/buildhelpers/pom.xml index 4b238df73e..3ddd27917b 100644 --- a/buildhelpers/pom.xml +++ b/buildhelpers/pom.xml @@ -36,6 +36,14 @@ </dependencies> <build> + <resources> + <!-- Include eclipse formatting settings in the jar to make them available + as a dependency for all submodules --> + <resource> + <directory>${project.basedir}/../eclipse</directory> + <targetPath>eclipse</targetPath> + </resource> + </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> 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) { diff --git a/eclipse/VaadinJavaConventions.xml b/eclipse/VaadinJavaConventions.xml index 8d2c47ab90..370d3e8def 100644 --- a/eclipse/VaadinJavaConventions.xml +++ b/eclipse/VaadinJavaConventions.xml @@ -48,7 +48,7 @@ <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
@@ -167,7 +167,7 @@ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
@@ -242,7 +242,7 @@ <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
@@ -486,6 +486,23 @@ <plugins> <plugin> + <groupId>com.marvinformatics.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <version>1.8.1</version> + <configuration> + <configFile>classpath:/eclipse/VaadinJavaConventions.xml</configFile> + <!-- Provide a dummy JS config file to avoid errors --> + <configJsFile>classpath:/eclipse/VaadinJavaConventions.xml</configJsFile> + </configuration> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>vaadin-buildhelpers</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-maven-plugin</artifactId> <executions> diff --git a/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java b/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java index 1f8d1e1aab..eebe257973 100644 --- a/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java +++ b/server/src/main/java/com/vaadin/data/provider/QuerySortOrderBuilder.java @@ -21,13 +21,14 @@ import com.vaadin.shared.data.sort.SortDirection; * Helper classes with fluent API for constructing {@link QuerySortOrder} lists. * When the sort order is ready to be passed on, calling {@link #build()} will * create the list of sort orders. - * + * * @see QuerySortOrder * @see #thenDesc(String) * @see #thenDesc(String) * @see #build() */ -public class QuerySortOrderBuilder extends SortOrderBuilder<QuerySortOrder, String> { +public class QuerySortOrderBuilder + extends SortOrderBuilder<QuerySortOrder, String> { @Override public QuerySortOrderBuilder thenAsc(String by) { diff --git a/server/src/main/java/com/vaadin/ui/AbstractDateField.java b/server/src/main/java/com/vaadin/ui/AbstractDateField.java index 57e0b0ce5f..06e6d74c30 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractDateField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractDateField.java @@ -62,12 +62,12 @@ import com.vaadin.ui.declarative.DesignContext; * @author Vaadin Ltd * * @since 8.0 - * + * * @param <T> * type of date ({@code LocalDate} or {@code LocalDateTime}). * @param <R> * resolution enumeration type - * + * */ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & Serializable & Comparable<? super T>, R extends Enum<R>> extends AbstractField<T> @@ -121,7 +121,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & /** * Constructs an empty <code>AbstractDateField</code> with no caption and * specified {@code resolution}. - * + * * @param resolution * initial resolution for the field */ @@ -317,8 +317,9 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & && (newDate == null || !newDate.equals(oldDate))) { setValue(newDate, true); // Don't require a repaint, client // updates itself - } else if (!uiHasValidDateString) { // oldDate == - // newDate == null + } else if (!uiHasValidDateString) { + // oldDate == + // newDate == null // Empty value set, previously contained unparsable date string, // clear related internal fields setValue(null); @@ -693,7 +694,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & /** * Returns a date integer value part for the given {@code date} for the * given {@code resolution}. - * + * * @param date * the given date * @param resolution @@ -707,7 +708,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & * keys are resolution and integer values. * <p> * This is the opposite to {@link #getDatePart(Temporal, Enum)}. - * + * * @param resolutionValues * date values to construct a date * @return date built from the given map of date values @@ -717,14 +718,14 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & /** * Returns a custom date range validator which is applicable for the type * {@code T}. - * + * * @return the date range validator */ protected abstract RangeValidator<T> getRangeValidator(); /** * Converts {@link Date} to date type {@code T}. - * + * * @param date * a date to convert * @return object of type {@code T} representing the {@code date} @@ -735,7 +736,7 @@ public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & * Converts the object of type {@code T} to {@link Date}. * <p> * This is the opposite to {@link #convertFromDate(Date)}. - * + * * @param date * the date of type {@code T} * @return converted date of type {@code Date} diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index c0dabb37c0..00ccf2b0e2 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -194,11 +194,11 @@ public abstract class UI extends AbstractSingleComponentContainer // Nothing to do, just need the message to be sent and processed } - @Override - public void popstate(String uri) { - getPage().updateLocation(uri, true, true); - - } + @Override + public void popstate(String uri) { + getPage().updateLocation(uri, true, true); + + } }; private DebugWindowServerRpc debugRpc = new DebugWindowServerRpc() { @Override diff --git a/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java b/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java index 398af7c1b1..5cda28b639 100644 --- a/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java +++ b/server/src/test/java/com/vaadin/data/GridAsMultiSelectInBinderTest.java @@ -233,10 +233,10 @@ public class GridAsMultiSelectInBinderTest assertEquals(Arrays.asList(), selected); selected.clear(); + // client side deselect model.updateSelection(Collections.emptySet(), - new LinkedHashSet<>(Arrays.asList(Sex.UNKNOWN)), true); // client - // side - // deselect + new LinkedHashSet<>(Arrays.asList(Sex.UNKNOWN)), true); + assertEquals(Arrays.asList(Sex.MALE), selected); selected.clear(); diff --git a/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java b/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java index 84f011abf8..2fea57ae80 100644 --- a/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java +++ b/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java @@ -82,9 +82,8 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria .thenComparing(StrBean::getId); List<StrBean> list = dataProvider - .fetch(createQuery( - QuerySortOrder.asc("value").thenAsc("randomNumber") - .thenAsc("id").build(), comp)) + .fetch(createQuery(QuerySortOrder.asc("value") + .thenAsc("randomNumber").thenAsc("id").build(), comp)) .collect(Collectors.toList()); // First value in data is { Xyz, 10, 100 } which should be last in list diff --git a/server/src/test/java/com/vaadin/server/VaadinSessionTest.java b/server/src/test/java/com/vaadin/server/VaadinSessionTest.java index 0a26bef1f6..5b5528e8e3 100644 --- a/server/src/test/java/com/vaadin/server/VaadinSessionTest.java +++ b/server/src/test/java/com/vaadin/server/VaadinSessionTest.java @@ -74,12 +74,10 @@ public class VaadinSessionTest implements Serializable { Object res; try { Thread.sleep(100); // for deadlock testing + + // simulates servlet container's session locking org.junit.Assert.assertTrue("Deadlock detected", - httpSessionLock.tryLock(5, TimeUnit.SECONDS)); // simulates - // servlet - // container's - // session - // locking + httpSessionLock.tryLock(5, TimeUnit.SECONDS)); String lockAttribute = mockService.getServiceName() + ".lock"; if (lockAttribute.equals(name)) { diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java index 4a3a0315c5..57cc19fa1b 100644 --- a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java +++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java @@ -34,111 +34,95 @@ public class GridNullValueSort { public void setup() { VaadinSession.setCurrent(null); grid = new TestGrid(); - grid.addColumn(i -> i, new NumberRenderer()).setId("int").setSortable(true); - grid.addColumn(i -> i == null ? null : String.valueOf(i)).setId("String").setSortable(true); - grid.addColumn(i -> i == null ? null : i != 1, booleanRenderer()).setId("Boolean").setSortable(true); + grid.addColumn(i -> i, new NumberRenderer()).setId("int") + .setSortable(true); + grid.addColumn(i -> i == null ? null : String.valueOf(i)) + .setId("String").setSortable(true); + grid.addColumn(i -> i == null ? null : i != 1, booleanRenderer()) + .setId("Boolean").setSortable(true); } @Test public void testNumbersNotNulls() { grid.sort(grid.getColumn("int"), SortDirection.ASCENDING); - performSort( - Arrays.asList(2, 1, 3), - Arrays.asList(1, 2, 3)); + performSort(Arrays.asList(2, 1, 3), Arrays.asList(1, 2, 3)); } @Test public void testNumbers() { grid.sort(grid.getColumn("int"), SortDirection.ASCENDING); - performSort( - Arrays.asList(1, 2, null, 3, null, null), + performSort(Arrays.asList(1, 2, null, 3, null, null), Arrays.asList(1, 2, 3, null, null, null)); } @Test public void testNumbersNotNullsDescending() { grid.sort(grid.getColumn("int"), SortDirection.DESCENDING); - performSort( - Arrays.asList(1, 2, 3), - Arrays.asList(3, 2, 1)); + performSort(Arrays.asList(1, 2, 3), Arrays.asList(3, 2, 1)); } @Test public void testNumbersDescending() { grid.sort(grid.getColumn("int"), SortDirection.DESCENDING); - performSort( - Arrays.asList(1, 3, null, null, null, 2), + performSort(Arrays.asList(1, 3, null, null, null, 2), Arrays.asList(null, null, null, 3, 2, 1)); } @Test public void testStringsNotNulls() { grid.sort(grid.getColumn("String"), SortDirection.ASCENDING); - performSort( - Arrays.asList(2, 1, 3), - Arrays.asList(1, 2, 3)); + performSort(Arrays.asList(2, 1, 3), Arrays.asList(1, 2, 3)); } @Test public void testStrings() { grid.sort(grid.getColumn("String"), SortDirection.ASCENDING); - performSort( - Arrays.asList(1, 2, null, 3, null, null), + performSort(Arrays.asList(1, 2, null, 3, null, null), Arrays.asList(1, 2, 3, null, null, null)); } @Test public void testStringsNotNullsDescending() { grid.sort(grid.getColumn("String"), SortDirection.DESCENDING); - performSort( - Arrays.asList(1, 2, 3), - Arrays.asList(3, 2, 1)); + performSort(Arrays.asList(1, 2, 3), Arrays.asList(3, 2, 1)); } @Test public void testStringsDescending() { grid.sort(grid.getColumn("String"), SortDirection.DESCENDING); - performSort( - Arrays.asList(1, 3, null, null, null, 2), + performSort(Arrays.asList(1, 3, null, null, null, 2), Arrays.asList(null, null, null, 3, 2, 1)); } - @Test public void testBooleansNotNulls() { grid.sort(grid.getColumn("Boolean"), SortDirection.ASCENDING); - performSort( - Arrays.asList(2, 1), - Arrays.asList(1, 2)); + performSort(Arrays.asList(2, 1), Arrays.asList(1, 2)); } @Test public void testBooleans() { grid.sort(grid.getColumn("Boolean"), SortDirection.ASCENDING); - performSort( - Arrays.asList(1, null, 2, null, null), + performSort(Arrays.asList(1, null, 2, null, null), Arrays.asList(1, 2, null, null, null)); } @Test public void testBooleansNotNullsDescending() { grid.sort(grid.getColumn("Boolean"), SortDirection.DESCENDING); - performSort( - Arrays.asList(1, 2), - Arrays.asList(2, 1)); + performSort(Arrays.asList(1, 2), Arrays.asList(2, 1)); } @Test public void testBooleansDescending() { grid.sort(grid.getColumn("Boolean"), SortDirection.DESCENDING); - performSort( - Arrays.asList(1, null, null, null, 2), + performSort(Arrays.asList(1, null, null, null, 2), Arrays.asList(null, null, null, 2, 1)); } - private void performSort(List<Integer> source, List<Integer> expected) { - SerializableComparator<Integer> sortingComparator = grid.createSortingComparator(); + SerializableComparator<Integer> sortingComparator = grid + .createSortingComparator(); List<Integer> data = new ArrayList<>(source); data.sort(sortingComparator); Assert.assertEquals(expected, data); diff --git a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java index 98224d90c1..813ff361f3 100644 --- a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java +++ b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java @@ -88,14 +88,9 @@ public class ComponentFactoryTest { public void testComponentFactoryThrowingStuff() { currentComponentFactory.set((ComponentFactory) ( String fullyQualifiedClassName, + // Will throw because class is not found DesignContext context) -> defaultFactory.createComponent( - "foobar." + fullyQualifiedClassName, context) // Will - // throw - // because - // class - // is not - // found - ); + "foobar." + fullyQualifiedClassName, context)); Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes())); } diff --git a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java index fa419118ff..6097ab3af7 100644 --- a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java +++ b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java @@ -62,8 +62,7 @@ public class AbstractSingleSelectTest { } @Override - protected void readItems(Element design, - DesignContext context) { + protected void readItems(Element design, DesignContext context) { } @Override @@ -265,8 +264,7 @@ public class AbstractSingleSelectTest { } @Override - protected void readItems(Element design, - DesignContext context) { + protected void readItems(Element design, DesignContext context) { } @Override @@ -283,9 +281,8 @@ public class AbstractSingleSelectTest { }); Assert.assertSame(registration, actualRegistration); - selectionListener.get() - .selectionChange( - new SingleSelectionEvent<>(select, value, true)); + selectionListener.get().selectionChange( + new SingleSelectionEvent<>(select, value, true)); Assert.assertEquals(select, event.get().getComponent()); Assert.assertEquals(value, event.get().getOldValue()); diff --git a/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java index 21715f7782..90a452942e 100644 --- a/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java +++ b/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java @@ -32,14 +32,17 @@ public class DateTimeFieldConstructorTest { public void initiallyEmpty() { DateTimeField dateTimeField = new DateTimeField(); Assert.assertTrue(dateTimeField.isEmpty()); - Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); + Assert.assertEquals(DateTimeResolution.MINUTE, + dateTimeField.getResolution()); } @Test public void testValueConstructor_emptyAfterClear() { - DateTimeField dateTimeField = new DateTimeField(null, LocalDateTime.now()); + DateTimeField dateTimeField = new DateTimeField(null, + LocalDateTime.now()); Assert.assertFalse(dateTimeField.isEmpty()); - Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); + Assert.assertEquals(DateTimeResolution.MINUTE, + dateTimeField.getResolution()); dateTimeField.clear(); Assert.assertTrue(dateTimeField.isEmpty()); @@ -50,7 +53,8 @@ public class DateTimeFieldConstructorTest { HasValue.ValueChangeListener valueChangeListener = Mockito .mock(HasValue.ValueChangeListener.class); DateTimeField dateTimeField = new DateTimeField(valueChangeListener); - Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); + Assert.assertEquals(DateTimeResolution.MINUTE, + dateTimeField.getResolution()); dateTimeField.setValue(LocalDateTime.now()); @@ -64,9 +68,9 @@ public class DateTimeFieldConstructorTest { HasValue.ValueChangeListener valueChangeListener = Mockito .mock(HasValue.ValueChangeListener.class); DateTimeField dateTimeField = new DateTimeField("Caption", - LocalDateTime.now(), - valueChangeListener); - Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); + LocalDateTime.now(), valueChangeListener); + Assert.assertEquals(DateTimeResolution.MINUTE, + dateTimeField.getResolution()); verify(valueChangeListener, never()) .valueChange(Mockito.any(HasValue.ValueChangeEvent.class)); diff --git a/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java index 61f31b0269..d6f8cc2a5c 100644 --- a/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java +++ b/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java @@ -57,8 +57,8 @@ public class PasswordFieldConstructorTest { public void testCaptionValueListener() { HasValue.ValueChangeListener valueChangeListener = Mockito .mock(HasValue.ValueChangeListener.class); - PasswordField passwordField = new PasswordField("Caption", "Initial value", - valueChangeListener); + PasswordField passwordField = new PasswordField("Caption", + "Initial value", valueChangeListener); verify(valueChangeListener, never()) .valueChange(Mockito.any(HasValue.ValueChangeEvent.class)); diff --git a/shared/src/main/java/com/vaadin/shared/ui/ui/UIServerRpc.java b/shared/src/main/java/com/vaadin/shared/ui/ui/UIServerRpc.java index 15391dc023..151719985b 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/ui/UIServerRpc.java +++ b/shared/src/main/java/com/vaadin/shared/ui/ui/UIServerRpc.java @@ -35,7 +35,7 @@ public interface UIServerRpc extends ClickRpc, ServerRpc { * should always be called to ensure the message is flushed right away. */ public void poll(); - + public void popstate(String uri); @NoLoadingIndicator diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java index 5970cc53a1..bdc26ed663 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/GridElement.java @@ -64,8 +64,8 @@ public class GridElement extends AbstractComponentElement { } public GridCellElement getCell(int columnIndex) { - TestBenchElement e = (TestBenchElement) findElement(By - .xpath("./td[" + (columnIndex + 1) + "]")); + TestBenchElement e = (TestBenchElement) findElement( + By.xpath("./td[" + (columnIndex + 1) + "]")); return e.wrap(GridCellElement.class); } } @@ -206,8 +206,8 @@ public class GridElement extends AbstractComponentElement { * @return Header cell element with given indices. */ public GridCellElement getHeaderCell(int rowIndex, int colIndex) { - return getSubPart("#header[" + rowIndex + "][" + colIndex + "]").wrap( - GridCellElement.class); + return getSubPart("#header[" + rowIndex + "][" + colIndex + "]") + .wrap(GridCellElement.class); } /** @@ -223,16 +223,16 @@ public class GridElement extends AbstractComponentElement { */ public GridCellElement getHeaderCellByCaption(String caption) { List<WebElement> headerRows = findElement(By.vaadin("#header")) - .findElements(By.xpath("./tr/th")); + .findElements(By.xpath("./tr/th")); for (WebElement header : headerRows) { if (caption.equals(header.getText())) { return TestBenchElement - .wrapElement(header, getCommandExecutor()) - .wrap(GridCellElement.class); + .wrapElement(header, getCommandExecutor()) + .wrap(GridCellElement.class); } } String errorMessage = String - .format("There is no header cell with %s caption. ", caption); + .format("There is no header cell with %s caption. ", caption); throw new NoSuchElementException(errorMessage); } @@ -250,7 +250,8 @@ public class GridElement extends AbstractComponentElement { * if there is no header row or no header cell with the given * text. */ - public GridCellElement getHeaderCellByCaption(int rowIndex, String caption) { + public GridCellElement getHeaderCellByCaption(int rowIndex, + String caption) { List<GridCellElement> headerCells = getHeaderCells(rowIndex); for (GridCellElement cell : headerCells) { if (caption.equals(cell.getText())) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponents.java b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponents.java index fc9753bc22..215faeab7f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponents.java @@ -29,7 +29,8 @@ public class AbsoluteLayoutResizeComponents extends AbstractReindeerTestUI { * Build test layout for #8255 */ private void addStartWithFullWidth(AbsoluteLayout layout) { - final Panel full = new Panel(new CssLayout(new Label("Start Width 100%"))); + final Panel full = new Panel( + new CssLayout(new Label("Start Width 100%"))); full.setWidth("100%"); full.setId("expanding-panel"); @@ -41,7 +42,8 @@ public class AbsoluteLayoutResizeComponents extends AbstractReindeerTestUI { * Build test layout for #8256 */ private void addStartWithDefinedWidth(AbsoluteLayout layout) { - final Panel small = new Panel(new CssLayout(new Label("Start Width 250px"))); + final Panel small = new Panel( + new CssLayout(new Label("Start Width 250px"))); small.setWidth("250px"); small.setId("small-panel"); @@ -49,18 +51,19 @@ public class AbsoluteLayoutResizeComponents extends AbstractReindeerTestUI { layout.addComponent(expandButton(small), "left: 10x; top: 150px;"); } - /** * Build test layout for #8257 */ private void addStartWithDefinedWidthAbsoluteLayout(AbsoluteLayout layout) { AbsoluteLayout layoutExpading = new AbsoluteLayout(); layoutExpading.setWidth("250px"); - layoutExpading.addComponent(new Panel(new CssLayout(new Label("Start Width 250px")))); + layoutExpading.addComponent( + new Panel(new CssLayout(new Label("Start Width 250px")))); layoutExpading.setId("absolute-expanding"); layout.addComponent(layoutExpading, "right:0;top:200px;"); - layout.addComponent(expandButton(layoutExpading), "left: 10x; top: 250px;"); + layout.addComponent(expandButton(layoutExpading), + "left: 10x; top: 250px;"); } /** @@ -70,7 +73,8 @@ public class AbsoluteLayoutResizeComponents extends AbstractReindeerTestUI { * @return Created Expand Button */ private Button expandButton(Component component) { - Button button = new Button("Change Size", clickEvent -> resizeComponent(component)); + Button button = new Button("Change Size", + clickEvent -> resizeComponent(component)); button.setId(component.getId() + "-button"); return button; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDataSourceReset.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDataSourceReset.java index a2589ce452..7cb0e63545 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDataSourceReset.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDataSourceReset.java @@ -37,7 +37,8 @@ public class GridDataSourceReset extends AbstractTestUI { persons = createPersons(10, new Random(1)); grid = new Grid<>(); - ListDataProvider<ComplexPerson> provider = DataProvider.ofCollection(persons); + ListDataProvider<ComplexPerson> provider = DataProvider + .ofCollection(persons); grid.setDataProvider(provider); grid.getSelectionModel().select(persons.get(0)); addComponent(new Button("Remove first", event -> { diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/RefreshDataProvider.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/RefreshDataProvider.java index 87da435796..66b73eb87d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/RefreshDataProvider.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/RefreshDataProvider.java @@ -35,7 +35,8 @@ public class RefreshDataProvider extends AbstractReindeerTestUI { Grid<DataObject> grid = new Grid<>(); List<DataObject> data = DataObject.generateObjects(); - ListDataProvider<DataObject> dataProvider = DataProvider.ofCollection(data); + ListDataProvider<DataObject> dataProvider = DataProvider + .ofCollection(data); grid.setDataProvider(dataProvider); grid.setDataProvider(dataProvider); diff --git a/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java b/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java index 0e7fd737d0..e932c02505 100644 --- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java +++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest5.java @@ -52,11 +52,10 @@ public class DDTest5 extends TestBase { HorizontalSortableCssLayoutWithWrappers verticalSortableCssLayoutWithWrappers = new HorizontalSortableCssLayoutWithWrappers(); w.addWindow(verticalSortableCssLayoutWithWrappers); verticalSortableCssLayoutWithWrappers.setPositionX(200); - verticalSortableCssLayoutWithWrappers - .setPositionY(40); /* - * FIXME: subwindow horizontal position does - * not work if only x set - */ + /* + * FIXME: subwindow horizontal position does not work if only x set + */ + verticalSortableCssLayoutWithWrappers.setPositionY(40); Label l; diff --git a/uitest/src/main/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionHorizontal.java b/uitest/src/main/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionHorizontal.java index e980471959..34b3663c7d 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionHorizontal.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/CompatibilityElementComponentGetCaptionHorizontal.java @@ -17,8 +17,8 @@ package com.vaadin.tests.elements; import com.vaadin.ui.HorizontalLayout; -public class CompatibilityElementComponentGetCaptionHorizontal extends - CompatibilityElementComponentGetCaptionBase { +public class CompatibilityElementComponentGetCaptionHorizontal + extends CompatibilityElementComponentGetCaptionBase { public CompatibilityElementComponentGetCaptionHorizontal() { mainLayout = new HorizontalLayout(); diff --git a/uitest/src/main/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractFieldElementSetValueReadOnly.java b/uitest/src/main/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractFieldElementSetValueReadOnly.java index 2b18a48095..768177683a 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractFieldElementSetValueReadOnly.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/abstracttextfield/CompatibilityAbstractFieldElementSetValueReadOnly.java @@ -20,7 +20,8 @@ import com.vaadin.v7.ui.TextField; import com.vaadin.v7.ui.Tree; import com.vaadin.v7.ui.TwinColSelect; -public class CompatibilityAbstractFieldElementSetValueReadOnly extends AbstractTestUI { +public class CompatibilityAbstractFieldElementSetValueReadOnly + extends AbstractTestUI { AbstractField<?>[] elems = { new ComboBox(), new ListSelect(), new NativeSelect(), new OptionGroup(), new Table(), new Tree(), diff --git a/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java b/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java index b92c667307..a90072c31f 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java @@ -21,8 +21,8 @@ public class GridUI extends AbstractTestUI { final Grid<Item> grid = new Grid<Item>(); grid.setItems(getMockData(rowCount)); Grid.Column<Item, String> column = grid.addColumn(Item::getFoo) - .setCaption("foo"); - HeaderRow row =grid.addHeaderRowAt(1); + .setCaption("foo"); + HeaderRow row = grid.addHeaderRowAt(1); row.getCell(column).setText("extra row"); grid.addColumn(Item::getBar).setCaption("bar"); diff --git a/uitest/src/main/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValue.java b/uitest/src/main/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValue.java index 43fc10cde1..3849439b16 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValue.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/nativeselect/NativeSelectSetValue.java @@ -13,7 +13,6 @@ import com.vaadin.ui.NativeSelect; public class NativeSelectSetValue extends AbstractTestUI { - private int counter = 0; Label lblCounter = new Label("0"); diff --git a/uitest/src/main/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescription.java b/uitest/src/main/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescription.java index 2b208d3e42..f57d8418ec 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescription.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/notification/NotificationGetTypeAndDescription.java @@ -11,9 +11,10 @@ import com.vaadin.ui.Notification.Type; public class NotificationGetTypeAndDescription extends AbstractTestUI { private final static Type[] types = { Type.WARNING_MESSAGE, - Type.ERROR_MESSAGE, Type.HUMANIZED_MESSAGE, Type.TRAY_NOTIFICATION }; - public final static String[] type_names = { "warning", "error", - "humanized", "tray_notification" }; + Type.ERROR_MESSAGE, Type.HUMANIZED_MESSAGE, + Type.TRAY_NOTIFICATION }; + public final static String[] type_names = { "warning", "error", "humanized", + "tray_notification" }; public final static String[] captions = { "warningC", "errorC", "humanizedC", "tray_notificationC" }; public final static String[] descriptions = { "warning", "error", diff --git a/uitest/src/main/java/com/vaadin/tests/elements/tabsheet/TabSheetElementTabWithoutCaption.java b/uitest/src/main/java/com/vaadin/tests/elements/tabsheet/TabSheetElementTabWithoutCaption.java index 048baf7404..d0cc9e4eb7 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/tabsheet/TabSheetElementTabWithoutCaption.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/tabsheet/TabSheetElementTabWithoutCaption.java @@ -42,18 +42,18 @@ public class TabSheetElementTabWithoutCaption extends AbstractTestUI { addComponent(ts); // Create a tab sheet that has icons instead of text captions TabSheet ts2 = new TabSheet(); - newTab = ts2.addTab(createTabContent(10), null, new ThemeResource( - "favicon.ico")); + newTab = ts2.addTab(createTabContent(10), null, + new ThemeResource("favicon.ico")); newTab.setClosable(true); - newTab = ts2.addTab(createTabContent(11), null, new ThemeResource( - "window/img/maximize.png")); + newTab = ts2.addTab(createTabContent(11), null, + new ThemeResource("window/img/maximize.png")); newTab.setClosable(false); newTab = ts2.addTab(createTabContent(12)); newTab.setClosable(false); newTab = ts2.addTab(createTabContent(12)); newTab.setClosable(true); - newTab = ts2.addTab(createTabContent(13), null, new ThemeResource( - "window/img/restore.png")); + newTab = ts2.addTab(createTabContent(13), null, + new ThemeResource("window/img/restore.png")); newTab.setClosable(true); addComponent(ts2); } diff --git a/uitest/src/main/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRow.java b/uitest/src/main/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRow.java index cde3fc794b..eedbf705ba 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRow.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/treetable/TreeTableElementExpandRow.java @@ -6,7 +6,6 @@ import com.vaadin.v7.ui.TreeTable; public class TreeTableElementExpandRow extends AbstractTestUI { - TreeTable treeTable = new TreeTable(); public static final String TEST_VALUE = "testValue"; diff --git a/uitest/src/main/java/com/vaadin/tests/util/ItemDataProvider.java b/uitest/src/main/java/com/vaadin/tests/util/ItemDataProvider.java index 90d668cf78..89bb76abe7 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/ItemDataProvider.java +++ b/uitest/src/main/java/com/vaadin/tests/util/ItemDataProvider.java @@ -12,8 +12,7 @@ import com.vaadin.data.provider.Query; * * @author Vaadin Ltd */ -public class ItemDataProvider - extends CallbackDataProvider<String, String> { +public class ItemDataProvider extends CallbackDataProvider<String, String> { public ItemDataProvider(int size) { super(q -> itemStream(q, size).skip(q.getOffset()).limit(q.getLimit()), diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java index 6e0b97eea7..7bf5ac25ce 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/EmptyEnum.java @@ -22,4 +22,3 @@ package com.vaadin.tests.widgetset.client; public enum EmptyEnum { } - diff --git a/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java index 6efee81a04..d25e2088c9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutResizeComponentsTest.java @@ -9,7 +9,6 @@ import org.openqa.selenium.WebElement; import java.util.Optional; - /** * Tests for component positioning after width changes from defined to relative and relative to defined */ @@ -23,20 +22,27 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { Optional<WebElement> panelWrapper = getComponentWrapper(componentId); - Assert.assertTrue("No wrapper element found for expanding panel [ID: " + componentId + "]", panelWrapper.isPresent()); + Assert.assertTrue("No wrapper element found for expanding panel [ID: " + + componentId + "]", panelWrapper.isPresent()); String left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals("Component wrapper was missing left:0; from its css positioning", "0px", left); + Assert.assertEquals( + "Component wrapper was missing left:0; from its css positioning", + "0px", left); WebElement panelComponent = findElement(By.id(componentId)); - Assert.assertEquals("Panel is not on the left side of the screen", 0, panelComponent.getLocation().getX()); + Assert.assertEquals("Panel is not on the left side of the screen", 0, + panelComponent.getLocation().getX()); // Click button to change component size $(ButtonElement.class).id(componentId + "-button").click(); left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals("Component wrapper did not have its left positioning reset to auto", "auto", left); - Assert.assertNotEquals("Panel is still on the left side of the screen", 0, panelComponent.getLocation().getX()); + Assert.assertEquals( + "Component wrapper did not have its left positioning reset to auto", + "auto", left); + Assert.assertNotEquals("Panel is still on the left side of the screen", + 0, panelComponent.getLocation().getX()); } @Test @@ -47,22 +53,29 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { Optional<WebElement> panelWrapper = getComponentWrapper(componentId); - Assert.assertTrue("No wrapper element found for panel [ID: " + componentId + "]", panelWrapper.isPresent()); + Assert.assertTrue( + "No wrapper element found for panel [ID: " + componentId + "]", + panelWrapper.isPresent()); String left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals("Component wrapper has a set Left marker", "auto", left); + Assert.assertEquals("Component wrapper has a set Left marker", "auto", + left); WebElement panelComponent = findElement(By.id(componentId)); - Assert.assertNotEquals("Panel is positioned to the left side of the screen", 0, panelComponent.getLocation().getX()); + Assert.assertNotEquals( + "Panel is positioned to the left side of the screen", 0, + panelComponent.getLocation().getX()); // Click button to change component size $(ButtonElement.class).id(componentId + "-button").click(); - left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals("Component wrapper was missing left:0; from its css positioning", "0px", left); + Assert.assertEquals( + "Component wrapper was missing left:0; from its css positioning", + "0px", left); - Assert.assertEquals("Panel is not on the left side of the screen", 0, panelComponent.getLocation().getX()); + Assert.assertEquals("Panel is not on the left side of the screen", 0, + panelComponent.getLocation().getX()); } @Test @@ -73,21 +86,29 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { Optional<WebElement> panelWrapper = getComponentWrapper(componentId); - Assert.assertTrue("No wrapper element found for AbsoluteLayout [ID: " + componentId + "].", panelWrapper.isPresent()); + Assert.assertTrue("No wrapper element found for AbsoluteLayout [ID: " + + componentId + "].", panelWrapper.isPresent()); String left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals("Component wrapper did not have its left positioning reset to auto", "auto", left); + Assert.assertEquals( + "Component wrapper did not have its left positioning reset to auto", + "auto", left); WebElement panelComponent = findElement(By.id(componentId)); - Assert.assertNotEquals("Panel is positioned to the left side of the screen", 0, panelComponent.getLocation().getX()); + Assert.assertNotEquals( + "Panel is positioned to the left side of the screen", 0, + panelComponent.getLocation().getX()); // Click button to change component size $(ButtonElement.class).id(componentId + "-button").click(); left = panelWrapper.get().getCssValue("left"); - Assert.assertEquals("Component wrapper was missing left:0; from its css positioning", "0px", left); + Assert.assertEquals( + "Component wrapper was missing left:0; from its css positioning", + "0px", left); - Assert.assertEquals("Panel is not on the left side of the screen", 0, panelComponent.getLocation().getX()); + Assert.assertEquals("Panel is not on the left side of the screen", 0, + panelComponent.getLocation().getX()); } /** @@ -99,7 +120,8 @@ public class AbsoluteLayoutResizeComponentsTest extends MultiBrowserTest { private Optional<WebElement> getComponentWrapper(String componentId) { WebElement panelWrapper = null; - for (WebElement wrapper : findElements(By.className("v-absolutelayout-wrapper"))) { + for (WebElement wrapper : findElements( + By.className("v-absolutelayout-wrapper"))) { // Check if this wrapper contains element with the wanted id. if (!wrapper.findElements(By.id(componentId)).isEmpty()) { panelWrapper = wrapper; diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/PushStateAndReplaceStateTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/PushStateAndReplaceStateTest.java index a57cbf6ed5..159967af2a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/PushStateAndReplaceStateTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/PushStateAndReplaceStateTest.java @@ -25,7 +25,7 @@ public class PushStateAndReplaceStateTest extends MultiBrowserTest { driver.navigate().back(); driver.findElement(By.className("v-Notification")).getText() - .contains("Popstate event"); + .contains("Popstate event"); assertUri(getTestUrl()); diff --git a/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java b/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java index 7fa495cf24..41731296ac 100644 --- a/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java +++ b/uitest/src/test/java/com/vaadin/tests/data/ReplaceDataProviderTest.java @@ -46,8 +46,7 @@ public class ReplaceDataProviderTest extends SingleBrowserTest { private void assertCellText(String text, int rowIndex, int colIndex) { String firstCellText = $(GridElement.class).first() - .getCell(rowIndex, colIndex) - .getText(); + .getCell(rowIndex, colIndex).getText(); Assert.assertEquals(text, firstCellText); } } diff --git a/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java b/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java index 28ed259840..c2a0c81b6c 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/CompatibilityComponentElementGetValueTest.java @@ -35,7 +35,8 @@ import com.vaadin.tests.tb3.MultiBrowserTest; * the License. */ -public class CompatibilityComponentElementGetValueTest extends MultiBrowserTest { +public class CompatibilityComponentElementGetValueTest + extends MultiBrowserTest { @Before public void init() { diff --git a/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java b/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java index 8652972df1..8ac0aae0fe 100644 --- a/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java +++ b/uitest/src/test/java/com/vaadin/tests/elements/grid/GridUITest.java @@ -83,7 +83,7 @@ public class GridUITest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); grid.getHeaderCellByCaption(1, "extra row"); } - + private int checkRows() { int rowCount = 0; for (final GridRowElement row : getRows()) { |