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.tags/8.0.0.beta2
</dependencies> | </dependencies> | ||||
<build> | <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> | <plugins> | ||||
<plugin> | <plugin> | ||||
<groupId>org.apache.maven.plugins</groupId> | <groupId>org.apache.maven.plugins</groupId> |
listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e); | listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e); | ||||
}); | }); | ||||
callbackFunc.listener = listener; | callbackFunc.listener = listener; | ||||
elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); | elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); | ||||
// Store function reference for later removal | // Store function reference for later removal | ||||
if(!elem._vaadin_animationend_callbacks) { | if(!elem._vaadin_animationend_callbacks) { | ||||
elem._vaadin_animationend_callbacks = []; | elem._vaadin_animationend_callbacks = []; | ||||
} | } | ||||
elem._vaadin_animationend_callbacks.push(callbackFunc); | elem._vaadin_animationend_callbacks.push(callbackFunc); | ||||
return callbackFunc; | return callbackFunc; | ||||
}-*/; | }-*/; | ||||
return event.mozAnimationName; | return event.mozAnimationName; | ||||
else if(event.oAnimationName) | else if(event.oAnimationName) | ||||
return event.oAnimationName; | return event.oAnimationName; | ||||
return ""; | return ""; | ||||
}-*/; | }-*/; | ||||
public static native String getAnimationName(ComputedStyle cstyle) | public static native String getAnimationName(ComputedStyle cstyle) | ||||
/*-{ | /*-{ | ||||
var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; | var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; | ||||
if(!cs.getPropertyValue) | if(!cs.getPropertyValue) | ||||
return ""; | return ""; | ||||
if(cs.getPropertyValue("-webkit-animation-name")) | if(cs.getPropertyValue("-webkit-animation-name")) | ||||
return cs.getPropertyValue("-webkit-animation-name"); | return cs.getPropertyValue("-webkit-animation-name"); | ||||
else if(cs.getPropertyValue("animation-name")) | else if(cs.getPropertyValue("animation-name")) | ||||
return cs.getPropertyValue("animation-name"); | return cs.getPropertyValue("animation-name"); | ||||
else if(cs.getPropertyValue("-moz-animation-name")) | else if(cs.getPropertyValue("-moz-animation-name")) | ||||
return cs.getPropertyValue("-moz-animation-name"); | return cs.getPropertyValue("-moz-animation-name"); | ||||
else if(cs.getPropertyValue("-o-animation-name")) | else if(cs.getPropertyValue("-o-animation-name")) | ||||
return cs.getPropertyValue("-o-animation-name"); | return cs.getPropertyValue("-o-animation-name"); | ||||
return ""; | return ""; | ||||
}-*/; | }-*/; | ||||
'MozAnimation': 'animationend', | 'MozAnimation': 'animationend', | ||||
'WebkitAnimation': 'webkitAnimationEnd' | 'WebkitAnimation': 'webkitAnimationEnd' | ||||
} | } | ||||
for(var a in anims){ | for(var a in anims){ | ||||
if( el.style[a] !== undefined ){ | if( el.style[a] !== undefined ){ | ||||
return anims[a]; | return anims[a]; | ||||
'mozAnimation', | 'mozAnimation', | ||||
'webkitAnimation' | 'webkitAnimation' | ||||
] | ] | ||||
for(var i=0; i < anims.length; i++) { | for(var i=0; i < anims.length; i++) { | ||||
if( el.style[anims[i]] !== undefined ){ | if( el.style[anims[i]] !== undefined ){ | ||||
return anims[i]; | return anims[i]; |
return vi; | return vi; | ||||
} | } | ||||
} | } | ||||
client.getProfilingData = $entry(function() { | client.getProfilingData = $entry(function() { | ||||
var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); | var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); | ||||
var pd = [ | var pd = [ | ||||
pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; | pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; | ||||
return pd; | return pd; | ||||
}); | }); | ||||
client.getElementByPath = $entry(function(id) { | client.getElementByPath = $entry(function(id) { | ||||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); | return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); | ||||
}); | }); | ||||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); | return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); | ||||
}); | }); | ||||
client.initializing = false; | client.initializing = false; | ||||
$wnd.vaadin.clients[TTAppId] = client; | $wnd.vaadin.clients[TTAppId] = client; | ||||
}-*/; | }-*/; | ||||
/*-{ | /*-{ | ||||
if(!$doc.styleSheets) | if(!$doc.styleSheets) | ||||
return null; | return null; | ||||
selector = selector.toLowerCase(); | selector = selector.toLowerCase(); | ||||
var allMatches = []; | var allMatches = []; | ||||
// IE handles imported sheet differently | // IE handles imported sheet differently | ||||
if(deep && sheet.imports && sheet.imports.length > 0) { | if(deep && sheet.imports && sheet.imports.length > 0) { | ||||
for(var i=0; i < sheet.imports.length; i++) { | for(var i=0; i < sheet.imports.length; i++) { | ||||
allMatches.concat(imports); | allMatches.concat(imports); | ||||
} | } | ||||
} | } | ||||
var theRules = new Array(); | var theRules = new Array(); | ||||
if (sheet.cssRules) | if (sheet.cssRules) | ||||
theRules = sheet.cssRules | theRules = sheet.cssRules | ||||
else if (sheet.rules) | else if (sheet.rules) | ||||
theRules = sheet.rules | theRules = sheet.rules | ||||
var j = theRules.length; | var j = theRules.length; | ||||
for(var i=0; i<j; i++) { | for(var i=0; i<j; i++) { | ||||
var r = theRules[i]; | var r = theRules[i]; | ||||
allMatches = allMatches.concat(imports); | allMatches = allMatches.concat(imports); | ||||
} | } | ||||
} | } | ||||
return allMatches; | return allMatches; | ||||
}-*/; | }-*/; | ||||
if(elem.nodeType != 1) { | if(elem.nodeType != 1) { | ||||
return {}; | return {}; | ||||
} | } | ||||
if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) { | if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) { | ||||
return $wnd.document.defaultView.getComputedStyle(elem, null); | return $wnd.document.defaultView.getComputedStyle(elem, null); | ||||
} | } | ||||
if(elem.currentStyle) { | if(elem.currentStyle) { | ||||
return elem.currentStyle; | return elem.currentStyle; | ||||
} | } | ||||
/*-{ | /*-{ | ||||
var cs = this.@com.vaadin.client.ComputedStyle::computedStyle; | var cs = this.@com.vaadin.client.ComputedStyle::computedStyle; | ||||
var elem = this.@com.vaadin.client.ComputedStyle::elem; | var elem = this.@com.vaadin.client.ComputedStyle::elem; | ||||
// Border values need to be checked separately. The width might have a | // 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 | // meaningful value even if the border style is "none". In that case the | ||||
// value should be 0. | // value should be 0. | ||||
if(borderStyle == "none") | if(borderStyle == "none") | ||||
return "0px"; | return "0px"; | ||||
} | } | ||||
if(cs.getPropertyValue) { | if(cs.getPropertyValue) { | ||||
// Convert name to dashed format | // Convert name to dashed format | ||||
name = name.replace(/([A-Z])/g, "-$1").toLowerCase(); | name = name.replace(/([A-Z])/g, "-$1").toLowerCase(); | ||||
var ret = cs.getPropertyValue(name); | var ret = cs.getPropertyValue(name); | ||||
} else { | } else { | ||||
var ret = cs[name]; | var ret = cs[name]; | ||||
var style = elem.style; | var style = elem.style; | ||||
// From the awesome hack by Dean Edwards | // From the awesome hack by Dean Edwards | ||||
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||||
// If we're not dealing with a regular pixel number | // 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 | // but a number that has a weird ending, we need to convert it to pixels | ||||
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { | if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { | ||||
// Remember the original values | // Remember the original values | ||||
var left = style.left, rsLeft = elem.runtimeStyle.left; | var left = style.left, rsLeft = elem.runtimeStyle.left; | ||||
// Put in the new values to get a computed value out | // Put in the new values to get a computed value out | ||||
elem.runtimeStyle.left = cs.left; | elem.runtimeStyle.left = cs.left; | ||||
style.left = ret || 0; | style.left = ret || 0; | ||||
ret = style.pixelLeft + "px"; | ret = style.pixelLeft + "px"; | ||||
// Revert the changed values | // Revert the changed values | ||||
style.left = left; | style.left = left; | ||||
elem.runtimeStyle.left = rsLeft; | elem.runtimeStyle.left = rsLeft; | ||||
} | } | ||||
} | } | ||||
// Normalize margin values. This is not totally valid, but in most cases | // Normalize margin values. This is not totally valid, but in most cases | ||||
// it is what the user wants to know. | // it is what the user wants to know. | ||||
if(name.indexOf("margin") > -1 && ret == "auto") { | if(name.indexOf("margin") > -1 && ret == "auto") { | ||||
return "0px"; | return "0px"; | ||||
} | } | ||||
// Some browsers return undefined width and height values as "auto", so | // Some browsers return undefined width and height values as "auto", so | ||||
// we need to retrieve those ourselves. | // we need to retrieve those ourselves. | ||||
if (name == "width" && ret == "auto") { | if (name == "width" && ret == "auto") { | ||||
} else if (name == "height" && ret == "auto") { | } else if (name == "height" && ret == "auto") { | ||||
ret = elem.clientHeight + "px"; | ret = elem.clientHeight + "px"; | ||||
} | } | ||||
return ret; | return ret; | ||||
}-*/; | }-*/; | ||||
/** | /** |
if (rules === undefined) { | if (rules === undefined) { | ||||
rules = sheet.rules; | rules = sheet.rules; | ||||
} | } | ||||
if (rules === null) { | if (rules === null) { | ||||
// Style sheet loaded, but can't access length because of XSS -> assume there's something there | // Style sheet loaded, but can't access length because of XSS -> assume there's something there | ||||
return 1; | return 1; | ||||
} | } | ||||
// Return length so we can distinguish 0 (probably 404 error) from normal case. | // Return length so we can distinguish 0 (probably 404 error) from normal case. | ||||
return rules.length; | return rules.length; | ||||
} catch (err) { | } catch (err) { |
private native static String getRecompileParameters(String moduleName) | private native static String getRecompileParameters(String moduleName) | ||||
/*-{ | /*-{ | ||||
var prop_map = $wnd.__gwt_activeModules[moduleName].bindings(); | var prop_map = $wnd.__gwt_activeModules[moduleName].bindings(); | ||||
// convert map to URL parameter string | // convert map to URL parameter string | ||||
var props = []; | var props = []; | ||||
for (var key in prop_map) { | for (var key in prop_map) { | ||||
props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key])) | props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key])) | ||||
} | } | ||||
return props.join('&') + '&'; | return props.join('&') + '&'; | ||||
}-*/; | }-*/; | ||||
var mod = $wnd.__gwt_activeModules[moduleName]; | var mod = $wnd.__gwt_activeModules[moduleName]; | ||||
if (!mod) | if (!mod) | ||||
return false; | return false; | ||||
if (mod.superdevmode) { | if (mod.superdevmode) { | ||||
// Running in super dev mode already, it is supported | // Running in super dev mode already, it is supported | ||||
return true; | return true; | ||||
} | } | ||||
return !!mod.canRedirect; | return !!mod.canRedirect; | ||||
}-*/; | }-*/; | ||||
com.google.gwt.dom.client.Element el, String p) | com.google.gwt.dom.client.Element el, String p) | ||||
/*-{ | /*-{ | ||||
try { | try { | ||||
if (el.currentStyle) { | if (el.currentStyle) { | ||||
// IE | // IE | ||||
return el.currentStyle[p]; | return el.currentStyle[p]; | ||||
} catch (e) { | } catch (e) { | ||||
return ""; | return ""; | ||||
} | } | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
try { | try { | ||||
el.focus(); | el.focus(); | ||||
} catch (e) { | } catch (e) { | ||||
} | } | ||||
}-*/; | }-*/; | ||||
if ($wnd.document.activeElement) { | if ($wnd.document.activeElement) { | ||||
return $wnd.document.activeElement; | return $wnd.document.activeElement; | ||||
} | } | ||||
return null; | return null; | ||||
}-*/; | }-*/; | ||||
/*-{ | /*-{ | ||||
var top = elem.offsetTop; | var top = elem.offsetTop; | ||||
var height = elem.offsetHeight; | var height = elem.offsetHeight; | ||||
if (elem.parentNode != elem.offsetParent) { | if (elem.parentNode != elem.offsetParent) { | ||||
top -= elem.parentNode.offsetTop; | top -= elem.parentNode.offsetTop; | ||||
} | } | ||||
var cur = elem.parentNode; | var cur = elem.parentNode; | ||||
while (cur && (cur.nodeType == 1)) { | while (cur && (cur.nodeType == 1)) { | ||||
if (top < cur.scrollTop) { | if (top < cur.scrollTop) { | ||||
if (top + height > cur.scrollTop + cur.clientHeight) { | if (top + height > cur.scrollTop + cur.clientHeight) { | ||||
cur.scrollTop = (top + height) - cur.clientHeight; | cur.scrollTop = (top + height) - cur.clientHeight; | ||||
} | } | ||||
var offsetTop = cur.offsetTop; | var offsetTop = cur.offsetTop; | ||||
if (cur.parentNode != cur.offsetParent) { | if (cur.parentNode != cur.offsetParent) { | ||||
offsetTop -= cur.parentNode.offsetTop; | offsetTop -= cur.parentNode.offsetTop; | ||||
} | } | ||||
top += offsetTop - cur.scrollTop; | top += offsetTop - cur.scrollTop; | ||||
cur = cur.parentNode; | cur = cur.parentNode; | ||||
} | } | ||||
} | } | ||||
var heightWithoutBorder = cloneElement.offsetHeight; | var heightWithoutBorder = cloneElement.offsetHeight; | ||||
parentElement.removeChild(cloneElement); | parentElement.removeChild(cloneElement); | ||||
return heightWithBorder - heightWithoutBorder; | return heightWithBorder - heightWithoutBorder; | ||||
} | } | ||||
}-*/; | }-*/; |
JavaScriptObject config) | JavaScriptObject config) | ||||
/*-{ | /*-{ | ||||
var self = this; | var self = this; | ||||
config.url = uri; | config.url = uri; | ||||
config.onOpen = $entry(function(response) { | config.onOpen = $entry(function(response) { | ||||
self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); | self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); | ||||
config.onClientTimeout = $entry(function(request) { | config.onClientTimeout = $entry(function(request) { | ||||
self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request); | self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request); | ||||
}); | }); | ||||
return $wnd.vaadinPush.atmosphere.subscribe(config); | return $wnd.vaadinPush.atmosphere.subscribe(config); | ||||
}-*/; | }-*/; | ||||
private static native JavaScriptObject createCellReferenceWrapper() | private static native JavaScriptObject createCellReferenceWrapper() | ||||
/*-{ | /*-{ | ||||
var reference = {}; | var reference = {}; | ||||
var setProperty = function(name, getter, setter) { | var setProperty = function(name, getter, setter) { | ||||
var descriptor = { | var descriptor = { | ||||
get: getter | get: getter | ||||
} | } | ||||
Object.defineProperty(reference, name, descriptor); | Object.defineProperty(reference, name, descriptor); | ||||
}; | }; | ||||
setProperty("element", function() { | setProperty("element", function() { | ||||
return reference.target.@CellReference::getElement()(); | return reference.target.@CellReference::getElement()(); | ||||
}, null); | }, null); | ||||
setProperty("rowIndex", function() { | setProperty("rowIndex", function() { | ||||
return reference.target.@CellReference::getRowIndex()(); | return reference.target.@CellReference::getRowIndex()(); | ||||
}, null); | }, null); | ||||
setProperty("columnIndex", function() { | setProperty("columnIndex", function() { | ||||
return reference.target.@CellReference::getColumnIndex()(); | return reference.target.@CellReference::getColumnIndex()(); | ||||
}, null); | }, null); | ||||
setProperty("colSpan", function() { | setProperty("colSpan", function() { | ||||
return reference.target.@RendererCellReference::getColSpan()(); | return reference.target.@RendererCellReference::getColSpan()(); | ||||
}, function(colSpan) { | }, function(colSpan) { | ||||
reference.target.@RendererCellReference::setColSpan(*)(colSpan); | reference.target.@RendererCellReference::setColSpan(*)(colSpan); | ||||
}); | }); | ||||
return reference; | return reference; | ||||
}-*/; | }-*/; | ||||
public DebugButton(String caption) { | public DebugButton(String caption) { | ||||
this(null, null, caption); | this(null, null, caption); | ||||
} | } | ||||
public DebugButton(String caption, String title) { | public DebugButton(String caption, String title) { | ||||
this(null, title, caption); | this(null, title, caption); | ||||
} | } |
*/ | */ | ||||
private static native void searchForBreakPointsNative() | private static native void searchForBreakPointsNative() | ||||
/*-{ | /*-{ | ||||
// Initialize variables | // Initialize variables | ||||
@com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache = []; | @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache = []; | ||||
@com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache = []; | @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache = []; | ||||
var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; | var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; | ||||
var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; | var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; | ||||
// Can't do squat if we can't parse stylesheets | // Can't do squat if we can't parse stylesheets | ||||
if(!$doc.styleSheets) | if(!$doc.styleSheets) | ||||
return; | return; | ||||
var sheets = $doc.styleSheets; | var sheets = $doc.styleSheets; | ||||
// Loop all stylesheets on the page and process them individually | // Loop all stylesheets on the page and process them individually | ||||
for(var i = 0, len = sheets.length; i < len; i++) { | for(var i = 0, len = sheets.length; i < len; i++) { | ||||
var sheet = sheets[i]; | var sheet = sheets[i]; | ||||
@com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(sheet); | @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(sheet); | ||||
} | } | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
private static native void searchStylesheetForBreakPoints( | private static native void searchStylesheetForBreakPoints( | ||||
final JavaScriptObject sheet) | final JavaScriptObject sheet) | ||||
/*-{ | /*-{ | ||||
// Inline variables for easier reading | // Inline variables for easier reading | ||||
var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; | var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; | ||||
var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; | var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; | ||||
// Get all the rulesets from the stylesheet | // Get all the rulesets from the stylesheet | ||||
var theRules = new Array(); | 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()(); | var IEOrEdge = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE()() || @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isEdge()(); | ||||
try { | try { | ||||
if (sheet.cssRules) { | if (sheet.cssRules) { | ||||
theRules = sheet.cssRules | theRules = sheet.cssRules | ||||
", probably because of cross domain issues: " + e); | ", probably because of cross domain issues: " + e); | ||||
return; | return; | ||||
} | } | ||||
// Loop through the rulesets | // Loop through the rulesets | ||||
for(var i = 0, len = theRules.length; i < len; i++) { | for(var i = 0, len = theRules.length; i < len; i++) { | ||||
var rule = theRules[i]; | var rule = theRules[i]; | ||||
if(rule.type == 3) { | if(rule.type == 3) { | ||||
// @import rule, traverse recursively | // @import rule, traverse recursively | ||||
@com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(rule.styleSheet); | @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(rule.styleSheet); | ||||
} else if(rule.type == 1 || !rule.type) { | } else if(rule.type == 1 || !rule.type) { | ||||
// Regular selector rule | // Regular selector rule | ||||
// Helper function | // Helper function | ||||
var pushToCache = function(ranges, selector, min, max) { | var pushToCache = function(ranges, selector, min, max) { | ||||
// Avoid adding duplicates | // Avoid adding duplicates | ||||
ranges.push([selector, min, max]); | ranges.push([selector, min, max]); | ||||
} | } | ||||
}; | }; | ||||
// Array of all of the separate selectors in this ruleset | // Array of all of the separate selectors in this ruleset | ||||
var haystack = rule.selectorText.split(","); | var haystack = rule.selectorText.split(","); | ||||
// IE/Edge parses CSS like .class[attr="val"] into [attr="val"].class so we need to check for both | // IE/Edge parses CSS like .class[attr="val"] into [attr="val"].class so we need to check for both | ||||
var selectorRegEx = IEOrEdge ? /\[.*\]([\.|#]\S+)/ : /([\.|#]\S+?)\[.*\]/; | var selectorRegEx = IEOrEdge ? /\[.*\]([\.|#]\S+)/ : /([\.|#]\S+?)\[.*\]/; | ||||
// Loop all the selectors in this ruleset | // Loop all the selectors in this ruleset | ||||
for(var k = 0, len2 = haystack.length; k < len2; k++) { | for(var k = 0, len2 = haystack.length; k < len2; k++) { | ||||
// Split the haystack into parts. | // Split the haystack into parts. | ||||
var widthRange = haystack[k].match(/\[width-range.*?\]/); | var widthRange = haystack[k].match(/\[width-range.*?\]/); | ||||
var heightRange = haystack[k].match(/\[height-range.*?\]/); | var heightRange = haystack[k].match(/\[height-range.*?\]/); | ||||
var selector = haystack[k].match(selectorRegEx); | var selector = haystack[k].match(selectorRegEx); | ||||
if (selector != null) { | if (selector != null) { | ||||
selector = selector[1]; | selector = selector[1]; | ||||
// Check for width-ranges. | // Check for width-ranges. | ||||
if (widthRange != null) { | if (widthRange != null) { | ||||
var minMax = widthRange[0].match(/\[width-range~?=["|'](.*?)-(.*?)["|']\]/i); | var minMax = widthRange[0].match(/\[width-range~?=["|'](.*?)-(.*?)["|']\]/i); | ||||
var min = minMax[1]; | var min = minMax[1]; | ||||
var max = minMax[2]; | var max = minMax[2]; | ||||
pushToCache(widthRanges, selector, min, max); | pushToCache(widthRanges, selector, min, max); | ||||
} | } | ||||
// Check for height-ranges. | // Check for height-ranges. | ||||
if (heightRange != null) { | if (heightRange != null) { | ||||
var minMax = heightRange[0].match(/\[height-range~?=["|'](.*?)-(.*?)["|']\]/i); | var minMax = heightRange[0].match(/\[height-range~?=["|'](.*?)-(.*?)["|']\]/i); | ||||
var min = minMax[1]; | var min = minMax[1]; | ||||
var max = minMax[2]; | var max = minMax[2]; | ||||
pushToCache(heightRanges, selector, min, max); | pushToCache(heightRanges, selector, min, max); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
*/ | */ | ||||
private native void getBreakPointsFor(final String selectors) | private native void getBreakPointsFor(final String selectors) | ||||
/*-{ | /*-{ | ||||
var selectors = selectors.split(","); | var selectors = selectors.split(","); | ||||
var widthBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints = []; | var widthBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints = []; | ||||
var heightBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints = []; | var heightBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints = []; | ||||
var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; | var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; | ||||
var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; | var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; | ||||
for(var i = 0, len = widthRanges.length; i < len; i++) { | for(var i = 0, len = widthRanges.length; i < len; i++) { | ||||
var bp = widthRanges[i]; | var bp = widthRanges[i]; | ||||
for(var j = 0, len2 = selectors.length; j < len2; j++) { | for(var j = 0, len2 = selectors.length; j < len2; j++) { | ||||
widthBreakpoints.push(bp); | widthBreakpoints.push(bp); | ||||
} | } | ||||
} | } | ||||
for(var i = 0, len = heightRanges.length; i < len; i++) { | for(var i = 0, len = heightRanges.length; i < len; i++) { | ||||
var bp = heightRanges[i]; | var bp = heightRanges[i]; | ||||
for(var j = 0, len2 = selectors.length; j < len2; j++) { | for(var j = 0, len2 = selectors.length; j < len2; j++) { | ||||
heightBreakpoints.push(bp); | heightBreakpoints.push(bp); | ||||
} | } | ||||
} | } | ||||
// Only for debugging | // Only for debugging | ||||
// console.log("Breakpoints for", selectors.join(","), widthBreakpoints, heightBreakpoints); | // console.log("Breakpoints for", selectors.join(","), widthBreakpoints, heightBreakpoints); | ||||
}-*/; | }-*/; | ||||
private String currentWidthRanges = ""; | private String currentWidthRanges = ""; | ||||
private native String resolveBreakpoint(String which, int size) | private native String resolveBreakpoint(String which, int size) | ||||
/*-{ | /*-{ | ||||
// Default to "width" breakpoints | // Default to "width" breakpoints | ||||
var breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints; | var breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints; | ||||
// Use height breakpoints if we're measuring the height | // Use height breakpoints if we're measuring the height | ||||
if(which == "height") | if(which == "height") | ||||
breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints; | breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints; | ||||
// Output string that goes into either the "width-range" or "height-range" attribute in the element | // Output string that goes into either the "width-range" or "height-range" attribute in the element | ||||
var ranges = ""; | var ranges = ""; | ||||
// Loop the breakpoints | // Loop the breakpoints | ||||
for(var i = 0, len = breakpoints.length; i < len; i++) { | for(var i = 0, len = breakpoints.length; i < len; i++) { | ||||
var bp = breakpoints[i]; | var bp = breakpoints[i]; | ||||
var min = parseInt(bp[1]); | var min = parseInt(bp[1]); | ||||
var max = parseInt(bp[2]); | var max = parseInt(bp[2]); | ||||
if(!isNaN(min) && !isNaN(max)) { | if(!isNaN(min) && !isNaN(max)) { | ||||
if(min <= size && size <= max) { | if(min <= size && size <= max) { | ||||
ranges += " " + bp[1] + "-" + bp[2]; | ranges += " " + bp[1] + "-" + bp[2]; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Trim the output and return it | // Trim the output and return it | ||||
return ranges.replace(/^\s+/, ""); | return ranges.replace(/^\s+/, ""); | ||||
}-*/; | }-*/; | ||||
} | } |
var m = this; | var m = this; | ||||
var target = $wnd; | var target = $wnd; | ||||
var parts = name.split('.'); | var parts = name.split('.'); | ||||
for(var i = 0; i < parts.length - 1; i++) { | for(var i = 0; i < parts.length - 1; i++) { | ||||
var part = parts[i]; | var part = parts[i]; | ||||
if (target[part] === undefined) { | if (target[part] === undefined) { | ||||
} | } | ||||
target = target[part]; | target = target[part]; | ||||
} | } | ||||
target[parts[parts.length - 1]] = $entry(function() { | 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 | //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); | var args = Array.prototype.slice.call(arguments, 0); | ||||
/*-{ | /*-{ | ||||
var target = $wnd; | var target = $wnd; | ||||
var parts = name.split('.'); | var parts = name.split('.'); | ||||
for(var i = 0; i < parts.length - 1; i++) { | for(var i = 0; i < parts.length - 1; i++) { | ||||
var part = parts[i]; | var part = parts[i]; | ||||
if (target[part] === undefined) { | if (target[part] === undefined) { | ||||
} | } | ||||
target = target[part]; | target = target[part]; | ||||
} | } | ||||
$wnd.console.log('removing',parts[parts.length - 1],'from',target); | $wnd.console.log('removing',parts[parts.length - 1],'from',target); | ||||
delete target[parts[parts.length - 1]]; | delete target[parts[parts.length - 1]]; | ||||
}-*/; | }-*/; |
@Override | @Override | ||||
public void run() { | 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 | // The default context click | ||||
// implementation only provides the | // implementation only provides the | ||||
// mouse coordinates relative to root | // mouse coordinates relative to root |
// been set but before init() is called to enable e.g. | // been set but before init() is called to enable e.g. | ||||
// JavaScriptConnector to use connection when determining the tag name | // JavaScriptConnector to use connection when determining the tag name | ||||
if (this instanceof ComponentConnector) { | if (this instanceof ComponentConnector) { | ||||
setConnectorId( | |||||
((ComponentConnector) this).getWidget().getElement(), | |||||
setConnectorId(((ComponentConnector) this).getWidget().getElement(), | |||||
connectorId); | connectorId); | ||||
} | } | ||||
: 0; | : 0; | ||||
// If clicks are currently disallowed or phantom, keep it from | // If clicks are currently disallowed or phantom, keep it from | ||||
// bubbling or being passed to the superclass. | // 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 | 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(); | event.stopPropagation(); | ||||
disallowNextClick = false; | disallowNextClick = false; | ||||
return; | return; | ||||
private static native int getHorizontalBorderAndPaddingWidth(Element elem) | private static native int getHorizontalBorderAndPaddingWidth(Element elem) | ||||
/*-{ | /*-{ | ||||
// THIS METHOD IS ONLY USED FOR INTERNET EXPLORER, IT DOESN'T WORK WITH OTHERS | // THIS METHOD IS ONLY USED FOR INTERNET EXPLORER, IT DOESN'T WORK WITH OTHERS | ||||
var convertToPixel = function(elem, value) { | var convertToPixel = function(elem, value) { | ||||
// From the awesome hack by Dean Edwards | // From the awesome hack by Dean Edwards | ||||
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||||
// Remember the original values | // Remember the original values | ||||
var left = elem.style.left, rsLeft = elem.runtimeStyle.left; | var left = elem.style.left, rsLeft = elem.runtimeStyle.left; | ||||
// Put in the new values to get a computed value out | // Put in the new values to get a computed value out | ||||
elem.runtimeStyle.left = elem.currentStyle.left; | elem.runtimeStyle.left = elem.currentStyle.left; | ||||
elem.style.left = value || 0; | elem.style.left = value || 0; | ||||
var ret = elem.style.pixelLeft; | var ret = elem.style.pixelLeft; | ||||
// Revert the changed values | // Revert the changed values | ||||
elem.style.left = left; | elem.style.left = left; | ||||
elem.runtimeStyle.left = rsLeft; | elem.runtimeStyle.left = rsLeft; | ||||
return ret; | return ret; | ||||
} | } | ||||
var ret = 0; | var ret = 0; | ||||
var sides = ["Right","Left"]; | var sides = ["Right","Left"]; | ||||
for(var i=0; i<2; i++) { | for(var i=0; i<2; i++) { | ||||
var side = sides[i]; | var side = sides[i]; | ||||
ret += parseInt(value.substr(0, value.length-2)); | ret += parseInt(value.substr(0, value.length-2)); | ||||
} | } | ||||
} | } | ||||
// Padding ------------------------------------------------------- | // Padding ------------------------------------------------------- | ||||
value = elem.currentStyle["padding"+side]; | value = elem.currentStyle["padding"+side]; | ||||
if ( !/^\d+(px)?$/i.test( value ) && /^\d/.test( value ) ) { | if ( !/^\d+(px)?$/i.test( value ) && /^\d/.test( value ) ) { | ||||
ret += parseInt(value.substr(0, value.length-2)); | ret += parseInt(value.substr(0, value.length-2)); | ||||
} | } | ||||
} | } | ||||
return ret; | return ret; | ||||
}-*/; | }-*/; | ||||
return $entry(function(e) { | return $entry(function(e) { | ||||
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; | var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; | ||||
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; | var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; | ||||
// IE8 has only delta y | // IE8 has only delta y | ||||
if (isNaN(deltaY)) { | if (isNaN(deltaY)) { | ||||
deltaY = -0.5*e.wheelDelta; | deltaY = -0.5*e.wheelDelta; | ||||
} | } | ||||
@com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode); | @com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode); | ||||
}); | }); | ||||
}-*/; | }-*/; |
public final native void postFile(VHtml5File file) | public final native void postFile(VHtml5File file) | ||||
/*-{ | /*-{ | ||||
this.setRequestHeader('Content-Type', 'multipart/form-data'); | this.setRequestHeader('Content-Type', 'multipart/form-data'); | ||||
// Seems like IE10 will loose the file if we don't keep a reference to it... | // Seems like IE10 will loose the file if we don't keep a reference to it... | ||||
this.fileBeingUploaded = file; | this.fileBeingUploaded = file; | ||||
this.send(file); | this.send(file); | ||||
}-*/; | }-*/; | ||||
protected native void hookHtml5Events(com.google.gwt.user.client.Element el) | protected native void hookHtml5Events(com.google.gwt.user.client.Element el) | ||||
/*-{ | /*-{ | ||||
var me = this; | var me = this; | ||||
el.addEventListener("dragenter", $entry(function(ev) { | el.addEventListener("dragenter", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
}), false); | }), false); | ||||
el.addEventListener("dragleave", $entry(function(ev) { | el.addEventListener("dragleave", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
}), false); | }), false); | ||||
el.addEventListener("dragover", $entry(function(ev) { | el.addEventListener("dragover", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
}), false); | }), false); | ||||
el.addEventListener("drop", $entry(function(ev) { | el.addEventListener("drop", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
}), false); | }), false); |
com.google.gwt.user.client.Element el) | com.google.gwt.user.client.Element el) | ||||
/*-{ | /*-{ | ||||
var me = this; | var me = this; | ||||
el.attachEvent("ondragstart", $entry(function(ev) { | el.attachEvent("ondragstart", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragStart(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragStart(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
})); | })); | ||||
protected native void hookHtml5Events(com.google.gwt.user.client.Element el) | protected native void hookHtml5Events(com.google.gwt.user.client.Element el) | ||||
/*-{ | /*-{ | ||||
var me = this; | var me = this; | ||||
el.attachEvent("ondragenter", $entry(function(ev) { | el.attachEvent("ondragenter", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
})); | })); | ||||
el.attachEvent("ondragleave", $entry(function(ev) { | el.attachEvent("ondragleave", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
})); | })); | ||||
el.attachEvent("ondragover", $entry(function(ev) { | el.attachEvent("ondragover", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
})); | })); | ||||
el.attachEvent("ondrop", $entry(function(ev) { | el.attachEvent("ondrop", $entry(function(ev) { | ||||
return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); | ||||
})); | })); |
el.addEventListener('loadedmetadata', $entry(function(e) { | el.addEventListener('loadedmetadata', $entry(function(e) { | ||||
self.@com.vaadin.client.ui.VVideo::updateElementDynamicSize(II)(el.videoWidth, el.videoHeight); | self.@com.vaadin.client.ui.VVideo::updateElementDynamicSize(II)(el.videoWidth, el.videoHeight); | ||||
}), false); | }), false); | ||||
}-*/; | }-*/; | ||||
/** | /** |
childStyles.toArray(new String[childStyles.size()])); | childStyles.toArray(new String[childStyles.size()])); | ||||
} | } | ||||
if (stateChangeEvent.hasPropertyChanged("height") || stateChangeEvent.hasPropertyChanged("width")) { | |||||
if (stateChangeEvent.hasPropertyChanged("height") | |||||
|| stateChangeEvent.hasPropertyChanged("width")) { | |||||
setChildWidgetPosition(child); | setChildWidgetPosition(child); | ||||
} | } | ||||
} | } |
} | } | ||||
} | } | ||||
} | } | ||||
// Zero sized files without a type are also likely to be folders | // Zero sized files without a type are also likely to be folders | ||||
var file = this.dataTransfer.files[fileIndex]; | var file = this.dataTransfer.files[fileIndex]; | ||||
if (file.size == 0 && !file.type) { | if (file.size == 0 && !file.type) { | ||||
return false; | return false; | ||||
} | } | ||||
// TODO Make it detect folders on all browsers | // TODO Make it detect folders on all browsers | ||||
return true; | return true; | ||||
}-*/; | }-*/; | ||||
/*-{ | /*-{ | ||||
var vScroll = esc.@com.vaadin.client.widgets.Escalator::verticalScrollbar; | var vScroll = esc.@com.vaadin.client.widgets.Escalator::verticalScrollbar; | ||||
var vScrollElem = vScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | var vScrollElem = vScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | ||||
var hScroll = esc.@com.vaadin.client.widgets.Escalator::horizontalScrollbar; | var hScroll = esc.@com.vaadin.client.widgets.Escalator::horizontalScrollbar; | ||||
var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); | ||||
return $entry(function(e) { | return $entry(function(e) { | ||||
var target = e.target; | var target = e.target; | ||||
// in case the scroll event was native (i.e. scrollbars were dragged, or | // in case the scroll event was native (i.e. scrollbars were dragged, or | ||||
// the scrollTop/Left was manually modified), the bundles have old cache | // 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. | // values. We need to make sure that the caches are kept up to date. | ||||
return $entry(function(e) { | return $entry(function(e) { | ||||
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; | var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; | ||||
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; | var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; | ||||
// Delta mode 0 is in pixels; we don't need to do anything... | // 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 | // 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 | // We need to scale the number of lines by the default line height | ||||
if(e.deltaMode === 1) { | if(e.deltaMode === 1) { | ||||
var brc = esc.@com.vaadin.client.widgets.Escalator::body; | var brc = esc.@com.vaadin.client.widgets.Escalator::body; | ||||
deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); | deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); | ||||
} | } | ||||
// Other delta modes aren't supported | // Other delta modes aren't supported | ||||
if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { | if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { | ||||
var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; | var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; | ||||
// Print warning message | // Print warning message | ||||
esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg); | esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg); | ||||
} | } | ||||
// IE8 has only delta y | // IE8 has only delta y | ||||
if (isNaN(deltaY)) { | if (isNaN(deltaY)) { | ||||
deltaY = -0.5*e.wheelDelta; | deltaY = -0.5*e.wheelDelta; | ||||
} | } | ||||
@com.vaadin.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); | @com.vaadin.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); | ||||
}); | }); | ||||
}-*/; | }-*/; |
protected void setDefaultHeaderContent(HeaderCell selectionCell) { | protected void setDefaultHeaderContent(HeaderCell selectionCell) { | ||||
this.selectionCell = selectionCell; | this.selectionCell = selectionCell; | ||||
// there is no checkbox yet -> create it | |||||
if (selectAllCheckBox == null) { | if (selectAllCheckBox == null) { | ||||
// there is no checkbox yet -> create it | |||||
selectAllCheckBox = GWT.create(CheckBox.class); | selectAllCheckBox = GWT.create(CheckBox.class); | ||||
selectAllCheckBox.setStylePrimaryName( | selectAllCheckBox.setStylePrimaryName( | ||||
getStylePrimaryName() + SELECT_ALL_CHECKBOX_CLASSNAME); | getStylePrimaryName() + SELECT_ALL_CHECKBOX_CLASSNAME); | ||||
// Select all with space when "select all" cell is active | // Select all with space when "select all" cell is active | ||||
addHeaderKeyUpHandler(this::onHeaderKeyUpEvent); | 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()) { | for (HeaderRow row : header.getRows()) { | ||||
if (row.getCell(this) | if (row.getCell(this) | ||||
.getType() == GridStaticCellType.WIDGET) { | .getType() == GridStaticCellType.WIDGET) { | ||||
cellColumnIndex = cellColumnRightIndex - 1; | 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) { | while (colspan > 1) { | ||||
cellColumnIndex++; | cellColumnIndex++; | ||||
colspan--; | colspan--; | ||||
* | * | ||||
* @param mode | * @param mode | ||||
* a ColumnResizeMode value | * a ColumnResizeMode value | ||||
* | |||||
* | |||||
* @since 7.7.5 | * @since 7.7.5 | ||||
*/ | */ | ||||
public void setColumnResizeMode(ColumnResizeMode mode) { | public void setColumnResizeMode(ColumnResizeMode mode) { |
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> | <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.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.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_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.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"/> | <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> | ||||
<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.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.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.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.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_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"/> | <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> | ||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> | <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.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.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.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.alignment_for_arguments_in_annotation" value="0"/> | ||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> | <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> |
</pluginManagement> | </pluginManagement> | ||||
<plugins> | <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> | <plugin> | ||||
<groupId>org.codehaus.mojo</groupId> | <groupId>org.codehaus.mojo</groupId> | ||||
<artifactId>animal-sniffer-maven-plugin</artifactId> | <artifactId>animal-sniffer-maven-plugin</artifactId> |
* Helper classes with fluent API for constructing {@link QuerySortOrder} lists. | * Helper classes with fluent API for constructing {@link QuerySortOrder} lists. | ||||
* When the sort order is ready to be passed on, calling {@link #build()} will | * When the sort order is ready to be passed on, calling {@link #build()} will | ||||
* create the list of sort orders. | * create the list of sort orders. | ||||
* | |||||
* | |||||
* @see QuerySortOrder | * @see QuerySortOrder | ||||
* @see #thenDesc(String) | * @see #thenDesc(String) | ||||
* @see #thenDesc(String) | * @see #thenDesc(String) | ||||
* @see #build() | * @see #build() | ||||
*/ | */ | ||||
public class QuerySortOrderBuilder extends SortOrderBuilder<QuerySortOrder, String> { | |||||
public class QuerySortOrderBuilder | |||||
extends SortOrderBuilder<QuerySortOrder, String> { | |||||
@Override | @Override | ||||
public QuerySortOrderBuilder thenAsc(String by) { | public QuerySortOrderBuilder thenAsc(String by) { |
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* | * | ||||
* @since 8.0 | * @since 8.0 | ||||
* | |||||
* | |||||
* @param <T> | * @param <T> | ||||
* type of date ({@code LocalDate} or {@code LocalDateTime}). | * type of date ({@code LocalDate} or {@code LocalDateTime}). | ||||
* @param <R> | * @param <R> | ||||
* resolution enumeration type | * resolution enumeration type | ||||
* | |||||
* | |||||
*/ | */ | ||||
public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & Serializable & Comparable<? super T>, R extends Enum<R>> | public abstract class AbstractDateField<T extends Temporal & TemporalAdjuster & Serializable & Comparable<? super T>, R extends Enum<R>> | ||||
extends AbstractField<T> | extends AbstractField<T> | ||||
/** | /** | ||||
* Constructs an empty <code>AbstractDateField</code> with no caption and | * Constructs an empty <code>AbstractDateField</code> with no caption and | ||||
* specified {@code resolution}. | * specified {@code resolution}. | ||||
* | |||||
* | |||||
* @param resolution | * @param resolution | ||||
* initial resolution for the field | * initial resolution for the field | ||||
*/ | */ | ||||
&& (newDate == null || !newDate.equals(oldDate))) { | && (newDate == null || !newDate.equals(oldDate))) { | ||||
setValue(newDate, true); // Don't require a repaint, client | setValue(newDate, true); // Don't require a repaint, client | ||||
// updates itself | // updates itself | ||||
} else if (!uiHasValidDateString) { // oldDate == | |||||
// newDate == null | |||||
} else if (!uiHasValidDateString) { | |||||
// oldDate == | |||||
// newDate == null | |||||
// Empty value set, previously contained unparsable date string, | // Empty value set, previously contained unparsable date string, | ||||
// clear related internal fields | // clear related internal fields | ||||
setValue(null); | setValue(null); | ||||
/** | /** | ||||
* Returns a date integer value part for the given {@code date} for the | * Returns a date integer value part for the given {@code date} for the | ||||
* given {@code resolution}. | * given {@code resolution}. | ||||
* | |||||
* | |||||
* @param date | * @param date | ||||
* the given date | * the given date | ||||
* @param resolution | * @param resolution | ||||
* keys are resolution and integer values. | * keys are resolution and integer values. | ||||
* <p> | * <p> | ||||
* This is the opposite to {@link #getDatePart(Temporal, Enum)}. | * This is the opposite to {@link #getDatePart(Temporal, Enum)}. | ||||
* | |||||
* | |||||
* @param resolutionValues | * @param resolutionValues | ||||
* date values to construct a date | * date values to construct a date | ||||
* @return date built from the given map of date values | * @return date built from the given map of date values | ||||
/** | /** | ||||
* Returns a custom date range validator which is applicable for the type | * Returns a custom date range validator which is applicable for the type | ||||
* {@code T}. | * {@code T}. | ||||
* | |||||
* | |||||
* @return the date range validator | * @return the date range validator | ||||
*/ | */ | ||||
protected abstract RangeValidator<T> getRangeValidator(); | protected abstract RangeValidator<T> getRangeValidator(); | ||||
/** | /** | ||||
* Converts {@link Date} to date type {@code T}. | * Converts {@link Date} to date type {@code T}. | ||||
* | |||||
* | |||||
* @param date | * @param date | ||||
* a date to convert | * a date to convert | ||||
* @return object of type {@code T} representing the {@code date} | * @return object of type {@code T} representing the {@code date} | ||||
* Converts the object of type {@code T} to {@link Date}. | * Converts the object of type {@code T} to {@link Date}. | ||||
* <p> | * <p> | ||||
* This is the opposite to {@link #convertFromDate(Date)}. | * This is the opposite to {@link #convertFromDate(Date)}. | ||||
* | |||||
* | |||||
* @param date | * @param date | ||||
* the date of type {@code T} | * the date of type {@code T} | ||||
* @return converted date of type {@code Date} | * @return converted date of type {@code Date} |
// Nothing to do, just need the message to be sent and processed | // 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() { | private DebugWindowServerRpc debugRpc = new DebugWindowServerRpc() { | ||||
@Override | @Override |
assertEquals(Arrays.asList(), selected); | assertEquals(Arrays.asList(), selected); | ||||
selected.clear(); | selected.clear(); | ||||
// client side deselect | |||||
model.updateSelection(Collections.emptySet(), | 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); | assertEquals(Arrays.asList(Sex.MALE), selected); | ||||
selected.clear(); | selected.clear(); | ||||
.thenComparing(StrBean::getId); | .thenComparing(StrBean::getId); | ||||
List<StrBean> list = dataProvider | 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()); | .collect(Collectors.toList()); | ||||
// First value in data is { Xyz, 10, 100 } which should be last in list | // First value in data is { Xyz, 10, 100 } which should be last in list |
Object res; | Object res; | ||||
try { | try { | ||||
Thread.sleep(100); // for deadlock testing | Thread.sleep(100); // for deadlock testing | ||||
// simulates servlet container's session locking | |||||
org.junit.Assert.assertTrue("Deadlock detected", | 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() | String lockAttribute = mockService.getServiceName() | ||||
+ ".lock"; | + ".lock"; | ||||
if (lockAttribute.equals(name)) { | if (lockAttribute.equals(name)) { |
public void setup() { | public void setup() { | ||||
VaadinSession.setCurrent(null); | VaadinSession.setCurrent(null); | ||||
grid = new TestGrid(); | 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 | @Test | ||||
public void testNumbersNotNulls() { | public void testNumbersNotNulls() { | ||||
grid.sort(grid.getColumn("int"), SortDirection.ASCENDING); | 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 | @Test | ||||
public void testNumbers() { | public void testNumbers() { | ||||
grid.sort(grid.getColumn("int"), SortDirection.ASCENDING); | 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)); | Arrays.asList(1, 2, 3, null, null, null)); | ||||
} | } | ||||
@Test | @Test | ||||
public void testNumbersNotNullsDescending() { | public void testNumbersNotNullsDescending() { | ||||
grid.sort(grid.getColumn("int"), SortDirection.DESCENDING); | 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 | @Test | ||||
public void testNumbersDescending() { | public void testNumbersDescending() { | ||||
grid.sort(grid.getColumn("int"), SortDirection.DESCENDING); | 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)); | Arrays.asList(null, null, null, 3, 2, 1)); | ||||
} | } | ||||
@Test | @Test | ||||
public void testStringsNotNulls() { | public void testStringsNotNulls() { | ||||
grid.sort(grid.getColumn("String"), SortDirection.ASCENDING); | 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 | @Test | ||||
public void testStrings() { | public void testStrings() { | ||||
grid.sort(grid.getColumn("String"), SortDirection.ASCENDING); | 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)); | Arrays.asList(1, 2, 3, null, null, null)); | ||||
} | } | ||||
@Test | @Test | ||||
public void testStringsNotNullsDescending() { | public void testStringsNotNullsDescending() { | ||||
grid.sort(grid.getColumn("String"), SortDirection.DESCENDING); | 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 | @Test | ||||
public void testStringsDescending() { | public void testStringsDescending() { | ||||
grid.sort(grid.getColumn("String"), SortDirection.DESCENDING); | 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)); | Arrays.asList(null, null, null, 3, 2, 1)); | ||||
} | } | ||||
@Test | @Test | ||||
public void testBooleansNotNulls() { | public void testBooleansNotNulls() { | ||||
grid.sort(grid.getColumn("Boolean"), SortDirection.ASCENDING); | 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 | @Test | ||||
public void testBooleans() { | public void testBooleans() { | ||||
grid.sort(grid.getColumn("Boolean"), SortDirection.ASCENDING); | 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)); | Arrays.asList(1, 2, null, null, null)); | ||||
} | } | ||||
@Test | @Test | ||||
public void testBooleansNotNullsDescending() { | public void testBooleansNotNullsDescending() { | ||||
grid.sort(grid.getColumn("Boolean"), SortDirection.DESCENDING); | 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 | @Test | ||||
public void testBooleansDescending() { | public void testBooleansDescending() { | ||||
grid.sort(grid.getColumn("Boolean"), SortDirection.DESCENDING); | 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)); | Arrays.asList(null, null, null, 2, 1)); | ||||
} | } | ||||
private void performSort(List<Integer> source, List<Integer> expected) { | 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); | List<Integer> data = new ArrayList<>(source); | ||||
data.sort(sortingComparator); | data.sort(sortingComparator); | ||||
Assert.assertEquals(expected, data); | Assert.assertEquals(expected, data); |
public void testComponentFactoryThrowingStuff() { | public void testComponentFactoryThrowingStuff() { | ||||
currentComponentFactory.set((ComponentFactory) ( | currentComponentFactory.set((ComponentFactory) ( | ||||
String fullyQualifiedClassName, | String fullyQualifiedClassName, | ||||
// Will throw because class is not found | |||||
DesignContext context) -> defaultFactory.createComponent( | DesignContext context) -> defaultFactory.createComponent( | ||||
"foobar." + fullyQualifiedClassName, context) // Will | |||||
// throw | |||||
// because | |||||
// class | |||||
// is not | |||||
// found | |||||
); | |||||
"foobar." + fullyQualifiedClassName, context)); | |||||
Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes())); | Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes())); | ||||
} | } |
} | } | ||||
@Override | @Override | ||||
protected void readItems(Element design, | |||||
DesignContext context) { | |||||
protected void readItems(Element design, DesignContext context) { | |||||
} | } | ||||
@Override | @Override | ||||
} | } | ||||
@Override | @Override | ||||
protected void readItems(Element design, | |||||
DesignContext context) { | |||||
protected void readItems(Element design, DesignContext context) { | |||||
} | } | ||||
@Override | @Override | ||||
}); | }); | ||||
Assert.assertSame(registration, actualRegistration); | 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(select, event.get().getComponent()); | ||||
Assert.assertEquals(value, event.get().getOldValue()); | Assert.assertEquals(value, event.get().getOldValue()); |
public void initiallyEmpty() { | public void initiallyEmpty() { | ||||
DateTimeField dateTimeField = new DateTimeField(); | DateTimeField dateTimeField = new DateTimeField(); | ||||
Assert.assertTrue(dateTimeField.isEmpty()); | Assert.assertTrue(dateTimeField.isEmpty()); | ||||
Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); | |||||
Assert.assertEquals(DateTimeResolution.MINUTE, | |||||
dateTimeField.getResolution()); | |||||
} | } | ||||
@Test | @Test | ||||
public void testValueConstructor_emptyAfterClear() { | public void testValueConstructor_emptyAfterClear() { | ||||
DateTimeField dateTimeField = new DateTimeField(null, LocalDateTime.now()); | |||||
DateTimeField dateTimeField = new DateTimeField(null, | |||||
LocalDateTime.now()); | |||||
Assert.assertFalse(dateTimeField.isEmpty()); | Assert.assertFalse(dateTimeField.isEmpty()); | ||||
Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); | |||||
Assert.assertEquals(DateTimeResolution.MINUTE, | |||||
dateTimeField.getResolution()); | |||||
dateTimeField.clear(); | dateTimeField.clear(); | ||||
Assert.assertTrue(dateTimeField.isEmpty()); | Assert.assertTrue(dateTimeField.isEmpty()); | ||||
HasValue.ValueChangeListener valueChangeListener = Mockito | HasValue.ValueChangeListener valueChangeListener = Mockito | ||||
.mock(HasValue.ValueChangeListener.class); | .mock(HasValue.ValueChangeListener.class); | ||||
DateTimeField dateTimeField = new DateTimeField(valueChangeListener); | DateTimeField dateTimeField = new DateTimeField(valueChangeListener); | ||||
Assert.assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution()); | |||||
Assert.assertEquals(DateTimeResolution.MINUTE, | |||||
dateTimeField.getResolution()); | |||||
dateTimeField.setValue(LocalDateTime.now()); | dateTimeField.setValue(LocalDateTime.now()); | ||||
HasValue.ValueChangeListener valueChangeListener = Mockito | HasValue.ValueChangeListener valueChangeListener = Mockito | ||||
.mock(HasValue.ValueChangeListener.class); | .mock(HasValue.ValueChangeListener.class); | ||||
DateTimeField dateTimeField = new DateTimeField("Caption", | 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()) | verify(valueChangeListener, never()) | ||||
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class)); | .valueChange(Mockito.any(HasValue.ValueChangeEvent.class)); |
public void testCaptionValueListener() { | public void testCaptionValueListener() { | ||||
HasValue.ValueChangeListener valueChangeListener = Mockito | HasValue.ValueChangeListener valueChangeListener = Mockito | ||||
.mock(HasValue.ValueChangeListener.class); | .mock(HasValue.ValueChangeListener.class); | ||||
PasswordField passwordField = new PasswordField("Caption", "Initial value", | |||||
valueChangeListener); | |||||
PasswordField passwordField = new PasswordField("Caption", | |||||
"Initial value", valueChangeListener); | |||||
verify(valueChangeListener, never()) | verify(valueChangeListener, never()) | ||||
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class)); | .valueChange(Mockito.any(HasValue.ValueChangeEvent.class)); |
* should always be called to ensure the message is flushed right away. | * should always be called to ensure the message is flushed right away. | ||||
*/ | */ | ||||
public void poll(); | public void poll(); | ||||
public void popstate(String uri); | public void popstate(String uri); | ||||
@NoLoadingIndicator | @NoLoadingIndicator |
} | } | ||||
public GridCellElement getCell(int columnIndex) { | 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); | return e.wrap(GridCellElement.class); | ||||
} | } | ||||
} | } | ||||
* @return Header cell element with given indices. | * @return Header cell element with given indices. | ||||
*/ | */ | ||||
public GridCellElement getHeaderCell(int rowIndex, int colIndex) { | public GridCellElement getHeaderCell(int rowIndex, int colIndex) { | ||||
return getSubPart("#header[" + rowIndex + "][" + colIndex + "]").wrap( | |||||
GridCellElement.class); | |||||
return getSubPart("#header[" + rowIndex + "][" + colIndex + "]") | |||||
.wrap(GridCellElement.class); | |||||
} | } | ||||
/** | /** | ||||
*/ | */ | ||||
public GridCellElement getHeaderCellByCaption(String caption) { | public GridCellElement getHeaderCellByCaption(String caption) { | ||||
List<WebElement> headerRows = findElement(By.vaadin("#header")) | List<WebElement> headerRows = findElement(By.vaadin("#header")) | ||||
.findElements(By.xpath("./tr/th")); | |||||
.findElements(By.xpath("./tr/th")); | |||||
for (WebElement header : headerRows) { | for (WebElement header : headerRows) { | ||||
if (caption.equals(header.getText())) { | if (caption.equals(header.getText())) { | ||||
return TestBenchElement | return TestBenchElement | ||||
.wrapElement(header, getCommandExecutor()) | |||||
.wrap(GridCellElement.class); | |||||
.wrapElement(header, getCommandExecutor()) | |||||
.wrap(GridCellElement.class); | |||||
} | } | ||||
} | } | ||||
String errorMessage = String | 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); | throw new NoSuchElementException(errorMessage); | ||||
} | } | ||||
* if there is no header row or no header cell with the given | * if there is no header row or no header cell with the given | ||||
* text. | * text. | ||||
*/ | */ | ||||
public GridCellElement getHeaderCellByCaption(int rowIndex, String caption) { | |||||
public GridCellElement getHeaderCellByCaption(int rowIndex, | |||||
String caption) { | |||||
List<GridCellElement> headerCells = getHeaderCells(rowIndex); | List<GridCellElement> headerCells = getHeaderCells(rowIndex); | ||||
for (GridCellElement cell : headerCells) { | for (GridCellElement cell : headerCells) { | ||||
if (caption.equals(cell.getText())) { | if (caption.equals(cell.getText())) { |
* Build test layout for #8255 | * Build test layout for #8255 | ||||
*/ | */ | ||||
private void addStartWithFullWidth(AbsoluteLayout layout) { | 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.setWidth("100%"); | ||||
full.setId("expanding-panel"); | full.setId("expanding-panel"); | ||||
* Build test layout for #8256 | * Build test layout for #8256 | ||||
*/ | */ | ||||
private void addStartWithDefinedWidth(AbsoluteLayout layout) { | 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.setWidth("250px"); | ||||
small.setId("small-panel"); | small.setId("small-panel"); | ||||
layout.addComponent(expandButton(small), "left: 10x; top: 150px;"); | layout.addComponent(expandButton(small), "left: 10x; top: 150px;"); | ||||
} | } | ||||
/** | /** | ||||
* Build test layout for #8257 | * Build test layout for #8257 | ||||
*/ | */ | ||||
private void addStartWithDefinedWidthAbsoluteLayout(AbsoluteLayout layout) { | private void addStartWithDefinedWidthAbsoluteLayout(AbsoluteLayout layout) { | ||||
AbsoluteLayout layoutExpading = new AbsoluteLayout(); | AbsoluteLayout layoutExpading = new AbsoluteLayout(); | ||||
layoutExpading.setWidth("250px"); | 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"); | layoutExpading.setId("absolute-expanding"); | ||||
layout.addComponent(layoutExpading, "right:0;top:200px;"); | layout.addComponent(layoutExpading, "right:0;top:200px;"); | ||||
layout.addComponent(expandButton(layoutExpading), "left: 10x; top: 250px;"); | |||||
layout.addComponent(expandButton(layoutExpading), | |||||
"left: 10x; top: 250px;"); | |||||
} | } | ||||
/** | /** | ||||
* @return Created Expand Button | * @return Created Expand Button | ||||
*/ | */ | ||||
private Button expandButton(Component component) { | 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"); | button.setId(component.getId() + "-button"); | ||||
return button; | return button; | ||||
} | } |
persons = createPersons(10, new Random(1)); | persons = createPersons(10, new Random(1)); | ||||
grid = new Grid<>(); | grid = new Grid<>(); | ||||
ListDataProvider<ComplexPerson> provider = DataProvider.ofCollection(persons); | |||||
ListDataProvider<ComplexPerson> provider = DataProvider | |||||
.ofCollection(persons); | |||||
grid.setDataProvider(provider); | grid.setDataProvider(provider); | ||||
grid.getSelectionModel().select(persons.get(0)); | grid.getSelectionModel().select(persons.get(0)); | ||||
addComponent(new Button("Remove first", event -> { | addComponent(new Button("Remove first", event -> { |
Grid<DataObject> grid = new Grid<>(); | Grid<DataObject> grid = new Grid<>(); | ||||
List<DataObject> data = DataObject.generateObjects(); | List<DataObject> data = DataObject.generateObjects(); | ||||
ListDataProvider<DataObject> dataProvider = DataProvider.ofCollection(data); | |||||
ListDataProvider<DataObject> dataProvider = DataProvider | |||||
.ofCollection(data); | |||||
grid.setDataProvider(dataProvider); | grid.setDataProvider(dataProvider); | ||||
grid.setDataProvider(dataProvider); | grid.setDataProvider(dataProvider); |
HorizontalSortableCssLayoutWithWrappers verticalSortableCssLayoutWithWrappers = new HorizontalSortableCssLayoutWithWrappers(); | HorizontalSortableCssLayoutWithWrappers verticalSortableCssLayoutWithWrappers = new HorizontalSortableCssLayoutWithWrappers(); | ||||
w.addWindow(verticalSortableCssLayoutWithWrappers); | w.addWindow(verticalSortableCssLayoutWithWrappers); | ||||
verticalSortableCssLayoutWithWrappers.setPositionX(200); | 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; | Label l; | ||||
import com.vaadin.ui.HorizontalLayout; | import com.vaadin.ui.HorizontalLayout; | ||||
public class CompatibilityElementComponentGetCaptionHorizontal extends | |||||
CompatibilityElementComponentGetCaptionBase { | |||||
public class CompatibilityElementComponentGetCaptionHorizontal | |||||
extends CompatibilityElementComponentGetCaptionBase { | |||||
public CompatibilityElementComponentGetCaptionHorizontal() { | public CompatibilityElementComponentGetCaptionHorizontal() { | ||||
mainLayout = new HorizontalLayout(); | mainLayout = new HorizontalLayout(); |
import com.vaadin.v7.ui.Tree; | import com.vaadin.v7.ui.Tree; | ||||
import com.vaadin.v7.ui.TwinColSelect; | import com.vaadin.v7.ui.TwinColSelect; | ||||
public class CompatibilityAbstractFieldElementSetValueReadOnly extends AbstractTestUI { | |||||
public class CompatibilityAbstractFieldElementSetValueReadOnly | |||||
extends AbstractTestUI { | |||||
AbstractField<?>[] elems = { new ComboBox(), new ListSelect(), | AbstractField<?>[] elems = { new ComboBox(), new ListSelect(), | ||||
new NativeSelect(), new OptionGroup(), new Table(), new Tree(), | new NativeSelect(), new OptionGroup(), new Table(), new Tree(), |
final Grid<Item> grid = new Grid<Item>(); | final Grid<Item> grid = new Grid<Item>(); | ||||
grid.setItems(getMockData(rowCount)); | grid.setItems(getMockData(rowCount)); | ||||
Grid.Column<Item, String> column = grid.addColumn(Item::getFoo) | 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"); | row.getCell(column).setText("extra row"); | ||||
grid.addColumn(Item::getBar).setCaption("bar"); | grid.addColumn(Item::getBar).setCaption("bar"); | ||||
public class NativeSelectSetValue extends AbstractTestUI { | public class NativeSelectSetValue extends AbstractTestUI { | ||||
private int counter = 0; | private int counter = 0; | ||||
Label lblCounter = new Label("0"); | Label lblCounter = new Label("0"); | ||||
public class NotificationGetTypeAndDescription extends AbstractTestUI { | public class NotificationGetTypeAndDescription extends AbstractTestUI { | ||||
private final static Type[] types = { Type.WARNING_MESSAGE, | 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", | public final static String[] captions = { "warningC", "errorC", | ||||
"humanizedC", "tray_notificationC" }; | "humanizedC", "tray_notificationC" }; | ||||
public final static String[] descriptions = { "warning", "error", | public final static String[] descriptions = { "warning", "error", |
addComponent(ts); | addComponent(ts); | ||||
// Create a tab sheet that has icons instead of text captions | // Create a tab sheet that has icons instead of text captions | ||||
TabSheet ts2 = new TabSheet(); | 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.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.setClosable(false); | ||||
newTab = ts2.addTab(createTabContent(12)); | newTab = ts2.addTab(createTabContent(12)); | ||||
newTab.setClosable(false); | newTab.setClosable(false); | ||||
newTab = ts2.addTab(createTabContent(12)); | newTab = ts2.addTab(createTabContent(12)); | ||||
newTab.setClosable(true); | 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); | newTab.setClosable(true); | ||||
addComponent(ts2); | addComponent(ts2); | ||||
} | } |
public class TreeTableElementExpandRow extends AbstractTestUI { | public class TreeTableElementExpandRow extends AbstractTestUI { | ||||
TreeTable treeTable = new TreeTable(); | TreeTable treeTable = new TreeTable(); | ||||
public static final String TEST_VALUE = "testValue"; | public static final String TEST_VALUE = "testValue"; | ||||
* | * | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
public class ItemDataProvider | |||||
extends CallbackDataProvider<String, String> { | |||||
public class ItemDataProvider extends CallbackDataProvider<String, String> { | |||||
public ItemDataProvider(int size) { | public ItemDataProvider(int size) { | ||||
super(q -> itemStream(q, size).skip(q.getOffset()).limit(q.getLimit()), | super(q -> itemStream(q, size).skip(q.getOffset()).limit(q.getLimit()), |
public enum EmptyEnum { | public enum EmptyEnum { | ||||
} | } | ||||
import java.util.Optional; | import java.util.Optional; | ||||
/** | /** | ||||
* Tests for component positioning after width changes from defined to relative and relative to defined | * Tests for component positioning after width changes from defined to relative and relative to defined | ||||
*/ | */ | ||||
Optional<WebElement> panelWrapper = getComponentWrapper(componentId); | 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"); | 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)); | 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 | // Click button to change component size | ||||
$(ButtonElement.class).id(componentId + "-button").click(); | $(ButtonElement.class).id(componentId + "-button").click(); | ||||
left = panelWrapper.get().getCssValue("left"); | 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 | @Test | ||||
Optional<WebElement> panelWrapper = getComponentWrapper(componentId); | 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"); | 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)); | 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 | // Click button to change component size | ||||
$(ButtonElement.class).id(componentId + "-button").click(); | $(ButtonElement.class).id(componentId + "-button").click(); | ||||
left = panelWrapper.get().getCssValue("left"); | 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 | @Test | ||||
Optional<WebElement> panelWrapper = getComponentWrapper(componentId); | 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"); | 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)); | 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 | // Click button to change component size | ||||
$(ButtonElement.class).id(componentId + "-button").click(); | $(ButtonElement.class).id(componentId + "-button").click(); | ||||
left = panelWrapper.get().getCssValue("left"); | 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()); | |||||
} | } | ||||
/** | /** | ||||
private Optional<WebElement> getComponentWrapper(String componentId) { | private Optional<WebElement> getComponentWrapper(String componentId) { | ||||
WebElement panelWrapper = null; | 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. | // Check if this wrapper contains element with the wanted id. | ||||
if (!wrapper.findElements(By.id(componentId)).isEmpty()) { | if (!wrapper.findElements(By.id(componentId)).isEmpty()) { | ||||
panelWrapper = wrapper; | panelWrapper = wrapper; |
driver.navigate().back(); | driver.navigate().back(); | ||||
driver.findElement(By.className("v-Notification")).getText() | driver.findElement(By.className("v-Notification")).getText() | ||||
.contains("Popstate event"); | |||||
.contains("Popstate event"); | |||||
assertUri(getTestUrl()); | assertUri(getTestUrl()); | ||||
private void assertCellText(String text, int rowIndex, int colIndex) { | private void assertCellText(String text, int rowIndex, int colIndex) { | ||||
String firstCellText = $(GridElement.class).first() | String firstCellText = $(GridElement.class).first() | ||||
.getCell(rowIndex, colIndex) | |||||
.getText(); | |||||
.getCell(rowIndex, colIndex).getText(); | |||||
Assert.assertEquals(text, firstCellText); | Assert.assertEquals(text, firstCellText); | ||||
} | } | ||||
} | } |
* the License. | * the License. | ||||
*/ | */ | ||||
public class CompatibilityComponentElementGetValueTest extends MultiBrowserTest { | |||||
public class CompatibilityComponentElementGetValueTest | |||||
extends MultiBrowserTest { | |||||
@Before | @Before | ||||
public void init() { | public void init() { |
GridElement grid = $(GridElement.class).first(); | GridElement grid = $(GridElement.class).first(); | ||||
grid.getHeaderCellByCaption(1, "extra row"); | grid.getHeaderCellByCaption(1, "extra row"); | ||||
} | } | ||||
private int checkRows() { | private int checkRows() { | ||||
int rowCount = 0; | int rowCount = 0; | ||||
for (final GridRowElement row : getRows()) { | for (final GridRowElement row : getRows()) { |