Skip to content

Commit

Permalink
run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Anisimov committed May 5, 2021
1 parent 5e73864 commit 3dcc844
Showing 530 changed files with 4,822 additions and 4,354 deletions.
2 changes: 0 additions & 2 deletions flow-client/src/main/java/com/vaadin/client/BrowserInfo.java
Original file line number Diff line number Diff line change
@@ -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) ||
2 changes: 1 addition & 1 deletion flow-client/src/main/java/com/vaadin/client/Console.java
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
*/
public final class Console {
private static boolean shouldLogToBrowserConsole;

@FunctionalInterface
// Runnable that can throw
private interface DeferWithoutEntryTask {
Original file line number Diff line number Diff line change
@@ -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));
3 changes: 2 additions & 1 deletion flow-client/src/main/java/com/vaadin/client/LitUtils.java
Original file line number Diff line number Diff line change
@@ -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
*/
122 changes: 52 additions & 70 deletions flow-client/src/main/java/com/vaadin/client/LoadingIndicator.java
Original file line number Diff line number Diff line change
@@ -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,24 +277,28 @@ 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.
* <p>
* 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;
setupTheming();
}

/**
* 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.
* <p>
* 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;
9 changes: 4 additions & 5 deletions flow-client/src/main/java/com/vaadin/client/PolymerUtils.java
Original file line number Diff line number Diff line change
@@ -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<EventRemover> registrations, NodeMap map) {
private static void registerPropertyChangeHandlers(JsonValue value,
JsArray<EventRemover> 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);
}-*/;

10 changes: 5 additions & 5 deletions flow-client/src/main/java/com/vaadin/client/PopStateHandler.java
Original file line number Diff line number Diff line change
@@ -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) {
Original file line number Diff line number Diff line change
@@ -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("."));
Original file line number Diff line number Diff line change
@@ -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 <code>null</code>
* if no value is defined
* @return integer value of the configuration parameter, or
* <code>null</code> if no value is defined
*/
public native Integer getConfigInteger(String name)
/*-{
Original file line number Diff line number Diff line change
@@ -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)));
}

/**
Original file line number Diff line number Diff line change
@@ -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(<body> 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(<body> 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();
}
Original file line number Diff line number Diff line change
@@ -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);
Loading

0 comments on commit 3dcc844

Please sign in to comment.