diff --git a/flow-client/src/main/java/com/vaadin/client/BrowserInfo.java b/flow-client/src/main/java/com/vaadin/client/BrowserInfo.java
index c94f94b6ad2..6d93e73ab12 100644
--- a/flow-client/src/main/java/com/vaadin/client/BrowserInfo.java
+++ b/flow-client/src/main/java/com/vaadin/client/BrowserInfo.java
@@ -209,8 +209,6 @@ private static native String getBrowserString()
return $wnd.navigator.userAgent;
}-*/;
-
-
private static native boolean isIos()
/*-{
return (/iPad|iPhone|iPod/.test(navigator.platform) ||
diff --git a/flow-client/src/main/java/com/vaadin/client/Console.java b/flow-client/src/main/java/com/vaadin/client/Console.java
index 54dfaeef0e0..773ca14dd0e 100644
--- a/flow-client/src/main/java/com/vaadin/client/Console.java
+++ b/flow-client/src/main/java/com/vaadin/client/Console.java
@@ -30,7 +30,7 @@
*/
public final class Console {
private static boolean shouldLogToBrowserConsole;
-
+
@FunctionalInterface
// Runnable that can throw
private interface DeferWithoutEntryTask {
diff --git a/flow-client/src/main/java/com/vaadin/client/DefaultRegistry.java b/flow-client/src/main/java/com/vaadin/client/DefaultRegistry.java
index 38f79cf54e8..20b197dc149 100644
--- a/flow-client/src/main/java/com/vaadin/client/DefaultRegistry.java
+++ b/flow-client/src/main/java/com/vaadin/client/DefaultRegistry.java
@@ -118,9 +118,11 @@ public DefaultRegistry(ApplicationConnection connection,
new ReconnectDialogConfiguration(this));
if (!applicationConfiguration.isClientRouting()) {
if (applicationConfiguration.isWebComponentMode()) {
- set(ScrollPositionHandler.class, new WebComponentScrollHandler());
+ set(ScrollPositionHandler.class,
+ new WebComponentScrollHandler());
} else {
- set(ScrollPositionHandler.class, new ScrollPositionHandler(this));
+ set(ScrollPositionHandler.class,
+ new ScrollPositionHandler(this));
}
}
set(Poller.class, new Poller(this));
diff --git a/flow-client/src/main/java/com/vaadin/client/LitUtils.java b/flow-client/src/main/java/com/vaadin/client/LitUtils.java
index 67017edab00..468ddf24882 100644
--- a/flow-client/src/main/java/com/vaadin/client/LitUtils.java
+++ b/flow-client/src/main/java/com/vaadin/client/LitUtils.java
@@ -19,7 +19,8 @@
import elemental.dom.Node;
/**
- * Utils class, intended to ease working with LitElement related code on client side.
+ * Utils class, intended to ease working with LitElement related code on client
+ * side.
*
* @author Vaadin Ltd
*/
diff --git a/flow-client/src/main/java/com/vaadin/client/LoadingIndicator.java b/flow-client/src/main/java/com/vaadin/client/LoadingIndicator.java
index 0e15c1ee4e8..022f645d618 100644
--- a/flow-client/src/main/java/com/vaadin/client/LoadingIndicator.java
+++ b/flow-client/src/main/java/com/vaadin/client/LoadingIndicator.java
@@ -39,59 +39,35 @@ public class LoadingIndicator {
private static final String PRIMARY_STYLE_NAME = "v-loading-indicator";
- private static final String DEFAULT_THEMING = "@-webkit-keyframes v-progress-start {" +
- "0% {width: 0%;}" +
- "100% {width: 50%;}}" +
- "@-moz-keyframes v-progress-start {" +
- "0% {width: 0%;}" +
- "100% {width: 50%;}}" +
- "@keyframes v-progress-start {" +
- "0% {width: 0%;}" +
- "100% {width: 50%;}}" +
- "@keyframes v-progress-delay {" +
- "0% {width: 50%;}" +
- "100% {width: 90%;}}" +
- "@keyframes v-progress-wait {" +
- "0% {width: 90%;height: 4px;}" +
- "3% {width: 91%;height: 7px;}" +
- "100% {width: 96%;height: 7px;}}" +
- "@-webkit-keyframes v-progress-wait-pulse {" +
- "0% {opacity: 1;}" +
- "50% {opacity: 0.1;}" +
- "100% {opacity: 1;}}" +
- "@-moz-keyframes v-progress-wait-pulse {" +
- "0% {opacity: 1;}" +
- "50% {opacity: 0.1;}" +
- "100% {opacity: 1;}}" +
- "@keyframes v-progress-wait-pulse {" +
- "0% {opacity: 1;}" +
- "50% {opacity: 0.1;}" +
- "100% {opacity: 1;}}" +
- ".v-loading-indicator {" +
- "position: fixed !important;" +
- "z-index: 99999;" +
- "left: 0;" +
- "right: auto;" +
- "top: 0;" +
- "width: 50%;" +
- "opacity: 1;" +
- "height: 4px;" +
- "background-color: var(--lumo-primary-color, var(--material-primary-color, blue));" +
- "pointer-events: none;" +
- "transition: none;" +
- "animation: v-progress-start 1000ms 200ms both;}" +
- ".v-loading-indicator[style*=\"none\"] {" +
- "display: block !important;" +
- "width: 100% !important;" +
- "opacity: 0;" +
- "animation: none !important;" +
- "transition: opacity 500ms 300ms, width 300ms;}" +
- ".v-loading-indicator.second {" +
- "width: 90%;" +
- "animation: v-progress-delay 3.8s forwards;}" +
- ".v-loading-indicator.third {" +
- "width: 96%;" +
- "animation: v-progress-wait 5s forwards, v-progress-wait-pulse 1s 4s infinite backwards;}";
+ private static final String DEFAULT_THEMING = "@-webkit-keyframes v-progress-start {"
+ + "0% {width: 0%;}" + "100% {width: 50%;}}"
+ + "@-moz-keyframes v-progress-start {" + "0% {width: 0%;}"
+ + "100% {width: 50%;}}" + "@keyframes v-progress-start {"
+ + "0% {width: 0%;}" + "100% {width: 50%;}}"
+ + "@keyframes v-progress-delay {" + "0% {width: 50%;}"
+ + "100% {width: 90%;}}" + "@keyframes v-progress-wait {"
+ + "0% {width: 90%;height: 4px;}" + "3% {width: 91%;height: 7px;}"
+ + "100% {width: 96%;height: 7px;}}"
+ + "@-webkit-keyframes v-progress-wait-pulse {" + "0% {opacity: 1;}"
+ + "50% {opacity: 0.1;}" + "100% {opacity: 1;}}"
+ + "@-moz-keyframes v-progress-wait-pulse {" + "0% {opacity: 1;}"
+ + "50% {opacity: 0.1;}" + "100% {opacity: 1;}}"
+ + "@keyframes v-progress-wait-pulse {" + "0% {opacity: 1;}"
+ + "50% {opacity: 0.1;}" + "100% {opacity: 1;}}"
+ + ".v-loading-indicator {" + "position: fixed !important;"
+ + "z-index: 99999;" + "left: 0;" + "right: auto;" + "top: 0;"
+ + "width: 50%;" + "opacity: 1;" + "height: 4px;"
+ + "background-color: var(--lumo-primary-color, var(--material-primary-color, blue));"
+ + "pointer-events: none;" + "transition: none;"
+ + "animation: v-progress-start 1000ms 200ms both;}"
+ + ".v-loading-indicator[style*=\"none\"] {"
+ + "display: block !important;" + "width: 100% !important;"
+ + "opacity: 0;" + "animation: none !important;"
+ + "transition: opacity 500ms 300ms, width 300ms;}"
+ + ".v-loading-indicator.second {" + "width: 90%;"
+ + "animation: v-progress-delay 3.8s forwards;}"
+ + ".v-loading-indicator.third {" + "width: 96%;"
+ + "animation: v-progress-wait 5s forwards, v-progress-wait-pulse 1s 4s infinite backwards;}";
private int firstDelay = LoadingIndicatorConfigurationMap.FIRST_DELAY_DEFAULT;
private int secondDelay = LoadingIndicatorConfigurationMap.SECOND_DELAY_DEFAULT;
@@ -127,7 +103,7 @@ public void run() {
* moves into the "first" state and is shown to the user
*
* @return The delay (in ms) until moving into the "first" state. Counted
- * from when {@link #trigger()} is called.
+ * from when {@link #trigger()} is called.
*/
public int getFirstDelay() {
return firstDelay;
@@ -138,8 +114,8 @@ public int getFirstDelay() {
* into the "first" state and is shown to the user
*
* @param firstDelay
- * The delay (in ms) until moving into the "first" state. Counted
- * from when {@link #trigger()} is called.
+ * The delay (in ms) until moving into the "first" state. Counted
+ * from when {@link #trigger()} is called.
*/
public void setFirstDelay(int firstDelay) {
this.firstDelay = firstDelay;
@@ -150,7 +126,7 @@ public void setFirstDelay(int firstDelay) {
* moves to its "second" state.
*
* @return The delay (in ms) until the loading indicator moves into its
- * "second" state. Counted from when {@link #trigger()} is called.
+ * "second" state. Counted from when {@link #trigger()} is called.
*/
public int getSecondDelay() {
return secondDelay;
@@ -161,9 +137,9 @@ public int getSecondDelay() {
* to its "second" state.
*
* @param secondDelay
- * The delay (in ms) until the loading indicator moves into its
- * "second" state. Counted from when {@link #trigger()} is
- * called.
+ * The delay (in ms) until the loading indicator moves into its
+ * "second" state. Counted from when {@link #trigger()} is
+ * called.
*/
public void setSecondDelay(int secondDelay) {
this.secondDelay = secondDelay;
@@ -174,7 +150,7 @@ public void setSecondDelay(int secondDelay) {
* moves to its "third" state.
*
* @return The delay (in ms) until the loading indicator moves into its
- * "third" state. Counted from when {@link #trigger()} is called.
+ * "third" state. Counted from when {@link #trigger()} is called.
*/
public int getThirdDelay() {
return thirdDelay;
@@ -185,9 +161,9 @@ public int getThirdDelay() {
* to its "third" state.
*
* @param thirdDelay
- * The delay (in ms) from the event until changing the loading
- * indicator into its "third" state. Counted from when
- * {@link #trigger()} is called.
+ * The delay (in ms) from the event until changing the loading
+ * indicator into its "third" state. Counted from when
+ * {@link #trigger()} is called.
*/
public void setThirdDelay(int thirdDelay) {
this.thirdDelay = thirdDelay;
@@ -272,7 +248,8 @@ public boolean isVisible() {
*/
public Element getElement() {
if (element == null) {
- element = Browser.getDocument().querySelector("." + PRIMARY_STYLE_NAME);
+ element = Browser.getDocument()
+ .querySelector("." + PRIMARY_STYLE_NAME);
setupTheming();
if (element == null) {
element = Browser.getDocument().createElement("div");
@@ -283,7 +260,8 @@ public Element getElement() {
}
private void setupTheming() {
- Element styleElement = Browser.getDocument().querySelector("style#css-loading-indicator");
+ Element styleElement = Browser.getDocument()
+ .querySelector("style#css-loading-indicator");
if (styleElement == null) {
styleElement = Browser.getDocument().createStyleElement();
styleElement.setAttribute("type", "text/css");
@@ -299,12 +277,14 @@ private void setupTheming() {
}
/**
- * Sets whether the default theming should be applied for the loading indicator or not.
+ * Sets whether the default theming should be applied for the loading
+ * indicator or not.
*
* Default is {@code true}.
*
* @param applyDefaultTheme
- * {@code true} for applying the default theming, {@code false} for not
+ * {@code true} for applying the default theming, {@code false}
+ * for not
*/
public void setApplyDefaultTheme(boolean applyDefaultTheme) {
this.applyDefaultTheme = applyDefaultTheme;
@@ -312,11 +292,13 @@ public void setApplyDefaultTheme(boolean applyDefaultTheme) {
}
/**
- * Returns whether the default theming should be applied for the loading indicator or not.
+ * Returns whether the default theming should be applied for the loading
+ * indicator or not.
*
* Default is {@code true}.
*
- * @return {@code true} for applying the default theming, {@code false} for not
+ * @return {@code true} for applying the default theming, {@code false} for
+ * not
*/
public boolean isApplyDefaultTheme() {
return applyDefaultTheme;
diff --git a/flow-client/src/main/java/com/vaadin/client/PolymerUtils.java b/flow-client/src/main/java/com/vaadin/client/PolymerUtils.java
index 95e6a180d4b..99564246d81 100644
--- a/flow-client/src/main/java/com/vaadin/client/PolymerUtils.java
+++ b/flow-client/src/main/java/com/vaadin/client/PolymerUtils.java
@@ -178,8 +178,7 @@ private static void registerChangeHandlers(StateNode node,
assert feature instanceof NodeMap : "Received an inconsistent NodeFeature for a node that has a ELEMENT_PROPERTIES feature. It should be NodeMap, but it is: "
+ feature;
NodeMap map = (NodeMap) feature;
- registerPropertyChangeHandlers(value, registrations,
- map);
+ registerPropertyChangeHandlers(value, registrations, map);
registerPropertyAddHandler(value, registrations, map);
} else if (node.hasFeature(NodeFeatures.TEMPLATE_MODELLIST)) {
assert feature instanceof NodeList : "Received an inconsistent NodeFeature for a node that has a TEMPLATE_MODELLIST feature. It should be NodeList, but it is: "
@@ -205,8 +204,8 @@ private static void registerPropertyAddHandler(JsonValue value,
}));
}
- private static void registerPropertyChangeHandlers(
- JsonValue value, JsArray registrations, NodeMap map) {
+ private static void registerPropertyChangeHandlers(JsonValue value,
+ JsArray registrations, NodeMap map) {
map.forEachProperty((property, propertyName) -> registrations
.push(property.addChangeListener(
event -> handlePropertyChange(property, value))));
@@ -379,7 +378,7 @@ public static native boolean isPolymerElement(Element htmlNode)
/*-{
var isP2Element = (typeof $wnd.Polymer === 'function') && $wnd.Polymer.Element && htmlNode instanceof $wnd.Polymer.Element;
var isP3Element = htmlNode.constructor.polymerElementVersion !== undefined;
-
+
return (isP2Element || isP3Element);
}-*/;
diff --git a/flow-client/src/main/java/com/vaadin/client/PopStateHandler.java b/flow-client/src/main/java/com/vaadin/client/PopStateHandler.java
index d5e831d0acf..697a1425431 100644
--- a/flow-client/src/main/java/com/vaadin/client/PopStateHandler.java
+++ b/flow-client/src/main/java/com/vaadin/client/PopStateHandler.java
@@ -62,8 +62,8 @@ public PopStateHandler(Registry registry) {
public void bind() {
// track the location and query string (#6107) after the latest response
// from server
- registry.getRequestResponseTracker().addResponseHandlingEndedHandler(
- event -> {
+ registry.getRequestResponseTracker()
+ .addResponseHandlingEndedHandler(event -> {
pathAfterPreviousResponse = Browser.getWindow()
.getLocation().getPathname();
queryAfterPreviousResponse = Browser.getWindow()
@@ -85,9 +85,9 @@ private void onPopStateEvent(Event e) {
assert pathAfterPreviousResponse != null : "Initial response has not ended before pop state event was triggered";
// don't visit server on pop state events caused by fragment change
- boolean requiresServerSideRoundtrip =
- !(Objects.equals(path, pathAfterPreviousResponse)
- && Objects.equals(query, queryAfterPreviousResponse));
+ boolean requiresServerSideRoundtrip = !(Objects.equals(path,
+ pathAfterPreviousResponse)
+ && Objects.equals(query, queryAfterPreviousResponse));
registry.getScrollPositionHandler().onPopStateEvent((PopStateEvent) e,
requiresServerSideRoundtrip);
if (!requiresServerSideRoundtrip) {
diff --git a/flow-client/src/main/java/com/vaadin/client/bootstrap/Bootstrapper.java b/flow-client/src/main/java/com/vaadin/client/bootstrap/Bootstrapper.java
index a4d250221e7..ef1da01b52b 100644
--- a/flow-client/src/main/java/com/vaadin/client/bootstrap/Bootstrapper.java
+++ b/flow-client/src/main/java/com/vaadin/client/bootstrap/Bootstrapper.java
@@ -128,8 +128,8 @@ private static void populateApplicationConfiguration(
conf.setWebComponentMode(jsoConfiguration
.getConfigBoolean(ApplicationConstants.APP_WC_MODE));
- conf.setClientRouting(
- jsoConfiguration.getConfigBoolean(ApplicationConstants.CLIENT_ROUTING));
+ conf.setClientRouting(jsoConfiguration
+ .getConfigBoolean(ApplicationConstants.CLIENT_ROUTING));
if (serviceUrl == null) {
conf.setServiceUrl(WidgetUtil.getAbsoluteUrl("."));
diff --git a/flow-client/src/main/java/com/vaadin/client/bootstrap/JsoConfiguration.java b/flow-client/src/main/java/com/vaadin/client/bootstrap/JsoConfiguration.java
index 7818a1af1b0..ba39997f83d 100644
--- a/flow-client/src/main/java/com/vaadin/client/bootstrap/JsoConfiguration.java
+++ b/flow-client/src/main/java/com/vaadin/client/bootstrap/JsoConfiguration.java
@@ -105,8 +105,8 @@ public native boolean getConfigBoolean(String name)
*
* @param name
* name of the configuration parameter
- * @return integer value of the configuration parameter, or null
- * if no value is defined
+ * @return integer value of the configuration parameter, or
+ * null if no value is defined
*/
public native Integer getConfigInteger(String name)
/*-{
diff --git a/flow-client/src/main/java/com/vaadin/client/communication/LoadingIndicatorConfigurator.java b/flow-client/src/main/java/com/vaadin/client/communication/LoadingIndicatorConfigurator.java
index b885e8c6502..56aae8aa415 100644
--- a/flow-client/src/main/java/com/vaadin/client/communication/LoadingIndicatorConfigurator.java
+++ b/flow-client/src/main/java/com/vaadin/client/communication/LoadingIndicatorConfigurator.java
@@ -62,8 +62,11 @@ public static void observe(StateNode node,
loadingIndicator::setThirdDelay,
LoadingIndicatorConfigurationMap.THIRD_DELAY_DEFAULT);
- MapProperty defaultThemeProperty = configMap.getProperty(LoadingIndicatorConfigurationMap.DEFAULT_THEME_APPLIED_KEY);
- defaultThemeProperty.addChangeListener(event -> loadingIndicator.setApplyDefaultTheme(event.getSource().getValueOrDefault(LoadingIndicatorConfigurationMap.DEFAULT_THEME_APPLIED_DEFAULT)));
+ MapProperty defaultThemeProperty = configMap.getProperty(
+ LoadingIndicatorConfigurationMap.DEFAULT_THEME_APPLIED_KEY);
+ defaultThemeProperty.addChangeListener(event -> loadingIndicator
+ .setApplyDefaultTheme(event.getSource().getValueOrDefault(
+ LoadingIndicatorConfigurationMap.DEFAULT_THEME_APPLIED_DEFAULT)));
}
/**
diff --git a/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java b/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java
index 5eb99b164c2..f9a1bbe289e 100644
--- a/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java
+++ b/flow-client/src/main/java/com/vaadin/client/communication/MessageHandler.java
@@ -265,15 +265,15 @@ protected void handleJSON(final ValueMap valueMap) {
}
/**
- * Should only prepare resync after the
- * if (locked || !isNextExpectedMessage(serverId)) {...}
- * since stateTree.repareForResync() will remove the nodes,
- * and if locked is true, it will return without handling
- * the message, thus won't adding nodes back.
+ * Should only prepare resync after the if (locked ||
+ * !isNextExpectedMessage(serverId)) {...} since
+ * stateTree.repareForResync() will remove the nodes, and if locked is
+ * true, it will return without handling the message, thus won't adding
+ * nodes back.
*
- * This is related to https://github.com/vaadin/flow/issues/8699
- * It seems that the reason is that `connectClient` is removed
- * from the rootNode( element) during a resync and not added back.
+ * This is related to https://github.com/vaadin/flow/issues/8699 It
+ * seems that the reason is that `connectClient` is removed from the
+ * rootNode( element) during a resync and not added back.
*/
if (isResynchronize(valueMap)) {
// Unregister all nodes and rebuild the state tree
@@ -433,8 +433,7 @@ assert getServerId(valueMap) == -1
registry.getSystemErrorHandler().handleUnrecoverableError(
error.getString("caption"),
error.getString("message"),
- error.getString("details"),
- error.getString("url"),
+ error.getString("details"), error.getString("url"),
error.getString("querySelector"));
registry.getUILifecycle().setState(UIState.TERMINATED);
@@ -564,8 +563,10 @@ private int getExpectedServerId() {
}
private void forceMessageHandling() {
- // Clear previous request if it exists. Otherwise resyncrhonize can trigger
- // "Trying to start a new request while another is active" exception and fail.
+ // Clear previous request if it exists. Otherwise resyncrhonize can
+ // trigger
+ // "Trying to start a new request while another is active" exception and
+ // fail.
if (registry.getRequestResponseTracker().hasActiveRequest()) {
registry.getRequestResponseTracker().endRequest();
}
diff --git a/flow-client/src/main/java/com/vaadin/client/communication/PushConnectionFactory.java b/flow-client/src/main/java/com/vaadin/client/communication/PushConnectionFactory.java
index b16d004e0d8..7498ed86331 100644
--- a/flow-client/src/main/java/com/vaadin/client/communication/PushConnectionFactory.java
+++ b/flow-client/src/main/java/com/vaadin/client/communication/PushConnectionFactory.java
@@ -28,9 +28,11 @@
public interface PushConnectionFactory {
/**
- * Creates a new {@link PushConnection} instance for the given {@code registry}.
+ * Creates a new {@link PushConnection} instance for the given
+ * {@code registry}.
*
- * @param registry the global registry
+ * @param registry
+ * the global registry
* @return the push connection instance
*/
PushConnection create(Registry registry);
diff --git a/flow-client/src/main/java/com/vaadin/client/communication/XhrConnection.java b/flow-client/src/main/java/com/vaadin/client/communication/XhrConnection.java
index 667cf0993b0..7b5e5ba3e42 100644
--- a/flow-client/src/main/java/com/vaadin/client/communication/XhrConnection.java
+++ b/flow-client/src/main/java/com/vaadin/client/communication/XhrConnection.java
@@ -189,13 +189,15 @@ protected String getUri() {
// the variable in JS scope, breaking strict mode which is
// needed for ES6 imports.
// See https://github.com/vaadin/flow/pull/6227
- return SharedUtil.addGetParameter(
- SharedUtil.addGetParameter(
- registry.getApplicationConfiguration().getServiceUrl(),
- ApplicationConstants.REQUEST_TYPE_PARAMETER,
- ApplicationConstants.REQUEST_TYPE_UIDL),
- ApplicationConstants.UI_ID_PARAMETER,
- registry.getApplicationConfiguration().getUIId());
+ return SharedUtil
+ .addGetParameter(
+ SharedUtil.addGetParameter(
+ registry.getApplicationConfiguration()
+ .getServiceUrl(),
+ ApplicationConstants.REQUEST_TYPE_PARAMETER,
+ ApplicationConstants.REQUEST_TYPE_UIDL),
+ ApplicationConstants.UI_ID_PARAMETER,
+ registry.getApplicationConfiguration().getUIId());
}
private static native boolean resendRequest(XMLHttpRequest xhr)
diff --git a/flow-client/src/main/java/com/vaadin/client/flow/binding/ServerEventObject.java b/flow-client/src/main/java/com/vaadin/client/flow/binding/ServerEventObject.java
index f7ceb3c41fe..c40b3a75a62 100644
--- a/flow-client/src/main/java/com/vaadin/client/flow/binding/ServerEventObject.java
+++ b/flow-client/src/main/java/com/vaadin/client/flow/binding/ServerEventObject.java
@@ -85,11 +85,11 @@ private native void initPromiseHandler()
Object.defineProperty(this, name, {
value: function(promiseId, success, value) {
var promise = this[name].promises[promiseId];
-
+
// undefined if client-side node was recreated after execution was scheduled
if (promise !== undefined) {
delete this[name].promises[promiseId];
-
+
if (success) {
// Resolve
promise[0](value);
diff --git a/flow-client/src/main/java/com/vaadin/client/flow/binding/SimpleElementBindingStrategy.java b/flow-client/src/main/java/com/vaadin/client/flow/binding/SimpleElementBindingStrategy.java
index 45bce51055b..59abe8222fe 100644
--- a/flow-client/src/main/java/com/vaadin/client/flow/binding/SimpleElementBindingStrategy.java
+++ b/flow-client/src/main/java/com/vaadin/client/flow/binding/SimpleElementBindingStrategy.java
@@ -291,9 +291,9 @@ private native void bindPolymerModelProperties(StateNode node,
private native void hookUpPolymerElement(StateNode node, Element element)
/*-{
var self = this;
-
+
var originalPropertiesChanged = element._propertiesChanged;
-
+
if (originalPropertiesChanged) {
element._propertiesChanged = function (currentProps, changedProps, oldProps) {
$entry(function () {
@@ -302,16 +302,16 @@ private native void hookUpPolymerElement(StateNode node, Element element)
originalPropertiesChanged.apply(this, arguments);
};
}
-
-
+
+
var tree = node.@com.vaadin.client.flow.StateNode::getTree()();
-
+
var originalReady = element.ready;
-
+
element.ready = function (){
originalReady.apply(this, arguments);
@com.vaadin.client.PolymerUtils::fireReadyEvent(*)(element);
-
+
// The _propertiesChanged method which is replaced above for the element
// doesn't do anything for items in dom-repeat.
// Instead it's called with some meaningful info for the dom-repeat element.
@@ -320,7 +320,7 @@ private native void hookUpPolymerElement(StateNode node, Element element)
// which changes this method for any dom-repeat instance.
var replaceDomRepeatPropertyChange = function(){
var domRepeat = element.root.querySelector('dom-repeat');
-
+
if ( domRepeat ){
// If the dom-repeat element is in the DOM then
// this method should not be executed anymore. The logic below will replace
@@ -334,12 +334,12 @@ private native void hookUpPolymerElement(StateNode node, Element element)
// if dom-repeat is found => replace _propertiesChanged method in the prototype and mark it as replaced.
if ( !domRepeat.constructor.prototype.$propChangedModified){
domRepeat.constructor.prototype.$propChangedModified = true;
-
+
var changed = domRepeat.constructor.prototype._propertiesChanged;
-
+
domRepeat.constructor.prototype._propertiesChanged = function(currentProps, changedProps, oldProps){
changed.apply(this, arguments);
-
+
var props = Object.getOwnPropertyNames(changedProps);
var items = "items.";
var i;
@@ -360,7 +360,7 @@ private native void hookUpPolymerElement(StateNode node, Element element)
if( currentPropsItem && currentPropsItem.nodeId ){
var nodeId = currentPropsItem.nodeId;
var value = currentPropsItem[propertyName];
-
+
// this is an attempt to find the template element
// which is not available as a context in the protype method
var host = this.__dataHost;
@@ -371,7 +371,7 @@ private native void hookUpPolymerElement(StateNode node, Element element)
while( !host.localName || host.__dataHost ){
host = host.__dataHost;
}
-
+
$entry(function () {
@SimpleElementBindingStrategy::handleListItemPropertyChange(*)(nodeId, host, propertyName, value, tree);
})();
@@ -382,7 +382,7 @@ private native void hookUpPolymerElement(StateNode node, Element element)
};
}
};
-
+
// dom-repeat doesn't have to be in DOM even if template has it
// such situation happens if there is dom-if e.g. which evaluates to false initially.
// in this case dom-repeat is not yet in the DOM tree until dom-if becomes true
@@ -397,7 +397,7 @@ private native void hookUpPolymerElement(StateNode node, Element element)
element.addEventListener('dom-change',replaceDomRepeatPropertyChange);
}
}
-
+
}-*/;
private static void handleListItemPropertyChange(double nodeId,
diff --git a/flow-client/src/main/java/com/vaadin/client/flow/collection/JsArray.java b/flow-client/src/main/java/com/vaadin/client/flow/collection/JsArray.java
index 1b9bae6eb24..b69de2dc5b6 100644
--- a/flow-client/src/main/java/com/vaadin/client/flow/collection/JsArray.java
+++ b/flow-client/src/main/java/com/vaadin/client/flow/collection/JsArray.java
@@ -236,15 +236,15 @@ private JsniHelper() {
static native int pushArray(JsArray array,
JsArray extends T> values)
- /*-{
- return array.push.apply(array, values);
- }-*/;
+ /*-{
+ return array.push.apply(array, values);
+ }-*/;
static native JsArray spliceArray(JsArray array, int index,
int remove, JsArray extends T> add)
- /*-{
- return array.splice.apply(array, [index, remove].concat(add));
- }-*/;
+ /*-{
+ return array.splice.apply(array, [index, remove].concat(add));
+ }-*/;
static native void clear(JsArray> array)
/*-{
diff --git a/flow-client/src/main/java/com/vaadin/client/flow/reactive/Reactive.java b/flow-client/src/main/java/com/vaadin/client/flow/reactive/Reactive.java
index 83919780d87..5dd003d5bfb 100644
--- a/flow-client/src/main/java/com/vaadin/client/flow/reactive/Reactive.java
+++ b/flow-client/src/main/java/com/vaadin/client/flow/reactive/Reactive.java
@@ -50,7 +50,7 @@ public class Reactive {
private static Computation currentComputation = null;
- private static boolean flushing =false;
+ private static boolean flushing = false;
private Reactive() {
// Only static stuff in this class
@@ -97,7 +97,7 @@ public static void addPostFlushListener(FlushListener postFlushListener) {
* @see #addPostFlushListener(FlushListener)
*/
public static void flush() {
- if(flushing) {
+ if (flushing) {
return;
}
try {
@@ -109,14 +109,15 @@ public static void flush() {
oldestListener.flush();
}
- // Purge one post flush listener, then look if there are new flush
+ // Purge one post flush listener, then look if there are new
+ // flush
// listeners to purge
if (hasPostFlushListeners()) {
FlushListener oldestListener = postFlushListeners.remove(0);
oldestListener.flush();
}
}
- }finally {
+ } finally {
flushing = false;
}
}
diff --git a/flow-client/src/main/java/com/vaadin/flow/linker/ClientEngineLinker.java b/flow-client/src/main/java/com/vaadin/flow/linker/ClientEngineLinker.java
index f09259dbcc8..af0412d9808 100644
--- a/flow-client/src/main/java/com/vaadin/flow/linker/ClientEngineLinker.java
+++ b/flow-client/src/main/java/com/vaadin/flow/linker/ClientEngineLinker.java
@@ -158,7 +158,7 @@ protected Collection> doEmitCompilation(TreeLogger logger,
@Override
protected EmittedArtifact emitSelectionScript(TreeLogger logger,
LinkerContext context, ArtifactSet artifacts)
- throws UnableToCompleteException {
+ throws UnableToCompleteException {
// Find the single Script result
Script result = getScript(logger, artifacts);
@@ -298,7 +298,7 @@ protected String getSelectionScriptTemplate(TreeLogger logger,
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context,
ArtifactSet artifacts, boolean onePermutation)
- throws UnableToCompleteException {
+ throws UnableToCompleteException {
ArtifactSet result = super.link(logger, context, artifacts,
onePermutation);
if (!onePermutation) {
@@ -312,7 +312,7 @@ public ArtifactSet link(TreeLogger logger, LinkerContext context,
*/
private Artifact> emitStrongNamePropertyFile(TreeLogger logger,
LinkerContext context, ArtifactSet artifacts)
- throws UnableToCompleteException {
+ throws UnableToCompleteException {
Script result = getScript(logger, artifacts);
String contents = "jsFile=" + getJsFilename(context, result);
diff --git a/flow-client/src/test/java/com/vaadin/client/CodeTest.java b/flow-client/src/test/java/com/vaadin/client/CodeTest.java
index 99d1a7a53b5..e9374a4e3cc 100644
--- a/flow-client/src/test/java/com/vaadin/client/CodeTest.java
+++ b/flow-client/src/test/java/com/vaadin/client/CodeTest.java
@@ -82,6 +82,7 @@ public boolean visit(PackageDeclaration node) {
packageName = node.getName().toString();
return false;
}
+
@Override
public boolean visit(ImportDeclaration node) {
imports.add(node.getName().toString());
@@ -93,7 +94,8 @@ public boolean visit(VariableDeclarationStatement node) {
for (Object frament : node.fragments()) {
if (frament instanceof VariableDeclarationFragment) {
VariableDeclarationFragment variableDeclaration = (VariableDeclarationFragment) frament;
- Expression expression = variableDeclaration.getInitializer();
+ Expression expression = variableDeclaration
+ .getInitializer();
if (expression instanceof ClassInstanceCreation) {
ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
Class> typeClass = getClass(node.getType());
diff --git a/flow-client/src/test/java/com/vaadin/client/flow/TreeChangeProcessorTest.java b/flow-client/src/test/java/com/vaadin/client/flow/TreeChangeProcessorTest.java
index b4b3d3aef3c..775c74d68cf 100644
--- a/flow-client/src/test/java/com/vaadin/client/flow/TreeChangeProcessorTest.java
+++ b/flow-client/src/test/java/com/vaadin/client/flow/TreeChangeProcessorTest.java
@@ -242,8 +242,6 @@ public void poulateListFeature() {
Assert.assertEquals(node, updatedNode);
}
-
-
@Test
public void testPutNodeGetsParent() {
StateNode child = new StateNode(2, tree);
@@ -267,13 +265,13 @@ public void testNodeChainGetsCorrectParents() {
StateNode child = new StateNode(2, tree);
tree.registerNode(child);
-
StateNode subChild = new StateNode(3, tree);
tree.registerNode(subChild);
child.getList(NodeFeatures.ELEMENT_CHILDREN).add(0, child);
JsonObject change = putNodeChange(rootId, ns, myKey, child.getId());
- JsonObject subChange = putNodeChange(child.getId(), ns, myKey, subChild.getId());
+ JsonObject subChange = putNodeChange(child.getId(), ns, myKey,
+ subChild.getId());
StateNode node = TreeChangeProcessor.processChange(tree, change);
Assert.assertEquals(tree.getRootNode(), node);
@@ -291,7 +289,6 @@ public void testNodeChainGetsCorrectParents() {
Assert.assertEquals(child, subChild.getParent());
}
-
@Test
public void testNodeDetachRemovesParent() {
StateNode child = new StateNode(2, tree);
@@ -308,7 +305,6 @@ public void testNodeDetachRemovesParent() {
Assert.assertSame(child, value);
Assert.assertEquals(node, child.getParent());
-
change = detachChange(child.getId());
TreeChangeProcessor.processChange(tree, change);
diff --git a/flow-client/src/test/java/com/vaadin/client/flow/reactive/ReactiveTest.java b/flow-client/src/test/java/com/vaadin/client/flow/reactive/ReactiveTest.java
index fff612ed3f9..508ad1aadb1 100644
--- a/flow-client/src/test/java/com/vaadin/client/flow/reactive/ReactiveTest.java
+++ b/flow-client/src/test/java/com/vaadin/client/flow/reactive/ReactiveTest.java
@@ -175,6 +175,7 @@ public void flushRunning_newFlushIsIgnored() {
Reactive.flush();
- Assert.assertEquals(Arrays.asList("flush", "flush2", "postFlush"), order);
+ Assert.assertEquals(Arrays.asList("flush", "flush2", "postFlush"),
+ order);
}
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanPropertySet.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanPropertySet.java
index 305e7cb3cfd..c29d48731c5 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanPropertySet.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanPropertySet.java
@@ -146,8 +146,7 @@ private Object writeReplace() {
* property definition from the cache.
*/
return new SerializedPropertyDefinition(
- getPropertySet().instanceKey.type,
- getName());
+ getPropertySet().instanceKey.type, getName());
}
@Override
@@ -238,8 +237,7 @@ private Object writeReplace() {
* property definition from the cache.
*/
return new SerializedPropertyDefinition(
- getPropertySet().instanceKey.type,
- getName());
+ getPropertySet().instanceKey.type, getName());
}
@Override
@@ -319,8 +317,7 @@ private BeanPropertySet(InstanceKey instanceKey) {
try {
definitions = BeanUtil.getBeanPropertyDescriptors(instanceKey.type)
- .stream()
- .filter(BeanPropertySet::hasNonObjectReadMethod)
+ .stream().filter(BeanPropertySet::hasNonObjectReadMethod)
.map(descriptor -> new BeanPropertyDefinition<>(this,
instanceKey.type, descriptor))
.collect(Collectors.toMap(PropertyDefinition::getName,
@@ -329,7 +326,7 @@ private BeanPropertySet(InstanceKey instanceKey) {
throw new IllegalArgumentException(
"Cannot find property descriptors for "
+ instanceKey.type.getName(),
- e);
+ e);
}
}
@@ -415,8 +412,9 @@ public static PropertySet get(Class extends T> beanType) {
Objects.requireNonNull(beanType, "Bean type cannot be null");
InstanceKey key = new InstanceKey(beanType, false, 0, null);
// Cache the reflection results
- return (PropertySet) INSTANCES.computeIfAbsent(key,
- ignored -> new BeanPropertySet<>(key)).copy();
+ return (PropertySet) INSTANCES
+ .computeIfAbsent(key, ignored -> new BeanPropertySet<>(key))
+ .copy();
}
private BeanPropertySet copy() {
@@ -444,9 +442,9 @@ public static PropertySet get(Class extends T> beanType,
InstanceKey key = new InstanceKey(beanType, false,
filterDefinition.getMaxNestingDepth(),
filterDefinition.getIgnorePackageNamesStartingWith());
- return (PropertySet) INSTANCES.computeIfAbsent(key,
- k -> new BeanPropertySet<>(key, checkNestedDefinitions,
- filterDefinition))
+ return (PropertySet) INSTANCES
+ .computeIfAbsent(key, k -> new BeanPropertySet<>(key,
+ checkNestedDefinitions, filterDefinition))
.copy();
}
@@ -488,7 +486,7 @@ public static PropertySet get(Class extends T> beanType,
throw new IllegalArgumentException(
"Cannot find property descriptors for "
+ instanceKey.type.getName(),
- e);
+ e);
}
}
return definition;
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanValidationBinder.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanValidationBinder.java
index 639a9a0e109..ab241094fa0 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanValidationBinder.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/BeanValidationBinder.java
@@ -58,7 +58,7 @@ public class BeanValidationBinder extends Binder {
* the bean type to use, not null
*/
public BeanValidationBinder(Class beanType) {
- this(beanType,false);
+ this(beanType, false);
}
/**
@@ -75,14 +75,15 @@ public BeanValidationBinder(Class beanType) {
* @param scanNestedDefinitions
* if {@code true}, scan for nested property definitions as well
*/
- public BeanValidationBinder(Class beanType, boolean scanNestedDefinitions) {
+ public BeanValidationBinder(Class beanType,
+ boolean scanNestedDefinitions) {
super(beanType, scanNestedDefinitions);
if (!BeanUtil.checkBeanValidationAvailable()) {
- throw new IllegalStateException(
- BeanValidationBinder.class.getSimpleName()
- + " cannot be used because a JSR-303 Bean Validation "
- + "implementation not found on the classpath or could not be initialized. Use "
- + Binder.class.getSimpleName() + " instead");
+ throw new IllegalStateException(BeanValidationBinder.class
+ .getSimpleName()
+ + " cannot be used because a JSR-303 Bean Validation "
+ + "implementation not found on the classpath or could not be initialized. Use "
+ + Binder.class.getSimpleName() + " instead");
}
this.beanType = beanType;
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java
index 28eeb6c7eb4..a860c0ceed5 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/Binder.java
@@ -237,10 +237,11 @@ default BindingValidationStatus validate() {
public boolean isAsRequiredEnabled();
/**
- * Define whether validators are disabled or enabled for this
- * specific binding.
+ * Define whether validators are disabled or enabled for this specific
+ * binding.
*
- * @param validatorsDisabled A boolean value.
+ * @param validatorsDisabled
+ * A boolean value.
*/
public void setValidatorsDisabled(boolean validatorsDisabled);
@@ -605,9 +606,11 @@ default BindingBuilder withNullRepresentation(
TARGET nullRepresentation) {
return withConverter(
fieldValue -> Objects.equals(fieldValue, nullRepresentation)
- ? null : fieldValue,
+ ? null
+ : fieldValue,
modelValue -> Objects.isNull(modelValue)
- ? nullRepresentation : modelValue);
+ ? nullRepresentation
+ : modelValue);
}
/**
@@ -891,8 +894,8 @@ public BindingBuilder withValidator(
Objects.requireNonNull(validator, "validator cannot be null");
Validator super TARGET> wrappedValidator = ((value, context) -> {
- if (getBinder().isValidatorsDisabled() ||
- (binding != null && binding.isValidatorsDisabled())) {
+ if (getBinder().isValidatorsDisabled() || (binding != null
+ && binding.isValidatorsDisabled())) {
return ValidationResult.ok();
} else {
return validator.apply(value, context);
@@ -1872,13 +1875,13 @@ public void writeBean(BEAN bean) throws ValidationException {
* {@code null}
*/
public void writeBeanAsDraft(BEAN bean) {
- doWriteDraft(bean, new ArrayList<>(bindings),false);
+ doWriteDraft(bean, new ArrayList<>(bindings), false);
}
/**
- * Writes successfully converted changes from the bound fields bypassing
- * all the Validation or all fields passing conversion if forced = true.
- * If the conversion fails, the value written to the bean will be null.
+ * Writes successfully converted changes from the bound fields bypassing all
+ * the Validation or all fields passing conversion if forced = true. If the
+ * conversion fails, the value written to the bean will be null.
*
* @see #writeBean(Object)
* @see #writeBeanIfValid(Object)
@@ -1892,7 +1895,7 @@ public void writeBeanAsDraft(BEAN bean) {
* disable all Validators during write
*/
public void writeBeanAsDraft(BEAN bean, boolean forced) {
- doWriteDraft(bean, new ArrayList<>(bindings),forced);
+ doWriteDraft(bean, new ArrayList<>(bindings), forced);
}
/**
@@ -1994,12 +1997,12 @@ private BinderValidationStatus doWriteIfValid(BEAN bean,
* disable validators during write if true
*/
@SuppressWarnings({ "unchecked" })
- private void doWriteDraft(BEAN bean,
- Collection> bindings, boolean forced) {
+ private void doWriteDraft(BEAN bean, Collection> bindings,
+ boolean forced) {
Objects.requireNonNull(bean, "bean cannot be null");
if (!forced) {
- bindings.forEach(binding -> ((BindingImpl) binding)
+ bindings.forEach(binding -> ((BindingImpl) binding)
.writeFieldValue(bean));
} else {
boolean isDisabled = isValidatorsDisabled();
@@ -2670,7 +2673,8 @@ private Converter createNullRepresentationA
Converter nullRepresentationConverter = Converter
.from(fieldValue -> fieldValue,
modelValue -> Objects.isNull(modelValue)
- ? field.getEmptyValue() : modelValue,
+ ? field.getEmptyValue()
+ : modelValue,
Throwable::getMessage);
ConverterDelegate converter = new ConverterDelegate<>(
nullRepresentationConverter);
@@ -3066,18 +3070,19 @@ public void removeBinding(String propertyName) {
}
/**
- * Control whether validators including bean level validators are
- * disabled or enabled globally for this Binder.
+ * Control whether validators including bean level validators are disabled
+ * or enabled globally for this Binder.
*
- * @param validatorsDisabled Boolean value.
+ * @param validatorsDisabled
+ * Boolean value.
*/
public void setValidatorsDisabled(boolean validatorsDisabled) {
this.validatorsDisabled = validatorsDisabled;
}
/**
- * Returns if the validators including bean level validators
- * are disabled or enabled for this Binder.
+ * Returns if the validators including bean level validators are disabled or
+ * enabled for this Binder.
*
* @return Boolean value
*/
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatus.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatus.java
index 858acb87bea..36b1fb583bb 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatus.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatus.java
@@ -34,8 +34,8 @@
* Note: if there are any field level validation errors, the bean level
* validation is not run.
*
- * Use {@link Binder#setValidationStatusHandler(BinderValidationStatusHandler)} to handle
- * form level validation status changes.
+ * Use {@link Binder#setValidationStatusHandler(BinderValidationStatusHandler)}
+ * to handle form level validation status changes.
*
* @author Vaadin Ltd
* @since 1.0
@@ -94,8 +94,8 @@ public BinderValidationStatus(Binder source,
public static BinderValidationStatus createUnresolvedStatus(
Binder source) {
return new BinderValidationStatus<>(source,
- source.getBindings().stream().map(
- BindingValidationStatus::createUnresolvedStatus)
+ source.getBindings().stream()
+ .map(BindingValidationStatus::createUnresolvedStatus)
.collect(Collectors.toList()),
Collections.emptyList());
}
@@ -117,7 +117,8 @@ public boolean isOk() {
*/
public boolean hasErrors() {
return binderStatuses.stream().anyMatch(ValidationResult::isError)
- || bindingStatuses.stream().anyMatch(BindingValidationStatus::isError);
+ || bindingStatuses.stream()
+ .anyMatch(BindingValidationStatus::isError);
}
/**
@@ -137,8 +138,8 @@ public Binder getBinder() {
public List getValidationErrors() {
List errors = new ArrayList<>(
getFieldValidationErrors().stream()
- .map(s -> s.getResult().get())
- .collect(Collectors.toList()));
+ .map(s -> s.getResult().get())
+ .collect(Collectors.toList()));
errors.addAll(getBeanValidationErrors());
return errors;
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatusHandler.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatusHandler.java
index 304b3274aee..e8a8c5612a4 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatusHandler.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/BinderValidationStatusHandler.java
@@ -27,8 +27,7 @@
*
* error message} for failed field validations. For bean level validation errors
* the default handler will display the first error message in
- * {@link Binder#setStatusLabel(HasText) status label}, if one has
- * been set.
+ * {@link Binder#setStatusLabel(HasText) status label}, if one has been set.
*
* @author Vaadin Ltd
* @since 1.0
@@ -43,7 +42,7 @@
*/
@FunctionalInterface
public interface BinderValidationStatusHandler
-extends SerializableEventListener {
+ extends SerializableEventListener {
/**
* Invoked when the validation status has changed in binder.
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/BindingValidationStatusHandler.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/BindingValidationStatusHandler.java
index 8065b001922..ce5542a33da 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/BindingValidationStatusHandler.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/BindingValidationStatusHandler.java
@@ -35,7 +35,7 @@
*/
@FunctionalInterface
public interface BindingValidationStatusHandler
-extends SerializableEventListener {
+ extends SerializableEventListener {
/**
* Invoked when the validation status has changed in a binding.
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/ErrorMessageProvider.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/ErrorMessageProvider.java
index 371834b07f3..ce596320068 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/ErrorMessageProvider.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/ErrorMessageProvider.java
@@ -26,7 +26,7 @@
*/
@FunctionalInterface
public interface ErrorMessageProvider
-extends SerializableFunction {
+ extends SerializableFunction {
/**
* Returns a generated error message for given {@code ValueContext}.
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/RequiredFieldConfigurator.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/RequiredFieldConfigurator.java
index 7ad8d3580f0..69db9851bd7 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/RequiredFieldConfigurator.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/RequiredFieldConfigurator.java
@@ -56,8 +56,8 @@ public interface RequiredFieldConfigurator
*/
RequiredFieldConfigurator NOT_EMPTY = (annotation,
binding) -> (annotation.annotationType().equals(NotEmpty.class)
- || annotation.annotationType().getName()
- .equals("org.hibernate.validator.constraints.NotEmpty"))
+ || annotation.annotationType().getName().equals(
+ "org.hibernate.validator.constraints.NotEmpty"))
&& RequiredFieldConfiguratorUtil.testConvertedDefaultValue(
binding,
RequiredFieldConfiguratorUtil::hasZeroSize);
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/Result.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/Result.java
index ecd5fe3866e..df613c2091a 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/Result.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/Result.java
@@ -82,7 +82,7 @@ static Result error(String message) {
* @return the result of invoking the supplier
*/
static Result of(SerializableSupplier supplier,
- SerializableFunction onError) {
+ SerializableFunction onError) {
Objects.requireNonNull(supplier, "supplier cannot be null");
Objects.requireNonNull(onError, "onError cannot be null");
@@ -133,7 +133,7 @@ default Result map(SerializableFunction mapper) {
* the function to call if failure
*/
void handle(SerializableConsumer ifOk,
- SerializableConsumer ifError);
+ SerializableConsumer ifError);
/**
* Applies the {@code consumer} if result is not an error.
@@ -187,5 +187,5 @@ default void ifError(SerializableConsumer consumer) {
*/
R getOrThrow(
SerializableFunction exceptionProvider)
- throws X;
+ throws X;
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/Setter.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/Setter.java
index f180bfc96e7..a4d343afe6a 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/Setter.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/Setter.java
@@ -36,7 +36,7 @@
*/
@FunctionalInterface
public interface Setter
-extends BiConsumer, Serializable {
+ extends BiConsumer, Serializable {
/**
* Save value to the bean property.
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/SimpleResult.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/SimpleResult.java
index 6c40e4ff75a..baeaaabed26 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/SimpleResult.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/SimpleResult.java
@@ -100,7 +100,7 @@ public String toString() {
@Override
public R getOrThrow(
SerializableFunction exceptionSupplier)
- throws X {
+ throws X {
Objects.requireNonNull(exceptionSupplier,
"Exception supplier cannot be null");
if (isError()) {
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationException.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationException.java
index d172648845e..de5dd4c9680 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationException.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationException.java
@@ -62,8 +62,8 @@ public ValidationException(
public List getValidationErrors() {
List errors = new ArrayList<>(
getFieldValidationErrors().stream()
- .map(s -> s.getResult().get())
- .collect(Collectors.toList()));
+ .map(s -> s.getResult().get())
+ .collect(Collectors.toList()));
errors.addAll(getBeanValidationErrors());
return errors;
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationResult.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationResult.java
index 1e80be9298b..5e8067bbe6e 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationResult.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/ValidationResult.java
@@ -68,95 +68,94 @@ public Optional getErrorLevel() {
}
}
- /**
- * Returns the result message.
- *
- * Throws an {@link IllegalStateException} if the result represents success.
- *
- * @return the error message
- * @throws IllegalStateException
- * if the result represents success
- */
- String getErrorMessage();
+ /**
+ * Returns the result message.
+ *
+ * Throws an {@link IllegalStateException} if the result represents success.
+ *
+ * @return the error message
+ * @throws IllegalStateException
+ * if the result represents success
+ */
+ String getErrorMessage();
- /**
- * Returns optional error level for this validation result. Error level is
- * not present for successful validation results.
- *
- * Note: By default {@link ErrorLevel#INFO} and
- * {@link ErrorLevel#WARNING} are not considered to be blocking the
- * validation and conversion chain.
- *
- * @see #isError()
- *
- * @return optional error level; error level is present for validation
- * results that have not passed validation
- *
- */
- Optional getErrorLevel();
+ /**
+ * Returns optional error level for this validation result. Error level is
+ * not present for successful validation results.
+ *
+ * Note: By default {@link ErrorLevel#INFO} and
+ * {@link ErrorLevel#WARNING} are not considered to be blocking the
+ * validation and conversion chain.
+ *
+ * @see #isError()
+ *
+ * @return optional error level; error level is present for validation
+ * results that have not passed validation
+ *
+ */
+ Optional getErrorLevel();
- /**
- * Checks if the result denotes an error.
- *
- *Note: By default {@link ErrorLevel#INFO} and
- * {@link ErrorLevel#WARNING} are not considered to be errors.
- *
- * @return true if the result denotes an error,
- * false otherwise
- */
- default boolean isError() {
- ErrorLevel errorLevel = getErrorLevel().orElse(null);
- return errorLevel != null && errorLevel != ErrorLevel.INFO
- && errorLevel != ErrorLevel.WARNING;
- }
+ /**
+ * Checks if the result denotes an error.
+ *
+ * Note: By default {@link ErrorLevel#INFO} and
+ * {@link ErrorLevel#WARNING} are not considered to be errors.
+ *
+ * @return true if the result denotes an error,
+ * false otherwise
+ */
+ default boolean isError() {
+ ErrorLevel errorLevel = getErrorLevel().orElse(null);
+ return errorLevel != null && errorLevel != ErrorLevel.INFO
+ && errorLevel != ErrorLevel.WARNING;
+ }
- /**
- * Returns a successful result.
- *
- * @return the successful result
- */
- static ValidationResult ok() {
- return new SimpleValidationResult(null,null);
- }
+ /**
+ * Returns a successful result.
+ *
+ * @return the successful result
+ */
+ static ValidationResult ok() {
+ return new SimpleValidationResult(null, null);
+ }
- /**
- * Creates the validation result which represent an error with the given
- * {@code errorMessage}.
- *
- * @param errorMessage
- * error message, not {@code null}
- * @return validation result which represent an error with the given
- * {@code errorMessage}
- * @throws NullPointerException
- * if {@code errorMessage} is null
- */
- static ValidationResult error(String errorMessage) {
- Objects.requireNonNull(errorMessage);
- return create(errorMessage, ErrorLevel.ERROR);
- }
-
- /**
- * Creates the validation result with the given {@code errorMessage} and
- * {@code errorLevel}. Results with {@link ErrorLevel} of {@code INFO} or
- * {@code WARNING} are not errors by default.
- *
- * @see #ok()
- * @see #error(String)
- *
- * @param errorMessage
- * error message, not {@code null}
- * @param errorLevel
- * error level, not {@code null}
- * @return validation result with the given {@code errorMessage} and
- * {@code errorLevel}
- * @throws NullPointerException
- * if {@code errorMessage} or {@code errorLevel} is {@code null}
- *
- */
- static ValidationResult create(String errorMessage,
- ErrorLevel errorLevel) {
- Objects.requireNonNull(errorMessage);
- Objects.requireNonNull(errorLevel);
- return new SimpleValidationResult(errorMessage, errorLevel);
- }
+ /**
+ * Creates the validation result which represent an error with the given
+ * {@code errorMessage}.
+ *
+ * @param errorMessage
+ * error message, not {@code null}
+ * @return validation result which represent an error with the given
+ * {@code errorMessage}
+ * @throws NullPointerException
+ * if {@code errorMessage} is null
+ */
+ static ValidationResult error(String errorMessage) {
+ Objects.requireNonNull(errorMessage);
+ return create(errorMessage, ErrorLevel.ERROR);
+ }
+
+ /**
+ * Creates the validation result with the given {@code errorMessage} and
+ * {@code errorLevel}. Results with {@link ErrorLevel} of {@code INFO} or
+ * {@code WARNING} are not errors by default.
+ *
+ * @see #ok()
+ * @see #error(String)
+ *
+ * @param errorMessage
+ * error message, not {@code null}
+ * @param errorLevel
+ * error level, not {@code null}
+ * @return validation result with the given {@code errorMessage} and
+ * {@code errorLevel}
+ * @throws NullPointerException
+ * if {@code errorMessage} or {@code errorLevel} is {@code null}
+ *
+ */
+ static ValidationResult create(String errorMessage, ErrorLevel errorLevel) {
+ Objects.requireNonNull(errorMessage);
+ Objects.requireNonNull(errorLevel);
+ return new SimpleValidationResult(errorMessage, errorLevel);
}
+}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/Validator.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/Validator.java
index dd5b5c0aa14..363107c5b6a 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/binder/Validator.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/Validator.java
@@ -190,8 +190,8 @@ static Validator from(SerializablePredicate guard,
errorMessageProvider.apply(context), errorLevel);
}
} catch (Exception e) {
- LoggerFactory.getLogger(Validator.class.getName()).info(
- "An exception is thrown during validation", e);
+ LoggerFactory.getLogger(Validator.class.getName())
+ .info("An exception is thrown during validation", e);
return ValidationResult.create(
errorMessageProvider.apply(context), errorLevel);
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/converter/LocalDateTimeToDateConverter.java b/flow-data/src/main/java/com/vaadin/flow/data/converter/LocalDateTimeToDateConverter.java
index 98ee4c756a6..f31d72bd547 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/converter/LocalDateTimeToDateConverter.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/converter/LocalDateTimeToDateConverter.java
@@ -31,21 +31,25 @@
* @author Vaadin Ltd
* @since 1.0
*/
-public class LocalDateTimeToDateConverter implements Converter {
+public class LocalDateTimeToDateConverter
+ implements Converter {
private ZoneId zoneId;
/**
* Creates a new converter using the given time zone.
*
- * @param zoneId the time zone to use, not null
+ * @param zoneId
+ * the time zone to use, not null
*/
public LocalDateTimeToDateConverter(ZoneId zoneId) {
- this.zoneId = Objects.requireNonNull(zoneId, "Zone identifier cannot be null");
+ this.zoneId = Objects.requireNonNull(zoneId,
+ "Zone identifier cannot be null");
}
@Override
- public Result convertToModel(LocalDateTime localDate, ValueContext context) {
+ public Result convertToModel(LocalDateTime localDate,
+ ValueContext context) {
if (localDate == null) {
return Result.ok(null);
}
@@ -54,12 +58,14 @@ public Result convertToModel(LocalDateTime localDate, ValueContext context
}
@Override
- public LocalDateTime convertToPresentation(Date date, ValueContext context) {
+ public LocalDateTime convertToPresentation(Date date,
+ ValueContext context) {
if (date == null) {
return null;
}
- return Instant.ofEpochMilli(date.getTime()).atZone(zoneId).toLocalDateTime();
+ return Instant.ofEpochMilli(date.getTime()).atZone(zoneId)
+ .toLocalDateTime();
}
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToDateConverter.java b/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToDateConverter.java
index 26708ae8393..ccc963e8957 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToDateConverter.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToDateConverter.java
@@ -40,8 +40,9 @@
public class StringToDateConverter implements Converter {
/**
- * Returns the format used by {@link #convertToPresentation(Date, ValueContext)}
- * and {@link #convertToModel(String, ValueContext)}.
+ * Returns the format used by
+ * {@link #convertToPresentation(Date, ValueContext)} and
+ * {@link #convertToModel(String, ValueContext)}.
*
* @param locale
* The locale to use
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToUuidConverter.java b/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToUuidConverter.java
index be765e67577..25a081f5552 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToUuidConverter.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/converter/StringToUuidConverter.java
@@ -29,8 +29,8 @@
* Leading and trailing white spaces are ignored when converting from a String.
*
*
- * The String representation uses the canonical format of 32-characters with a hyphen
- * to separate each of five groups of hexadecimal digits as defined in:
+ * The String representation uses the canonical format of 32-characters with a
+ * hyphen to separate each of five groups of hexadecimal digits as defined in:
* RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace
* http://www.ietf.org/rfc/rfc4122.txt
*
@@ -44,17 +44,19 @@ public class StringToUuidConverter implements Converter {
/**
* Constructs a converter for String to UUID and back.
*
- * @param errorMessage the error message to use if conversion fails
+ * @param errorMessage
+ * the error message to use if conversion fails
*/
public StringToUuidConverter(String errorMessage) {
this(ctx -> errorMessage);
}
/**
- * Constructs a new converter instance with the given error message provider.
- * Empty strings are converted to null.
+ * Constructs a new converter instance with the given error message
+ * provider. Empty strings are converted to null.
*
- * @param errorMessageProvider the error message provider to use if conversion fails
+ * @param errorMessageProvider
+ * the error message provider to use if conversion fails
*/
public StringToUuidConverter(ErrorMessageProvider errorMessageProvider) {
this.errorMessageProvider = errorMessageProvider;
@@ -74,11 +76,12 @@ public Result convertToModel(String value, ValueContext context) {
try {
uuid = UUID.fromString(value);
} catch (java.lang.IllegalArgumentException e) {
- LoggerFactory.getLogger(StringToUuidConverter.class.getName()).warn(
- "Unable to convert String to UUID: " + value, e);
+ LoggerFactory.getLogger(StringToUuidConverter.class.getName())
+ .warn("Unable to convert String to UUID: " + value, e);
return Result.error(this.errorMessageProvider.apply(context));
}
- return Result.ok(uuid); // Return the UUID object, converted from String.
+ return Result.ok(uuid); // Return the UUID object, converted from
+ // String.
}
@Override
@@ -87,7 +90,8 @@ public String convertToPresentation(UUID value, ValueContext context) {
return null;
}
// `java.util.UUID::toString` generates a textual representation of a
- // UUID’s 128-bits as in a hexadecimal `String` in 32-character canonical
+ // UUID’s 128-bits as in a hexadecimal `String` in 32-character
+ // canonical
// format with four hyphens separating groups of digits.
// https://docs.oracle.com/javase/10/docs/api/java/util/UUID.html#toString()
return value.toString();
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractDataProvider.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractDataProvider.java
index 7c057eb03bd..3e1c7de8a05 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractDataProvider.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractDataProvider.java
@@ -45,7 +45,8 @@ public abstract class AbstractDataProvider implements DataProvider {
@Override
public Registration addDataProviderListener(
DataProviderListener listener) {
- // Using an anonymous class instead of lambda or method reference to prevent potential
+ // Using an anonymous class instead of lambda or method reference to
+ // prevent potential
// self reference serialization issues when clients holds a reference
// to the Registration instance returned by this method
SerializableConsumer consumer = new SerializableConsumer() {
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractListDataView.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractListDataView.java
index 04aadf359a6..4867da08ebd 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractListDataView.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/AbstractListDataView.java
@@ -355,8 +355,8 @@ private void addItemOnTarget(T item, T target,
* position towards to target item.
*/
removeItemIfPresent(item, dataProvider);
- itemList.add(insertItemsIndexProvider.apply(getItemIndex(target,
- itemList.stream())), item);
+ itemList.add(insertItemsIndexProvider
+ .apply(getItemIndex(target, itemList.stream())), item);
dataProvider.refreshAll();
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java
index 53766241f0e..0ac13c88317 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataChangeEvent.java
@@ -65,9 +65,11 @@ public DataRefreshEvent(DataProvider source, T item) {
* @param item
* the updated item, not null
* @param refreshChildren
- * whether, in hierarchical providers, subelements should be refreshed as well
+ * whether, in hierarchical providers, subelements should be
+ * refreshed as well
*/
- public DataRefreshEvent(DataProvider source, T item, boolean refreshChildren) {
+ public DataRefreshEvent(DataProvider source, T item,
+ boolean refreshChildren) {
super(source);
Objects.requireNonNull(item, "Refreshed item can't be null");
this.item = item;
@@ -84,9 +86,11 @@ public T getItem() {
}
/**
- * Gets the a boolean whether the refresh is supposed to be refreshChildren (in hierarchical data providers).
+ * Gets the a boolean whether the refresh is supposed to be
+ * refreshChildren (in hierarchical data providers).
*
- * @return whether, in hierarchical providers, subelements should be refreshed as well
+ * @return whether, in hierarchical providers, subelements should be
+ * refreshed as well
*/
public boolean isRefreshChildren() {
return refreshChildren;
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java
index b691279457a..7d59db15d55 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java
@@ -126,18 +126,20 @@ public class DataCommunicator implements Serializable {
/**
* In-memory data provider with no items.
*
- * Data Communicator is initialised with this data provider by default
- * until a new data provider is assigned with
+ * Data Communicator is initialised with this data provider by default until
+ * a new data provider is assigned with
* {@link #setDataProvider(DataProvider, Object)}.
*
- * @param item type
+ * @param
+ * item type
*
* @see AbstractDataView#AbstractDataView(SerializableSupplier, Component)
*/
- public static final class EmptyDataProvider extends ListDataProvider {
+ public static final class EmptyDataProvider
+ extends ListDataProvider {
/**
- * Create in-memory data provider instance with no items in the
- * backed collection.
+ * Create in-memory data provider instance with no items in the backed
+ * collection.
*/
public EmptyDataProvider() {
super(new ArrayList<>(0));
@@ -286,9 +288,9 @@ public DataCommunicator(DataGenerator dataGenerator,
* @param stateNode
* the state node used to communicate for
* @param fetchEnabled
- * if {@code fetchEnabled} is {@code true} then the data
- * provider will be called to fetch the items and/or to get the
- * items count until it's set to {@code false}
+ * if {@code fetchEnabled} is {@code true} then the data provider
+ * will be called to fetch the items and/or to get the items
+ * count until it's set to {@code false}
*/
public DataCommunicator(DataGenerator dataGenerator,
ArrayUpdater arrayUpdater,
@@ -505,8 +507,8 @@ public boolean isItemActive(T item) {
* Gets the item at the given index from the data available to the
* component. Data is filtered and sorted the same way as in the component.
*
- * Call to the backend is triggered if the item for a requested index is
- * not present in the cached active items.
+ * Call to the backend is triggered if the item for a requested index is not
+ * present in the cached active items.
*
* @param index
* the index of the item to get
@@ -523,22 +525,21 @@ public T getItem(int index) {
int activeDataEnd = activeStart + activeKeyOrder.size() - 1;
/*
* Check if the item on a requested index is already in the cache of
- * active items. No matter is this currently a defined or undefined
- * mode
+ * active items. No matter is this currently a defined or undefined mode
*/
if (index >= activeStart && index <= activeDataEnd) {
return getKeyMapper().get(activeKeyOrder.get(index - activeStart));
} else {
final int itemCount = getItemCount();
/*
- * The exception is thrown if the exact size is used and the data
- * is empty, or the index is outside of the item count range,
- * because we definitely know the item count from a backend.
+ * The exception is thrown if the exact size is used and the data is
+ * empty, or the index is outside of the item count range, because
+ * we definitely know the item count from a backend.
*/
if (isDefinedSize()) {
if (itemCount == 0) {
- throw new IndexOutOfBoundsException(String
- .format("Requested index %d on empty data.", index));
+ throw new IndexOutOfBoundsException(String.format(
+ "Requested index %d on empty data.", index));
} else if (index >= itemCount) {
throw new IndexOutOfBoundsException(String.format(
"Given index %d is outside of the accepted range '0 - %d'",
@@ -546,13 +547,12 @@ public T getItem(int index) {
}
}
/*
- * In case of undefined size we don't check the empty data or
- * the item count, because item count = 0 may mean the
- * flush (fetch) action hasn't been made yet. And even
- * if the requested index is outside of the item count
- * estimation, we can make the request, because the backend can
- * have the item on that index (we simply not yet fetched
- * this item during the scrolling).
+ * In case of undefined size we don't check the empty data or the
+ * item count, because item count = 0 may mean the flush (fetch)
+ * action hasn't been made yet. And even if the requested index is
+ * outside of the item count estimation, we can make the request,
+ * because the backend can have the item on that index (we simply
+ * not yet fetched this item during the scrolling).
*/
return (T) getDataProvider().fetch(buildQuery(index, 1)).findFirst()
.orElse(null);
@@ -955,7 +955,8 @@ protected Stream fetchFromProvider(int offset, int limit) {
doFetchFromDataProvider(newOffset, pageSize)
.forEach(addItemAndCheckConsumer);
page++;
- } while (page < pages && fetchedPerPage.getAndSet(0) == pageSize);
+ } while (page < pages
+ && fetchedPerPage.getAndSet(0) == pageSize);
stream = streamBuilder.build();
} else {
@@ -1300,15 +1301,14 @@ private List getJsonItems(Range range) {
}
private static void withMissing(Range expected, Range actual,
- Consumer action) {
+ Consumer action) {
Range[] partition = expected.partitionWith(actual);
applyIfNotEmpty(partition[0], action);
applyIfNotEmpty(partition[2], action);
}
- private static void applyIfNotEmpty(Range range,
- Consumer action) {
+ private static void applyIfNotEmpty(Range range, Consumer action) {
if (!range.isEmpty()) {
action.accept(range);
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataKeyMapper.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataKeyMapper.java
index 8d813025aeb..9a9f952c4d1 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataKeyMapper.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataKeyMapper.java
@@ -93,4 +93,3 @@ public interface DataKeyMapper extends Serializable {
*/
void setIdentifierGetter(ValueProvider identifierGetter);
}
-
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataProvider.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataProvider.java
index e930a8aa573..56d92900400 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataProvider.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataProvider.java
@@ -113,9 +113,9 @@ public interface DataProvider extends Serializable {
*
* @see #refreshItem(Object)
*
- * By default it just does a standard refreshItem, in a hierarchical DataProvider
- * it is supposed to refresh all of the children as well in case 'refreshChildren'
- * is true.
+ * By default it just does a standard refreshItem, in a hierarchical
+ * DataProvider it is supposed to refresh all of the children as well
+ * in case 'refreshChildren' is true.
*
* @param item
* the item to refresh
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataView.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataView.java
index 52d0c0e8280..3ada5feb9a6 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataView.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataView.java
@@ -59,9 +59,9 @@ public interface DataView extends Serializable {
*
* For this to work properly, the item must either implement
* {@link Object#equals(Object)} and {@link Object#hashCode()} to consider
- * both the old and the new item instances to be equal, or alternatively
- * use the {@link #setIdentifierProvider(IdentifierProvider)} to set
- * an appropriate item's identifier.
+ * both the old and the new item instances to be equal, or alternatively use
+ * the {@link #setIdentifierProvider(IdentifierProvider)} to set an
+ * appropriate item's identifier.
*
* This method delegates the update to
* {@link DataProvider#refreshItem(Object)}.
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataViewUtils.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataViewUtils.java
index 9c7884454a7..38d7b524cca 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataViewUtils.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataViewUtils.java
@@ -85,7 +85,7 @@ public static Optional> getComponentSortComparator
* items type
*/
public static void setComponentFilter(Component component,
- SerializablePredicate filter) {
+ SerializablePredicate filter) {
ComponentUtil.setData(component, COMPONENT_IN_MEMORY_FILTER_KEY,
filter);
}
@@ -104,7 +104,7 @@ public static void setComponentFilter(Component component,
* items type
*/
public static void setComponentSortComparator(Component component,
- SerializableComparator sortComparator) {
+ SerializableComparator sortComparator) {
ComponentUtil.setData(component, COMPONENT_IN_MEMORY_SORTING_KEY,
sortComparator);
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/InMemoryDataProvider.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/InMemoryDataProvider.java
index f0ad28dc721..ba077e22f7c 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/InMemoryDataProvider.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/InMemoryDataProvider.java
@@ -232,8 +232,7 @@ default void clearFilters() {
* @param comparator
* a comparator to add, not null
*/
- default void addSortComparator(
- SerializableComparator comparator) {
+ default void addSortComparator(SerializableComparator comparator) {
Objects.requireNonNull(comparator, "Comparator to add cannot be null");
SerializableComparator originalComparator = getSortComparator();
if (originalComparator == null) {
@@ -402,8 +401,7 @@ default DataProvider filteringBySubstring(
ValueProvider valueProvider, Locale locale) {
Objects.requireNonNull(locale, "Locale cannot be null");
return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(
- this, valueProvider,
- String::contains, () -> locale);
+ this, valueProvider, String::contains, () -> locale);
}
/**
@@ -444,8 +442,8 @@ default DataProvider filteringBySubstring(
*/
default DataProvider filteringByPrefix(
ValueProvider valueProvider, Locale locale) {
- return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(this, valueProvider,
- String::startsWith, () -> locale);
+ return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(
+ this, valueProvider, String::startsWith, () -> locale);
}
/**
@@ -464,7 +462,8 @@ default DataProvider filteringByPrefix(
*/
default DataProvider filteringByPrefix(
ValueProvider valueProvider) {
- return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(this, valueProvider,
- String::startsWith, InMemoryDataProviderHelpers.CURRENT_LOCALE_SUPPLIER);
+ return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(
+ this, valueProvider, String::startsWith,
+ InMemoryDataProviderHelpers.CURRENT_LOCALE_SUPPLIER);
}
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeEvent.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeEvent.java
index 8be0e57ed10..c1c1fed8efc 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeEvent.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeEvent.java
@@ -53,7 +53,8 @@ public class ItemCountChangeEvent
* @param itemCountEstimated
* whether item count is an estimate
*/
- public ItemCountChangeEvent(T source, int itemCount, boolean itemCountEstimated) {
+ public ItemCountChangeEvent(T source, int itemCount,
+ boolean itemCountEstimated) {
super(source, false);
this.itemCount = itemCount;
this.itemCountEstimated = itemCountEstimated;
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeListener.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeListener.java
index 345c8e36e79..4a584d9e36f 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeListener.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/ItemCountChangeListener.java
@@ -23,12 +23,12 @@
* Items count changes are mostly due to filtering of the data, but can also be
* sent for changes in the dataset.
*
- * The {@link #itemCountChanged(ItemCountChangeEvent)} will be called
- * during the "before client response"-phase, so changes done during the
- * server round trip will only receive one event.
- * For example, this code will trigger only one
+ * The {@link #itemCountChanged(ItemCountChangeEvent)} will be called during the
+ * "before client response"-phase, so changes done during the server round trip
+ * will only receive one event. For example, this code will trigger only one
* {@link #itemCountChanged(ItemCountChangeEvent)} method call, although there
* are two methods called which cause the item count change:
+ *
*
* {@code
* dataView.addItemCountChangeListener(listener);
@@ -46,7 +46,7 @@ public interface ItemCountChangeListener extends Serializable {
* Invoked for changes in the data size.
*
* @param event
- * Component event containing new data size
+ * Component event containing new data size
*/
void itemCountChanged(ItemCountChangeEvent event);
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/ListDataView.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/ListDataView.java
index 5d080f79bb3..ab8fb0965dd 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/ListDataView.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/ListDataView.java
@@ -56,8 +56,8 @@ public interface ListDataView>
boolean contains(T item);
/**
- * Get the full item count with filters if any set. As the item count
- * might change at any point, it is recommended to add a listener with the
+ * Get the full item count with filters if any set. As the item count might
+ * change at any point, it is recommended to add a listener with the
* {@link #addItemCountChangeListener(ComponentEventListener)} method
* instead to get notified when the item count has changed.
*
@@ -99,8 +99,8 @@ public interface ListDataView>
/**
* Adds an item to the data list if it is not already present.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* @param item
* item to add
@@ -116,8 +116,8 @@ public interface ListDataView>
/**
* Adds an item after the given target item.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* If the item is already present in the data provider, then it is moved.
*
@@ -140,8 +140,8 @@ public interface ListDataView>
/**
* Adds an item before the given target item.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* If the item is already present in the data provider, then it is moved.
*
@@ -164,8 +164,8 @@ public interface ListDataView>
/**
* Adds multiple items to the data list.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* Any items that already present in the data provider are moved to the end.
*
@@ -184,9 +184,9 @@ public interface ListDataView>
* Adds multiple items after the given target item. The full collection is
* added in order after the target.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
- * Any items that already present in the data provider are moved.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception. Any items that already present in
+ * the data provider are moved.
*
* Note! Item is added to the unfiltered and unsorted List.
*
@@ -208,8 +208,8 @@ public interface ListDataView>
* Adds multiple items before the given target item. The full collection is
* added in order before the target.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* Any items that already present in the data provider are moved.
*
@@ -232,8 +232,8 @@ public interface ListDataView>
/**
* Remove an item from the data list.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* @param item
* item to remove
@@ -248,8 +248,8 @@ public interface ListDataView>
/**
* Remove multiple items from the data list.
*
- * The backing {@link List} must be mutable to use this method. Immutable data
- * structure will throw an exception.
+ * The backing {@link List} must be mutable to use this method. Immutable
+ * data structure will throw an exception.
*
* @param items
* collection of items to remove
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HasHierarchicalDataProvider.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HasHierarchicalDataProvider.java
index 76bde643428..f082df5c815 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HasHierarchicalDataProvider.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HasHierarchicalDataProvider.java
@@ -177,5 +177,6 @@ public default void setItems(Stream rootItems,
* @param hierarchicalDataProvider
* the hierarchical data provider to use, not {@code null}
*/
- void setDataProvider(HierarchicalDataProvider hierarchicalDataProvider);
+ void setDataProvider(
+ HierarchicalDataProvider hierarchicalDataProvider);
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalCommunicationController.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalCommunicationController.java
index 70928dc6ef5..dad2540fbda 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalCommunicationController.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalCommunicationController.java
@@ -261,8 +261,7 @@ private List activate(Range range) {
if (mapperHasKey) {
// Ensure latest instance from provider is used
keyMapper.refresh(bean);
- passivatedByUpdate.values()
- .forEach(set -> set.remove(key));
+ passivatedByUpdate.values().forEach(set -> set.remove(key));
}
activeKeys.add(key);
});
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java
index 49d97b9524a..b7fe7c29931 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchicalDataCommunicator.java
@@ -159,18 +159,15 @@ public void reset() {
.startUpdate(getHierarchyMapper().getRootSize());
update.enqueue("$connector.ensureHierarchy");
- Collection expandedItems = getHierarchyMapper().getExpandedItems();
+ Collection expandedItems = getHierarchyMapper()
+ .getExpandedItems();
if (!expandedItems.isEmpty()) {
- update.enqueue("$connector.expandItems",
- expandedItems
- .stream()
- .map(getKeyMapper()::key)
- .map(key -> {
- JsonObject json = Json.createObject();
- json.put("key", key);
- return json;
- }).collect(
- JsonUtils.asArray()));
+ update.enqueue("$connector.expandItems", expandedItems.stream()
+ .map(getKeyMapper()::key).map(key -> {
+ JsonObject json = Json.createObject();
+ json.put("key", key);
+ return json;
+ }).collect(JsonUtils.asArray()));
}
requestFlush(update);
@@ -178,16 +175,19 @@ public void reset() {
}
@Override
- protected void handleDataRefreshEvent(DataChangeEvent.DataRefreshEvent event) {
+ protected void handleDataRefreshEvent(
+ DataChangeEvent.DataRefreshEvent event) {
if (event.isRefreshChildren()) {
T item = event.getItem();
if (isExpanded(item)) {
String parentKey = uniqueKeyProviderSupplier.get().apply(item);
if (!dataControllers.containsKey(parentKey)) {
- setParentRequestedRange(0, mapper.countChildItems(item), item);
+ setParentRequestedRange(0, mapper.countChildItems(item),
+ item);
}
- HierarchicalCommunicationController dataController = dataControllers.get(parentKey);
+ HierarchicalCommunicationController dataController = dataControllers
+ .get(parentKey);
if (dataController != null) {
dataController.setResendEntireRange(true);
requestFlush(dataController);
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchyMapper.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchyMapper.java
index 34f6da66a10..4a17db738ab 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchyMapper.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/HierarchyMapper.java
@@ -189,8 +189,8 @@ private boolean doExpand(T item) {
*
* @param item
* the item to collapse
- * @return {@code true} if item has been collapsed,
- * {@code false} if item is empty or already collapsed
+ * @return {@code true} if item has been collapsed, {@code false} if item is
+ * empty or already collapsed
*/
public boolean collapse(T item) {
if (item == null) {
@@ -225,7 +225,6 @@ public Range collapse(T item, Integer position) {
return removedRows;
}
-
/**
* Gets the current in-memory sorting.
*
@@ -374,10 +373,10 @@ private Stream doFetchDirectChildren(T parent, Range range) {
Range actualRange = (range == null)
? Range.withLength(0, Integer.MAX_VALUE)
: range;
- return getDataProvider().fetchChildren(new HierarchicalQuery(
- actualRange.getStart(), actualRange.length(),
- getBackEndSorting(),
- getInMemorySorting(), getFilter(), parent));
+ return getDataProvider()
+ .fetchChildren(new HierarchicalQuery(actualRange.getStart(),
+ actualRange.length(), getBackEndSorting(),
+ getInMemorySorting(), getFilter(), parent));
}
/**
@@ -573,12 +572,10 @@ private Stream getChildrenStream(T parent, Range range,
registerChildren(parent, childList);
}
}
- return combineParentAndChildStreams(parent,
- childList.stream(),
+ return combineParentAndChildStreams(parent, childList.stream(),
includeParent);
}
-
/**
* Register parent and children items into inner structures. May be
* overridden in subclasses.
@@ -635,7 +632,7 @@ public boolean hasExpandedItems() {
* Returns the expanded items in form of an unmodifiable collection.
*
* @return an unmodifiable {@code Collection} containing the expanded
- * items.
+ * items.
*/
public Collection getExpandedItems() {
return Collections.unmodifiableCollection(expandedItems.values());
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/TreeDataProvider.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/TreeDataProvider.java
index d151c7bfafc..4d8c997bbda 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/TreeDataProvider.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/hierarchy/TreeDataProvider.java
@@ -24,7 +24,6 @@
import com.vaadin.flow.function.SerializableComparator;
import com.vaadin.flow.function.SerializablePredicate;
-
/**
* An in-memory data provider for listing components that display hierarchical
* data. Uses an instance of {@link TreeData} as its source of data.
@@ -89,8 +88,8 @@ public int getChildCount(
items = treeData.getRootItems().stream();
}
- return (int) getFilteredStream(items,
- query.getFilter()).skip(query.getOffset()).limit(query.getLimit()).count();
+ return (int) getFilteredStream(items, query.getFilter())
+ .skip(query.getOffset()).limit(query.getLimit()).count();
}
@Override
@@ -143,17 +142,16 @@ public void setSortComparator(SerializableComparator comparator) {
private Stream getFilteredStream(Stream stream,
Optional> queryFilter) {
- final Optional> combinedFilter =
- filter != null ?
- Optional.of(queryFilter.map(filter::and).orElse(filter)) :
- queryFilter;
- return combinedFilter
- .map(f -> stream.filter(element -> flatten(element).anyMatch(f)))
- .orElse(stream);
+ final Optional> combinedFilter = filter != null
+ ? Optional.of(queryFilter.map(filter::and).orElse(filter))
+ : queryFilter;
+ return combinedFilter.map(
+ f -> stream.filter(element -> flatten(element).anyMatch(f)))
+ .orElse(stream);
}
private Stream flatten(T element) {
- return Stream.concat(Stream.of(element),
- getTreeData().getChildren(element).stream().flatMap(this::flatten));
+ return Stream.concat(Stream.of(element), getTreeData()
+ .getChildren(element).stream().flatMap(this::flatten));
}
}
diff --git a/flow-data/src/main/java/com/vaadin/flow/data/renderer/BasicRenderer.java b/flow-data/src/main/java/com/vaadin/flow/data/renderer/BasicRenderer.java
index 3e3573aae95..4dcb9e9f224 100644
--- a/flow-data/src/main/java/com/vaadin/flow/data/renderer/BasicRenderer.java
+++ b/flow-data/src/main/java/com/vaadin/flow/data/renderer/BasicRenderer.java
@@ -81,17 +81,16 @@ public Rendering