diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-18 09:27:03 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-18 09:27:03 +0300 |
commit | 6d54d78944f6c3278eed3bb5e7ee19687ee5714e (patch) | |
tree | 8142f622e644e98bb3f8d19a7021fd125f9fed40 /client | |
parent | 7b899665d07be33f86015f71695868c70bc5a589 (diff) | |
download | vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.tar.gz vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.zip |
Format using Eclipse Neon
Change-Id: I33f1cc33969ff74a95b1b8cc0f2add589be5aae0
Diffstat (limited to 'client')
252 files changed, 3868 insertions, 3466 deletions
diff --git a/client/src/main/java/com/vaadin/client/AnimationUtil.java b/client/src/main/java/com/vaadin/client/AnimationUtil.java index 063a0a163e..816a5f9e28 100644 --- a/client/src/main/java/com/vaadin/client/AnimationUtil.java +++ b/client/src/main/java/com/vaadin/client/AnimationUtil.java @@ -65,7 +65,7 @@ public class AnimationUtil { var callbackFunc = $entry(function(e) { listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e); }); - + elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); // Store function reference for later removal @@ -111,7 +111,7 @@ public class AnimationUtil { return event.mozAnimationName; else if(event.oAnimationName) return event.oAnimationName; - + return ""; }-*/; @@ -119,22 +119,22 @@ public class AnimationUtil { public static native String getAnimationName(ComputedStyle cstyle) /*-{ var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; - + if(!cs.getPropertyValue) return ""; - + if(cs.getPropertyValue("-webkit-animation-name")) return cs.getPropertyValue("-webkit-animation-name"); - + else if(cs.getPropertyValue("animation-name")) return cs.getPropertyValue("animation-name"); - + else if(cs.getPropertyValue("-moz-animation-name")) return cs.getPropertyValue("-moz-animation-name"); - + else if(cs.getPropertyValue("-o-animation-name")) return cs.getPropertyValue("-o-animation-name"); - + return ""; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index a9fd9803c3..81cea63313 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -418,7 +418,8 @@ public class ApplicationConfiguration implements EntryPoint { .intValue(); // null -> false - standalone = jsoConfiguration.getConfigBoolean("standalone") == Boolean.TRUE; + standalone = jsoConfiguration + .getConfigBoolean("standalone") == Boolean.TRUE; heartbeatInterval = jsoConfiguration .getConfigInteger("heartbeatInterval"); @@ -442,7 +443,8 @@ public class ApplicationConfiguration implements EntryPoint { @Override public void execute() { Profiler.enter("ApplicationConfiguration.startApplication"); - ApplicationConfiguration appConf = getConfigFromDOM(applicationId); + ApplicationConfiguration appConf = getConfigFromDOM( + applicationId); ApplicationConnection a = GWT .create(ApplicationConnection.class); a.init(widgetSet, appConf); @@ -511,7 +513,8 @@ public class ApplicationConfiguration implements EntryPoint { // Initialize if not already loaded Integer currentTag = Integer.valueOf(tag); while (type == null && currentTag != null) { - String serverSideClassNameForTag = getServerSideClassNameForTag(currentTag); + String serverSideClassNameForTag = getServerSideClassNameForTag( + currentTag); if (TypeData.hasIdentifier(serverSideClassNameForTag)) { try { type = (Class<? extends ServerConnector>) TypeData @@ -624,9 +627,8 @@ public class ApplicationConfiguration implements EntryPoint { cmd.execute(); } callbacks.clear(); - } else if (dependenciesLoading == 0 - && !ConnectorBundleLoader.get().isBundleLoaded( - ConnectorBundleLoader.DEFERRED_BUNDLE_NAME)) { + } else if (dependenciesLoading == 0 && !ConnectorBundleLoader.get() + .isBundleLoaded(ConnectorBundleLoader.DEFERRED_BUNDLE_NAME)) { ConnectorBundleLoader.get().loadBundle( ConnectorBundleLoader.DEFERRED_BUNDLE_NAME, new BundleLoadCallback() { @@ -655,9 +657,8 @@ public class ApplicationConfiguration implements EntryPoint { // Don't run twice if the module has been inherited several times, // and don't continue if vaadinBootstrap was not executed. if (moduleLoaded || !vaadinBootstrapLoaded()) { - getLogger() - .log(Level.WARNING, - "vaadinBootstrap.js was not loaded, skipping vaadin application configuration."); + getLogger().log(Level.WARNING, + "vaadinBootstrap.js was not loaded, skipping vaadin application configuration."); return; } moduleLoaded = true; @@ -714,7 +715,8 @@ public class ApplicationConfiguration implements EntryPoint { @Override public void onFailure(Throwable reason) { - Window.alert("Failed to load Vaadin debug window styles"); + Window.alert( + "Failed to load Vaadin debug window styles"); } }); diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java index 97ddd14764..f8c75948eb 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java @@ -109,9 +109,8 @@ public class ApplicationConnection implements HasHandlers { * <pre> * if (sessionExpired) { * response.setHeader("Content-Type", "text/html"); - * response.getWriter().write( - * myLoginPageHtml + "<!-- Vaadin-Refresh: " - * + request.getContextPath() + " -->"); + * response.getWriter().write(myLoginPageHtml + "<!-- Vaadin-Refresh: " + * + request.getContextPath() + " -->"); * } * </pre> */ @@ -156,7 +155,8 @@ public class ApplicationConnection implements HasHandlers { void onResponseHandlingEnded(ResponseHandlingEndedEvent e); } - public static class RequestStartingEvent extends ApplicationConnectionEvent { + public static class RequestStartingEvent + extends ApplicationConnectionEvent { public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>(); @@ -175,8 +175,8 @@ public class ApplicationConnection implements HasHandlers { } } - public static class ResponseHandlingEndedEvent extends - ApplicationConnectionEvent { + public static class ResponseHandlingEndedEvent + extends ApplicationConnectionEvent { public static Type<CommunicationHandler> TYPE = new Type<CommunicationHandler>(); @@ -195,8 +195,8 @@ public class ApplicationConnection implements HasHandlers { } } - public static abstract class ApplicationConnectionEvent extends - GwtEvent<CommunicationHandler> { + public static abstract class ApplicationConnectionEvent + extends GwtEvent<CommunicationHandler> { private ApplicationConnection connection; @@ -210,8 +210,8 @@ public class ApplicationConnection implements HasHandlers { } - public static class ResponseHandlingStartedEvent extends - ApplicationConnectionEvent { + public static class ResponseHandlingStartedEvent + extends ApplicationConnectionEvent { public ResponseHandlingStartedEvent(ApplicationConnection connection) { super(connection); @@ -242,8 +242,8 @@ public class ApplicationConnection implements HasHandlers { * @since 7.1.8 * @author Vaadin Ltd */ - public static class ApplicationStoppedEvent extends - GwtEvent<ApplicationStoppedHandler> { + public static class ApplicationStoppedEvent + extends GwtEvent<ApplicationStoppedHandler> { public static Type<ApplicationStoppedHandler> TYPE = new Type<ApplicationStoppedHandler>(); @@ -351,8 +351,8 @@ public class ApplicationConnection implements HasHandlers { public ApplicationConnection() { // Assuming UI data is eagerly loaded - ConnectorBundleLoader.get().loadBundle( - ConnectorBundleLoader.EAGER_BUNDLE_NAME, null); + ConnectorBundleLoader.get() + .loadBundle(ConnectorBundleLoader.EAGER_BUNDLE_NAME, null); uIConnector = GWT.create(UIConnector.class); rpcManager = GWT.create(RpcManager.class); layoutManager = GWT.create(LayoutManager.class); @@ -368,9 +368,8 @@ public class ApplicationConnection implements HasHandlers { getLogger().info("Starting application " + cnf.getRootPanelId()); getLogger().info("Using theme: " + cnf.getThemeName()); - getLogger().info( - "Vaadin application servlet version: " - + cnf.getServletVersion()); + getLogger().info("Vaadin application servlet version: " + + cnf.getServletVersion()); if (!cnf.getServletVersion().equals(Version.getFullVersion())) { getLogger() @@ -440,8 +439,8 @@ public class ApplicationConnection implements HasHandlers { // Hack to avoid logging an error in endRequest() getMessageSender().startRequest(); - getMessageHandler().handleMessage( - MessageHandler.parseJson(jsonText)); + getMessageHandler() + .handleMessage(MessageHandler.parseJson(jsonText)); } // Tooltip can't be created earlier because the @@ -483,7 +482,7 @@ public class ApplicationConnection implements HasHandlers { return vi; } } - + client.getProfilingData = $entry(function() { var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); var pd = [ @@ -498,7 +497,7 @@ public class ApplicationConnection implements HasHandlers { pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; return pd; }); - + client.getElementByPath = $entry(function(id) { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); }); @@ -515,7 +514,7 @@ public class ApplicationConnection implements HasHandlers { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); }); client.initializing = false; - + $wnd.vaadin.clients[TTAppId] = client; }-*/; @@ -619,10 +618,9 @@ public class ApplicationConnection implements HasHandlers { // Show this message just once if (cssWaits++ == 0) { - getLogger().warning( - "Assuming CSS loading is not complete, " - + "postponing render phase. " - + "(.v-loading-indicator height == 0)"); + getLogger().warning("Assuming CSS loading is not complete, " + + "postponing render phase. " + + "(.v-loading-indicator height == 0)"); } } else { cssLoaded = true; @@ -775,9 +773,8 @@ public class ApplicationConnection implements HasHandlers { @Override public void onError(ResourceLoadEvent event) { - getLogger() - .severe(event.getResourceUrl() - + " could not be loaded, or the load detection failed because the stylesheet is empty."); + getLogger().severe(event.getResourceUrl() + + " could not be loaded, or the load detection failed because the stylesheet is empty."); // The show must go on onLoad(event); } @@ -1361,9 +1358,8 @@ public class ApplicationConnection implements HasHandlers { */ @Deprecated public void unregisterPaintable(ServerConnector p) { - getLogger().info( - "unregisterPaintable (unnecessarily) called for " - + Util.getConnectorString(p)); + getLogger().info("unregisterPaintable (unnecessarily) called for " + + Util.getConnectorString(p)); } /** @@ -1397,10 +1393,8 @@ public class ApplicationConnection implements HasHandlers { } if (!manageCaption) { - getLogger() - .warning( - Util.getConnectorString(connector) - + " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all."); + getLogger().warning(Util.getConnectorString(connector) + + " called updateComponent with manageCaption=false. The parameter was ignored - override delegateCaption() to return false instead. It is however not recommended to use caption this way at all."); } return false; } @@ -1474,37 +1468,35 @@ public class ApplicationConnection implements HasHandlers { * @param delegate * the delegate. */ - public void setCommunicationErrorDelegate(CommunicationErrorHandler delegate) { + public void setCommunicationErrorDelegate( + CommunicationErrorHandler delegate) { communicationErrorDelegate = delegate; } public void setApplicationRunning(boolean applicationRunning) { if (getApplicationState() == ApplicationState.TERMINATED) { if (applicationRunning) { - getLogger() - .severe("Tried to restart a terminated application. This is not supported"); + getLogger().severe( + "Tried to restart a terminated application. This is not supported"); } else { - getLogger() - .warning( - "Tried to stop a terminated application. This should not be done"); + getLogger().warning( + "Tried to stop a terminated application. This should not be done"); } return; } else if (getApplicationState() == ApplicationState.INITIALIZING) { if (applicationRunning) { applicationState = ApplicationState.RUNNING; } else { - getLogger() - .warning( - "Tried to stop the application before it has started. This should not be done"); + getLogger().warning( + "Tried to stop the application before it has started. This should not be done"); } } else if (getApplicationState() == ApplicationState.RUNNING) { if (!applicationRunning) { applicationState = ApplicationState.TERMINATED; eventBus.fireEvent(new ApplicationStoppedEvent()); } else { - getLogger() - .warning( - "Tried to start an already running application. This should not be done"); + getLogger().warning( + "Tried to start an already running application. This should not be done"); } } } diff --git a/client/src/main/java/com/vaadin/client/BrowserInfo.java b/client/src/main/java/com/vaadin/client/BrowserInfo.java index d1592c95f4..0074054392 100644 --- a/client/src/main/java/com/vaadin/client/BrowserInfo.java +++ b/client/src/main/java/com/vaadin/client/BrowserInfo.java @@ -453,8 +453,8 @@ public class BrowserInfo { * otherwise */ public boolean isAndroidWithBrokenScrollTop() { - return isAndroid() - && (getOperatingSystemMajorVersion() == 3 || getOperatingSystemMajorVersion() == 4); + return isAndroid() && (getOperatingSystemMajorVersion() == 3 + || getOperatingSystemMajorVersion() == 4); } public boolean isAndroid23() { diff --git a/client/src/main/java/com/vaadin/client/CSSRule.java b/client/src/main/java/com/vaadin/client/CSSRule.java index a1ddce6d0a..d57eacf275 100644 --- a/client/src/main/java/com/vaadin/client/CSSRule.java +++ b/client/src/main/java/com/vaadin/client/CSSRule.java @@ -63,11 +63,11 @@ public class CSSRule { /*-{ if(!$doc.styleSheets) return null; - + selector = selector.toLowerCase(); - + var allMatches = []; - + // IE handles imported sheet differently if(deep && sheet.imports && sheet.imports.length > 0) { for(var i=0; i < sheet.imports.length; i++) { @@ -76,13 +76,13 @@ public class CSSRule { allMatches.concat(imports); } } - + var theRules = new Array(); if (sheet.cssRules) theRules = sheet.cssRules else if (sheet.rules) theRules = sheet.rules - + var j = theRules.length; for(var i=0; i<j; i++) { var r = theRules[i]; @@ -102,7 +102,7 @@ public class CSSRule { allMatches = allMatches.concat(imports); } } - + return allMatches; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ComputedStyle.java b/client/src/main/java/com/vaadin/client/ComputedStyle.java index 65a6e69019..4844b00a75 100644 --- a/client/src/main/java/com/vaadin/client/ComputedStyle.java +++ b/client/src/main/java/com/vaadin/client/ComputedStyle.java @@ -78,7 +78,7 @@ public class ComputedStyle { if(borderStyle == "none") return "0px"; } - + if(cs.getPropertyValue) { // Convert name to dashed format @@ -89,10 +89,10 @@ public class ComputedStyle { var ret = cs[name]; var style = elem.style; - + // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - + // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { @@ -124,7 +124,7 @@ public class ComputedStyle { } else if (name == "height" && ret == "auto") { ret = elem.clientHeight + "px"; } - + return ret; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java b/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java index 419f052324..3da7703cbd 100644 --- a/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/ConnectorHierarchyChangeEvent.java @@ -34,8 +34,8 @@ import com.vaadin.client.ui.AbstractHasComponentsConnector; * @since 7.0.0 * */ -public class ConnectorHierarchyChangeEvent extends - AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> { +public class ConnectorHierarchyChangeEvent + extends AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> { /** * Type of this event, used by the event bus. */ @@ -90,8 +90,8 @@ public class ConnectorHierarchyChangeEvent extends * implement this interface, but instead make your connector class extend * {@link AbstractHasComponentsConnector} or an appropriate subclass. */ - public interface ConnectorHierarchyChangeHandler extends Serializable, - EventHandler { + public interface ConnectorHierarchyChangeHandler + extends Serializable, EventHandler { /** * Called by the framework when the list of child components of the * connector implementing this interface has changed. The implementation diff --git a/client/src/main/java/com/vaadin/client/ConnectorMap.java b/client/src/main/java/com/vaadin/client/ConnectorMap.java index 3200dd6ab4..2b95a1efaa 100644 --- a/client/src/main/java/com/vaadin/client/ConnectorMap.java +++ b/client/src/main/java/com/vaadin/client/ConnectorMap.java @@ -26,7 +26,8 @@ import com.google.gwt.user.client.ui.Widget; public class ConnectorMap { - public static ConnectorMap get(ApplicationConnection applicationConnection) { + public static ConnectorMap get( + ApplicationConnection applicationConnection) { return applicationConnection.getConnectorMap(); } diff --git a/client/src/main/java/com/vaadin/client/DateTimeService.java b/client/src/main/java/com/vaadin/client/DateTimeService.java index 04006d85fb..2d6b8aaaa0 100644 --- a/client/src/main/java/com/vaadin/client/DateTimeService.java +++ b/client/src/main/java/com/vaadin/client/DateTimeService.java @@ -152,8 +152,8 @@ public class DateTimeService { try { firstDay = LocaleService.getFirstDayOfWeek(currentLocale); } catch (final LocaleNotLoadedException e) { - getLogger().log(Level.SEVERE, - "Locale not loaded, using fallback 0", e); + getLogger().log(Level.SEVERE, "Locale not loaded, using fallback 0", + e); firstDay = 0; } int start = dateForFirstOfThisMonth.getDay() - firstDay; @@ -278,16 +278,16 @@ public class DateTimeService { // Find nearest thursday (defines the week in ISO 8601). The week number // for the nearest thursday is the same as for the target date. int nearestThursdayDiff = 4 - dayOfWeek; // 4 is thursday - Date nearestThursday = new Date(date.getTime() + nearestThursdayDiff - * MILLISECONDS_PER_DAY); + Date nearestThursday = new Date( + date.getTime() + nearestThursdayDiff * MILLISECONDS_PER_DAY); Date firstOfJanuary = new Date(nearestThursday.getYear(), 0, 1); long timeDiff = nearestThursday.getTime() - firstOfJanuary.getTime(); // Rounding the result, as the division doesn't result in an integer // when the given date is inside daylight saving time period. - int daysSinceFirstOfJanuary = (int) Math.round((double) timeDiff - / MILLISECONDS_PER_DAY); + int daysSinceFirstOfJanuary = (int) Math + .round((double) timeDiff / MILLISECONDS_PER_DAY); int weekNumber = (daysSinceFirstOfJanuary) / 7 + 1; @@ -343,8 +343,8 @@ public class DateTimeService { formatStr = formatStr.replaceAll("'([E]{4,})'", dayName); formatStr = formatStr.replaceAll("([E]{4,})'", "'" + dayName); formatStr = formatStr.replaceAll("'([E]{4,})", dayName + "'"); - formatStr = formatStr - .replaceAll("[E]{4,}", "'" + dayName + "'"); + formatStr = formatStr.replaceAll("[E]{4,}", + "'" + dayName + "'"); } } @@ -363,8 +363,8 @@ public class DateTimeService { formatStr = formatStr.replaceAll("'([E]{3,})'", dayName); formatStr = formatStr.replaceAll("([E]{3,})'", "'" + dayName); formatStr = formatStr.replaceAll("'([E]{3,})", dayName + "'"); - formatStr = formatStr - .replaceAll("[E]{3,}", "'" + dayName + "'"); + formatStr = formatStr.replaceAll("[E]{3,}", + "'" + dayName + "'"); } } @@ -386,8 +386,8 @@ public class DateTimeService { formatStr = formatStr.replaceAll("'([M]{4,})'", monthName); formatStr = formatStr.replaceAll("([M]{4,})'", "'" + monthName); formatStr = formatStr.replaceAll("'([M]{4,})", monthName + "'"); - formatStr = formatStr.replaceAll("[M]{4,}", "'" + monthName - + "'"); + formatStr = formatStr.replaceAll("[M]{4,}", + "'" + monthName + "'"); } } @@ -406,8 +406,8 @@ public class DateTimeService { formatStr = formatStr.replaceAll("'([M]{3,})'", monthName); formatStr = formatStr.replaceAll("([M]{3,})'", "'" + monthName); formatStr = formatStr.replaceAll("'([M]{3,})", monthName + "'"); - formatStr = formatStr.replaceAll("[M]{3,}", "'" + monthName - + "'"); + formatStr = formatStr.replaceAll("[M]{3,}", + "'" + monthName + "'"); } } @@ -490,8 +490,8 @@ public class DateTimeService { // Some version of Firefox sets the timestamp to 0 if parsing fails. if (date != null && date.getTime() == 0) { - throw new IllegalArgumentException("Parsing of '" + dateString - + "' failed"); + throw new IllegalArgumentException( + "Parsing of '" + dateString + "' failed"); } return date; diff --git a/client/src/main/java/com/vaadin/client/EventHelper.java b/client/src/main/java/com/vaadin/client/EventHelper.java index 1ee252af0f..94fbddf309 100644 --- a/client/src/main/java/com/vaadin/client/EventHelper.java +++ b/client/src/main/java/com/vaadin/client/EventHelper.java @@ -87,7 +87,8 @@ public class EventHelper { * handler later */ public static <T extends ComponentConnector & FocusHandler> HandlerRegistration updateFocusHandler( - T connector, HandlerRegistration handlerRegistration, Widget widget) { + T connector, HandlerRegistration handlerRegistration, + Widget widget) { return updateHandler(connector, connector, FOCUS, handlerRegistration, FocusEvent.getType(), widget); } @@ -126,14 +127,16 @@ public class EventHelper { * handler later */ public static <T extends ComponentConnector & BlurHandler> HandlerRegistration updateBlurHandler( - T connector, HandlerRegistration handlerRegistration, Widget widget) { + T connector, HandlerRegistration handlerRegistration, + Widget widget) { return updateHandler(connector, connector, BLUR, handlerRegistration, BlurEvent.getType(), widget); } public static <H extends EventHandler> HandlerRegistration updateHandler( ComponentConnector connector, H handler, String eventIdentifier, - HandlerRegistration handlerRegistration, Type<H> type, Widget widget) { + HandlerRegistration handlerRegistration, Type<H> type, + Widget widget) { if (connector.hasEventListener(eventIdentifier)) { if (handlerRegistration == null) { handlerRegistration = widget.addDomHandler(handler, type); diff --git a/client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java b/client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java index bb76377cd1..41aea1e57e 100644 --- a/client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java +++ b/client/src/main/java/com/vaadin/client/HasChildMeasurementHintConnector.java @@ -25,8 +25,8 @@ import com.vaadin.client.ui.layout.ElementResizeListener; * @since 7.6 * @author Vaadin Ltd */ -public interface HasChildMeasurementHintConnector extends - HasComponentsConnector { +public interface HasChildMeasurementHintConnector + extends HasComponentsConnector { /** * Specifies how you would like child components measurements to be handled. diff --git a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java index 1833b370e5..eee180ad89 100644 --- a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java +++ b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java @@ -64,8 +64,8 @@ public class JavaScriptConnectorHelper { /** * The id of the previous response for which state changes have been * processed. If this is the same as the - * {@link ApplicationConnection#getLastSeenServerSyncId()}, it means that the - * state change has already been handled and should not be done again. + * {@link ApplicationConnection#getLastSeenServerSyncId()}, it means that + * the state change has already been handled and should not be done again. */ private int processedResponseId = -1; @@ -93,7 +93,8 @@ public class JavaScriptConnectorHelper { } private void processStateChanges() { - int lastResponseId = connector.getConnection().getLastSeenServerSyncId(); + int lastResponseId = connector.getConnection() + .getLastSeenServerSyncId(); if (processedResponseId == lastResponseId) { return; } @@ -140,7 +141,8 @@ public class JavaScriptConnectorHelper { return rpcName.replace('$', '.'); } - protected JavaScriptObject createRpcObject(String iface, Set<String> methods) { + protected JavaScriptObject createRpcObject(String iface, + Set<String> methods) { JavaScriptObject object = JavaScriptObject.createObject(); for (String method : methods) { @@ -157,19 +159,16 @@ public class JavaScriptConnectorHelper { Integer tag = Integer.valueOf(this.tag); while (tag != null) { String serverSideClassName = conf.getServerSideClassNameForTag(tag); - String initFunctionName = serverSideClassName - .replaceAll("\\.", "_"); + String initFunctionName = serverSideClassName.replaceAll("\\.", + "_"); if (tryInitJs(initFunctionName, getConnectorWrapper())) { - getLogger().info( - "JavaScript connector initialized using " - + initFunctionName); + getLogger().info("JavaScript connector initialized using " + + initFunctionName); this.initFunctionName = initFunctionName; return true; } else { - getLogger() - .warning( - "No JavaScript function " + initFunctionName - + " found"); + getLogger().warning("No JavaScript function " + initFunctionName + + " found"); attemptedNames.add(initFunctionName); tag = conf.getParentTag(tag.intValue()); } @@ -267,8 +266,8 @@ public class JavaScriptConnectorHelper { ElementResizeListener listener = elementListeners.get(callbackFunction); if (listener == null) { - LayoutManager layoutManager = LayoutManager.get(connector - .getConnection()); + LayoutManager layoutManager = LayoutManager + .get(connector.getConnection()); listener = new ElementResizeListener() { @Override public void onElementResize(ElementResizeEvent e) { @@ -343,8 +342,8 @@ public class JavaScriptConnectorHelper { return connector; } - return ConnectorMap.get(connector.getConnection()).getConnector( - connectorId); + return ConnectorMap.get(connector.getConnection()) + .getConnector(connectorId); } private void fireRpc(String iface, String method, @@ -378,16 +377,15 @@ public class JavaScriptConnectorHelper { interfaceList += getJsInterfaceName(iface); } - throw new IllegalStateException( - "Can not call method " - + method - + " for wildcard rpc proxy because the function is defined for multiple rpc interfaces: " - + interfaceList - + ". Retrieve a rpc proxy for a specific interface using getRpcProxy(interfaceName) to use the function."); + throw new IllegalStateException("Can not call method " + method + + " for wildcard rpc proxy because the function is defined for multiple rpc interfaces: " + + interfaceList + + ". Retrieve a rpc proxy for a specific interface using getRpcProxy(interfaceName) to use the function."); } } - private void fireCallback(String name, JsArray<JavaScriptObject> arguments) { + private void fireCallback(String name, + JsArray<JavaScriptObject> arguments) { MethodInvocation invocation = new JavaScriptMethodInvocation( connector.getConnectorId(), "com.vaadin.ui.JavaScript$JavaScriptCallbackRpc", "call", @@ -450,7 +448,8 @@ public class JavaScriptConnectorHelper { }-*/; private static native void invokeJsRpc(JavaScriptObject rpcMap, - String interfaceName, String methodName, JavaScriptObject parameters) + String interfaceName, String methodName, + JavaScriptObject parameters) /*-{ var targets = rpcMap[interfaceName]; if (!targets) { @@ -479,14 +478,15 @@ public class JavaScriptConnectorHelper { invokeIfPresent(connectorWrapper, "onUnregister"); if (!resizeListeners.isEmpty()) { - LayoutManager layoutManager = LayoutManager.get(connector - .getConnection()); + LayoutManager layoutManager = LayoutManager + .get(connector.getConnection()); for (Entry<Element, Map<JavaScriptObject, ElementResizeListener>> entry : resizeListeners .entrySet()) { Element element = entry.getKey(); - for (ElementResizeListener listener : entry.getValue().values()) { - layoutManager - .removeElementResizeListener(element, listener); + for (ElementResizeListener listener : entry.getValue() + .values()) { + layoutManager.removeElementResizeListener(element, + listener); } } resizeListeners.clear(); diff --git a/client/src/main/java/com/vaadin/client/LayoutManager.java b/client/src/main/java/com/vaadin/client/LayoutManager.java index ed83e195d7..10a77379f1 100644 --- a/client/src/main/java/com/vaadin/client/LayoutManager.java +++ b/client/src/main/java/com/vaadin/client/LayoutManager.java @@ -240,9 +240,8 @@ public class LayoutManager { } layoutCounts.put(layout.getConnectorId(), count); if (count.intValue() > 2) { - getLogger().severe( - Util.getConnectorString(layout) + " has been layouted " - + count.intValue() + " times"); + getLogger().severe(Util.getConnectorString(layout) + + " has been layouted " + count.intValue() + " times"); } } @@ -321,8 +320,8 @@ public class LayoutManager { for (int i = 0; i < dumpLength; i++) { ServerConnector connector = connectorMap.getConnector(dump.get(i)); if (connector != null) { - currentDependencyTree.setNeedsMeasure( - (ComponentConnector) connector, true); + currentDependencyTree + .setNeedsMeasure((ComponentConnector) connector, true); } } needsMeasure = FastStringSet.create(); @@ -357,23 +356,27 @@ public class LayoutManager { Collection<ElementResizeListener> listeners = elementResizeListeners .get(element); if (listeners != null) { - Profiler.enter("Layout fire resize events - listeners not null"); - Profiler.enter("ElementResizeListener.onElementResize copy list"); - ElementResizeListener[] array = listeners - .toArray(new ElementResizeListener[listeners - .size()]); - Profiler.leave("ElementResizeListener.onElementResize copy list"); + Profiler.enter( + "Layout fire resize events - listeners not null"); + Profiler.enter( + "ElementResizeListener.onElementResize copy list"); + ElementResizeListener[] array = listeners.toArray( + new ElementResizeListener[listeners.size()]); + Profiler.leave( + "ElementResizeListener.onElementResize copy list"); ElementResizeEvent event = new ElementResizeEvent(this, element); for (ElementResizeListener listener : array) { try { String key = null; if (Profiler.isEnabled()) { - Profiler.enter("ElementResizeListener.onElementResize construct profiler key"); + Profiler.enter( + "ElementResizeListener.onElementResize construct profiler key"); key = "ElementResizeListener.onElementResize for " + listener.getClass() .getSimpleName(); - Profiler.leave("ElementResizeListener.onElementResize construct profiler key"); + Profiler.leave( + "ElementResizeListener.onElementResize construct profiler key"); Profiler.enter(key); } @@ -386,7 +389,8 @@ public class LayoutManager { "Error in resize listener", e); } } - Profiler.leave("Layout fire resize events - listeners not null"); + Profiler.leave( + "Layout fire resize events - listeners not null"); } } listenersToFire.clear(); @@ -451,10 +455,9 @@ public class LayoutManager { Profiler.leave(key); } } catch (RuntimeException e) { - getLogger() - .log(Level.SEVERE, - "Error in SimpleManagedLayout (horizontal) handling", - e); + getLogger().log(Level.SEVERE, + "Error in SimpleManagedLayout (horizontal) handling", + e); } countLayout(layoutCounts, rr); @@ -488,10 +491,9 @@ public class LayoutManager { Profiler.leave(key); } } catch (RuntimeException e) { - getLogger() - .log(Level.SEVERE, - "Error in DirectionalManagedLayout handling", - e); + getLogger().log(Level.SEVERE, + "Error in DirectionalManagedLayout handling", + e); } countLayout(layoutCounts, cl); } else { @@ -514,10 +516,9 @@ public class LayoutManager { Profiler.leave(key); } } catch (RuntimeException e) { - getLogger() - .log(Level.SEVERE, - "Error in SimpleManagedLayout (vertical) handling", - e); + getLogger().log(Level.SEVERE, + "Error in SimpleManagedLayout (vertical) handling", + e); } countLayout(layoutCounts, rr); } @@ -544,8 +545,9 @@ public class LayoutManager { } String connectorString = changedCids.get(i); if (changedCids.length() < 10) { - ServerConnector connector = ConnectorMap.get( - connection).getConnector(connectorString); + ServerConnector connector = ConnectorMap + .get(connection) + .getConnector(connectorString); connectorString = Util .getConnectorString(connector); } @@ -557,18 +559,17 @@ public class LayoutManager { Profiler.leave("Layout pass"); - getLogger() - .info("Pass " + passes + " measured " - + measuredConnectorCount + " elements, fired " - + firedListeners + " listeners and did " - + layoutCount + " layouts."); + getLogger().info("Pass " + passes + " measured " + + measuredConnectorCount + " elements, fired " + + firedListeners + " listeners and did " + layoutCount + + " layouts."); if (passes > 100) { getLogger().severe(LOOP_ABORT_MESSAGE); if (ApplicationConfiguration.isDebugMode()) { - VNotification.createNotification( - VNotification.DELAY_FOREVER, - connection.getUIConnector().getWidget()) + VNotification + .createNotification(VNotification.DELAY_FOREVER, + connection.getUIConnector().getWidget()) .show(LOOP_ABORT_MESSAGE, VNotification.CENTERED, "error"); } @@ -601,15 +602,14 @@ public class LayoutManager { cleanMeasuredSizes(); - getLogger().info( - "Total layout phase time: " + totalDuration.elapsedMillis() - + "ms"); + getLogger().info("Total layout phase time: " + + totalDuration.elapsedMillis() + "ms"); } private void logConnectorStatus(int connectorId) { - currentDependencyTree - .logDependencyStatus((ComponentConnector) ConnectorMap.get( - connection).getConnector(Integer.toString(connectorId))); + currentDependencyTree.logDependencyStatus( + (ComponentConnector) ConnectorMap.get(connection) + .getConnector(Integer.toString(connectorId))); } private int measureConnectors(LayoutDependencyTree layoutDependencyTree, @@ -637,12 +637,10 @@ public class LayoutManager { } if (debugLogging) { - getLogger() - .info("Doing overflow fix for " - + Util.getConnectorString(componentConnector) - + " in " - + Util.getConnectorString(componentConnector - .getParent())); + getLogger().info("Doing overflow fix for " + + Util.getConnectorString(componentConnector) + + " in " + Util.getConnectorString( + componentConnector.getParent())); } Profiler.enter("Overflow fix apply"); @@ -760,9 +758,8 @@ public class LayoutManager { return true; } ServerConnector parent = componentConnector.getParent(); - if (parent instanceof ComponentConnector - && !currentDependencyTree - .noMoreChangesExpected((ComponentConnector) parent)) { + if (parent instanceof ComponentConnector && !currentDependencyTree + .noMoreChangesExpected((ComponentConnector) parent)) { return true; } @@ -819,9 +816,8 @@ public class LayoutManager { measuredAndUpdate(element, getMeasuredSize(element, null)); } Profiler.leave("LayoutManager.measureNonConenctors"); - getLogger().info( - "Measured " + measuredNonConnectorElements.size() - + " non connector elements"); + getLogger().info("Measured " + measuredNonConnectorElements.size() + + " non connector elements"); } private MeasureResult measuredAndUpdate(Element element, @@ -916,9 +912,8 @@ public class LayoutManager { */ public final void setNeedsHorizontalLayout(ManagedLayout layout) { if (isLayoutRunning()) { - getLogger() - .warning( - "setNeedsHorizontalLayout should not be run while a layout phase is in progress."); + getLogger().warning( + "setNeedsHorizontalLayout should not be run while a layout phase is in progress."); } needsHorizontalLayout.add(layout.getConnectorId()); } @@ -942,9 +937,8 @@ public class LayoutManager { */ public final void setNeedsVerticalLayout(ManagedLayout layout) { if (isLayoutRunning()) { - getLogger() - .warning( - "setNeedsVerticalLayout should not be run while a layout phase is in progress."); + getLogger().warning( + "setNeedsVerticalLayout should not be run while a layout phase is in progress."); } needsVerticalLayout.add(layout.getConnectorId()); } @@ -972,9 +966,10 @@ public class LayoutManager { * borders) of the element in pixels. */ public final int getOuterHeight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; - return (int) Math.ceil(getMeasuredSize(element, nullSize) - .getOuterHeight()); + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; + return (int) Math + .ceil(getMeasuredSize(element, nullSize).getOuterHeight()); } /** @@ -998,7 +993,8 @@ public class LayoutManager { * borders) of the element in pixels. */ public final double getOuterHeightDouble(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getOuterHeight(); } @@ -1026,9 +1022,10 @@ public class LayoutManager { * borders) of the element in pixels. */ public final int getOuterWidth(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; - return (int) Math.ceil(getMeasuredSize(element, nullSize) - .getOuterWidth()); + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; + return (int) Math + .ceil(getMeasuredSize(element, nullSize).getOuterWidth()); } /** @@ -1051,7 +1048,8 @@ public class LayoutManager { * borders) of the element in pixels. */ public final double getOuterWidthDouble(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getOuterWidth(); } @@ -1078,9 +1076,10 @@ public class LayoutManager { * borders) of the element in pixels. */ public final int getInnerHeight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; - return (int) Math.ceil(getMeasuredSize(element, nullSize) - .getInnerHeight()); + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; + return (int) Math + .ceil(getMeasuredSize(element, nullSize).getInnerHeight()); } /** @@ -1104,7 +1103,8 @@ public class LayoutManager { * borders) of the element in pixels. */ public final double getInnerHeightDouble(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getInnerHeight(); } @@ -1131,9 +1131,10 @@ public class LayoutManager { * borders) of the element in pixels. */ public final int getInnerWidth(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; - return (int) Math.ceil(getMeasuredSize(element, nullSize) - .getInnerWidth()); + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; + return (int) Math + .ceil(getMeasuredSize(element, nullSize).getInnerWidth()); } /** @@ -1157,7 +1158,8 @@ public class LayoutManager { * borders) of the element in pixels. */ public final double getInnerWidthDouble(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getInnerWidth(); } @@ -1182,7 +1184,8 @@ public class LayoutManager { * element in pixels. */ public final int getBorderHeight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getBorderHeight(); } @@ -1207,7 +1210,8 @@ public class LayoutManager { * element in pixels. */ public int getPaddingHeight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getPaddingHeight(); } @@ -1232,7 +1236,8 @@ public class LayoutManager { * element in pixels. */ public int getBorderWidth(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getBorderWidth(); } @@ -1255,7 +1260,8 @@ public class LayoutManager { * @return the measured top border of the element in pixels. */ public int getBorderTop(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getBorderTop(); } @@ -1278,7 +1284,8 @@ public class LayoutManager { * @return the measured left border of the element in pixels. */ public int getBorderLeft(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getBorderLeft(); } @@ -1301,7 +1308,8 @@ public class LayoutManager { * @return the measured bottom border of the element in pixels. */ public int getBorderBottom(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getBorderBottom(); } @@ -1324,7 +1332,8 @@ public class LayoutManager { * @return the measured right border of the element in pixels. */ public int getBorderRight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getBorderRight(); } @@ -1349,7 +1358,8 @@ public class LayoutManager { * element in pixels. */ public int getPaddingWidth(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getPaddingWidth(); } @@ -1372,7 +1382,8 @@ public class LayoutManager { * @return the measured top padding of the element in pixels. */ public int getPaddingTop(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getPaddingTop(); } @@ -1395,7 +1406,8 @@ public class LayoutManager { * @return the measured left padding of the element in pixels. */ public int getPaddingLeft(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getPaddingLeft(); } @@ -1418,7 +1430,8 @@ public class LayoutManager { * @return the measured bottom padding of the element in pixels. */ public int getPaddingBottom(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getPaddingBottom(); } @@ -1441,7 +1454,8 @@ public class LayoutManager { * @return the measured right padding of the element in pixels. */ public int getPaddingRight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getPaddingRight(); } @@ -1464,7 +1478,8 @@ public class LayoutManager { * @return the measured top margin of the element in pixels. */ public int getMarginTop(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getMarginTop(); } @@ -1487,7 +1502,8 @@ public class LayoutManager { * @return the measured right margin of the element in pixels. */ public int getMarginRight(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getMarginRight(); } @@ -1510,7 +1526,8 @@ public class LayoutManager { * @return the measured bottom margin of the element in pixels. */ public int getMarginBottom(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getMarginBottom(); } @@ -1533,7 +1550,8 @@ public class LayoutManager { * @return the measured left margin of the element in pixels. */ public int getMarginLeft(Element element) { - assert needsMeasure(element) : "Getting measurement for element that is not measured"; + assert needsMeasure( + element) : "Getting measurement for element that is not measured"; return getMeasuredSize(element, nullSize).getMarginLeft(); } @@ -1594,7 +1612,8 @@ public class LayoutManager { * the new outer height (including margins, borders and paddings) * of the component in pixels */ - public void reportOuterHeight(ComponentConnector component, int outerHeight) { + public void reportOuterHeight(ComponentConnector component, + int outerHeight) { Element element = component.getWidget().getElement(); MeasuredSize measuredSize = getMeasuredSize(element); if (isLayoutRunning()) { @@ -1627,8 +1646,8 @@ public class LayoutManager { int assignedHeight) { assert component.isRelativeHeight(); - float percentSize = parsePercent(component.getState().height == null ? "" - : component.getState().height); + float percentSize = parsePercent(component.getState().height == null + ? "" : component.getState().height); int effectiveHeight = Math.round(assignedHeight * (percentSize / 100)); reportOuterHeight(component, effectiveHeight); @@ -1792,7 +1811,8 @@ public class LayoutManager { if (component instanceof HasComponentsConnector) { HasComponentsConnector hasComponents = (HasComponentsConnector) component; - for (ComponentConnector child : hasComponents.getChildComponents()) { + for (ComponentConnector child : hasComponents + .getChildComponents()) { setNeedsMeasureRecursively(child); } } @@ -1820,7 +1840,8 @@ public class LayoutManager { * false otherwise */ public boolean isLayoutNeeded() { - if (!needsHorizontalLayout.isEmpty() || !needsVerticalLayout.isEmpty()) { + if (!needsHorizontalLayout.isEmpty() + || !needsVerticalLayout.isEmpty()) { return true; } if (!needsMeasure.isEmpty()) { diff --git a/client/src/main/java/com/vaadin/client/MeasuredSize.java b/client/src/main/java/com/vaadin/client/MeasuredSize.java index 2099008350..f358517afa 100644 --- a/client/src/main/java/com/vaadin/client/MeasuredSize.java +++ b/client/src/main/java/com/vaadin/client/MeasuredSize.java @@ -205,7 +205,8 @@ public class MeasuredSize { heightChanged = true; } if (!widthChanged && hasWidthChanged(this.paddings, paddings)) { - debugSizeChange(element, "Width (padding)", this.paddings, paddings); + debugSizeChange(element, "Width (padding)", this.paddings, + paddings); widthChanged = true; } this.paddings = paddings; @@ -278,9 +279,8 @@ public class MeasuredSize { private void debugSizeChange(Element element, String sizeChangeType, String changedFrom, String changedTo) { if (debugSizeChanges) { - getLogger() - .info(sizeChangeType + " has changed from " + changedFrom - + " to " + changedTo + " for " + element.toString()); + getLogger().info(sizeChangeType + " has changed from " + changedFrom + + " to " + changedTo + " for " + element.toString()); } } diff --git a/client/src/main/java/com/vaadin/client/Profiler.java b/client/src/main/java/com/vaadin/client/Profiler.java index 3923b66218..3d48d1c616 100644 --- a/client/src/main/java/com/vaadin/client/Profiler.java +++ b/client/src/main/java/com/vaadin/client/Profiler.java @@ -197,7 +197,8 @@ public class Profiler { return Collections.unmodifiableCollection(children.values()); } - private void buildRecursiveString(StringBuilder builder, String prefix) { + private void buildRecursiveString(StringBuilder builder, + String prefix) { if (getName() != null) { String msg = getStringRepresentation(prefix); builder.append(msg + '\n'); @@ -220,9 +221,7 @@ public class Profiler { String msg = prefix + " " + getName() + " in " + roundToSignificantFigures(getTimeSpent()) + " ms."; if (getCount() > 1) { - msg += " Invoked " - + getCount() - + " times (" + msg += " Invoked " + getCount() + " times (" + roundToSignificantFigures(getTimeSpent() / getCount()) + " ms per time, min " + roundToSignificantFigures(getMinTimeSpent()) @@ -270,10 +269,10 @@ public class Profiler { totalNode.time += getOwnTime(); totalNode.count += getCount(); - totalNode.minTime = roundToSignificantFigures(Math.min( - totalNode.minTime, getMinTimeSpent())); - totalNode.maxTime = roundToSignificantFigures(Math.max( - totalNode.maxTime, getMaxTimeSpent())); + totalNode.minTime = roundToSignificantFigures( + Math.min(totalNode.minTime, getMinTimeSpent())); + totalNode.maxTime = roundToSignificantFigures( + Math.max(totalNode.maxTime, getMaxTimeSpent())); } for (Node node : children.values()) { node.sumUpTotals(totals); @@ -468,9 +467,8 @@ public class Profiler { stack.add(rootNode); JsArray<GwtStatsEvent> gwtStatsEvents = getGwtStatsEvents(); if (gwtStatsEvents.length() == 0) { - getLogger() - .warning( - "No profiling events recorded, this might happen if another __gwtStatsEvent handler is installed."); + getLogger().warning( + "No profiling events recorded, this might happen if another __gwtStatsEvent handler is installed."); return; } @@ -503,10 +501,8 @@ public class Profiler { if (type.equals("end")) { if (!inEvent) { - getLogger().severe( - "Got end event for " + eventName - + " but is currently in " - + stackTop.getName()); + getLogger().severe("Got end event for " + eventName + + " but is currently in " + stackTop.getName()); return; } Node previousStackTop = stack.removeLast(); @@ -516,8 +512,9 @@ public class Profiler { previousStackTop.leave(gwtStatsEvent.getMillis()); } } else { - double millis = isExtendedEvent ? gwtStatsEvent - .getRelativeMillis() : gwtStatsEvent.getMillis(); + double millis = isExtendedEvent + ? gwtStatsEvent.getRelativeMillis() + : gwtStatsEvent.getMillis(); if (!inEvent) { stackTop = stackTop.enterChild(eventName, millis); stack.add(stackTop); @@ -538,9 +535,8 @@ public class Profiler { } if (stack.size() != 1) { - getLogger().warning( - "Not all nodes are left, the last node is " - + stack.getLast().getName()); + getLogger().warning("Not all nodes are left, the last node is " + + stack.getLast().getName()); return; } @@ -600,8 +596,8 @@ public class Profiler { } if (timings.isEmpty()) { - getLogger() - .info("Bootstrap timings not supported, please ensure your browser supports performance.timing"); + getLogger().info( + "Bootstrap timings not supported, please ensure your browser supports performance.timing"); return; } @@ -675,7 +671,8 @@ public class Profiler { public static void setProfilerResultConsumer( ProfilerResultConsumer profilerResultConsumer) { if (consumer != null) { - throw new IllegalStateException("The consumer has already been set"); + throw new IllegalStateException( + "The consumer has already been set"); } consumer = profilerResultConsumer; } @@ -697,8 +694,8 @@ public class Profiler { double getRelativeTime(); } - private static class DefaultRelativeTimeSupplier implements - RelativeTimeSupplier { + private static class DefaultRelativeTimeSupplier + implements RelativeTimeSupplier { @Override public native double getRelativeTime() @@ -707,8 +704,8 @@ public class Profiler { }-*/; } - private static class HighResolutionTimeSupplier implements - RelativeTimeSupplier { + private static class HighResolutionTimeSupplier + implements RelativeTimeSupplier { @Override public native double getRelativeTime() diff --git a/client/src/main/java/com/vaadin/client/ResourceLoader.java b/client/src/main/java/com/vaadin/client/ResourceLoader.java index 559768d09c..b7c845c292 100644 --- a/client/src/main/java/com/vaadin/client/ResourceLoader.java +++ b/client/src/main/java/com/vaadin/client/ResourceLoader.java @@ -533,12 +533,12 @@ public class ResourceLoader { if (rules === undefined) { rules = sheet.rules; } - + if (rules === null) { // Style sheet loaded, but can't access length because of XSS -> assume there's something there return 1; } - + // Return length so we can distinguish 0 (probably 404 error) from normal case. return rules.length; } catch (err) { diff --git a/client/src/main/java/com/vaadin/client/ServerConnector.java b/client/src/main/java/com/vaadin/client/ServerConnector.java index 0bc2ac9995..795474bfcd 100644 --- a/client/src/main/java/com/vaadin/client/ServerConnector.java +++ b/client/src/main/java/com/vaadin/client/ServerConnector.java @@ -84,7 +84,8 @@ public interface ServerConnector extends Connector { * @return A handler registration reference that can be used to unregister * the handler */ - public HandlerRegistration addStateChangeHandler(StateChangeHandler handler); + public HandlerRegistration addStateChangeHandler( + StateChangeHandler handler); /** * Removes a handler that is called whenever any part of the state has been diff --git a/client/src/main/java/com/vaadin/client/SimpleTree.java b/client/src/main/java/com/vaadin/client/SimpleTree.java index 3c63f54d5f..cd7d73683c 100644 --- a/client/src/main/java/com/vaadin/client/SimpleTree.java +++ b/client/src/main/java/com/vaadin/client/SimpleTree.java @@ -81,14 +81,15 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers { @Override public void onClick(ClickEvent event) { if (event.getNativeEvent().getEventTarget().cast() == handle) { - if (children.getStyle().getDisplay().intern() == Display.NONE - .getCssName()) { + if (children.getStyle().getDisplay() + .intern() == Display.NONE.getCssName()) { open(event.getNativeEvent().getAltKey()); } else { close(); } - } else if (event.getNativeEvent().getEventTarget().cast() == text) { + } else if (event.getNativeEvent().getEventTarget() + .cast() == text) { select(event); } } @@ -173,20 +174,22 @@ public class SimpleTree extends ComplexPanel implements HasDoubleClickHandlers { * {@inheritDoc} Events are not fired when double clicking child widgets. */ @Override - public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) { + public HandlerRegistration addDoubleClickHandler( + DoubleClickHandler handler) { if (textDoubleClickHandlerManager == null) { textDoubleClickHandlerManager = new HandlerManager(this); addDomHandler(new DoubleClickHandler() { @Override public void onDoubleClick(DoubleClickEvent event) { - if (event.getNativeEvent().getEventTarget().cast() == text) { + if (event.getNativeEvent().getEventTarget() + .cast() == text) { textDoubleClickHandlerManager.fireEvent(event); } } }, DoubleClickEvent.getType()); } - return textDoubleClickHandlerManager.addHandler( - DoubleClickEvent.getType(), handler); + return textDoubleClickHandlerManager + .addHandler(DoubleClickEvent.getType(), handler); } } diff --git a/client/src/main/java/com/vaadin/client/SuperDevMode.java b/client/src/main/java/com/vaadin/client/SuperDevMode.java index f664244715..cc7e107555 100644 --- a/client/src/main/java/com/vaadin/client/SuperDevMode.java +++ b/client/src/main/java/com/vaadin/client/SuperDevMode.java @@ -53,9 +53,8 @@ public class SuperDevMode { private static void recompileWidgetsetAndStartInDevMode( final String serverUrl) { - getLogger().info( - "Recompiling widgetset using<br/>" + serverUrl - + "<br/>and then reloading in super dev mode"); + getLogger().info("Recompiling widgetset using<br/>" + serverUrl + + "<br/>and then reloading in super dev mode"); VNotification n = new VNotification(); n.show("<b>Recompiling widgetset, please wait</b>", VNotification.CENTERED, VNotification.STYLE_SYSTEM); @@ -63,8 +62,9 @@ public class SuperDevMode { JsonpRequestBuilder b = new JsonpRequestBuilder(); b.setCallbackParam("_callback"); b.setTimeout(COMPILE_TIMEOUT_IN_SECONDS * 1000); - b.requestObject(serverUrl + "recompile/" + GWT.getModuleName() + "?" - + getRecompileParameters(GWT.getModuleName()), + b.requestObject( + serverUrl + "recompile/" + GWT.getModuleName() + "?" + + getRecompileParameters(GWT.getModuleName()), new AsyncCallback<RecompileResult>() { @Override @@ -77,8 +77,7 @@ public class SuperDevMode { return; } - setSession( - getSuperDevModeHookKey(), + setSession(getSuperDevModeHookKey(), getSuperDevWidgetSetUrl(GWT.getModuleName(), serverUrl)); setSession(SKIP_RECOMPILE, "1"); @@ -92,9 +91,8 @@ public class SuperDevMode { getLogger().severe("JSONP compile call failed"); // Don't log exception as they are shown as // notifications - getLogger().severe( - caught.getClass().getSimpleName() + ": " - + caught.getMessage()); + getLogger().severe(caught.getClass().getSimpleName() + + ": " + caught.getMessage()); failed(); } @@ -227,12 +225,12 @@ public class SuperDevMode { var mod = $wnd.__gwt_activeModules[moduleName]; if (!mod) return false; - + if (mod.superdevmode) { // Running in super dev mode already, it is supported return true; } - + return !!mod.canRedirect; }-*/; @@ -254,9 +252,10 @@ public class SuperDevMode { // in super dev mode, as a result of the recompile, the enabled // check will fail... if (!isSuperDevModeEnabledInModule()) { - showError("SuperDevMode is disabled for this module/widgetset.<br/>" - + "Ensure that your module definition (.gwt.xml) does not contain <br/>" - + "<set-configuration-property name="devModeRedirectEnabled" value="false" /><br/>"); + showError( + "SuperDevMode is disabled for this module/widgetset.<br/>" + + "Ensure that your module definition (.gwt.xml) does not contain <br/>" + + "<set-configuration-property name="devModeRedirectEnabled" value="false" /><br/>"); return false; } return SuperDevMode.recompileIfNeeded(superDevModeParameter); diff --git a/client/src/main/java/com/vaadin/client/TooltipInfo.java b/client/src/main/java/com/vaadin/client/TooltipInfo.java index c1dd5037eb..970f155af5 100644 --- a/client/src/main/java/com/vaadin/client/TooltipInfo.java +++ b/client/src/main/java/com/vaadin/client/TooltipInfo.java @@ -82,6 +82,7 @@ public class TooltipInfo { public boolean equals(TooltipInfo other) { return (other != null && SharedUtil.equals(other.title, title) - && SharedUtil.equals(other.errorMessageHtml, errorMessageHtml) && other.identifier == identifier); + && SharedUtil.equals(other.errorMessageHtml, errorMessageHtml) + && other.identifier == identifier); } } diff --git a/client/src/main/java/com/vaadin/client/UIDL.java b/client/src/main/java/com/vaadin/client/UIDL.java index 2c2a5de308..1b9ee9ffce 100644 --- a/client/src/main/java/com/vaadin/client/UIDL.java +++ b/client/src/main/java/com/vaadin/client/UIDL.java @@ -314,9 +314,8 @@ public final class UIDL extends JavaScriptObject { case CHILD_TYPE_XML: return getChildXML(index); default: - throw new IllegalStateException( - "Illegal child in tag " + getTag() - + " at index " + index); + throw new IllegalStateException("Illegal child in tag " + + getTag() + " at index " + index); } } return null; @@ -522,8 +521,8 @@ public final class UIDL extends JavaScriptObject { */ public ServerConnector getPaintableAttribute(String name, ApplicationConnection connection) { - return ConnectorMap.get(connection).getConnector( - getStringAttribute(name)); + return ConnectorMap.get(connection) + .getConnector(getStringAttribute(name)); } /** @@ -535,8 +534,8 @@ public final class UIDL extends JavaScriptObject { */ public ServerConnector getPaintableVariable(String name, ApplicationConnection connection) { - return ConnectorMap.get(connection).getConnector( - getStringVariable(name)); + return ConnectorMap.get(connection) + .getConnector(getStringVariable(name)); } /** diff --git a/client/src/main/java/com/vaadin/client/Util.java b/client/src/main/java/com/vaadin/client/Util.java index 8b5caa6051..b53dbd071b 100644 --- a/client/src/main/java/com/vaadin/client/Util.java +++ b/client/src/main/java/com/vaadin/client/Util.java @@ -225,8 +225,8 @@ public class Util { @Deprecated public static int measureVerticalPaddingAndBorder(Element element, int paddingGuess) { - return WidgetUtil - .measureVerticalPaddingAndBorder(element, paddingGuess); + return WidgetUtil.measureVerticalPaddingAndBorder(element, + paddingGuess); } /** @@ -441,7 +441,8 @@ public class Util { * @return The border-box width for the element */ @Deprecated - public static int getRequiredWidth(com.google.gwt.dom.client.Element element) { + public static int getRequiredWidth( + com.google.gwt.dom.client.Element element) { return WidgetUtil.getRequiredWidth(element); } @@ -535,7 +536,8 @@ public class Util { * @return true if auto or scroll */ @Deprecated - public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe) { + public static boolean mayHaveScrollBars( + com.google.gwt.dom.client.Element pe) { return WidgetUtil.mayHaveScrollBars(pe); } @@ -596,8 +598,9 @@ public class Util { VOverlay overlay = findWidget(element, VOverlay.class); if (overlay != null && overlay.getOwner() != null) { - return getConnectorForElement(client, client.getUIConnector() - .getWidget(), overlay.getOwner().getElement()); + return getConnectorForElement(client, + client.getUIConnector().getWidget(), + overlay.getOwner().getElement()); } else { return null; } @@ -623,8 +626,8 @@ public class Util { * @param element * the element to start from */ - public static ComponentConnector findPaintable( - ApplicationConnection client, Element element) { + public static ComponentConnector findPaintable(ApplicationConnection client, + Element element) { Widget widget = Util.findWidget(element, null); ConnectorMap vPaintableMap = ConnectorMap.get(client); while (widget != null && !vPaintableMap.isConnector(widget)) { @@ -746,9 +749,8 @@ public class Util { if (connector != null) { getLogger().info("\t" + id + " (" + connector.getClass() + ") :"); } else { - getLogger().warning( - "\t" + id + ": Warning: no corresponding connector for id " - + id); + getLogger().warning("\t" + id + + ": Warning: no corresponding connector for id " + id); } for (MethodInvocation invocation : invocations) { getLogger().info("\t\t" + getInvocationDebugString(invocation)); @@ -763,22 +765,24 @@ public class Util { * @param invocation * @return */ - private static String getInvocationDebugString(MethodInvocation invocation) { + private static String getInvocationDebugString( + MethodInvocation invocation) { Object[] parameters = invocation.getParameters(); String formattedParams = null; - if (ApplicationConstants.UPDATE_VARIABLE_METHOD.equals(invocation - .getMethodName()) && parameters.length == 2) { + if (ApplicationConstants.UPDATE_VARIABLE_METHOD + .equals(invocation.getMethodName()) && parameters.length == 2) { // name, value Object value = parameters[1]; // TODO paintables inside lists/maps get rendered as // components in the debug console - String formattedValue = value instanceof ServerConnector ? ((ServerConnector) value) - .getConnectorId() : String.valueOf(value); + String formattedValue = value instanceof ServerConnector + ? ((ServerConnector) value).getConnectorId() + : String.valueOf(value); formattedParams = parameters[0] + " : " + formattedValue; } if (null == formattedParams) { - formattedParams = (null != parameters) ? Arrays - .toString(parameters) : null; + formattedParams = (null != parameters) ? Arrays.toString(parameters) + : null; } return invocation.getInterfaceName() + "." + invocation.getMethodName() + "(" + formattedParams + ")"; @@ -806,8 +810,8 @@ public class Util { printConnectorInvocations(invocations, curId, c); } } catch (Exception e) { - getLogger() - .log(Level.SEVERE, "Error logging method invocations", e); + getLogger().log(Level.SEVERE, "Error logging method invocations", + e); } } @@ -1230,7 +1234,8 @@ public class Util { Profiler.enter("skipMeasureDueLayoutHint"); boolean skip = false; - HasChildMeasurementHintConnector parent = getPossibleChildMeasurementHintParentConnector(candidate); + HasChildMeasurementHintConnector parent = getPossibleChildMeasurementHintParentConnector( + candidate); if (parent != null) { ChildMeasurementHint measureMode = parent.getChildMeasurementHint(); diff --git a/client/src/main/java/com/vaadin/client/VCaption.java b/client/src/main/java/com/vaadin/client/VCaption.java index ace4fd7184..51945907ae 100644 --- a/client/src/main/java/com/vaadin/client/VCaption.java +++ b/client/src/main/java/com/vaadin/client/VCaption.java @@ -94,7 +94,8 @@ public class VCaption extends HTML { * @param client * ApplicationConnection */ - public VCaption(ComponentConnector component, ApplicationConnection client) { + public VCaption(ComponentConnector component, + ApplicationConnection client) { super(); this.client = client; owner = component; @@ -172,8 +173,8 @@ public class VCaption extends HTML { icon = null; } if (hasIcon) { - String uri = owner.getState().resources.get( - ComponentConstants.ICON_RESOURCE).getURL(); + String uri = owner.getState().resources + .get(ComponentConstants.ICON_RESOURCE).getURL(); icon = client.getIcon(uri); @@ -247,8 +248,8 @@ public class VCaption extends HTML { getInsertPosition(InsertPosition.REQUIRED)); // Hide the required indicator from assistive device - Roles.getTextboxRole().setAriaHiddenState( - requiredFieldIndicator, true); + Roles.getTextboxRole() + .setAriaHiddenState(requiredFieldIndicator, true); } } else if (requiredFieldIndicator != null) { // Remove existing @@ -269,8 +270,8 @@ public class VCaption extends HTML { getInsertPosition(InsertPosition.ERROR)); // Hide error indicator from assistive devices - Roles.getTextboxRole().setAriaHiddenState( - errorIndicatorElement, true); + Roles.getTextboxRole().setAriaHiddenState(errorIndicatorElement, + true); } } else if (errorIndicatorElement != null) { // Remove existing @@ -447,9 +448,8 @@ public class VCaption extends HTML { if (owner != null) { Util.notifyParentOfSizeChange(owner.getWidget(), true); } else { - getLogger() - .warning( - "Warning: Icon load event was not propagated because VCaption owner is unknown."); + getLogger().warning( + "Warning: Icon load event was not propagated because VCaption owner is unknown."); } } } @@ -637,13 +637,13 @@ public class VCaption extends HTML { } if (icon != null) { - int iconRequiredWidth = WidgetUtil.getRequiredWidth(icon - .getElement()); + int iconRequiredWidth = WidgetUtil + .getRequiredWidth(icon.getElement()); if (availableWidth > iconRequiredWidth) { availableWidth -= iconRequiredWidth; } else { - icon.getElement().getStyle() - .setWidth(availableWidth, Unit.PX); + icon.getElement().getStyle().setWidth(availableWidth, + Unit.PX); availableWidth = 0; } } diff --git a/client/src/main/java/com/vaadin/client/VErrorMessage.java b/client/src/main/java/com/vaadin/client/VErrorMessage.java index 271c7b1be8..41967b9983 100644 --- a/client/src/main/java/com/vaadin/client/VErrorMessage.java +++ b/client/src/main/java/com/vaadin/client/VErrorMessage.java @@ -73,12 +73,10 @@ public class VErrorMessage extends FlowPanel { } errorContainer.setPopupPosition( DOM.getAbsoluteLeft(indicatorElement) - + 2 - * DOM.getElementPropertyInt(indicatorElement, + + 2 * DOM.getElementPropertyInt(indicatorElement, "offsetHeight"), DOM.getAbsoluteTop(indicatorElement) - + 2 - * DOM.getElementPropertyInt(indicatorElement, + + 2 * DOM.getElementPropertyInt(indicatorElement, "offsetHeight")); errorContainer.show(); diff --git a/client/src/main/java/com/vaadin/client/VTooltip.java b/client/src/main/java/com/vaadin/client/VTooltip.java index 39d0682821..454b5a8276 100644 --- a/client/src/main/java/com/vaadin/client/VTooltip.java +++ b/client/src/main/java/com/vaadin/client/VTooltip.java @@ -48,9 +48,8 @@ import com.vaadin.client.ui.VOverlay; public class VTooltip extends VOverlay { private static final String CLASSNAME = "v-tooltip"; private static final int MARGIN = 4; - public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN - | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEMOVE - | Event.ONCLICK; + public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN | Event.ONMOUSEOVER + | Event.ONMOUSEOUT | Event.ONMOUSEMOVE | Event.ONCLICK; VErrorMessage em = new VErrorMessage(); Element description = DOM.createDiv(); @@ -134,7 +133,8 @@ public class VTooltip extends VOverlay { } private void setTooltipText(TooltipInfo info) { - if (info.getErrorMessage() != null && !info.getErrorMessage().isEmpty()) { + if (info.getErrorMessage() != null + && !info.getErrorMessage().isEmpty()) { em.setVisible(true); em.updateMessage(info.getErrorMessage()); } else { @@ -227,8 +227,9 @@ public class VTooltip extends VOverlay { x = tooltipEventMouseX + Window.getScrollLeft() - 10 - offsetWidth; } - if (x + offsetWidth + MARGIN - Window.getScrollLeft() > Window - .getClientWidth()) { + if (x + offsetWidth + MARGIN + - Window.getScrollLeft() > Window + .getClientWidth()) { x = Window.getClientWidth() - offsetWidth - MARGIN + Window.getScrollLeft(); } @@ -254,8 +255,9 @@ public class VTooltip extends VOverlay { private int getFinalTouchX(int offsetWidth) { int x = 0; int widthNeeded = 10 + offsetWidth; - int roomLeft = currentElement != null ? currentElement - .getAbsoluteLeft() : EVENT_XY_POSITION_OUTSIDE; + int roomLeft = currentElement != null + ? currentElement.getAbsoluteLeft() + : EVENT_XY_POSITION_OUTSIDE; int viewPortWidth = Window.getClientWidth(); int roomRight = viewPortWidth - roomLeft; if (roomRight > widthNeeded) { @@ -263,7 +265,8 @@ public class VTooltip extends VOverlay { } else { x = roomLeft - offsetWidth; } - if (x + offsetWidth - Window.getScrollLeft() > viewPortWidth) { + if (x + offsetWidth + - Window.getScrollLeft() > viewPortWidth) { x = viewPortWidth - offsetWidth + Window.getScrollLeft(); } @@ -300,8 +303,9 @@ public class VTooltip extends VOverlay { - offsetHeight; } - if (y + offsetHeight + MARGIN - Window.getScrollTop() > Window - .getClientHeight()) { + if (y + offsetHeight + MARGIN + - Window.getScrollTop() > Window + .getClientHeight()) { y = tooltipEventMouseY - 5 - offsetHeight + Window.getScrollTop(); if (y - Window.getScrollTop() < 0) { @@ -333,19 +337,17 @@ public class VTooltip extends VOverlay { private int getFinalTouchY(int offsetHeight) { int y = 0; int heightNeeded = 10 + offsetHeight; - int roomAbove = currentElement != null ? currentElement - .getAbsoluteTop() - + currentElement.getOffsetHeight() + int roomAbove = currentElement != null + ? currentElement.getAbsoluteTop() + + currentElement.getOffsetHeight() : EVENT_XY_POSITION_OUTSIDE; int roomBelow = Window.getClientHeight() - roomAbove; if (roomBelow > heightNeeded) { y = roomAbove; } else { - y = roomAbove - - offsetHeight - - (currentElement != null ? currentElement - .getOffsetHeight() : 0); + y = roomAbove - offsetHeight - (currentElement != null + ? currentElement.getOffsetHeight() : 0); } if (y + offsetHeight - Window.getScrollTop() > Window @@ -454,13 +456,13 @@ public class VTooltip extends VOverlay { } private int getEventX(Event event, boolean isFocused) { - return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM - .eventGetClientX(event); + return isFocused ? EVENT_XY_POSITION_OUTSIDE + : DOM.eventGetClientX(event); } private int getEventY(Event event, boolean isFocused) { - return isFocused ? EVENT_XY_POSITION_OUTSIDE : DOM - .eventGetClientY(event); + return isFocused ? EVENT_XY_POSITION_OUTSIDE + : DOM.eventGetClientY(event); } @Override @@ -494,9 +496,9 @@ public class VTooltip extends VOverlay { opening = false; } - private class TooltipEventHandler implements MouseMoveHandler, - KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler, - MouseOutHandler { + private class TooltipEventHandler + implements MouseMoveHandler, KeyDownHandler, FocusHandler, + BlurHandler, MouseDownHandler, MouseOutHandler { /** * Marker for handling of tooltip through focus @@ -647,8 +649,8 @@ public class VTooltip extends VOverlay { @Override public void onMouseOut(MouseOutEvent moe) { - Element element = WidgetUtil.getElementUnderMouse(moe - .getNativeEvent()); + Element element = WidgetUtil + .getElementUnderMouse(moe.getNativeEvent()); handleOnMouseOut(element); } @@ -668,12 +670,12 @@ public class VTooltip extends VOverlay { } private boolean hasCommonOwner(Widget owner, Element element) { - ComponentConnector connector = Util.findPaintable( - getApplicationConnection(), element); + ComponentConnector connector = Util + .findPaintable(getApplicationConnection(), element); if (connector != null && connector.getConnection() != null && connector.getConnection().getUIConnector() != null) { - return owner.equals(connector.getConnection().getUIConnector() - .getWidget()); + return owner.equals( + connector.getConnection().getUIConnector().getWidget()); } return false; } diff --git a/client/src/main/java/com/vaadin/client/VUIDLBrowser.java b/client/src/main/java/com/vaadin/client/VUIDLBrowser.java index 08f4c653a5..a091596ab8 100644 --- a/client/src/main/java/com/vaadin/client/VUIDLBrowser.java +++ b/client/src/main/java/com/vaadin/client/VUIDLBrowser.java @@ -74,8 +74,8 @@ public class VUIDLBrowser extends SimpleTree { SimpleTree stateChanges = new SimpleTree("shared state"); for (String connectorId : stateJson.getKeySet()) { - stateChanges.add(new SharedStateItem(connectorId, stateJson - .getValueMap(connectorId))); + stateChanges.add(new SharedStateItem(connectorId, + stateJson.getValueMap(connectorId))); } add(stateChanges); @@ -239,9 +239,8 @@ public class VUIDLBrowser extends SimpleTree { @Override public void open(boolean recursive) { - if (getWidgetCount() == 1 - && getWidget(0).getElement().getInnerText() - .equals("LOADING")) { + if (getWidgetCount() == 1 && getWidget(0).getElement() + .getInnerText().equals("LOADING")) { dir(); } super.open(recursive); diff --git a/client/src/main/java/com/vaadin/client/WidgetLoader.java b/client/src/main/java/com/vaadin/client/WidgetLoader.java index 4cc1cd1d5f..9aaf8e89f9 100644 --- a/client/src/main/java/com/vaadin/client/WidgetLoader.java +++ b/client/src/main/java/com/vaadin/client/WidgetLoader.java @@ -17,7 +17,9 @@ package com.vaadin.client; import com.google.gwt.core.client.RunAsyncCallback; -/** A helper class used by WidgetMap implementation. Used by the generated code. */ +/** + * A helper class used by WidgetMap implementation. Used by the generated code. + */ abstract class WidgetLoader implements RunAsyncCallback { @Override diff --git a/client/src/main/java/com/vaadin/client/WidgetSet.java b/client/src/main/java/com/vaadin/client/WidgetSet.java index e85eac388f..eb92be0e8e 100644 --- a/client/src/main/java/com/vaadin/client/WidgetSet.java +++ b/client/src/main/java/com/vaadin/client/WidgetSet.java @@ -67,8 +67,8 @@ public class WidgetSet { * let the auto generated code instantiate this type */ try { - ServerConnector connector = (ServerConnector) TypeData.getType( - classType).createInstance(); + ServerConnector connector = (ServerConnector) TypeData + .getType(classType).createInstance(); if (connector instanceof HasJavaScriptConnectorHelper) { ((HasJavaScriptConnectorHelper) connector) .getJavascriptConnectorHelper().setTag(tag); @@ -78,8 +78,7 @@ public class WidgetSet { } catch (NoDataException e) { Profiler.leave("WidgetSet.createConnector"); throw new IllegalStateException( - "There is no information about " - + classType + "There is no information about " + classType + ". Did you remember to compile the right widgetset?", e); } @@ -127,10 +126,9 @@ public class WidgetSet { } while (bundleName == null && t != null); if (bundleName != null && !loader.isBundleLoaded(bundleName)) { - getLogger().info( - "Loading bundle " + bundleName - + " to be able to render server side class " - + serverSideClassName); + getLogger().info("Loading bundle " + bundleName + + " to be able to render server side class " + + serverSideClassName); ApplicationConfiguration.startDependencyLoading(); loader.loadBundle(bundleName, new BundleLoadCallback() { @Override diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java index 8161ceff19..bfe7a10feb 100644 --- a/client/src/main/java/com/vaadin/client/WidgetUtil.java +++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java @@ -293,8 +293,8 @@ public class WidgetUtil { setHeight(widget, ""); return paddingBorderGuess; } else if (height.endsWith("px")) { - int pixelHeight = Integer.parseInt(height.substring(0, - height.length() - 2)); + int pixelHeight = Integer + .parseInt(height.substring(0, height.length() - 2)); return setHeightExcludingPaddingAndBorder(widget.getElement(), pixelHeight, paddingBorderGuess, false); } else { @@ -320,8 +320,8 @@ public class WidgetUtil { setWidth(widget, ""); return paddingBorderGuess; } else if (width.endsWith("px")) { - int pixelWidth = Integer.parseInt(width.substring(0, - width.length() - 2)); + int pixelWidth = Integer + .parseInt(width.substring(0, width.length() - 2)); return setWidthExcludingPaddingAndBorder(widget.getElement(), pixelWidth, paddingBorderGuess, false); } else { @@ -455,12 +455,12 @@ public class WidgetUtil { // Add max version if fix lands sometime to Webkit // Starting from Opera 11.00, also a problem in Opera if (BrowserInfo.get().requiresOverflowAutoFix()) { - final String originalOverflow = elem.getStyle().getProperty( - "overflow"); - final String originalOverflowX = elem.getStyle().getProperty( - "overflowX"); - final String originalOverflowY = elem.getStyle().getProperty( - "overflowY"); + final String originalOverflow = elem.getStyle() + .getProperty("overflow"); + final String originalOverflowX = elem.getStyle() + .getProperty("overflowX"); + final String originalOverflowY = elem.getStyle() + .getProperty("overflowY"); if ("hidden".equals(originalOverflow) || "hidden".equals(originalOverflowX) || "hidden".equals(originalOverflowY)) { @@ -505,7 +505,8 @@ public class WidgetUtil { // updated when collapsing/expanding columns // Also appeared in Safari 5.1 with webkit 534 (#7667) if ((BrowserInfo.get().isChrome() || (BrowserInfo.get() - .isSafari() && BrowserInfo.get().getWebkitVersion() >= 534)) + .isSafari() + && BrowserInfo.get().getWebkitVersion() >= 534)) && (scrollleft > 0 || elem.getScrollLeft() > 0)) { int scrollvalue = scrollleft; @@ -541,7 +542,8 @@ public class WidgetUtil { * The element to check * @return The border-box width for the element */ - public static int getRequiredWidth(com.google.gwt.dom.client.Element element) { + public static int getRequiredWidth( + com.google.gwt.dom.client.Element element) { int reqWidth = getRequiredWidthBoundingClientRect(element); if (BrowserInfo.get().isIE() && !BrowserInfo.get().isIE8()) { int csSize = getRequiredWidthComputedStyle(element); @@ -772,7 +774,8 @@ public class WidgetUtil { * the element to detect * @return true if auto or scroll */ - public static boolean mayHaveScrollBars(com.google.gwt.dom.client.Element pe) { + public static boolean mayHaveScrollBars( + com.google.gwt.dom.client.Element pe) { String overflow = getComputedStyle(pe, "overflow"); if (overflow != null) { if (overflow.equals("auto") || overflow.equals("scroll")) { @@ -800,7 +803,7 @@ public class WidgetUtil { com.google.gwt.dom.client.Element el, String p) /*-{ try { - + if (el.currentStyle) { // IE return el.currentStyle[p]; @@ -815,7 +818,7 @@ public class WidgetUtil { } catch (e) { return ""; } - + }-*/; /** @@ -829,7 +832,7 @@ public class WidgetUtil { try { el.focus(); } catch (e) { - + } }-*/; @@ -1087,10 +1090,9 @@ public class WidgetUtil { touch.getClientX(), touch.getClientY(), false, false, false, false, NativeEvent.BUTTON_LEFT); final NativeEvent createMouseDownEvent = Document.get() - .createMouseDownEvent(0, touch.getScreenX(), - touch.getScreenY(), touch.getClientX(), - touch.getClientY(), false, false, false, false, - NativeEvent.BUTTON_LEFT); + .createMouseDownEvent(0, touch.getScreenX(), touch.getScreenY(), + touch.getClientX(), touch.getClientY(), false, false, + false, false, NativeEvent.BUTTON_LEFT); final NativeEvent createMouseClickEvent = Document.get() .createClickEvent(0, touch.getScreenX(), touch.getScreenY(), touch.getClientX(), touch.getClientY(), false, false, @@ -1140,7 +1142,7 @@ public class WidgetUtil { if ($wnd.document.activeElement) { return $wnd.document.activeElement; } - + return null; }-*/; @@ -1211,11 +1213,11 @@ public class WidgetUtil { /*-{ var top = elem.offsetTop; var height = elem.offsetHeight; - + if (elem.parentNode != elem.offsetParent) { top -= elem.parentNode.offsetTop; } - + var cur = elem.parentNode; while (cur && (cur.nodeType == 1)) { if (top < cur.scrollTop) { @@ -1224,12 +1226,12 @@ public class WidgetUtil { if (top + height > cur.scrollTop + cur.clientHeight) { cur.scrollTop = (top + height) - cur.clientHeight; } - + var offsetTop = cur.offsetTop; if (cur.parentNode != cur.offsetParent) { offsetTop -= cur.parentNode.offsetTop; } - + top += offsetTop - cur.scrollTop; cur = cur.parentNode; } @@ -1263,8 +1265,8 @@ public class WidgetUtil { divElement.getStyle().setDisplay(Display.NONE); RootPanel.getBodyElement().appendChild(divElement); - divElement.setInnerHTML("<a href='" + escapeAttribute(url) - + "' ></a>"); + divElement.setInnerHTML( + "<a href='" + escapeAttribute(url) + "' ></a>"); AnchorElement a = divElement.getChild(0).cast(); String href = a.getHref(); @@ -1365,7 +1367,8 @@ public class WidgetUtil { * * @return true if the values are considered equals; false otherwise */ - public static boolean pixelValuesEqual(final double num1, final double num2) { + public static boolean pixelValuesEqual(final double num1, + final double num2) { return Math.abs(num1 - num2) <= PIXEL_EPSILON; } @@ -1480,9 +1483,9 @@ public class WidgetUtil { unit = unitByType(symbol); } } else { - throw new IllegalArgumentException("Invalid size argument: \"" - + s + "\" (should match " + sizePattern.getSource() - + ")"); + throw new IllegalArgumentException( + "Invalid size argument: \"" + s + "\" (should match " + + sizePattern.getSource() + ")"); } return new CssSize(size, unit); } @@ -1558,8 +1561,8 @@ public class WidgetUtil { * @return true if the two sizes are equals, otherwise false. */ public static boolean equals(String cssSize1, String cssSize2) { - return CssSize.fromString(cssSize1).equals( - CssSize.fromString(cssSize2)); + return CssSize.fromString(cssSize1) + .equals(CssSize.fromString(cssSize2)); } } @@ -1595,7 +1598,8 @@ public class WidgetUtil { * @return the bottom border thickness */ public static double getBorderBottomThickness(Element element) { - return getBorderThickness(element, new String[] { "borderBottomWidth" }); + return getBorderThickness(element, + new String[] { "borderBottomWidth" }); } /** @@ -1611,8 +1615,8 @@ public class WidgetUtil { * @return the top and bottom border thickness */ public static double getBorderTopAndBottomThickness(Element element) { - return getBorderThickness(element, new String[] { "borderTopWidth", - "borderBottomWidth" }); + return getBorderThickness(element, + new String[] { "borderTopWidth", "borderBottomWidth" }); } /** @@ -1657,8 +1661,8 @@ public class WidgetUtil { * @return the top border thickness */ public static double getBorderLeftAndRightThickness(Element element) { - return getBorderThickness(element, new String[] { "borderLeftWidth", - "borderRightWidth" }); + return getBorderThickness(element, + new String[] { "borderLeftWidth", "borderRightWidth" }); } private static native double getBorderThickness( diff --git a/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java index f439d27107..dc09189be4 100644 --- a/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/main/java/com/vaadin/client/communication/AtmospherePushConnection.java @@ -209,8 +209,8 @@ public class AtmospherePushConnection implements PushConnection { String csrfToken = connection.getMessageHandler().getCsrfToken(); if (!csrfToken.equals(ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE)) { - extraParams += "&" + ApplicationConstants.CSRF_TOKEN_PARAMETER - + "=" + csrfToken; + extraParams += "&" + ApplicationConstants.CSRF_TOKEN_PARAMETER + "=" + + csrfToken; } // uri is needed to identify the right connection when closing @@ -266,9 +266,8 @@ public class AtmospherePushConnection implements PushConnection { "This server to client push connection should not be used to send client to server messages"); } if (state == State.CONNECTED) { - getLogger().info( - "Sending push (" + transport + ") message to server: " - + message.toJson()); + getLogger().info("Sending push (" + transport + + ") message to server: " + message.toJson()); if (transport.equals("websocket")) { FragmentedMessage fragmented = new FragmentedMessage( @@ -295,9 +294,8 @@ public class AtmospherePushConnection implements PushConnection { } protected void onReopen(AtmosphereResponse response) { - getLogger().info( - "Push connection re-established using " - + response.getTransport()); + getLogger().info("Push connection re-established using " + + response.getTransport()); onConnect(response); } @@ -362,7 +360,8 @@ public class AtmospherePushConnection implements PushConnection { break; case DISCONNECT_PENDING: case DISCONNECTED: - throw new IllegalStateException("Can not disconnect more than once"); + throw new IllegalStateException( + "Can not disconnect more than once"); } } @@ -374,9 +373,8 @@ public class AtmospherePushConnection implements PushConnection { getConnectionStateHandler().pushInvalidContent(this, message); return; } else { - getLogger().info( - "Received push (" + getTransportType() + ") message: " - + message); + getLogger().info("Received push (" + getTransportType() + + ") message: " + message); connection.getMessageHandler().handleMessage(json); } } @@ -386,10 +384,9 @@ public class AtmospherePushConnection implements PushConnection { * tried */ protected void onTransportFailure() { - getLogger().warning( - "Push connection using primary method (" - + getConfig().getTransport() + ") failed. Trying with " - + getConfig().getFallbackTransport()); + getLogger().warning("Push connection using primary method (" + + getConfig().getTransport() + ") failed. Trying with " + + getConfig().getFallbackTransport()); } /** @@ -529,7 +526,7 @@ public class AtmospherePushConnection implements PushConnection { JavaScriptObject config) /*-{ var self = this; - + config.url = uri; config.onOpen = $entry(function(response) { self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); @@ -555,7 +552,7 @@ public class AtmospherePushConnection implements PushConnection { config.onClientTimeout = $entry(function(request) { self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request); }); - + return $wnd.vaadinPush.atmosphere.subscribe(config); }-*/; diff --git a/client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java b/client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java index f32bd5c5ea..080358086a 100644 --- a/client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java +++ b/client/src/main/java/com/vaadin/client/communication/DefaultConnectionStateHandler.java @@ -229,8 +229,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { } reconnectAttempt++; - getLogger().info( - "Reconnect attempt " + reconnectAttempt + " for " + type); + getLogger() + .info("Reconnect attempt " + reconnectAttempt + " for " + type); if (reconnectAttempt >= getConfiguration().reconnectAttempts) { // Max attempts reached, stop trying @@ -283,9 +283,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { if (!connection.isApplicationRunning()) { // This should not happen as nobody should call this if the // application has been stopped - getLogger() - .warning( - "Trying to reconnect after application has been stopped. Giving up"); + getLogger().warning( + "Trying to reconnect after application has been stopped. Giving up"); return; } if (payload != null) { @@ -390,8 +389,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { * @return The text to show in the reconnect dialog */ protected String getDialogText(int reconnectAttempt) { - return getConfiguration().dialogText.replace("{0}", reconnectAttempt - + ""); + return getConfiguration().dialogText.replace("{0}", + reconnectAttempt + ""); } @Override @@ -401,7 +400,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { } private ReconnectDialogConfigurationState getConfiguration() { - return connection.getUIConnector().getState().reconnectDialogConfiguration; + return connection.getUIConnector() + .getState().reconnectDialogConfiguration; } @Override @@ -416,9 +416,10 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { * has expired.) If the response contains a magic substring, do a * synchronous refresh. See #8241. */ - MatchResult refreshToken = RegExp.compile( - ApplicationConnection.UIDL_REFRESH_TOKEN - + "(:\\s*(.*?))?(\\s|$)").exec(responseText); + MatchResult refreshToken = RegExp + .compile(ApplicationConnection.UIDL_REFRESH_TOKEN + + "(:\\s*(.*?))?(\\s|$)") + .exec(responseText); if (refreshToken != null) { WidgetUtil.redirect(refreshToken.getGroup(2)); } else { @@ -430,7 +431,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { } @Override - public void pushInvalidContent(PushConnection pushConnection, String message) { + public void pushInvalidContent(PushConnection pushConnection, + String message) { debug("pushInvalidContent"); if (pushConnection.isBidirectional()) { // We can't be sure that what was pushed was actually a response but @@ -441,8 +443,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { // Do nothing special for now. Should likely do the same as // xhrInvalidContent - handleUnrecoverableCommunicationError("Invalid JSON from server: " - + message, null); + handleUnrecoverableCommunicationError( + "Invalid JSON from server: " + message, null); } @@ -538,8 +540,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { @Override public void pushScriptLoadError(String resourceUrl) { - connection.handleCommunicationError(resourceUrl - + " could not be loaded. Push will not work.", 0); + connection.handleCommunicationError( + resourceUrl + " could not be loaded. Push will not work.", 0); } @Override @@ -550,7 +552,8 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { @Override public void pushReconnectPending(PushConnection pushConnection) { - debug("pushReconnectPending(" + pushConnection.getTransportType() + ")"); + debug("pushReconnectPending(" + pushConnection.getTransportType() + + ")"); getLogger().info("Reopening push connection"); if (pushConnection.isBidirectional()) { // Lost connection for a connection which will tell us when the @@ -579,10 +582,9 @@ public class DefaultConnectionStateHandler implements ConnectionStateHandler { debug("pushClientTimeout()"); // TODO Reconnect, allowing client timeout to be set // https://dev.vaadin.com/ticket/18429 - connection - .handleCommunicationError( - "Client unexpectedly disconnected. Ensure client timeout is disabled.", - -1); + connection.handleCommunicationError( + "Client unexpectedly disconnected. Ensure client timeout is disabled.", + -1); } @Override diff --git a/client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java b/client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java index 05b4e109ff..7d311dc9e5 100644 --- a/client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java +++ b/client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java @@ -37,7 +37,8 @@ import com.vaadin.client.ui.VOverlay; * @since 7.6 * @author Vaadin Ltd */ -public class DefaultReconnectDialog extends VOverlay implements ReconnectDialog { +public class DefaultReconnectDialog extends VOverlay + implements ReconnectDialog { private static final String STYLE_RECONNECTING = "active"; private static final String STYLE_BODY_RECONNECTING = "v-reconnecting"; diff --git a/client/src/main/java/com/vaadin/client/communication/Heartbeat.java b/client/src/main/java/com/vaadin/client/communication/Heartbeat.java index f38fbca5c8..3ed7510d8f 100644 --- a/client/src/main/java/com/vaadin/client/communication/Heartbeat.java +++ b/client/src/main/java/com/vaadin/client/communication/Heartbeat.java @@ -63,9 +63,10 @@ public class Heartbeat { setInterval(connection.getConfiguration().getHeartbeatInterval()); - uri = SharedUtil.addGetParameters(connection - .translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX - + ApplicationConstants.HEARTBEAT_PATH + '/'), + uri = SharedUtil.addGetParameters( + connection.translateVaadinUri( + ApplicationConstants.APP_PROTOCOL_PREFIX + + ApplicationConstants.HEARTBEAT_PATH + '/'), UIConstants.UI_ID_PARAMETER + "=" + connection.getConfiguration().getUIId()); @@ -111,8 +112,8 @@ public class Heartbeat { public void onError(Request request, Throwable exception) { // Handler should stop the application if heartbeat should no // longer be sent - connection.getConnectionStateHandler().heartbeatException( - request, exception); + connection.getConnectionStateHandler() + .heartbeatException(request, exception); schedule(); } }; diff --git a/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java b/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java index 0ce89c873e..8c11cb76fd 100644 --- a/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java +++ b/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java @@ -119,8 +119,8 @@ public class JsonDecoder { } else if (Character.class.getName().equals(baseTypeName)) { return Character.valueOf(jsonValue.asString().charAt(0)); } else if (Connector.class.getName().equals(baseTypeName)) { - return ConnectorMap.get(connection).getConnector( - jsonValue.asString()); + return ConnectorMap.get(connection) + .getConnector(jsonValue.asString()); } else { return decodeObject(type, jsonValue, target, connection); } @@ -169,12 +169,15 @@ public class JsonDecoder { propertyReference = null; } - Profiler.leave("JsonDecoder.decodeObject meta data processing"); - JsonValue encodedPropertyValue = jsonObject.get(property - .getName()); + Profiler.leave( + "JsonDecoder.decodeObject meta data processing"); + JsonValue encodedPropertyValue = jsonObject + .get(property.getName()); Object decodedValue = decodeValue(propertyType, - encodedPropertyValue, propertyReference, connection); - Profiler.enter("JsonDecoder.decodeObject meta data processing"); + encodedPropertyValue, propertyReference, + connection); + Profiler.enter( + "JsonDecoder.decodeObject meta data processing"); property.setValue(target, decodedValue); } Profiler.leave("JsonDecoder.decodeObject meta data processing"); @@ -183,8 +186,8 @@ public class JsonDecoder { } catch (NoDataException e) { Profiler.leave("JsonDecoder.decodeObject meta data processing"); Profiler.leave("JsonDecoder.decodeObject"); - throw new RuntimeException("Can not deserialize " - + type.getSignature(), e); + throw new RuntimeException( + "Can not deserialize " + type.getSignature(), e); } } } @@ -210,7 +213,8 @@ public class JsonDecoder { if (keyType.getBaseTypeName().equals(String.class.getName())) { assert jsonMap.getType() == JsonType.OBJECT; return decodeStringMap(valueType, (JsonObject) jsonMap, connection); - } else if (keyType.getBaseTypeName().equals(Connector.class.getName())) { + } else if (keyType.getBaseTypeName() + .equals(Connector.class.getName())) { assert jsonMap.getType() == JsonType.OBJECT; return decodeConnectorMap(valueType, (JsonObject) jsonMap, connection); @@ -274,16 +278,16 @@ public class JsonDecoder { private static List<Object> decodeList(Type type, JsonArray jsonArray, ApplicationConnection connection) { List<Object> tokens = new ArrayList<Object>(); - decodeIntoCollection(type.getParameterTypes()[0], jsonArray, - connection, tokens); + decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection, + tokens); return tokens; } private static Set<Object> decodeSet(Type type, JsonArray jsonArray, ApplicationConnection connection) { Set<Object> tokens = new HashSet<Object>(); - decodeIntoCollection(type.getParameterTypes()[0], jsonArray, - connection, tokens); + decodeIntoCollection(type.getParameterTypes()[0], jsonArray, connection, + tokens); return tokens; } diff --git a/client/src/main/java/com/vaadin/client/communication/JsonEncoder.java b/client/src/main/java/com/vaadin/client/communication/JsonEncoder.java index 8d2a447ac5..d04be4d57b 100644 --- a/client/src/main/java/com/vaadin/client/communication/JsonEncoder.java +++ b/client/src/main/java/com/vaadin/client/communication/JsonEncoder.java @@ -122,14 +122,14 @@ public class JsonEncoder { Type propertyType = property.getType(); JsonValue encodedPropertyValue = encode(propertyValue, propertyType, connection); - jsonObject - .put(property.getName(), encodedPropertyValue); + jsonObject.put(property.getName(), + encodedPropertyValue); } return jsonObject; } catch (NoDataException e) { - throw new RuntimeException("Can not encode " - + type.getSignature(), e); + throw new RuntimeException( + "Can not encode " + type.getSignature(), e); } } else { @@ -154,8 +154,8 @@ public class JsonEncoder { if (value != null) { valueType = value.getClass().getName(); } - throw new IllegalArgumentException("Cannot encode object of type " - + valueType); + throw new IllegalArgumentException( + "Cannot encode object of type " + valueType); } jsonArray.set(0, Json.create(transportType)); jsonArray.set(1, encode(value, null, connection)); @@ -188,22 +188,23 @@ public class JsonEncoder { } } - private static JsonValue encodeChildValue(Object value, - Type collectionType, int typeIndex, ApplicationConnection connection) { + private static JsonValue encodeChildValue(Object value, Type collectionType, + int typeIndex, ApplicationConnection connection) { if (collectionType == null) { return encode(new UidlValue(value), null, connection); } else { assert collectionType.getParameterTypes() != null && collectionType.getParameterTypes().length > typeIndex - && collectionType.getParameterTypes()[typeIndex] != null : "Proper generics required for encoding child value, assertion failed for " - + collectionType; + && collectionType + .getParameterTypes()[typeIndex] != null : "Proper generics required for encoding child value, assertion failed for " + + collectionType; Type childType = collectionType.getParameterTypes()[typeIndex]; return encode(value, childType, connection); } } - private static JsonArray encodeObjectMap(Map<Object, Object> map, - Type type, ApplicationConnection connection) { + private static JsonArray encodeObjectMap(Map<Object, Object> map, Type type, + ApplicationConnection connection) { JsonArray keys = Json.createArray(); JsonArray values = Json.createArray(); @@ -230,8 +231,8 @@ public class JsonEncoder { for (Entry<?, ?> entry : map.entrySet()) { Connector connector = (Connector) entry.getKey(); - JsonValue encodedValue = encodeChildValue(entry.getValue(), type, - 1, connection); + JsonValue encodedValue = encodeChildValue(entry.getValue(), type, 1, + connection); jsonMap.put(connector.getConnectorId(), encodedValue); } @@ -239,8 +240,8 @@ public class JsonEncoder { return jsonMap; } - private static JsonValue encodeStringMap(Map<Object, Object> map, - Type type, ApplicationConnection connection) { + private static JsonValue encodeStringMap(Map<Object, Object> map, Type type, + ApplicationConnection connection) { JsonObject jsonMap = Json.createObject(); for (Entry<?, ?> entry : map.entrySet()) { diff --git a/client/src/main/java/com/vaadin/client/communication/MessageHandler.java b/client/src/main/java/com/vaadin/client/communication/MessageHandler.java index 15e94ca8d9..4a895d7f28 100644 --- a/client/src/main/java/com/vaadin/client/communication/MessageHandler.java +++ b/client/src/main/java/com/vaadin/client/communication/MessageHandler.java @@ -125,7 +125,9 @@ public class MessageHandler { */ private Set<Object> responseHandlingLocks = new HashSet<Object>(); - /** Contains all UIDL messages received while response handling is suspended */ + /** + * Contains all UIDL messages received while response handling is suspended + */ private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<PendingUIDLMessage>(); // will hold the CSRF token once received @@ -232,14 +234,14 @@ public class MessageHandler { "The json to handle cannot be null"); } if (getServerId(json) == -1) { - getLogger() - .severe("Response didn't contain a server id. " - + "Please verify that the server is up-to-date and that the response data has not been modified in transmission."); + getLogger().severe("Response didn't contain a server id. " + + "Please verify that the server is up-to-date and that the response data has not been modified in transmission."); } if (connection.getApplicationState() == ApplicationState.RUNNING) { handleJSON(json); - } else if (connection.getApplicationState() == ApplicationState.INITIALIZING) { + } else if (connection + .getApplicationState() == ApplicationState.INITIALIZING) { // Application is starting up for the first time connection.setApplicationRunning(true); connection.executeWhenCSSLoaded(new Command() { @@ -249,9 +251,8 @@ public class MessageHandler { } }); } else { - getLogger() - .warning( - "Ignored received message because application has already been stopped"); + getLogger().warning( + "Ignored received message because application has already been stopped"); return; } } @@ -264,9 +265,8 @@ public class MessageHandler { // messages and ensure this is handled next. Otherwise we // would keep waiting for an older message forever (if this // is triggered by forceHandleMessage) - getLogger().info( - "Received resync message with id " + serverId - + " while waiting for " + getExpectedServerId()); + getLogger().info("Received resync message with id " + serverId + + " while waiting for " + getExpectedServerId()); lastSeenServerSyncId = serverId - 1; removeOldPendingMessages(); } @@ -286,21 +286,17 @@ public class MessageHandler { // Unexpected server id if (serverId <= lastSeenServerSyncId) { // Why is the server re-sending an old package? Ignore it - getLogger().warning( - "Received message with server id " + serverId - + " but have already seen " - + lastSeenServerSyncId + ". Ignoring it"); + getLogger().warning("Received message with server id " + + serverId + " but have already seen " + + lastSeenServerSyncId + ". Ignoring it"); endRequestIfResponse(json); return; } // We are waiting for an earlier message... - getLogger() - .info("Received message with server id " - + serverId - + " but expected " - + getExpectedServerId() - + ". Postponing handling until the missing message(s) have been received"); + getLogger().info("Received message with server id " + serverId + + " but expected " + getExpectedServerId() + + ". Postponing handling until the missing message(s) have been received"); } pendingUIDLMessages.add(new PendingUIDLMessage(json)); if (!forceHandleMessage.isRunning()) { @@ -364,8 +360,8 @@ public class MessageHandler { connection.setResource(key, resources.getAsString(key)); } } - handleUIDLDuration.logDuration( - " * Handling resources from server completed", 10); + handleUIDLDuration + .logDuration(" * Handling resources from server completed", 10); getLogger().info(" * Handling type inheritance map from server"); @@ -379,20 +375,20 @@ public class MessageHandler { getLogger().info("Handling type mappings from server"); if (json.containsKey("typeMappings")) { - connection.getConfiguration() - .addComponentMappings(json.getValueMap("typeMappings"), - connection.getWidgetSet()); + connection.getConfiguration().addComponentMappings( + json.getValueMap("typeMappings"), + connection.getWidgetSet()); } getLogger().info("Handling resource dependencies"); if (json.containsKey("scriptDependencies")) { - connection.loadScriptDependencies(json - .getJSStringArray("scriptDependencies")); + connection.loadScriptDependencies( + json.getJSStringArray("scriptDependencies")); } if (json.containsKey("styleDependencies")) { - connection.loadStyleDependencies(json - .getJSStringArray("styleDependencies")); + connection.loadStyleDependencies( + json.getJSStringArray("styleDependencies")); } handleUIDLDuration.logDuration( @@ -431,8 +427,8 @@ public class MessageHandler { redirectTimer = new Timer() { @Override public void run() { - WidgetUtil.redirect(timedRedirect - .getString("url")); + WidgetUtil.redirect( + timedRedirect.getString("url")); } }; sessionExpirationInterval = timedRedirect @@ -450,7 +446,8 @@ public class MessageHandler { double processUidlStart = Duration.currentTimeMillis(); // Ensure that all connectors that we are about to update exist - JsArrayString createdConnectorIds = createConnectorsIfNeeded(json); + JsArrayString createdConnectorIds = createConnectorsIfNeeded( + json); // Update states, do not fire events JsArrayObject<StateChangeEvent> pendingStateChangeEvents = updateConnectorState( @@ -463,15 +460,17 @@ public class MessageHandler { Profiler.enter("Handling locales"); getLogger().info(" * Handling locales"); // Store locale data - LocaleService - .addLocales(getUIConnector().getState().localeServiceState.localeData); + LocaleService.addLocales(getUIConnector() + .getState().localeServiceState.localeData); Profiler.leave("Handling locales"); // Update hierarchy, do not fire events - ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(json); + ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy( + json); // Fire hierarchy change events - sendHierarchyChangeEvents(connectorHierarchyUpdateResult.events); + sendHierarchyChangeEvents( + connectorHierarchyUpdateResult.events); updateCaptions(pendingStateChangeEvents, connectorHierarchyUpdateResult.parentChangedIds); @@ -489,20 +488,20 @@ public class MessageHandler { if (json.containsKey("dd")) { // response contains data for drag and drop service - VDragAndDropManager.get().handleServerResponse( - json.getValueMap("dd")); + VDragAndDropManager.get() + .handleServerResponse(json.getValueMap("dd")); } - int removed = unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds); + int removed = unregisterRemovedConnectors( + connectorHierarchyUpdateResult.detachedConnectorIds); if (removed > 0 && !isResponse(json)) { // Must acknowledge the removal using an XHR or server // memory usage will keep growing getUIConnector().sendAck(); } - getLogger() - .info("handleUIDLMessage: " - + (Duration.currentTimeMillis() - processUidlStart) - + " ms"); + getLogger().info("handleUIDLMessage: " + + (Duration.currentTimeMillis() - processUidlStart) + + " ms"); updatingState = false; @@ -516,8 +515,8 @@ public class MessageHandler { layoutManager.layoutNow(); } } catch (final Throwable e) { - getLogger() - .log(Level.SEVERE, "Error processing layouts", e); + getLogger().log(Level.SEVERE, "Error processing layouts", + e); } Profiler.leave("Layout processing"); @@ -546,18 +545,17 @@ public class MessageHandler { // TODO build profiling for widget impl loading time - lastProcessingTime = (int) ((new Date().getTime()) - start - .getTime()); + lastProcessingTime = (int) ((new Date().getTime()) + - start.getTime()); totalProcessingTime += lastProcessingTime; if (bootstrapTime == 0) { double fetchStart = getFetchStartTime(); if (fetchStart != 0) { - int time = (int) (Duration.currentTimeMillis() - fetchStart); - getLogger().log( - Level.INFO, - "First response processed " + time - + " ms after fetchStart"); + int time = (int) (Duration.currentTimeMillis() + - fetchStart); + getLogger().log(Level.INFO, "First response processed " + + time + " ms after fetchStart"); } bootstrapTime = calculateBootstrapTime(); @@ -566,9 +564,8 @@ public class MessageHandler { } } - getLogger().info( - " Processing time was " - + String.valueOf(lastProcessingTime) + "ms"); + getLogger().info(" Processing time was " + + String.valueOf(lastProcessingTime) + "ms"); getLogger().info( "Referenced paintables: " + getConnectorMap().size()); @@ -607,13 +604,16 @@ public class MessageHandler { .cast(); // Update hierarchy based on the fake response - ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(fakeValueMap); + ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy( + fakeValueMap); // Send hierarchy events based on the fake update - sendHierarchyChangeEvents(connectorHierarchyUpdateResult.events); + sendHierarchyChangeEvents( + connectorHierarchyUpdateResult.events); // Unregister all the old connectors that have now been removed - unregisterRemovedConnectors(connectorHierarchyUpdateResult.detachedConnectorIds); + unregisterRemovedConnectors( + connectorHierarchyUpdateResult.detachedConnectorIds); getLayoutManager().cleanMeasuredSizes(); } @@ -654,10 +654,12 @@ public class MessageHandler { .delegateCaptionHandling()) { ServerConnector parent = child.getParent(); if (parent instanceof HasComponentsConnector) { - Profiler.enter("HasComponentsConnector.updateCaption"); + Profiler.enter( + "HasComponentsConnector.updateCaption"); ((HasComponentsConnector) parent) .updateCaption((ComponentConnector) child); - Profiler.leave("HasComponentsConnector.updateCaption"); + Profiler.leave( + "HasComponentsConnector.updateCaption"); } } } @@ -725,15 +727,16 @@ public class MessageHandler { .getReturnType(); Widget widget = component.getWidget(); - Object propertyValue = property.getValue(component - .getState()); + Object propertyValue = property + .getValue(component.getState()); widgetType.getMethod(methodName).invoke(widget, propertyValue); } catch (NoDataException e) { throw new RuntimeException( "Missing data needed to invoke @DelegateToWidget for " - + component.getClass().getSimpleName(), e); + + component.getClass().getSimpleName(), + e); } } @@ -770,7 +773,8 @@ public class MessageHandler { } private void verifyConnectorHierarchy() { - Profiler.enter("verifyConnectorHierarchy - this is only performed in debug mode"); + Profiler.enter( + "verifyConnectorHierarchy - this is only performed in debug mode"); JsArrayObject<ServerConnector> currentConnectors = getConnectorMap() .getConnectorsAsJsArray(); @@ -779,31 +783,29 @@ public class MessageHandler { ServerConnector c = currentConnectors.get(i); if (c.getParent() != null) { if (!c.getParent().getChildren().contains(c)) { - getLogger() - .severe("ERROR: Connector " - + c.getConnectorId() - + " is connected to a parent but the parent (" - + c.getParent().getConnectorId() - + ") does not contain the connector"); + getLogger().severe("ERROR: Connector " + + c.getConnectorId() + + " is connected to a parent but the parent (" + + c.getParent().getConnectorId() + + ") does not contain the connector"); } } else if (c == getUIConnector()) { // UIConnector for this connection, ignore - } else if (c instanceof WindowConnector - && getUIConnector().hasSubWindow( - (WindowConnector) c)) { + } else if (c instanceof WindowConnector && getUIConnector() + .hasSubWindow((WindowConnector) c)) { // Sub window attached to this UIConnector, ignore } else { // The connector has been detached from the // hierarchy but was not unregistered. - getLogger() - .severe("ERROR: Connector " - + c.getConnectorId() - + " is not attached to a parent but has not been unregistered"); + getLogger().severe("ERROR: Connector " + + c.getConnectorId() + + " is not attached to a parent but has not been unregistered"); } } - Profiler.leave("verifyConnectorHierarchy - this is only performed in debug mode"); + Profiler.leave( + "verifyConnectorHierarchy - this is only performed in debug mode"); } private int unregisterRemovedConnectors( @@ -813,12 +815,14 @@ public class MessageHandler { JsArrayString detachedArray = detachedConnectors.dump(); int nrDetached = detachedArray.length(); for (int i = 0; i < nrDetached; i++) { - ServerConnector connector = getConnectorMap().getConnector( - detachedArray.get(i)); + ServerConnector connector = getConnectorMap() + .getConnector(detachedArray.get(i)); - Profiler.enter("unregisterRemovedConnectors unregisterConnector"); + Profiler.enter( + "unregisterRemovedConnectors unregisterConnector"); getConnectorMap().unregisterConnector(connector); - Profiler.leave("unregisterRemovedConnectors unregisterConnector"); + Profiler.leave( + "unregisterRemovedConnectors unregisterConnector"); } if (ApplicationConfiguration.isDebugMode()) { @@ -836,8 +840,8 @@ public class MessageHandler { private JsArrayString createConnectorsIfNeeded(ValueMap json) { getLogger().info(" * Creating connectors (if needed)"); - JsArrayString createdConnectors = JavaScriptObject - .createArray().cast(); + JsArrayString createdConnectors = JavaScriptObject.createArray() + .cast(); if (!json.containsKey("types")) { return createdConnectors; } @@ -859,8 +863,8 @@ public class MessageHandler { // connector onlyNoLayoutUpdates = false; - int connectorType = Integer.parseInt(types - .getString(connectorId)); + int connectorType = Integer + .parseInt(types.getString(connectorId)); Class<? extends ServerConnector> connectorClass = connection .getConfiguration() @@ -869,10 +873,12 @@ public class MessageHandler { // Connector does not exist so we must create it if (connectorClass != getUIConnector().getClass()) { // create, initialize and register the paintable - Profiler.enter("ApplicationConnection.getConnector"); + Profiler.enter( + "ApplicationConnection.getConnector"); connector = connection.getConnector(connectorId, connectorType); - Profiler.leave("ApplicationConnection.getConnector"); + Profiler.leave( + "ApplicationConnection.getConnector"); createdConnectors.push(connectorId); } else { @@ -921,9 +927,8 @@ public class MessageHandler { if (legacyConnector instanceof Paintable) { String key = null; if (Profiler.isEnabled()) { - key = "updateFromUIDL for " - + legacyConnector.getClass() - .getSimpleName(); + key = "updateFromUIDL for " + legacyConnector + .getClass().getSimpleName(); Profiler.enter(key); } @@ -934,15 +939,15 @@ public class MessageHandler { Profiler.leave(key); } } else if (legacyConnector == null) { - getLogger() - .severe("Received update for " - + uidl.getTag() + getLogger().severe( + "Received update for " + uidl.getTag() + ", but there is no such paintable (" + connectorId + ") rendered."); } else { getLogger() .severe("Server sent Vaadin 6 style updates for " - + Util.getConnectorString(legacyConnector) + + Util.getConnectorString( + legacyConnector) + " but this is not a Vaadin 6 Paintable"); } @@ -977,15 +982,15 @@ public class MessageHandler { Profiler.leave("sendHierarchyChangeEvents"); } - private void logHierarchyChange(ConnectorHierarchyChangeEvent event) { + private void logHierarchyChange( + ConnectorHierarchyChangeEvent event) { if (true) { // Always disabled for now. Can be enabled manually return; } - getLogger() - .info("Hierarchy changed for " - + Util.getConnectorString(event.getConnector())); + getLogger().info("Hierarchy changed for " + + Util.getConnectorString(event.getConnector())); String oldChildren = "* Old children: "; for (ComponentConnector child : event.getOldChildren()) { oldChildren += Util.getConnectorString(child) + " "; @@ -1041,11 +1046,12 @@ public class MessageHandler { } SharedState state = connector.getState(); - Type stateType = new Type(state.getClass() - .getName(), null); + Type stateType = new Type( + state.getClass().getName(), null); if (onlyNoLayoutUpdates) { - Profiler.enter("updateConnectorState @NoLayout handling"); + Profiler.enter( + "updateConnectorState @NoLayout handling"); for (String propertyName : stateJson.keys()) { Property property = stateType .getProperty(propertyName); @@ -1054,12 +1060,13 @@ public class MessageHandler { break; } } - Profiler.leave("updateConnectorState @NoLayout handling"); + Profiler.leave( + "updateConnectorState @NoLayout handling"); } Profiler.enter("updateConnectorState decodeValue"); - JsonDecoder.decodeValue(stateType, stateJson, - state, connection); + JsonDecoder.decodeValue(stateType, stateJson, state, + connection); Profiler.leave("updateConnectorState decodeValue"); if (Profiler.isEnabled()) { @@ -1095,8 +1102,8 @@ public class MessageHandler { int length = dump.length(); for (int i = 0; i < length; i++) { String connectorId = dump.get(i); - ServerConnector connector = getConnectorMap().getConnector( - connectorId); + ServerConnector connector = getConnectorMap() + .getConnector(connectorId); StateChangeEvent event = new StateChangeEvent(connector, Json.createObject(), true); @@ -1143,8 +1150,8 @@ public class MessageHandler { .getJSStringArray(connectorId); hasHierarchy.add(connectorId); - updateConnectorHierarchy(connectorId, - childConnectorIds, maybeDetached, result); + updateConnectorHierarchy(connectorId, childConnectorIds, + maybeDetached, result); } } @@ -1166,7 +1173,8 @@ public class MessageHandler { } } - Profiler.enter("updateConnectorHierarchy detach removed connectors"); + Profiler.enter( + "updateConnectorHierarchy detach removed connectors"); /* * Connector is in maybeDetached at this point if it has been @@ -1174,13 +1182,14 @@ public class MessageHandler { */ JsArrayString maybeDetachedArray = maybeDetached.dump(); for (int i = 0; i < maybeDetachedArray.length(); i++) { - ServerConnector removed = getConnectorMap().getConnector( - maybeDetachedArray.get(i)); + ServerConnector removed = getConnectorMap() + .getConnector(maybeDetachedArray.get(i)); recursivelyDetach(removed, result.events, result.detachedConnectorIds); } - Profiler.leave("updateConnectorHierarchy detach removed connectors"); + Profiler.leave( + "updateConnectorHierarchy detach removed connectors"); if (result.events.size() != 0) { onlyNoLayoutUpdates = false; @@ -1217,7 +1226,8 @@ public class MessageHandler { .getConnector(connectorId); int childConnectorSize = childConnectorIds.length(); - Profiler.enter("updateConnectorHierarchy find new connectors"); + Profiler.enter( + "updateConnectorHierarchy find new connectors"); List<ServerConnector> newChildren = new ArrayList<ServerConnector>(); List<ComponentConnector> newComponents = new ArrayList<ComponentConnector>(); @@ -1227,18 +1237,14 @@ public class MessageHandler { ServerConnector childConnector = connectorMap .getConnector(childConnectorId); if (childConnector == null) { - getLogger() - .severe("Hierarchy claims that " - + childConnectorId - + " is a child for " - + connectorId - + " (" - + parentConnector.getClass() - .getName() - + ") but no connector with id " - + childConnectorId - + " has been registered. " - + "More information might be available in the server-side log if assertions are enabled"); + getLogger().severe("Hierarchy claims that " + + childConnectorId + " is a child for " + + connectorId + " (" + + parentConnector.getClass().getName() + + ") but no connector with id " + + childConnectorId + + " has been registered. " + + "More information might be available in the server-side log if assertions are enabled"); continue; } newChildren.add(childConnector); @@ -1246,9 +1252,9 @@ public class MessageHandler { newComponents .add((ComponentConnector) childConnector); } else if (!(childConnector instanceof AbstractExtensionConnector)) { - throw new IllegalStateException( - Util.getConnectorString(childConnector) - + " is not a ComponentConnector nor an AbstractExtensionConnector"); + throw new IllegalStateException(Util + .getConnectorString(childConnector) + + " is not a ComponentConnector nor an AbstractExtensionConnector"); } if (childConnector.getParent() != parentConnector) { childConnector.setParent(parentConnector); @@ -1259,21 +1265,23 @@ public class MessageHandler { } } - Profiler.leave("updateConnectorHierarchy find new connectors"); + Profiler.leave( + "updateConnectorHierarchy find new connectors"); // TODO This check should be done on the server side in // the future so the hierarchy update is only sent when // something actually has changed List<ServerConnector> oldChildren = parentConnector .getChildren(); - boolean actuallyChanged = !Util.collectionsEquals( - oldChildren, newChildren); + boolean actuallyChanged = !Util + .collectionsEquals(oldChildren, newChildren); if (!actuallyChanged) { return; } - Profiler.enter("updateConnectorHierarchy handle HasComponentsConnector"); + Profiler.enter( + "updateConnectorHierarchy handle HasComponentsConnector"); if (parentConnector instanceof HasComponentsConnector) { HasComponentsConnector ccc = (HasComponentsConnector) parentConnector; @@ -1283,27 +1291,28 @@ public class MessageHandler { newComponents)) { // Fire change event if the hierarchy has // changed - ConnectorHierarchyChangeEvent event = GWT - .create(ConnectorHierarchyChangeEvent.class); + ConnectorHierarchyChangeEvent event = GWT.create( + ConnectorHierarchyChangeEvent.class); event.setOldChildren(oldComponents); event.setConnector(parentConnector); ccc.setChildComponents(newComponents); result.events.add(event); } } else if (!newComponents.isEmpty()) { - getLogger() - .severe("Hierachy claims " - + Util.getConnectorString(parentConnector) - + " has component children even though it isn't a HasComponentsConnector"); + getLogger().severe("Hierachy claims " + + Util.getConnectorString(parentConnector) + + " has component children even though it isn't a HasComponentsConnector"); } - Profiler.leave("updateConnectorHierarchy handle HasComponentsConnector"); + Profiler.leave( + "updateConnectorHierarchy handle HasComponentsConnector"); Profiler.enter("updateConnectorHierarchy setChildren"); parentConnector.setChildren(newChildren); Profiler.leave("updateConnectorHierarchy setChildren"); - Profiler.enter("updateConnectorHierarchy find removed children"); + Profiler.enter( + "updateConnectorHierarchy find removed children"); /* * Find children removed from this parent and mark for @@ -1325,7 +1334,8 @@ public class MessageHandler { } } - Profiler.leave("updateConnectorHierarchy find removed children"); + Profiler.leave( + "updateConnectorHierarchy find removed children"); } catch (final Throwable e) { getLogger().log(Level.SEVERE, "Error updating connector hierarchy", e); @@ -1412,20 +1422,20 @@ public class MessageHandler { /* * Clear child list and parent */ - Profiler.enter(prefix - + "recursivelyDetach clear children and parent"); + Profiler.enter( + prefix + "recursivelyDetach clear children and parent"); connector .setChildren(Collections.<ServerConnector> emptyList()); connector.setParent(null); - Profiler.leave(prefix - + "recursivelyDetach clear children and parent"); + Profiler.leave( + prefix + "recursivelyDetach clear children and parent"); /* * Create an artificial hierarchy event for containers to give * it a chance to clean up after its children if it has any */ - Profiler.enter(prefix - + "recursivelyDetach create hierarchy event"); + Profiler.enter( + prefix + "recursivelyDetach create hierarchy event"); if (connector instanceof HasComponentsConnector) { HasComponentsConnector ccc = (HasComponentsConnector) connector; List<ComponentConnector> oldChildren = ccc @@ -1435,8 +1445,8 @@ public class MessageHandler { * HasComponentsConnector has a separate child component * list that should also be cleared */ - ccc.setChildComponents(Collections - .<ComponentConnector> emptyList()); + ccc.setChildComponents( + Collections.<ComponentConnector> emptyList()); // Create event and add it to the list of pending events ConnectorHierarchyChangeEvent event = GWT @@ -1446,8 +1456,8 @@ public class MessageHandler { events.add(event); } } - Profiler.leave(prefix - + "recursivelyDetach create hierarchy event"); + Profiler.leave( + prefix + "recursivelyDetach create hierarchy event"); } private native void replaceState(AbstractConnector connector, @@ -1463,8 +1473,8 @@ public class MessageHandler { getLogger() .info(" * Performing server to client RPC calls"); - JsonArray rpcCalls = Util.jso2json(json - .getJavaScriptObject("rpc")); + JsonArray rpcCalls = Util + .jso2json(json.getJavaScriptObject("rpc")); int rpcLength = rpcCalls.length(); for (int i = 0; i < rpcLength; i++) { @@ -1474,17 +1484,15 @@ public class MessageHandler { .parseAndApplyInvocation(rpcCall, connection); - if (onlyNoLayoutUpdates - && !RpcManager.getMethod(invocation) - .isNoLayout()) { + if (onlyNoLayoutUpdates && !RpcManager + .getMethod(invocation).isNoLayout()) { onlyNoLayoutUpdates = false; } } catch (final Throwable e) { - getLogger() - .log(Level.SEVERE, - "Error performing server to client RPC calls", - e); + getLogger().log(Level.SEVERE, + "Error performing server to client RPC calls", + e); } } @@ -1557,18 +1565,16 @@ public class MessageHandler { if (!responseHandlingLocks.isEmpty()) { // Lock which was never release -> bug in locker or things just // too slow - getLogger() - .warning( - "WARNING: reponse handling was never resumed, forcibly removing locks..."); + getLogger().warning( + "WARNING: reponse handling was never resumed, forcibly removing locks..."); responseHandlingLocks.clear(); } else { // Waited for out-of-order message which never arrived // Do one final check and resynchronize if the message is not // there. The final check is only a precaution as this timer // should have been cancelled if the message has arrived - getLogger().warning( - "Gave up waiting for message " + getExpectedServerId() - + " from the server"); + getLogger().warning("Gave up waiting for message " + + getExpectedServerId() + " from the server"); } if (!handlePendingMessages() && !pendingUIDLMessages.isEmpty()) { @@ -1603,8 +1609,8 @@ public class MessageHandler { forceHandleMessage.cancel(); if (!pendingUIDLMessages.isEmpty()) { - getLogger() - .info("No more response handling locks, handling pending requests."); + getLogger().info( + "No more response handling locks, handling pending requests."); handlePendingMessages(); } } @@ -1776,10 +1782,9 @@ public class MessageHandler { final double start = Profiler.getRelativeTimeMillis(); try { ValueMap json = parseJSONResponse(jsonText); - getLogger().info( - "JSON parsing took " - + Util.round(Profiler.getRelativeTimeMillis() - - start, 3) + "ms"); + getLogger().info("JSON parsing took " + + Util.round(Profiler.getRelativeTimeMillis() - start, 3) + + "ms"); return json; } catch (final Exception e) { getLogger().severe("Unable to parse JSON: " + jsonText); diff --git a/client/src/main/java/com/vaadin/client/communication/MessageSender.java b/client/src/main/java/com/vaadin/client/communication/MessageSender.java index 5862809b0c..f77f55f6ff 100644 --- a/client/src/main/java/com/vaadin/client/communication/MessageSender.java +++ b/client/src/main/java/com/vaadin/client/communication/MessageSender.java @@ -78,9 +78,8 @@ public class MessageSender { public void sendInvocationsToServer() { if (!connection.isApplicationRunning()) { - getLogger() - .warning( - "Trying to send RPC from not yet started or stopped application"); + getLogger().warning( + "Trying to send RPC from not yet started or stopped application"); return; } @@ -115,9 +114,8 @@ public class MessageSender { if (reqJson.length() == 0) { // Nothing to send, all invocations were filtered out (for // non-existing connectors) - getLogger() - .warning( - "All RPCs filtered out, not sending anything to the server"); + getLogger().warning( + "All RPCs filtered out, not sending anything to the server"); return; } @@ -155,8 +153,8 @@ public class MessageSender { payload.put(ApplicationConstants.CSRF_TOKEN, csrfToken); } payload.put(ApplicationConstants.RPC_INVOCATIONS, reqInvocations); - payload.put(ApplicationConstants.SERVER_SYNC_ID, getMessageHandler() - .getLastSeenServerSyncId()); + payload.put(ApplicationConstants.SERVER_SYNC_ID, + getMessageHandler().getLastSeenServerSyncId()); payload.put(ApplicationConstants.CLIENT_TO_SERVER_ID, clientToServerMessageId++); @@ -257,9 +255,8 @@ public class MessageSender { Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { - if (!connection.isApplicationRunning() - || !(hasActiveRequest() || getServerRpcQueue() - .isFlushPending())) { + if (!connection.isApplicationRunning() || !(hasActiveRequest() + || getServerRpcQueue().isFlushPending())) { getLoadingIndicator().hide(); // If on Liferay and session expiration management is in @@ -392,9 +389,8 @@ public class MessageSender { // We have never sent a message to the server, so likely the // server knows better (typical case is that we refreshed a // @PreserveOnRefresh UI) - getLogger().info( - "Updating client-to-server id to " + nextExpectedId - + " based on server"); + getLogger().info("Updating client-to-server id to " + + nextExpectedId + " based on server"); } else { getLogger().warning( "Server expects next client-to-server id to be " diff --git a/client/src/main/java/com/vaadin/client/communication/PushConnection.java b/client/src/main/java/com/vaadin/client/communication/PushConnection.java index 489d2c39a4..f3595c732c 100644 --- a/client/src/main/java/com/vaadin/client/communication/PushConnection.java +++ b/client/src/main/java/com/vaadin/client/communication/PushConnection.java @@ -49,8 +49,8 @@ public interface PushConnection { * <p> * Implementation detail: If the push connection is not connected and the * message can thus not be sent, the implementation must call - * {@link ConnectionStateHandler#pushNotConnected(JsonObject)}, which - * will retry the send later. + * {@link ConnectionStateHandler#pushNotConnected(JsonObject)}, which will + * retry the send later. * <p> * This method must not be called if the push connection is not * bidirectional (if {@link #isBidirectional()} returns false) diff --git a/client/src/main/java/com/vaadin/client/communication/RpcManager.java b/client/src/main/java/com/vaadin/client/communication/RpcManager.java index dfcfb47f46..578c9bd6a4 100644 --- a/client/src/main/java/com/vaadin/client/communication/RpcManager.java +++ b/client/src/main/java/com/vaadin/client/communication/RpcManager.java @@ -58,9 +58,10 @@ public class RpcManager { method.invoke(clientRpc, invocation.getParameters()); } } catch (NoDataException e) { - throw new IllegalStateException("There is no information about " - + method.getSignature() - + ". Did you remember to compile the right widgetset?", e); + throw new IllegalStateException( + "There is no information about " + method.getSignature() + + ". Did you remember to compile the right widgetset?", + e); } } @@ -91,9 +92,10 @@ public class RpcManager { Type[] parameterTypes = method.getParameterTypes(); return parameterTypes; } catch (NoDataException e) { - throw new IllegalStateException("There is no information about " - + method.getSignature() - + ". Did you remember to compile the right widgetset?", e); + throw new IllegalStateException( + "There is no information about " + method.getSignature() + + ". Did you remember to compile the right widgetset?", + e); } } @@ -112,13 +114,12 @@ public class RpcManager { interfaceName, methodName); if (connector instanceof HasJavaScriptConnectorHelper) { ((HasJavaScriptConnectorHelper) connector) - .getJavascriptConnectorHelper().invokeJsRpc(invocation, - parametersJson); + .getJavascriptConnectorHelper() + .invokeJsRpc(invocation, parametersJson); } else { if (connector == null) { - throw new IllegalStateException("Target connector (" - + connector + ") not found for RCC to " - + getSignature(invocation)); + throw new IllegalStateException("Target connector (" + connector + + ") not found for RCC to " + getSignature(invocation)); } parseMethodParameters(invocation, parametersJson, connection); diff --git a/client/src/main/java/com/vaadin/client/communication/RpcProxy.java b/client/src/main/java/com/vaadin/client/communication/RpcProxy.java index b757590f77..83de44afb4 100644 --- a/client/src/main/java/com/vaadin/client/communication/RpcProxy.java +++ b/client/src/main/java/com/vaadin/client/communication/RpcProxy.java @@ -36,14 +36,14 @@ public class RpcProxy { return (T) TypeData.getType(rpcInterface).createProxy( new RpcInvokationHandler(rpcInterface, connector)); } catch (NoDataException e) { - throw new IllegalStateException("There is no information about " - + rpcInterface - + ". Did you forget to compile the widgetset?"); + throw new IllegalStateException( + "There is no information about " + rpcInterface + + ". Did you forget to compile the widgetset?"); } } - private static final class RpcInvokationHandler implements - InvokationHandler { + private static final class RpcInvokationHandler + implements InvokationHandler { private final Class<?> rpcInterface; private final ServerConnector connector; @@ -58,8 +58,8 @@ public class RpcProxy { MethodInvocation invocation = new MethodInvocation( connector.getConnectorId(), rpcInterface.getName(), method.getName(), params); - ServerRpcQueue serverRpcQueue = ServerRpcQueue.get(connector - .getConnection()); + ServerRpcQueue serverRpcQueue = ServerRpcQueue + .get(connector.getConnection()); serverRpcQueue.add(invocation, method.isLastOnly()); if (!method.isDelayed()) { serverRpcQueue.flush(); diff --git a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java index e5d5ea8a25..27bebe4347 100644 --- a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java +++ b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java @@ -118,15 +118,15 @@ public class ServerRpcQueue { */ public void add(MethodInvocation invocation, boolean lastOnly) { if (!connection.isApplicationRunning()) { - getLogger() - .warning( - "Trying to invoke method on not yet started or stopped application"); + getLogger().warning( + "Trying to invoke method on not yet started or stopped application"); return; } String tag; if (lastOnly) { tag = invocation.getLastOnlyTag(); - assert !tag.matches("\\d+") : "getLastOnlyTag value must have at least one non-digit character"; + assert !tag.matches( + "\\d+") : "getLastOnlyTag value must have at least one non-digit character"; pendingInvocations.remove(tag); } else { tag = Integer.toString(lastInvocationTag++); @@ -255,9 +255,8 @@ public class ServerRpcQueue { for (MethodInvocation invocation : getAll()) { String connectorId = invocation.getConnectorId(); if (!connectorExists(connectorId)) { - getLogger().info( - "Ignoring RPC for removed connector: " + connectorId - + ": " + invocation.toString()); + getLogger().info("Ignoring RPC for removed connector: " + + connectorId + ": " + invocation.toString()); continue; } @@ -275,8 +274,8 @@ public class ServerRpcQueue { Method method = type.getMethod(invocation.getMethodName()); parameterTypes = method.getParameterTypes(); } catch (NoDataException e) { - throw new RuntimeException("No type data for " - + invocation.toString(), e); + throw new RuntimeException( + "No type data for " + invocation.toString(), e); } } @@ -334,8 +333,8 @@ public class ServerRpcQueue { * otherwise */ public static boolean isLegacyVariableChange(MethodInvocation invocation) { - return ApplicationConstants.UPDATE_VARIABLE_METHOD.equals(invocation - .getInterfaceName()) + return ApplicationConstants.UPDATE_VARIABLE_METHOD + .equals(invocation.getInterfaceName()) && ApplicationConstants.UPDATE_VARIABLE_METHOD .equals(invocation.getMethodName()); } diff --git a/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java b/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java index c2c1ceaea9..ba96d64518 100644 --- a/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/communication/StateChangeEvent.java @@ -33,8 +33,8 @@ import com.vaadin.client.ui.AbstractConnector; import elemental.json.JsonObject; -public class StateChangeEvent extends - AbstractServerConnectorEvent<StateChangeHandler> { +public class StateChangeEvent + extends AbstractServerConnectorEvent<StateChangeHandler> { /** * Type of this event, used by the event bus. */ @@ -176,7 +176,8 @@ public class StateChangeEvent extends @Deprecated public FastStringSet getChangedPropertiesFastSet() { if (changedProperties == null) { - Profiler.enter("StateChangeEvent.getChangedPropertiesFastSet populate"); + Profiler.enter( + "StateChangeEvent.getChangedPropertiesFastSet populate"); changedProperties = FastStringSet.create(); addJsonFields(stateJson, changedProperties, ""); @@ -186,7 +187,8 @@ public class StateChangeEvent extends changedProperties, ""); } - Profiler.leave("StateChangeEvent.getChangedPropertiesFastSet populate"); + Profiler.leave( + "StateChangeEvent.getChangedPropertiesFastSet populate"); } return changedProperties; } @@ -282,8 +284,10 @@ public class StateChangeEvent extends } } } catch (NoDataException e) { - throw new IllegalStateException("No property info for " + type - + ". Did you remember to compile the right widgetset?", e); + throw new IllegalStateException( + "No property info for " + type + + ". Did you remember to compile the right widgetset?", + e); } } diff --git a/client/src/main/java/com/vaadin/client/communication/XhrConnection.java b/client/src/main/java/com/vaadin/client/communication/XhrConnection.java index 11e3cf3cb7..3e7a86d4ac 100644 --- a/client/src/main/java/com/vaadin/client/communication/XhrConnection.java +++ b/client/src/main/java/com/vaadin/client/communication/XhrConnection.java @@ -146,10 +146,9 @@ public class XhrConnection { return; } - getLogger().info( - "Server visit took " - + Util.round(Profiler.getRelativeTimeMillis() - - requestStartTime, 3) + "ms"); + getLogger().info("Server visit took " + Util.round( + Profiler.getRelativeTimeMillis() - requestStartTime, 3) + + "ms"); // for(;;);["+ realJson +"]" String responseText = response.getText(); @@ -221,8 +220,8 @@ public class XhrConnection { }.schedule(retryTimeout); } } catch (RequestException e) { - getConnectionStateHandler().xhrException( - new XhrConnectionError(null, payload, e)); + getConnectionStateHandler() + .xhrException(new XhrConnectionError(null, payload, e)); } } @@ -236,8 +235,8 @@ public class XhrConnection { .translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX + ApplicationConstants.UIDL_PATH + '/'); - uri = SharedUtil.addGetParameters(uri, UIConstants.UI_ID_PARAMETER - + "=" + connection.getConfiguration().getUIId()); + uri = SharedUtil.addGetParameters(uri, UIConstants.UI_ID_PARAMETER + "=" + + connection.getConfiguration().getUIId()); return uri; diff --git a/client/src/main/java/com/vaadin/client/componentlocator/ComponentLocator.java b/client/src/main/java/com/vaadin/client/componentlocator/ComponentLocator.java index 0dfaf99cc1..7b01fd8742 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/ComponentLocator.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/ComponentLocator.java @@ -51,8 +51,9 @@ public class ComponentLocator { */ public ComponentLocator(ApplicationConnection client) { this.client = client; - locatorStrategies = Arrays.asList(new VaadinFinderLocatorStrategy( - client), new LegacyLocatorStrategy(client)); + locatorStrategies = Arrays.asList( + new VaadinFinderLocatorStrategy(client), + new LegacyLocatorStrategy(client)); } /** @@ -181,8 +182,8 @@ public class ComponentLocator { JsArray<Element> jsElements = JavaScriptObject.createArray().cast(); for (LocatorStrategy strategy : locatorStrategies) { if (strategy.validatePath(path)) { - List<Element> elements = strategy.getElementsByPathStartingAt( - path, root); + List<Element> elements = strategy + .getElementsByPathStartingAt(path, root); if (elements.size() > 0) { for (Element e : elements) { jsElements.push(e); diff --git a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java index 517d979c8e..77d618aed4 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java @@ -75,8 +75,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { private final ApplicationConnection client; - private static final RegExp validSyntax = RegExp - .compile("^((\\w+::)?((PID_S)?\\w[-$_a-zA-Z0-9.' ]*)?)?(/[-$_a-zA-Z0-9]+\\[\\d+\\])*/?(#.*)?$"); + private static final RegExp validSyntax = RegExp.compile( + "^((\\w+::)?((PID_S)?\\w[-$_a-zA-Z0-9.' ]*)?)?(/[-$_a-zA-Z0-9]+\\[\\d+\\])*/?(#.*)?$"); public LegacyLocatorStrategy(ApplicationConnection clientConnection) { client = clientConnection; @@ -89,8 +89,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { @Override public String getPathForElement(Element targetElement) { - ComponentConnector connector = Util - .findPaintable(client, targetElement); + ComponentConnector connector = Util.findPaintable(client, + targetElement); Widget w = null; if (connector != null) { @@ -169,8 +169,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { * If the widget can provide an identifier for the targetElement we * let it do that */ - String elementLocator = ((SubPartAware) w).getSubPartName(DOM - .asOld(targetElement)); + String elementLocator = ((SubPartAware) w) + .getSubPartName(DOM.asOld(targetElement)); if (elementLocator != null) { return path + LegacyLocatorStrategy.SUBPART_SEPARATOR + elementLocator; @@ -200,7 +200,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { * {@inheritDoc} */ @Override - public Element getElementByPathStartingAt(String path, Element baseElement) { + public Element getElementByPathStartingAt(String path, + Element baseElement) { /* * Path is of type "targetWidgetPath#componentPart" or * "targetWidgetPath". @@ -253,7 +254,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { * {@inheritDoc} */ @Override - public List<Element> getElementsByPathStartingAt(String path, Element root) { + public List<Element> getElementsByPathStartingAt(String path, + Element root) { // This type of search is not supported in LegacyLocator List<Element> array = new ArrayList<Element>(); Element e = getElementByPathStartingAt(path, root); @@ -295,7 +297,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { * @return The widget whose root element is a parent of * {@code targetElement}. */ - private Widget findParentWidget(Element targetElement, Widget ancestorWidget) { + private Widget findParentWidget(Element targetElement, + Widget ancestorWidget) { /* * As we cannot resolve Widgets from the element we start from the * widget and move downwards to the correct child widget, as long as we @@ -334,13 +337,13 @@ public class LegacyLocatorStrategy implements LocatorStrategy { String childIndexString = part.substring("domChild[".length(), part.length() - 1); - if (WidgetUtil.findWidget(baseElement, null) instanceof VAbstractOrderedLayout) { + if (WidgetUtil.findWidget(baseElement, + null) instanceof VAbstractOrderedLayout) { if (element.hasChildNodes()) { Element e = element.getFirstChildElement().cast(); String cn = e.getClassName(); - if (cn != null - && (cn.equals("v-expand") || cn - .contains("v-has-caption"))) { + if (cn != null && (cn.equals("v-expand") + || cn.contains("v-has-caption"))) { element = e; } } @@ -472,8 +475,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { while (i.hasNext()) { Object child = i.next(); if (child == w) { - return basePath + PARENTCHILD_SEPARATOR + simpleName + "[" - + pos + "]"; + return basePath + PARENTCHILD_SEPARATOR + simpleName + "[" + pos + + "]"; } String simpleName2 = Util.getSimpleName(child); if (simpleName.equals(simpleName2)) { @@ -568,8 +571,9 @@ public class LegacyLocatorStrategy implements LocatorStrategy { // ChildComponentContainer and VOrderedLayout$Slot have been // replaced with Slot if (w instanceof VAbstractOrderedLayout - && ("ChildComponentContainer".equals(widgetClassName) || "VOrderedLayout$Slot" - .equals(widgetClassName))) { + && ("ChildComponentContainer".equals(widgetClassName) + || "VOrderedLayout$Slot" + .equals(widgetClassName))) { widgetClassName = "Slot"; } @@ -606,8 +610,8 @@ public class LegacyLocatorStrategy implements LocatorStrategy { // the same type before it int nextIndex = 0; for (Widget child : layout) { - boolean matchingType = nextWidgetClassName.equals(Util - .getSimpleName(child)); + boolean matchingType = nextWidgetClassName + .equals(Util.getSimpleName(child)); if (matchingType && widgetPosition == 0) { // This is the n:th child that we looked for break; diff --git a/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java b/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java index 31f6cc9b05..6c9a6af54b 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/SelectorPredicate.java @@ -141,11 +141,11 @@ public class SelectorPredicate { * found. */ private static String extractPredicateString(String pathFragment) { - int ixOpenBracket = LocatorUtil - .indexOfIgnoringQuoted(pathFragment, '['); + int ixOpenBracket = LocatorUtil.indexOfIgnoringQuoted(pathFragment, + '['); if (ixOpenBracket >= 0) { - int ixCloseBracket = LocatorUtil.indexOfIgnoringQuoted( - pathFragment, ']', ixOpenBracket); + int ixCloseBracket = LocatorUtil.indexOfIgnoringQuoted(pathFragment, + ']', ixOpenBracket); return pathFragment.substring(ixOpenBracket + 1, ixCloseBracket); } return ""; diff --git a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java index 44bdeddff3..263031e13c 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java @@ -86,8 +86,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { boolean hasSubParts = targetWidget instanceof SubPartAware; if (oldTarget != targetElement) { if (hasSubParts) { - subPart = ((SubPartAware) targetWidget).getSubPartName(DOM - .asOld(oldTarget)); + subPart = ((SubPartAware) targetWidget) + .getSubPartName(DOM.asOld(oldTarget)); } if (!hasSubParts || subPart == null) { @@ -96,7 +96,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { } } - List<ConnectorPath> hierarchy = getConnectorHierarchyForElement(targetElement); + List<ConnectorPath> hierarchy = getConnectorHierarchyForElement( + targetElement); List<String> path = new ArrayList<String>(); // Assemble longname path components back-to-forth with useful @@ -151,12 +152,13 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { // See if we get minimum from second last. If not then we already // have the best one.. Second last one contains almost full // component hierarchy. - if (getElementsByPath(selectors.get(selectors.size() - 2)).indexOf( - target) == min) { + if (getElementsByPath(selectors.get(selectors.size() - 2)) + .indexOf(target) == min) { for (int i = 1; i < selectors.size() - 2; ++i) { // Loop through the remaining selectors and look for one // with the same index - if (getElementsByPath(selectors.get(i)).indexOf(target) == min) { + if (getElementsByPath(selectors.get(i)) + .indexOf(target) == min) { bestSelector = selectors.get(i); break; } @@ -218,8 +220,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { * not exist on the object (or some other error is encountered). */ private String getPropertyValue(ComponentConnector c, String propertyName) { - Property prop = AbstractConnector.getStateType(c).getProperty( - propertyName); + Property prop = AbstractConnector.getStateType(c) + .getProperty(propertyName); try { return prop.getValue(c.getState()).toString(); } catch (Exception e) { @@ -289,8 +291,9 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { } else { final UIConnector uiConnector = client.getUIConnector(); - elements.addAll(eliminateDuplicates(getElementsByPathStartingAtConnector( - path, uiConnector, Document.get().getBody()))); + elements.addAll( + eliminateDuplicates(getElementsByPathStartingAtConnector( + path, uiConnector, Document.get().getBody()))); } for (SelectorPredicate p : postFilters) { @@ -340,7 +343,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { * {@inheritDoc} */ @Override - public List<Element> getElementsByPathStartingAt(String path, Element root) { + public List<Element> getElementsByPathStartingAt(String path, + Element root) { List<SelectorPredicate> postFilters = SelectorPredicate .extractPostFilterPredicates(path); if (postFilters.size() > 0) { @@ -474,8 +478,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { for (ComponentConnector parent : parents) { connectors.addAll(filterMatches( collectPotentialMatches(parent, fragments[0], - findRecursively), SelectorPredicate - .extractPredicates(fragments[0]))); + findRecursively), + SelectorPredicate.extractPredicates(fragments[0]))); } if (!connectors.isEmpty() && fragments.length > 1) { @@ -518,8 +522,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { String propData = getPropertyValue(potentialMatches.get(i), p.getName()); - if ((p.isWildcard() && propData == null) - || (!p.isWildcard() && !p.getValue().equals(propData))) { + if ((p.isWildcard() && propData == null) || (!p.isWildcard() + && !p.getValue().equals(propData))) { potentialMatches.remove(i); --l; --i; @@ -637,7 +641,8 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { if (widgetName.equals(fullName + ".class") || widgetName.equals(fullName) || widgetName.equals(simpleName + ".class") - || widgetName.equals(simpleName) || widgetName.equals(name)) { + || widgetName.equals(simpleName) + || widgetName.equals(name)) { return true; } } diff --git a/client/src/main/java/com/vaadin/client/connectors/AbstractRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/AbstractRendererConnector.java index f7e3c15ac8..cc59ca5088 100644 --- a/client/src/main/java/com/vaadin/client/connectors/AbstractRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/AbstractRendererConnector.java @@ -34,9 +34,8 @@ import elemental.json.JsonValue; * {@link com.vaadin.ui.components.grid.Renderer Renderer}. As a connector, it * can use the regular Vaadin RPC and shared state mechanism to pass additional * state and information between the client and the server. This base class - * itself only uses the basic - * {@link com.vaadin.shared.communication.SharedState SharedState} and no RPC - * interfaces. + * itself only uses the basic {@link com.vaadin.shared.communication.SharedState + * SharedState} and no RPC interfaces. * * @param <T> * the presentation type of the renderer @@ -44,8 +43,8 @@ import elemental.json.JsonValue; * @since 7.4 * @author Vaadin Ltd */ -public abstract class AbstractRendererConnector<T> extends - AbstractExtensionConnector { +public abstract class AbstractRendererConnector<T> + extends AbstractExtensionConnector { private Renderer<T> renderer = null; @@ -54,10 +53,9 @@ public abstract class AbstractRendererConnector<T> extends protected AbstractRendererConnector() { if (presentationType == null) { - throw new IllegalStateException( - "No presentation type found for " - + getClass().getSimpleName() - + ". This may be caused by some unspecified problem in widgetset compilation."); + throw new IllegalStateException("No presentation type found for " + + getClass().getSimpleName() + + ". This may be caused by some unspecified problem in widgetset compilation."); } } @@ -112,7 +110,8 @@ public abstract class AbstractRendererConnector<T> extends + getClass().getSimpleName() + ". This might be caused by explicitely using " + "super.createRenderer() or some unspecified " - + "problem with the widgetset compilation.", e); + + "problem with the widgetset compilation.", + e); } } @@ -153,8 +152,8 @@ public abstract class AbstractRendererConnector<T> extends if (parent instanceof GridConnector) { return ((GridConnector) parent).getRowKey(row); } else { - throw new IllegalStateException("Renderers can only be used " - + "with a Grid."); + throw new IllegalStateException( + "Renderers can only be used " + "with a Grid."); } } @@ -174,8 +173,8 @@ public abstract class AbstractRendererConnector<T> extends if (parent instanceof GridConnector) { return ((GridConnector) parent).getColumnId(column); } else { - throw new IllegalStateException("Renderers can only be used " - + "with a Grid."); + throw new IllegalStateException( + "Renderers can only be used " + "with a Grid."); } } diff --git a/client/src/main/java/com/vaadin/client/connectors/AbstractSelectionModelConnector.java b/client/src/main/java/com/vaadin/client/connectors/AbstractSelectionModelConnector.java index 3a96f0f03b..45c8f3002d 100644 --- a/client/src/main/java/com/vaadin/client/connectors/AbstractSelectionModelConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/AbstractSelectionModelConnector.java @@ -53,8 +53,8 @@ public abstract class AbstractSelectionModelConnector<T extends SelectionModel<J protected abstract T createSelectionModel(); - public abstract static class AbstractSelectionModel implements - SelectionModel<JsonObject> { + public abstract static class AbstractSelectionModel + implements SelectionModel<JsonObject> { @Override public boolean isSelected(JsonObject row) { diff --git a/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java index 094ca24b5a..caa571c355 100644 --- a/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java @@ -29,7 +29,8 @@ import elemental.json.JsonObject; * @author Vaadin Ltd */ @Connect(com.vaadin.ui.renderers.ButtonRenderer.class) -public class ButtonRendererConnector extends ClickableRendererConnector<String> { +public class ButtonRendererConnector + extends ClickableRendererConnector<String> { @Override public ButtonRenderer getRenderer() { diff --git a/client/src/main/java/com/vaadin/client/connectors/ClickableRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/ClickableRendererConnector.java index 9d16a57a17..43874e767b 100644 --- a/client/src/main/java/com/vaadin/client/connectors/ClickableRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/ClickableRendererConnector.java @@ -33,23 +33,24 @@ import elemental.json.JsonObject; * @since 7.4 * @author Vaadin Ltd */ -public abstract class ClickableRendererConnector<T> extends - AbstractRendererConnector<T> { +public abstract class ClickableRendererConnector<T> + extends AbstractRendererConnector<T> { HandlerRegistration clickRegistration; @Override protected void init() { - clickRegistration = addClickHandler(new RendererClickHandler<JsonObject>() { - @Override - public void onClick(RendererClickEvent<JsonObject> event) { - getRpcProxy(RendererClickRpc.class).click( - getRowKey(event.getCell().getRow()), - getColumnId(event.getCell().getColumn()), - MouseEventDetailsBuilder.buildMouseEventDetails(event - .getNativeEvent())); - } - }); + clickRegistration = addClickHandler( + new RendererClickHandler<JsonObject>() { + @Override + public void onClick(RendererClickEvent<JsonObject> event) { + getRpcProxy(RendererClickRpc.class).click( + getRowKey(event.getCell().getRow()), + getColumnId(event.getCell().getColumn()), + MouseEventDetailsBuilder.buildMouseEventDetails( + event.getNativeEvent())); + } + }); } @Override diff --git a/client/src/main/java/com/vaadin/client/connectors/DetailComponentManagerConnector.java b/client/src/main/java/com/vaadin/client/connectors/DetailComponentManagerConnector.java index 6830d27ef0..cf5b63d4ae 100644 --- a/client/src/main/java/com/vaadin/client/connectors/DetailComponentManagerConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/DetailComponentManagerConnector.java @@ -26,7 +26,8 @@ import com.vaadin.ui.Grid.DetailComponentManager; * @since 7.6.1 */ @Connect(DetailComponentManager.class) -public class DetailComponentManagerConnector extends AbstractExtensionConnector { +public class DetailComponentManagerConnector + extends AbstractExtensionConnector { @Override protected void extend(ServerConnector target) { diff --git a/client/src/main/java/com/vaadin/client/connectors/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/GridConnector.java index 550cf1517c..6045d31944 100644 --- a/client/src/main/java/com/vaadin/client/connectors/GridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/GridConnector.java @@ -111,8 +111,8 @@ import elemental.json.JsonValue; * @author Vaadin Ltd */ @Connect(com.vaadin.ui.Grid.class) -public class GridConnector extends AbstractHasComponentsConnector implements - SimpleManagedLayout, DeferredWorker { +public class GridConnector extends AbstractHasComponentsConnector + implements SimpleManagedLayout, DeferredWorker { private static final class CustomStyleGenerator implements CellStyleGenerator<JsonObject>, RowStyleGenerator<JsonObject> { @@ -223,7 +223,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements public void onStateChanged( StateChangeEvent stateChangeEvent) { - String error = editorConnector.getState().errorMessage; + String error = editorConnector + .getState().errorMessage; if (error == null) { columnToErrorMessage @@ -233,7 +234,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements // therefore, we use this hack to make the // string human-readable. Element e = DOM.createElement("div"); - e.setInnerHTML(editorConnector.getState().errorMessage); + e.setInnerHTML(editorConnector + .getState().errorMessage); error = getHeaderCaption() + ": " + e.getInnerText(); @@ -242,8 +244,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } // Handle Editor RPC before updating error status - Scheduler.get().scheduleFinally( - new ScheduledCommand() { + Scheduler.get() + .scheduleFinally(new ScheduledCommand() { @Override public void execute() { @@ -400,8 +402,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } } - private class ItemClickHandler implements BodyClickHandler, - BodyDoubleClickHandler { + private class ItemClickHandler + implements BodyClickHandler, BodyDoubleClickHandler { @Override public void onClick(GridClickEvent event) { @@ -417,15 +419,13 @@ public class GridConnector extends AbstractHasComponentsConnector implements } } - private void fireItemClick(CellReference<?> cell, NativeEvent mouseEvent) { + private void fireItemClick(CellReference<?> cell, + NativeEvent mouseEvent) { String rowKey = getRowKey((JsonObject) cell.getRow()); String columnId = getColumnId(cell.getColumn()); - getRpcProxy(GridServerRpc.class) - .itemClick( - rowKey, - columnId, - MouseEventDetailsBuilder - .buildMouseEventDetails(mouseEvent)); + getRpcProxy(GridServerRpc.class).itemClick(rowKey, columnId, + MouseEventDetailsBuilder + .buildMouseEventDetails(mouseEvent)); } } @@ -441,8 +441,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements newColumnOrder.add(((CustomGridColumn) column).id); } // the other case would be the multi selection column } - getRpcProxy(GridServerRpc.class).columnsReordered( - newColumnOrder, columnOrder); + getRpcProxy(GridServerRpc.class) + .columnsReordered(newColumnOrder, columnOrder); columnOrder = newColumnOrder; getState().columnOrder = newColumnOrder; } @@ -491,7 +491,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } }; - private class CustomDetailsGenerator implements HeightAwareDetailsGenerator { + private class CustomDetailsGenerator + implements HeightAwareDetailsGenerator { private final Map<String, ComponentConnector> idToDetailsMap = new HashMap<String, ComponentConnector>(); private final Map<String, Integer> idToRowIndex = new HashMap<String, Integer>(); @@ -534,9 +535,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements private String getId(int rowIndex) { JsonObject row = getWidget().getDataSource().getRow(rowIndex); - if (!row.hasKey(GridState.JSONKEY_DETAILS_VISIBLE) - || row.getString(GridState.JSONKEY_DETAILS_VISIBLE) - .isEmpty()) { + if (!row.hasKey(GridState.JSONKEY_DETAILS_VISIBLE) || row + .getString(GridState.JSONKEY_DETAILS_VISIBLE).isEmpty()) { return null; } @@ -782,8 +782,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements if (!Arrays.equals(columnIds, getState().sortColumns) || !Arrays.equals(directions, getState().sortDirs)) { // Report back to server if changed - getRpcProxy(GridServerRpc.class).sort(columnIds, - directions, event.isUserOriginated()); + getRpcProxy(GridServerRpc.class).sort(columnIds, directions, + event.isUserOriginated()); } } }); @@ -939,7 +939,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } } - private void updateHeaderCellFromState(HeaderCell cell, CellState cellState) { + private void updateHeaderCellFromState(HeaderCell cell, + CellState cellState) { switch (cellState.type) { case TEXT: cell.setText(cellState.text); @@ -958,8 +959,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } break; default: - throw new IllegalStateException("unexpected cell type: " - + cellState.type); + throw new IllegalStateException( + "unexpected cell type: " + cellState.type); } cell.setStyleName(cellState.styleName); } @@ -999,7 +1000,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } } - private void updateFooterCellFromState(FooterCell cell, CellState cellState) { + private void updateFooterCellFromState(FooterCell cell, + CellState cellState) { switch (cellState.type) { case TEXT: cell.setText(cellState.text); @@ -1018,8 +1020,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements } break; default: - throw new IllegalStateException("unexpected cell type: " - + cellState.type); + throw new IllegalStateException( + "unexpected cell type: " + cellState.type); } cell.setStyleName(cellState.styleName); } @@ -1074,7 +1076,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements column.setExpandRatio(state.expandRatio); assert state.rendererConnector instanceof AbstractRendererConnector : "GridColumnState.rendererConnector is invalid (not subclass of AbstractRendererConnector)"; - column.setRenderer((AbstractRendererConnector<Object>) state.rendererConnector); + column.setRenderer( + (AbstractRendererConnector<Object>) state.rendererConnector); column.setSortable(state.sortable); @@ -1087,7 +1090,8 @@ public class GridConnector extends AbstractHasComponentsConnector implements column.setHidingToggleCaption(state.hidingToggleCaption); column.setEditable(state.editable); - column.setEditorConnector((AbstractComponentConnector) state.editorConnector); + column.setEditorConnector( + (AbstractComponentConnector) state.editorConnector); } /** diff --git a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java index 1229922a9c..70d3da211a 100644 --- a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java @@ -45,14 +45,14 @@ import elemental.json.JsonValue; // This is really typed to <JsonValue>, but because of the way native strings // are not always instanceof JsonValue, we need to accept Object @Connect(AbstractJavaScriptRenderer.class) -public class JavaScriptRendererConnector extends - AbstractRendererConnector<Object> implements - HasJavaScriptConnectorHelper { +public class JavaScriptRendererConnector + extends AbstractRendererConnector<Object> + implements HasJavaScriptConnectorHelper { private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper( this); - private final JavaScriptObject cellReferenceWrapper = createCellReferenceWrapper(BrowserInfo - .get().isIE8()); + private final JavaScriptObject cellReferenceWrapper = createCellReferenceWrapper( + BrowserInfo.get().isIE8()); @Override protected void init() { @@ -137,9 +137,9 @@ public class JavaScriptRendererConnector extends helper.ensureJavascriptInited(); if (!hasFunction("render")) { - throw new RuntimeException("JavaScriptRenderer " - + helper.getInitFunctionName() - + " must have a function named 'render'"); + throw new RuntimeException( + "JavaScriptRenderer " + helper.getInitFunctionName() + + " must have a function named 'render'"); } final boolean hasInit = hasFunction("init"); @@ -221,8 +221,8 @@ public class JavaScriptRendererConnector extends @Override public Collection<String> getConsumedEvents() { if (hasGetConsumedEvents) { - JsArrayString events = getConsumedEvents(helper - .getConnectorWrapper()); + JsArrayString events = getConsumedEvents( + helper.getConnectorWrapper()); ArrayList<String> list = new ArrayList<String>( events.length()); diff --git a/client/src/main/java/com/vaadin/client/connectors/MultiSelectionModelConnector.java b/client/src/main/java/com/vaadin/client/connectors/MultiSelectionModelConnector.java index 5d00619995..d7e1580b7b 100644 --- a/client/src/main/java/com/vaadin/client/connectors/MultiSelectionModelConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/MultiSelectionModelConnector.java @@ -87,8 +87,8 @@ public class MultiSelectionModelConnector extends @OnStateChange("allSelected") void updateSelectAllCheckbox() { if (selectionModel.getSelectionColumnRenderer() != null) { - HeaderCell cell = getGrid().getDefaultHeaderRow().getCell( - getGrid().getColumn(0)); + HeaderCell cell = getGrid().getDefaultHeaderRow() + .getCell(getGrid().getColumn(0)); CheckBox widget = (CheckBox) cell.getWidget(); widget.setValue(getState().allSelected, false); } @@ -119,11 +119,12 @@ public class MultiSelectionModelConnector extends selectAll(); } }); - dataAvailable = getGrid().addDataAvailableHandler( - new DataAvailableHandler() { + dataAvailable = getGrid() + .addDataAvailableHandler(new DataAvailableHandler() { @Override - public void onDataAvailable(DataAvailableEvent event) { + public void onDataAvailable( + DataAvailableEvent event) { availableRows = event.getAvailableRows(); } }); @@ -156,7 +157,8 @@ public class MultiSelectionModelConnector extends assert !isBeingBatchSelected() : "Can't select all in middle of a batch selection."; DataSource<JsonObject> dataSource = getGrid().getDataSource(); - for (int i = availableRows.getStart(); i < availableRows.getEnd(); ++i) { + for (int i = availableRows.getStart(); i < availableRows + .getEnd(); ++i) { final JsonObject row = dataSource.getRow(i); if (row != null) { RowHandle<JsonObject> handle = dataSource.getHandle(row); @@ -202,7 +204,8 @@ public class MultiSelectionModelConnector extends assert !isBeingBatchSelected() : "Can't select all in middle of a batch selection."; DataSource<JsonObject> dataSource = getGrid().getDataSource(); - for (int i = availableRows.getStart(); i < availableRows.getEnd(); ++i) { + for (int i = availableRows.getStart(); i < availableRows + .getEnd(); ++i) { final JsonObject row = dataSource.getRow(i); if (row != null) { RowHandle<JsonObject> handle = dataSource.getHandle(row); @@ -300,8 +303,8 @@ public class MultiSelectionModelConnector extends * rows. Unpins any pinned rows. */ private void sendDeselected() { - getRpcProxy(MultiSelectionModelServerRpc.class).deselect( - getRowKeys(deselected)); + getRpcProxy(MultiSelectionModelServerRpc.class) + .deselect(getRowKeys(deselected)); if (isBeingBatchSelected()) { for (RowHandle<JsonObject> row : deselected) { @@ -317,8 +320,8 @@ public class MultiSelectionModelConnector extends * Unpins any pinned rows. */ private void sendSelected() { - getRpcProxy(MultiSelectionModelServerRpc.class).select( - getRowKeys(selected)); + getRpcProxy(MultiSelectionModelServerRpc.class) + .select(getRowKeys(selected)); if (isBeingBatchSelected()) { for (RowHandle<JsonObject> row : selected) { @@ -347,7 +350,8 @@ public class MultiSelectionModelConnector extends @Override public void startBatchSelect() { - assert selected.isEmpty() && deselected.isEmpty() : "Row caches were not clear."; + assert selected.isEmpty() + && deselected.isEmpty() : "Row caches were not clear."; batchSelect = true; } diff --git a/client/src/main/java/com/vaadin/client/connectors/NoSelectionModelConnector.java b/client/src/main/java/com/vaadin/client/connectors/NoSelectionModelConnector.java index b9f2d626c2..e0c88f5fa1 100644 --- a/client/src/main/java/com/vaadin/client/connectors/NoSelectionModelConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/NoSelectionModelConnector.java @@ -30,8 +30,8 @@ import elemental.json.JsonObject; * @author Vaadin Ltd */ @Connect(NoSelectionModel.class) -public class NoSelectionModelConnector extends - AbstractSelectionModelConnector<SelectionModel<JsonObject>> { +public class NoSelectionModelConnector + extends AbstractSelectionModelConnector<SelectionModel<JsonObject>> { @Override protected void extend(ServerConnector target) { diff --git a/client/src/main/java/com/vaadin/client/connectors/NumberRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/NumberRendererConnector.java index c044e0d6f1..98c4d64e9f 100644 --- a/client/src/main/java/com/vaadin/client/connectors/NumberRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/NumberRendererConnector.java @@ -18,9 +18,8 @@ package com.vaadin.client.connectors; import com.vaadin.shared.ui.Connect; /** - * A connector for - * {@link com.vaadin.ui.components.grid.renderers.NumberRenderer NumberRenderer} - * . + * A connector for {@link com.vaadin.ui.components.grid.renderers.NumberRenderer + * NumberRenderer} . * <p> * The server-side Renderer operates on numbers, but the data is serialized as a * string, and displayed as-is on the client side. This is to be able to support diff --git a/client/src/main/java/com/vaadin/client/connectors/ProgressBarRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/ProgressBarRendererConnector.java index 9b5e8a9677..ea8215330b 100644 --- a/client/src/main/java/com/vaadin/client/connectors/ProgressBarRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/ProgressBarRendererConnector.java @@ -25,8 +25,8 @@ import com.vaadin.shared.ui.Connect; * @author Vaadin Ltd */ @Connect(com.vaadin.ui.renderers.ProgressBarRenderer.class) -public class ProgressBarRendererConnector extends - AbstractRendererConnector<Double> { +public class ProgressBarRendererConnector + extends AbstractRendererConnector<Double> { @Override public ProgressBarRenderer getRenderer() { diff --git a/client/src/main/java/com/vaadin/client/connectors/RpcDataSourceConnector.java b/client/src/main/java/com/vaadin/client/connectors/RpcDataSourceConnector.java index d744bbc1c7..bd05ea0d34 100644 --- a/client/src/main/java/com/vaadin/client/connectors/RpcDataSourceConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/RpcDataSourceConnector.java @@ -133,8 +133,8 @@ public class RpcDataSourceConnector extends AbstractExtensionConnector { Range cached = getCachedRange(); - rpcProxy.requestRows(firstRowIndex, numberOfRows, - cached.getStart(), cached.length()); + rpcProxy.requestRows(firstRowIndex, numberOfRows, cached.getStart(), + cached.length()); /* * Show the progress indicator if there is a pending data request diff --git a/client/src/main/java/com/vaadin/client/connectors/SingleSelectionModelConnector.java b/client/src/main/java/com/vaadin/client/connectors/SingleSelectionModelConnector.java index fddf3865a2..0825db4d2f 100644 --- a/client/src/main/java/com/vaadin/client/connectors/SingleSelectionModelConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/SingleSelectionModelConnector.java @@ -78,8 +78,8 @@ public class SingleSelectionModelConnector extends /** * SingleSelectionModel without a selection column renderer. */ - public class SingleSelectionModel extends AbstractSelectionModel implements - SelectionModel.Single<JsonObject> { + public class SingleSelectionModel extends AbstractSelectionModel + implements SelectionModel.Single<JsonObject> { private RowHandle<JsonObject> selectedRow; private boolean deselectAllowed; @@ -110,8 +110,8 @@ public class SingleSelectionModelConnector extends // Check if currently re-selected row was deselected from // the server. if (row != null && getRowHandle(row).equals(selectedRow)) { - if (selectedRow.getRow().hasKey( - GridState.JSONKEY_SELECTED)) { + if (selectedRow.getRow() + .hasKey(GridState.JSONKEY_SELECTED)) { // Everything is OK, no need to do anything. return false; } @@ -130,8 +130,8 @@ public class SingleSelectionModelConnector extends } if (changed) { - getRpcProxy(SingleSelectionModelServerRpc.class).select( - getRowKey(row)); + getRpcProxy(SingleSelectionModelServerRpc.class) + .select(getRowKey(row)); } return changed; diff --git a/client/src/main/java/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java index 72d8db3c4a..e30f8dac99 100644 --- a/client/src/main/java/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java @@ -26,8 +26,8 @@ import com.vaadin.shared.ui.Connect; * @author Vaadin Ltd */ @Connect(com.vaadin.ui.renderers.HtmlRenderer.class) -public class UnsafeHtmlRendererConnector extends - AbstractRendererConnector<String> { +public class UnsafeHtmlRendererConnector + extends AbstractRendererConnector<String> { public static class UnsafeHtmlRenderer implements Renderer<String> { @Override diff --git a/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java index 05ac7182c5..e0c8612846 100644 --- a/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java +++ b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java @@ -437,8 +437,10 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { Range received = Range.withLength(firstRowIndex, rowData.size()); if (isWaitingForData()) { - cacheStrategy.onDataArrive(Duration.currentTimeMillis() - - currentRequestCallback.requestStart, received.length()); + cacheStrategy.onDataArrive( + Duration.currentTimeMillis() + - currentRequestCallback.requestStart, + received.length()); currentRequestCallback = null; } @@ -450,17 +452,20 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { Range newUsefulData = partition[1]; if (!newUsefulData.isEmpty()) { // Update the parts that are actually inside - for (int i = newUsefulData.getStart(); i < newUsefulData.getEnd(); i++) { + for (int i = newUsefulData.getStart(); i < newUsefulData + .getEnd(); i++) { final T row = rowData.get(i - firstRowIndex); indexToRowMap.put(Integer.valueOf(i), row); keyToIndexMap.put(getRowKey(row), Integer.valueOf(i)); } if (dataChangeHandler != null) { - Profiler.enter("AbstractRemoteDataSource.setRowData notify dataChangeHandler"); + Profiler.enter( + "AbstractRemoteDataSource.setRowData notify dataChangeHandler"); dataChangeHandler.dataUpdated(newUsefulData.getStart(), newUsefulData.length()); - Profiler.leave("AbstractRemoteDataSource.setRowData notify dataChangeHandler"); + Profiler.leave( + "AbstractRemoteDataSource.setRowData notify dataChangeHandler"); } // Potentially extend the range @@ -552,8 +557,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { // Removal and cache share some indices. fix accordingly. Range[] partitions = cached.partitionWith(removedRange); Range remainsBefore = partitions[0]; - Range transposedRemainsAfter = partitions[2].offsetBy(-removedRange - .length()); + Range transposedRemainsAfter = partitions[2] + .offsetBy(-removedRange.length()); cached = remainsBefore.combineWith(transposedRemainsAfter); } else if (removedRange.getEnd() <= cached.getStart()) { // Removal was before the cache. offset the cache. @@ -696,8 +701,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { Object key = getRowKey(row); if (key == null) { - throw new NullPointerException("key may not be null (row: " + row - + ")"); + throw new NullPointerException( + "key may not be null (row: " + row + ")"); } if (pinnedRows.containsKey(key)) { diff --git a/client/src/main/java/com/vaadin/client/data/CacheStrategy.java b/client/src/main/java/com/vaadin/client/data/CacheStrategy.java index 79ce537314..37701bd785 100644 --- a/client/src/main/java/com/vaadin/client/data/CacheStrategy.java +++ b/client/src/main/java/com/vaadin/client/data/CacheStrategy.java @@ -46,8 +46,8 @@ public interface CacheStrategy { Range estimatedAvailableRange) { int cacheSize = getMinimumCacheSize(displayedRange.length()); - return displayedRange.expand(cacheSize, cacheSize).restrictTo( - estimatedAvailableRange); + return displayedRange.expand(cacheSize, cacheSize) + .restrictTo(estimatedAvailableRange); } @Override @@ -55,8 +55,8 @@ public interface CacheStrategy { Range estimatedAvailableRange) { int cacheSize = getMaximumCacheSize(displayedRange.length()); - return displayedRange.expand(cacheSize, cacheSize).restrictTo( - estimatedAvailableRange); + return displayedRange.expand(cacheSize, cacheSize) + .restrictTo(estimatedAvailableRange); } /** @@ -86,8 +86,8 @@ public interface CacheStrategy { * the cache and items are discarded if there's yet another page size worth * of items cached in either direction. */ - public static class DefaultCacheStrategy extends - AbstractBasicSymmetricalCacheStrategy { + public static class DefaultCacheStrategy + extends AbstractBasicSymmetricalCacheStrategy { private final int minimumRatio; private final int maximumRatio; diff --git a/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java index fc9f3856b5..45652e0257 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/AnalyzeLayoutsPanel.java @@ -68,8 +68,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel { int size = valueMapArray.length(); if (size > 0) { - SimpleTree root = new SimpleTree("Layouts analyzed, " + size - + " top level problems"); + SimpleTree root = new SimpleTree( + "Layouts analyzed, " + size + " top level problems"); for (int i = 0; i < size; i++) { printLayoutError(ac, valueMapArray.get(i), root); } @@ -94,7 +94,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel { printClientSideDetectedIssues(zeroHeightComponents, ac); } if (zeroWidthComponents.size() > 0) { - add(new HTML("<p><strong>Horizontally zero size:</strong></p>")); + add(new HTML( + "<p><strong>Horizontally zero size:</strong></p>")); printClientSideDetectedIssues(zeroWidthComponents, ac); } } @@ -111,12 +112,10 @@ public class AnalyzeLayoutsPanel extends FlowPanel { final ServerConnector parent = connector.getParent(); final String parentId = parent.getConnectorId(); - final Label errorDetails = new Label(connector.getClass() - .getSimpleName() - + "[" - + connector.getConnectorId() - + "]" - + " inside " + parent.getClass().getSimpleName()); + final Label errorDetails = new Label( + connector.getClass().getSimpleName() + "[" + + connector.getConnectorId() + "]" + " inside " + + parent.getClass().getSimpleName()); if (parent instanceof ComponentConnector) { final ComponentConnector parentConnector = (ComponentConnector) parent; @@ -173,8 +172,8 @@ public class AnalyzeLayoutsPanel extends FlowPanel { Highlight.show(connector); - final SimpleTree errorNode = new SimpleTree(connector.getClass() - .getSimpleName() + " id: " + pid); + final SimpleTree errorNode = new SimpleTree( + connector.getClass().getSimpleName() + " id: " + pid); errorNode.addDomHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { @@ -205,12 +204,12 @@ public class AnalyzeLayoutsPanel extends FlowPanel { VerticalPanel errorDetails = new VerticalPanel(); if (valueMap.containsKey("heightMsg")) { - errorDetails.add(new Label("Height problem: " - + valueMap.getString("heightMsg"))); + errorDetails.add(new Label( + "Height problem: " + valueMap.getString("heightMsg"))); } if (valueMap.containsKey("widthMsg")) { - errorDetails.add(new Label("Width problem: " - + valueMap.getString("widthMsg"))); + errorDetails.add(new Label( + "Width problem: " + valueMap.getString("widthMsg"))); } if (errorDetails.getWidgetCount() > 0) { errorNode.add(errorDetails); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java index 5269d82bd6..554d13317f 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/ConnectorInfoPanel.java @@ -57,13 +57,13 @@ public class ConnectorInfoPanel extends FlowPanel { if (connector instanceof ComponentConnector) { ComponentConnector component = (ComponentConnector) connector; - ignoreProperties.addAll(Arrays.asList("caption", "description", - "width", "height")); + ignoreProperties.addAll( + Arrays.asList("caption", "description", "width", "height")); AbstractComponentState componentState = component.getState(); - html += getRowHTML("Widget", component.getWidget().getClass() - .getSimpleName()); + html += getRowHTML("Widget", + component.getWidget().getClass().getSimpleName()); html += getRowHTML("Caption", componentState.caption); html += getRowHTML("Description", componentState.description); html += getRowHTML("Width", componentState.width + " (actual: " diff --git a/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java b/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java index f797197afb..23777823c0 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/DebugButton.java @@ -44,7 +44,7 @@ public class DebugButton extends Button { public DebugButton(String caption) { this(null, null, caption); } - + public DebugButton(String caption, String title) { this(null, title, caption); } diff --git a/client/src/main/java/com/vaadin/client/debug/internal/ErrorNotificationHandler.java b/client/src/main/java/com/vaadin/client/debug/internal/ErrorNotificationHandler.java index 5d128cbdcc..adca5305ef 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/ErrorNotificationHandler.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/ErrorNotificationHandler.java @@ -66,8 +66,8 @@ public class ErrorNotificationHandler extends Handler { .getRunningApplications().get(0); owner = connection.getUIConnector().getWidget(); } - VNotification n = VNotification.createNotification( - VNotification.DELAY_FOREVER, owner); + VNotification n = VNotification + .createNotification(VNotification.DELAY_FOREVER, owner); n.getElement().getStyle().setTextAlign(TextAlign.LEFT); n.show("<h1>Uncaught client side exception</h1><br />" + exceptionText.replace("\n", "<br/>\n"), diff --git a/client/src/main/java/com/vaadin/client/debug/internal/HierarchySection.java b/client/src/main/java/com/vaadin/client/debug/internal/HierarchySection.java index ffb4042e69..3557497be4 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/HierarchySection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/HierarchySection.java @@ -121,8 +121,8 @@ public class HierarchySection implements Section { stopFind(); connector.getConnection().getUIConnector() .showServerDesign(connector); - content.setWidget(new HTML( - "Design file for component sent to server log")); + content.setWidget( + new HTML("Design file for component sent to server log")); } }; @@ -334,17 +334,17 @@ public class HierarchySection implements Section { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { - if (event.getTypeInt() == Event.ONKEYDOWN - && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { + if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent() + .getKeyCode() == KeyCodes.KEY_ESCAPE) { stopFind(); Highlight.hideAll(); return; } if (event.getTypeInt() == Event.ONMOUSEMOVE) { Highlight.hideAll(); - Element eventTarget = WidgetUtil.getElementFromPoint(event - .getNativeEvent().getClientX(), event.getNativeEvent() - .getClientY()); + Element eventTarget = WidgetUtil.getElementFromPoint( + event.getNativeEvent().getClientX(), + event.getNativeEvent().getClientY()); if (VDebugWindow.get().getElement().isOrHasChild(eventTarget)) { // Do not prevent using debug window controls @@ -376,9 +376,9 @@ public class HierarchySection implements Section { event.cancel(); event.consume(); event.getNativeEvent().stopPropagation(); - Element eventTarget = WidgetUtil.getElementFromPoint(event - .getNativeEvent().getClientX(), event.getNativeEvent() - .getClientY()); + Element eventTarget = WidgetUtil.getElementFromPoint( + event.getNativeEvent().getClientX(), + event.getNativeEvent().getClientY()); for (ApplicationConnection a : ApplicationConfiguration .getRunningApplications()) { ComponentConnector connector = Util.getConnectorForElement( diff --git a/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java b/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java index e91f4abcbb..74f1cabf02 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/Highlight.java @@ -204,8 +204,8 @@ public class Highlight { style.setBackgroundColor(color); style.setOpacity(DEFAULT_OPACITY); if (BrowserInfo.get().isIE()) { - style.setProperty("filter", "alpha(opacity=" - + (DEFAULT_OPACITY * 100) + ")"); + style.setProperty("filter", + "alpha(opacity=" + (DEFAULT_OPACITY * 100) + ")"); } highlights.add(highlight); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/InfoSection.java b/client/src/main/java/com/vaadin/client/debug/internal/InfoSection.java index 39ff345cb1..034d921a37 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/InfoSection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/InfoSection.java @@ -165,8 +165,8 @@ public class InfoSection implements Section { addRow("Widget set", GWT.getModuleName()); addRow("Theme", connection.getUIConnector().getActiveTheme()); - String communicationMethodInfo = connection - .getMessageSender().getCommunicationMethodName(); + String communicationMethodInfo = connection.getMessageSender() + .getCommunicationMethodName(); int pollInterval = connection.getUIConnector().getState().pollInterval; if (pollInterval > 0) { communicationMethodInfo += " (poll interval " + pollInterval @@ -211,10 +211,10 @@ public class InfoSection implements Section { themeVersion); boolean servletOk = equalsEither(servletVersion, clientVersion, themeVersion); - addRow("Client engine version", clientVersion, clientOk ? null - : ERROR_STYLE); - addRow("Server engine version", servletVersion, servletOk ? null - : ERROR_STYLE); + addRow("Client engine version", clientVersion, + clientOk ? null : ERROR_STYLE); + addRow("Server engine version", servletVersion, + servletOk ? null : ERROR_STYLE); addRow("Theme version", themeVersion, themeOk ? null : ERROR_STYLE); if (jsVersion != null) { addRow("Push server version", atmosphereVersion); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/LogSection.java b/client/src/main/java/com/vaadin/client/debug/internal/LogSection.java index 30abb4fff9..edbdf14ea3 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/LogSection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/LogSection.java @@ -61,7 +61,8 @@ public class LogSection implements Section { } @Override - protected String getRecordInfo(LogRecord event, String newline) { + protected String getRecordInfo(LogRecord event, + String newline) { return ""; } }); @@ -157,8 +158,8 @@ public class LogSection implements Section { public void onClick(ClickEvent event) { Element el = Element .as(event.getNativeEvent().getEventTarget()); - while (!el.getClassName().contains( - VDebugWindow.STYLENAME + "-message")) { + while (!el.getClassName() + .contains(VDebugWindow.STYLENAME + "-message")) { if (el == contentElement) { // clicked something else return; @@ -336,8 +337,8 @@ public class LogSection implements Section { + "'></span><span class='" + VDebugWindow.STYLENAME + "-time' title='" + VDebugWindow.getTimingTooltip(sinceStart, sinceReset) + "'>" - + sinceReset + "ms</span><span class='" - + VDebugWindow.STYLENAME + "-message'>" + msg + "</span>"; + + sinceReset + "ms</span><span class='" + VDebugWindow.STYLENAME + + "-message'>" + msg + "</span>"; row.setInnerHTML(inner); contentElement.appendChild(row); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/NetworkSection.java b/client/src/main/java/com/vaadin/client/debug/internal/NetworkSection.java index 5b0579238f..deb1271348 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/NetworkSection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/NetworkSection.java @@ -84,8 +84,8 @@ public class NetworkSection implements Section { VUIDLBrowser vuidlBrowser = new VUIDLBrowser(uidl, ac); vuidlBrowser.addStyleName(VDebugWindow.STYLENAME + "-row"); vuidlBrowser.setText("Response @ " + sinceReset + "ms"); - vuidlBrowser.setTitle(VDebugWindow.getTimingTooltip(sinceStart, - sinceReset)); + vuidlBrowser.setTitle( + VDebugWindow.getTimingTooltip(sinceStart, sinceReset)); vuidlBrowser.close(); content.add(vuidlBrowser); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java b/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java index d9aad9e61b..9edb8c662f 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/OptimizedWidgetsetPanel.java @@ -95,8 +95,8 @@ public class OptimizedWidgetsetPanel extends FlowPanel { tag++; if (tag > 10000) { // Sanity check - getLogger() - .severe("Search for used connector classes was forcefully terminated"); + getLogger().severe( + "Search for used connector classes was forcefully terminated"); break; } } diff --git a/client/src/main/java/com/vaadin/client/debug/internal/ProfilerSection.java b/client/src/main/java/com/vaadin/client/debug/internal/ProfilerSection.java index 2851563884..c75df09fcf 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/ProfilerSection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/ProfilerSection.java @@ -69,13 +69,13 @@ public class ProfilerSection implements Section { SimpleTree offendersTree = new SimpleTree("Longest events"); for (int i = 0; i < totals.size() && i < 20; i++) { Node node = totals.get(i); - offendersTree.add(new Label(node - .getStringRepresentation(""))); + offendersTree + .add(new Label(node.getStringRepresentation(""))); } - SimpleTree root = new SimpleTree(eventCount - + " profiler events using " + Util.round(totalTime, 3) - + " ms"); + SimpleTree root = new SimpleTree( + eventCount + " profiler events using " + + Util.round(totalTime, 3) + " ms"); root.add(drillDownTree); root.add(offendersTree); root.open(false); @@ -85,12 +85,14 @@ public class ProfilerSection implements Section { } @Override - public void addBootstrapData(LinkedHashMap<String, Double> timings) { + public void addBootstrapData( + LinkedHashMap<String, Double> timings) { SimpleTree tree = new SimpleTree( "Time since window.performance.timing events"); Set<Entry<String, Double>> entrySet = timings.entrySet(); for (Entry<String, Double> entry : entrySet) { - tree.add(new Label(entry.getValue() + " " + entry.getKey())); + tree.add( + new Label(entry.getValue() + " " + entry.getKey())); } tree.open(false); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/Section.java b/client/src/main/java/com/vaadin/client/debug/internal/Section.java index 876b9bbc27..5d0fd66d4f 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/Section.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/Section.java @@ -31,7 +31,8 @@ public interface Section { * Returns a button that will be used to activate this section, displayed as * a tab in {@link VDebugWindow}. * <p> - * <em>The same instance <b>must</b> be returned each time this method is called.</em> + * <em>The same instance <b>must</b> be returned each time this method is + * called.</em> * </p> * <p> * The button should preferably only have an icon (no caption), and should diff --git a/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java b/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java index d0b6b10722..44c3373823 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/TestBenchSection.java @@ -54,8 +54,8 @@ public class TestBenchSection implements Section { /** * Selector widget showing a selector in a program-usable form. */ - private static class SelectorWidget extends HTML implements - MouseOverHandler, MouseOutHandler { + private static class SelectorWidget extends HTML + implements MouseOverHandler, MouseOutHandler { private final SelectorPath path; public SelectorWidget(final SelectorPath path) { @@ -197,9 +197,9 @@ public class TestBenchSection implements Section { private void pickSelector(ServerConnector connector, Element element) { - SelectorPath p = new SelectorPath(connector, Util - .findPaintable(connector.getConnection(), element).getWidget() - .getElement()); + SelectorPath p = new SelectorPath(connector, + Util.findPaintable(connector.getConnection(), element) + .getWidget().getElement()); SelectorWidget w = new SelectorWidget(p); content.add(w); @@ -210,17 +210,17 @@ public class TestBenchSection implements Section { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { - if (event.getTypeInt() == Event.ONKEYDOWN - && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) { + if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent() + .getKeyCode() == KeyCodes.KEY_ESCAPE) { stopFind(); Highlight.hideAll(); return; } if (event.getTypeInt() == Event.ONMOUSEMOVE || event.getTypeInt() == Event.ONCLICK) { - Element eventTarget = WidgetUtil.getElementFromPoint(event - .getNativeEvent().getClientX(), event.getNativeEvent() - .getClientY()); + Element eventTarget = WidgetUtil.getElementFromPoint( + event.getNativeEvent().getClientX(), + event.getNativeEvent().getClientY()); if (VDebugWindow.get().getElement().isOrHasChild(eventTarget)) { if (isFindMode() && event.getTypeInt() == Event.ONCLICK) { stopFind(); @@ -232,9 +232,9 @@ public class TestBenchSection implements Section { // make sure that not finding the highlight element only Highlight.hideAll(); - eventTarget = WidgetUtil.getElementFromPoint(event - .getNativeEvent().getClientX(), event.getNativeEvent() - .getClientY()); + eventTarget = WidgetUtil.getElementFromPoint( + event.getNativeEvent().getClientX(), + event.getNativeEvent().getClientY()); ComponentConnector connector = findConnector(eventTarget); if (event.getTypeInt() == Event.ONMOUSEMOVE) { @@ -264,8 +264,8 @@ public class TestBenchSection implements Section { private ComponentConnector findConnector(Element element) { for (ApplicationConnection a : ApplicationConfiguration .getRunningApplications()) { - ComponentConnector connector = Util.getConnectorForElement(a, a - .getUIConnector().getWidget(), element); + ComponentConnector connector = Util.getConnectorForElement(a, + a.getUIConnector().getWidget(), element); if (connector == null) { connector = Util.getConnectorForElement(a, RootPanel.get(), element); diff --git a/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java b/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java index fbc838f861..5d7e1ba3ed 100644 --- a/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java +++ b/client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java @@ -710,22 +710,23 @@ public final class VDebugWindow extends VOverlay { public void execute() { readStoredState(); - Window.addResizeHandler(new com.google.gwt.event.logical.shared.ResizeHandler() { - - Timer t = new Timer() { - @Override - public void run() { - applyPositionAndSize(); - } - }; - - @Override - public void onResize(ResizeEvent event) { - t.cancel(); - // TODO less - t.schedule(1000); - } - }); + Window.addResizeHandler( + new com.google.gwt.event.logical.shared.ResizeHandler() { + + Timer t = new Timer() { + @Override + public void run() { + applyPositionAndSize(); + } + }; + + @Override + public void onResize(ResizeEvent event) { + t.cancel(); + // TODO less + t.schedule(1000); + } + }); } }); } @@ -793,7 +794,8 @@ public final class VDebugWindow extends VOverlay { DebugButton[] modes = new DebugButton[] { new DebugButton(Icon.DEVMODE_OFF, "Debug only (causes page reload)"), - new DebugButton(Icon.DEVMODE_ON, "DevMode (causes page reload)"), + new DebugButton(Icon.DEVMODE_ON, + "DevMode (causes page reload)"), new DebugButton(Icon.DEVMODE_SUPER, "SuperDevMode (causes page reload)") }; diff --git a/client/src/main/java/com/vaadin/client/event/PointerEvent.java b/client/src/main/java/com/vaadin/client/event/PointerEvent.java index 71e73f945c..c544a286be 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerEvent.java +++ b/client/src/main/java/com/vaadin/client/event/PointerEvent.java @@ -27,8 +27,8 @@ import com.google.gwt.event.shared.EventHandler; * * @since 7.2 */ -public abstract class PointerEvent<H extends EventHandler> extends - MouseEvent<H> { +public abstract class PointerEvent<H extends EventHandler> + extends MouseEvent<H> { enum EventType { PointerDown, PointerMove, PointerOut, PointerOver, PointerUp, PointerCancel; diff --git a/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplIE10.java b/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplIE10.java index 1de2f9722f..1b0e58c387 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplIE10.java +++ b/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplIE10.java @@ -23,8 +23,8 @@ import com.vaadin.client.event.PointerEvent.EventType; * @since 7.2 * @author Vaadin Ltd */ -public class PointerEventSupportImplIE10 extends - PointerEventSupportImplModernIE { +public class PointerEventSupportImplIE10 + extends PointerEventSupportImplModernIE { @Override public String getNativeEventName(EventType eventName) { diff --git a/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplModernIE.java b/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplModernIE.java index 851c600bcb..57b822b24a 100644 --- a/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplModernIE.java +++ b/client/src/main/java/com/vaadin/client/event/PointerEventSupportImplModernIE.java @@ -50,8 +50,8 @@ public class PointerEventSupportImplModernIE extends PointerEventSupportImpl { } DOMImplStandard .addBitlessEventDispatchers(eventDispatcherMapExtensions); - DOMImplStandard - .addCaptureEventDispatchers(captureEventDispatcherMapExtensions); + DOMImplStandard.addCaptureEventDispatchers( + captureEventDispatcherMapExtensions); inited = true; } diff --git a/client/src/main/java/com/vaadin/client/extensions/BrowserWindowOpenerConnector.java b/client/src/main/java/com/vaadin/client/extensions/BrowserWindowOpenerConnector.java index 11e3e80a14..ca17e84ea4 100644 --- a/client/src/main/java/com/vaadin/client/extensions/BrowserWindowOpenerConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/BrowserWindowOpenerConnector.java @@ -68,7 +68,8 @@ public class BrowserWindowOpenerConnector extends AbstractExtensionConnector if (!getState().parameters.isEmpty()) { StringBuilder params = new StringBuilder(); - for (Entry<String, String> entry : getState().parameters.entrySet()) { + for (Entry<String, String> entry : getState().parameters + .entrySet()) { if (params.length() != 0) { params.append('&'); } diff --git a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java index ae330be8f4..c5fafd1cd9 100644 --- a/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/ResponsiveConnector.java @@ -40,8 +40,8 @@ import com.vaadin.shared.util.SharedUtil; */ @SuppressWarnings("GwtInconsistentSerializableClass") @Connect(Responsive.class) -public class ResponsiveConnector extends AbstractExtensionConnector implements - ElementResizeListener { +public class ResponsiveConnector extends AbstractExtensionConnector + implements ElementResizeListener { /** * The target component which we will monitor for width changes @@ -166,26 +166,26 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements */ private static native void searchForBreakPointsNative() /*-{ - + // Initialize variables @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache = []; @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache = []; - + var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; - + // Can't do squat if we can't parse stylesheets if(!$doc.styleSheets) return; - + var sheets = $doc.styleSheets; - + // Loop all stylesheets on the page and process them individually for(var i = 0, len = sheets.length; i < len; i++) { var sheet = sheets[i]; @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(sheet); } - + }-*/; /** @@ -198,16 +198,16 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements private static native void searchStylesheetForBreakPoints( final JavaScriptObject sheet) /*-{ - + // Inline variables for easier reading var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; - + // Get all the rulesets from the stylesheet var theRules = new Array(); var IEOrEdge = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE()() || @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isEdge()(); var IE8 = @com.vaadin.client.BrowserInfo::get()().@com.vaadin.client.BrowserInfo::isIE8()(); - + try { if (sheet.cssRules) { theRules = sheet.cssRules @@ -220,7 +220,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements ", probably because of cross domain issues: " + e); return; } - + // Special import handling for IE8 if (IE8) { try { @@ -232,18 +232,18 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements @com.vaadin.client.extensions.ResponsiveConnector::error(Ljava/lang/String;)("Failed to handle imports of CSS style sheet: " + sheet.href); } } - + // Loop through the rulesets for(var i = 0, len = theRules.length; i < len; i++) { var rule = theRules[i]; - + if(rule.type == 3) { // @import rule, traverse recursively @com.vaadin.client.extensions.ResponsiveConnector::searchStylesheetForBreakPoints(Lcom/google/gwt/core/client/JavaScriptObject;)(rule.styleSheet); - + } else if(rule.type == 1 ||Â !rule.type) { // Regular selector rule - + // Helper function var pushToCache = function(ranges, selector, min, max) { // Avoid adding duplicates @@ -259,13 +259,13 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements ranges.push([selector, min, max]); } }; - + // Array of all of the separate selectors in this ruleset var haystack = rule.selectorText.split(","); - + // IE/Edge parses CSS like .class[attr="val"] into [attr="val"].class so we need to check for both var selectorRegEx = IEOrEdge ? /\[.*\]([\.|#]\S+)/ : /([\.|#]\S+?)\[.*\]/; - + // Loop all the selectors in this ruleset for(var k = 0, len2 = haystack.length; k < len2; k++) { @@ -273,7 +273,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements var widthRange = haystack[k].match(/\[width-range.*?\]/); var heightRange = haystack[k].match(/\[height-range.*?\]/); var selector = haystack[k].match(selectorRegEx); - + if (selector != null) { selector = selector[1]; @@ -285,7 +285,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements pushToCache(widthRanges, selector, min, max); } - + // Check for height-ranges. if (heightRange != null) { var minMax = heightRange[0].match(/\[height-range~?=["|'](.*?)-(.*?)["|']\]/i); @@ -298,7 +298,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements } } } - + }-*/; /** @@ -308,15 +308,15 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements */ private native void getBreakPointsFor(final String selectors) /*-{ - + var selectors = selectors.split(","); - + var widthBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints = []; var heightBreakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints = []; - + var widthRanges = @com.vaadin.client.extensions.ResponsiveConnector::widthRangeCache; var heightRanges = @com.vaadin.client.extensions.ResponsiveConnector::heightRangeCache; - + for(var i = 0, len = widthRanges.length; i < len; i++) { var bp = widthRanges[i]; for(var j = 0, len2 = selectors.length; j < len2; j++) { @@ -324,7 +324,7 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements widthBreakpoints.push(bp); } } - + for(var i = 0, len = heightRanges.length; i < len; i++) { var bp = heightRanges[i]; for(var j = 0, len2 = selectors.length; j < len2; j++) { @@ -332,10 +332,10 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements heightBreakpoints.push(bp); } } - + // Only for debugging // console.log("Breakpoints for", selectors.join(","), widthBreakpoints, heightBreakpoints); - + }-*/; private String currentWidthRanges = ""; @@ -386,8 +386,8 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements // case some new styles are applied if (!currentWidthRanges.equals(oldWidthRanges) || !currentHeightRanges.equals(oldHeightRanges)) { - layoutManager - .setNeedsMeasureRecursively(ResponsiveConnector.this.target); + layoutManager.setNeedsMeasureRecursively( + ResponsiveConnector.this.target); } } @@ -408,24 +408,24 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements private native String resolveBreakpoint(String which, int size) /*-{ - + // Default to "width" breakpoints var breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::widthBreakpoints; - + // Use height breakpoints if we're measuring the height if(which == "height") breakpoints = this.@com.vaadin.client.extensions.ResponsiveConnector::heightBreakpoints; - + // Output string that goes into either the "width-range" or "height-range" attribute in the element var ranges = ""; - + // Loop the breakpoints for(var i = 0, len = breakpoints.length; i < len; i++) { var bp = breakpoints[i]; - + var min = parseInt(bp[1]); var max = parseInt(bp[2]); - + if(!isNaN(min) && !isNaN(max)) { if(min <= size && size <= max) { ranges += " " + bp[1] + "-" + bp[2]; @@ -440,10 +440,10 @@ public class ResponsiveConnector extends AbstractExtensionConnector implements } } } - + // Trim the output and return it return ranges.replace(/^\s+/, ""); - + }-*/; } diff --git a/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java index 364b948573..ece6d560e9 100644 --- a/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java @@ -104,7 +104,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { } target = target[part]; } - + $wnd.console.log('removing',parts[parts.length - 1],'from',target); delete target[parts[parts.length - 1]]; }-*/; diff --git a/client/src/main/java/com/vaadin/client/legacy/ui/VLegacyTextField.java b/client/src/main/java/com/vaadin/client/legacy/ui/VLegacyTextField.java index bcd4f85be9..7c8520f658 100644 --- a/client/src/main/java/com/vaadin/client/legacy/ui/VLegacyTextField.java +++ b/client/src/main/java/com/vaadin/client/legacy/ui/VLegacyTextField.java @@ -46,8 +46,8 @@ import com.vaadin.shared.legacy.ui.textfield.LegacyTextFieldConstants; * */ @Deprecated -public class VLegacyTextField extends TextBoxBase implements Field, ChangeHandler, - FocusHandler, BlurHandler, KeyDownHandler { +public class VLegacyTextField extends TextBoxBase implements Field, + ChangeHandler, FocusHandler, BlurHandler, KeyDownHandler { /** * The input node CSS classname. diff --git a/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java b/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java index e67fee96cf..9a02912b6c 100644 --- a/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -102,8 +102,8 @@ public abstract class ConnectorBundleLoader { public boolean isBundleLoaded(String bundleName) { AsyncBundleLoader loader = asyncBlockLoaders.get(bundleName); if (loader == null) { - throw new IllegalArgumentException("Bundle " + bundleName - + " not recognized"); + throw new IllegalArgumentException( + "Bundle " + bundleName + " not recognized"); } return loader.getState() == State.LOADED; } diff --git a/client/src/main/java/com/vaadin/client/metadata/OnStateChangeMethod.java b/client/src/main/java/com/vaadin/client/metadata/OnStateChangeMethod.java index 47749fcd52..fd325b53cb 100644 --- a/client/src/main/java/com/vaadin/client/metadata/OnStateChangeMethod.java +++ b/client/src/main/java/com/vaadin/client/metadata/OnStateChangeMethod.java @@ -70,8 +70,8 @@ public class OnStateChangeMethod { this.methodName = methodName; - this.properties = Collections.unmodifiableList(Arrays - .asList(properties)); + this.properties = Collections + .unmodifiableList(Arrays.asList(properties)); this.declaringClass = declaringClass; } @@ -95,8 +95,10 @@ public class OnStateChangeMethod { try { declaringType.getMethod(methodName).invoke(connector); } catch (NoDataException e) { - throw new RuntimeException("Couldn't invoke @OnStateChange method " - + declaringType.getSignature() + "." + methodName, e); + throw new RuntimeException( + "Couldn't invoke @OnStateChange method " + + declaringType.getSignature() + "." + methodName, + e); } } diff --git a/client/src/main/java/com/vaadin/client/metadata/Property.java b/client/src/main/java/com/vaadin/client/metadata/Property.java index 90b29b32b7..abaaab8fed 100644 --- a/client/src/main/java/com/vaadin/client/metadata/Property.java +++ b/client/src/main/java/com/vaadin/client/metadata/Property.java @@ -105,8 +105,8 @@ public class Property { /** * Gets the property name formatted for displaying in a user interface. This - * returns a string where e.g. "camelCase" has been converted to - * "Camel case". + * returns a string where e.g. "camelCase" has been converted to "Camel + * case". * * @return the name of this property, formatted for humans to read */ diff --git a/client/src/main/java/com/vaadin/client/metadata/Type.java b/client/src/main/java/com/vaadin/client/metadata/Type.java index 15617ffe3c..d863bed78b 100644 --- a/client/src/main/java/com/vaadin/client/metadata/Type.java +++ b/client/src/main/java/com/vaadin/client/metadata/Type.java @@ -80,7 +80,8 @@ public class Type { return new Property(this, propertyName); } - private static String calculateSignature(String name, Type[] parameterTypes) { + private static String calculateSignature(String name, + Type[] parameterTypes) { String string = name; if (parameterTypes != null && parameterTypes.length != 0) { string += '<'; diff --git a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java index e3c1c8392a..c6f8a08695 100644 --- a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java +++ b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java @@ -74,8 +74,8 @@ public class TypeDataStore { public static Class<?> getClass(String identifier) throws NoDataException { Class<?> class1 = get().identifiers.get(identifier); if (class1 == null) { - throw new NoDataException("There is not class for identifier " - + identifier); + throw new NoDataException( + "There is not class for identifier " + identifier); } return class1; } @@ -103,8 +103,8 @@ public class TypeDataStore { public static Type getReturnType(Method method) throws NoDataException { Type type = get().returnTypes.get(method.getLookupKey()); if (type == null) { - throw new NoDataException("There is no return type for " - + method.getSignature()); + throw new NoDataException( + "There is no return type for " + method.getSignature()); } return type; } @@ -112,26 +112,27 @@ public class TypeDataStore { public static Invoker getInvoker(Method method) throws NoDataException { Invoker invoker = get().invokers.get(method.getLookupKey()); if (invoker == null) { - throw new NoDataException("There is no invoker for " - + method.getSignature()); + throw new NoDataException( + "There is no invoker for " + method.getSignature()); } return invoker; } public static Invoker getConstructor(Type type) throws NoDataException { - Invoker invoker = get().invokers.get(new Method(type, CONSTRUCTOR_NAME) - .getLookupKey()); + Invoker invoker = get().invokers + .get(new Method(type, CONSTRUCTOR_NAME).getLookupKey()); if (invoker == null) { - throw new NoDataException("There is no constructor for " - + type.getSignature()); + throw new NoDataException( + "There is no constructor for " + type.getSignature()); } return invoker; } public static Object getValue(Property property, Object target) throws NoDataException { - return getJsPropertyValue(get().jsTypeData, property.getBeanType() - .getBaseTypeName(), property.getName(), target); + return getJsPropertyValue(get().jsTypeData, + property.getBeanType().getBaseTypeName(), property.getName(), + target); } public static String getDelegateToWidget(Property property) { @@ -151,8 +152,8 @@ public class TypeDataStore { Type type = getType(clazz); delegateToWidget.put(new Property(type, propertyName).getLookupKey(), delegateValue); - JsArrayString typeProperties = delegateToWidgetProperties.get(type - .getBaseTypeName()); + JsArrayString typeProperties = delegateToWidgetProperties + .get(type.getBaseTypeName()); if (typeProperties == null) { typeProperties = JavaScriptObject.createArray().cast(); delegateToWidgetProperties.put(type.getBaseTypeName(), @@ -166,7 +167,8 @@ public class TypeDataStore { getType(presentationType)); } - public void setReturnType(Class<?> type, String methodName, Type returnType) { + public void setReturnType(Class<?> type, String methodName, + Type returnType) { returnTypes.put(new Method(getType(type), methodName).getLookupKey(), returnType); } @@ -202,11 +204,11 @@ public class TypeDataStore { public static ProxyHandler getProxyHandler(Type type) throws NoDataException { - ProxyHandler proxyHandler = get().proxyHandlers.get(type - .getBaseTypeName()); + ProxyHandler proxyHandler = get().proxyHandlers + .get(type.getBaseTypeName()); if (proxyHandler == null) { - throw new NoDataException("No proxy handler for " - + type.getSignature()); + throw new NoDataException( + "No proxy handler for " + type.getSignature()); } return proxyHandler; } @@ -225,8 +227,8 @@ public class TypeDataStore { private static boolean hasMethodAttribute(Method method, MethodAttribute attribute) { - FastStringSet attributes = get().methodAttributes.get(method - .getLookupKey()); + FastStringSet attributes = get().methodAttributes + .get(method.getLookupKey()); return attributes != null && attributes.contains(attribute.name()); } @@ -282,17 +284,20 @@ public class TypeDataStore { } public static Type getType(Property property) throws NoDataException { - return getJsPropertyType(get().jsTypeData, property.getBeanType() - .getBaseTypeName(), property.getName()); + return getJsPropertyType(get().jsTypeData, + property.getBeanType().getBaseTypeName(), property.getName()); } - public void setPropertyType(Class<?> clazz, String propertyName, Type type) { + public void setPropertyType(Class<?> clazz, String propertyName, + Type type) { setJsPropertyType(jsTypeData, clazz.getName(), propertyName, type); } - public static void setValue(Property property, Object target, Object value) { - setJsPropertyValue(get().jsTypeData, property.getBeanType() - .getBaseTypeName(), property.getName(), target, value); + public static void setValue(Property property, Object target, + Object value) { + setJsPropertyValue(get().jsTypeData, + property.getBeanType().getBaseTypeName(), property.getName(), + target, value); } public void setSerializerFactory(Class<?> clazz, Invoker factory) { @@ -300,8 +305,8 @@ public class TypeDataStore { } public static JSONSerializer<?> findSerializer(Type type) { - Invoker factoryCreator = get().serializerFactories.get(type - .getBaseTypeName()); + Invoker factoryCreator = get().serializerFactories + .get(type.getBaseTypeName()); if (factoryCreator == null) { return null; } @@ -313,8 +318,8 @@ public class TypeDataStore { } public void setSuperClass(Class<?> baseClass, Class<?> superClass) { - String superClassName = superClass == null ? null : superClass - .getName(); + String superClassName = superClass == null ? null + : superClass.getName(); setSuperClass(jsTypeData, baseClass.getName(), superClassName); } @@ -324,7 +329,8 @@ public class TypeDataStore { } private static native void setPropertyData(JavaScriptObject typeData, - String className, String propertyName, JavaScriptObject propertyData) + String className, String propertyName, + JavaScriptObject propertyData) /*-{ typeData[className][propertyName] = propertyData; }-*/; @@ -437,7 +443,8 @@ public class TypeDataStore { */ public void addOnStateChangeMethod(Class<?> clazz, OnStateChangeMethod method) { - FastStringMap<JsArrayObject<OnStateChangeMethod>> handlers = getOnStateChangeMethods(clazz); + FastStringMap<JsArrayObject<OnStateChangeMethod>> handlers = getOnStateChangeMethods( + clazz); if (handlers == null) { handlers = FastStringMap.create(); onStateChangeMethods.put(getType(clazz).getSignature(), handlers); @@ -482,7 +489,7 @@ public class TypeDataStore { * otherwise <code>false</code> */ public static boolean isNoLayoutProperty(Property property) { - return hasNoLayout(get().jsTypeData, property.getBeanType() - .getSignature(), property.getName()); + return hasNoLayout(get().jsTypeData, + property.getBeanType().getSignature(), property.getName()); } } diff --git a/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java b/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java index caffc521d1..91f02a019d 100644 --- a/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/ClickableRenderer.java @@ -49,8 +49,8 @@ import com.vaadin.shared.ui.grid.GridConstants.Section; * @since 7.4 * @author Vaadin Ltd */ -public abstract class ClickableRenderer<T, W extends Widget> extends - WidgetRenderer<T, W> implements ClickHandler { +public abstract class ClickableRenderer<T, W extends Widget> + extends WidgetRenderer<T, W> implements ClickHandler { /** * A handler for {@link RendererClickEvent renderer click events}. @@ -79,8 +79,8 @@ public abstract class ClickableRenderer<T, W extends Widget> extends * the row type of the containing Grid */ @SuppressWarnings("rawtypes") - public static class RendererClickEvent<R> extends - MouseEvent<RendererClickHandler> { + public static class RendererClickEvent<R> + extends MouseEvent<RendererClickHandler> { @SuppressWarnings("unchecked") static final Type<RendererClickHandler> TYPE = new Type<RendererClickHandler>( @@ -213,7 +213,8 @@ public abstract class ClickableRenderer<T, W extends Widget> extends * @param handler * the click handler to be added */ - public HandlerRegistration addClickHandler(RendererClickHandler<?> handler) { + public HandlerRegistration addClickHandler( + RendererClickHandler<?> handler) { if (handlerManager == null) { handlerManager = new HandlerManager(this); } diff --git a/client/src/main/java/com/vaadin/client/renderers/DateRenderer.java b/client/src/main/java/com/vaadin/client/renderers/DateRenderer.java index 4d15fac724..c0a0d2a322 100644 --- a/client/src/main/java/com/vaadin/client/renderers/DateRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/DateRenderer.java @@ -34,8 +34,8 @@ public class DateRenderer implements Renderer<Date> { // Calendar is unavailable for GWT @SuppressWarnings("deprecation") - private TimeZone timeZone = TimeZone.createTimeZone(new Date() - .getTimezoneOffset()); + private TimeZone timeZone = TimeZone + .createTimeZone(new Date().getTimezoneOffset()); public DateRenderer() { this(PredefinedFormat.DATE_TIME_SHORT); @@ -59,8 +59,8 @@ public class DateRenderer implements Renderer<Date> { * Gets the format of how the date is formatted. * * @return the format - * @see <a - * href="http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/shared/DateTimeFormat.html">GWT + * @see <a href= + * "http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/shared/DateTimeFormat.html">GWT * documentation on DateTimeFormat</a> */ public DateTimeFormat getFormat() { @@ -72,8 +72,8 @@ public class DateRenderer implements Renderer<Date> { * * @param format * the format to set - * @see <a - * href="http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/shared/DateTimeFormat.html">GWT + * @see <a href= + * "http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/shared/DateTimeFormat.html">GWT * documentation on DateTimeFormat</a> */ public void setFormat(DateTimeFormat format) { diff --git a/client/src/main/java/com/vaadin/client/renderers/HtmlRenderer.java b/client/src/main/java/com/vaadin/client/renderers/HtmlRenderer.java index ec6dc761f6..13366f784f 100644 --- a/client/src/main/java/com/vaadin/client/renderers/HtmlRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/HtmlRenderer.java @@ -35,7 +35,7 @@ public class HtmlRenderer implements Renderer<String> { @Override public void render(RendererCellReference cell, String htmlString) { - cell.getElement().setInnerSafeHtml( - SafeHtmlUtils.fromSafeConstant(htmlString)); + cell.getElement() + .setInnerSafeHtml(SafeHtmlUtils.fromSafeConstant(htmlString)); } } diff --git a/client/src/main/java/com/vaadin/client/renderers/WidgetRenderer.java b/client/src/main/java/com/vaadin/client/renderers/WidgetRenderer.java index d7219e7241..953662aa7f 100644 --- a/client/src/main/java/com/vaadin/client/renderers/WidgetRenderer.java +++ b/client/src/main/java/com/vaadin/client/renderers/WidgetRenderer.java @@ -30,8 +30,8 @@ import com.vaadin.client.widget.grid.RendererCellReference; * @param <W> * the Widget type */ -public abstract class WidgetRenderer<T, W extends Widget> extends - ComplexRenderer<T> { +public abstract class WidgetRenderer<T, W extends Widget> + extends ComplexRenderer<T> { @Override public void init(RendererCellReference cell) { @@ -50,8 +50,8 @@ public abstract class WidgetRenderer<T, W extends Widget> extends @Override public void render(RendererCellReference cell, T data) { W w = getWidget(cell.getElement()); - assert w != null : "Widget not found in cell (" + cell.getColumn() - + "," + cell.getRow() + ")"; + assert w != null : "Widget not found in cell (" + cell.getColumn() + "," + + cell.getRow() + ")"; render(cell, data, w); } @@ -105,7 +105,8 @@ public abstract class WidgetRenderer<T, W extends Widget> extends protected static <W extends Widget> W getWidget(TableCellElement e, Class<W> klass) { W w = WidgetUtil.findWidget(e.getFirstChildElement(), klass); - assert w == null || w.getElement() == e.getFirstChildElement() : "Widget not found inside cell"; + assert w == null || w.getElement() == e + .getFirstChildElement() : "Widget not found inside cell"; return w; } } diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java b/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java index a2c54ec7ca..e7409e0ba3 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractClickEventHandler.java @@ -171,8 +171,8 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, * When getting a mousedown event, we must detect where the * corresponding mouseup event if it's on a different part of the page. */ - lastMouseDownTarget = WidgetUtil.getElementUnderMouse(event - .getNativeEvent()); + lastMouseDownTarget = WidgetUtil + .getElementUnderMouse(event.getNativeEvent()); mouseUpPreviewMatched = false; mouseUpEventPreviewRegistration = Event .addNativePreviewHandler(mouseUpPreviewHandler); @@ -186,10 +186,10 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler, * but we can't fire the even there as the event might get canceled * before it gets here. */ - if (hasEventListener() - && mouseUpPreviewMatched + if (hasEventListener() && mouseUpPreviewMatched && lastMouseDownTarget != null - && WidgetUtil.getElementUnderMouse(event.getNativeEvent()) == lastMouseDownTarget + && WidgetUtil.getElementUnderMouse( + event.getNativeEvent()) == lastMouseDownTarget && shouldFireEvent(event)) { // "Click" with left, right or middle button fireClick(event.getNativeEvent()); diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java index e040386e63..5879ac8208 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentConnector.java @@ -104,18 +104,19 @@ public abstract class AbstractComponentConnector extends AbstractConnector @OnStateChange("registeredEventListeners") void handleContextClickListenerChange() { if (contextHandler == null && hasEventListener(EventId.CONTEXT_CLICK)) { - contextHandler = getWidget().addDomHandler( - new ContextMenuHandler() { + contextHandler = getWidget() + .addDomHandler(new ContextMenuHandler() { @Override public void onContextMenu(ContextMenuEvent event) { - final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder.buildMouseEventDetails( - event.getNativeEvent(), getWidget() - .getElement()); + final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder + .buildMouseEventDetails( + event.getNativeEvent(), + getWidget().getElement()); event.preventDefault(); event.stopPropagation(); - sendContextClickEvent(mouseEventDetails, event - .getNativeEvent().getEventTarget()); + sendContextClickEvent(mouseEventDetails, + event.getNativeEvent().getEventTarget()); } }, ContextMenuEvent.getType()); @@ -196,8 +197,9 @@ public abstract class AbstractComponentConnector extends AbstractConnector * this was the case with iOS devices. */ - final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder.buildMouseEventDetails( - event.getNativeEvent(), getWidget().getElement()); + final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder + .buildMouseEventDetails(event.getNativeEvent(), + getWidget().getElement()); final EventTarget eventTarget = event.getNativeEvent() .getEventTarget(); @@ -364,7 +366,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector + getClass().getSimpleName() + ". This might be caused by explicitely using " + "super.createWidget() or some unspecified " - + "problem with the widgetset compilation.", e); + + "problem with the widgetset compilation.", + e); } } @@ -419,7 +422,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector * first setting tabindex, then enabled state (through super * implementation). */ - Profiler.enter("AbstractComponentConnector.onStateChanged update tab index"); + Profiler.enter( + "AbstractComponentConnector.onStateChanged update tab index"); if (getState() instanceof TabIndexState) { if (getWidget() instanceof Focusable) { ((Focusable) getWidget()) @@ -434,27 +438,35 @@ public abstract class AbstractComponentConnector extends AbstractConnector // + " which does not implement Focusable"); } } - Profiler.leave("AbstractComponentConnector.onStateChanged update tab index"); + Profiler.leave( + "AbstractComponentConnector.onStateChanged update tab index"); - Profiler.enter("AbstractComponentConnector.onStateChanged AbstractConnector.onStateChanged()"); + Profiler.enter( + "AbstractComponentConnector.onStateChanged AbstractConnector.onStateChanged()"); super.onStateChanged(stateChangeEvent); - Profiler.leave("AbstractComponentConnector.onStateChanged AbstractConnector.onStateChanged()"); + Profiler.leave( + "AbstractComponentConnector.onStateChanged AbstractConnector.onStateChanged()"); // Style names - Profiler.enter("AbstractComponentConnector.onStateChanged updateWidgetStyleNames"); + Profiler.enter( + "AbstractComponentConnector.onStateChanged updateWidgetStyleNames"); updateWidgetStyleNames(); - Profiler.leave("AbstractComponentConnector.onStateChanged updateWidgetStyleNames"); + Profiler.leave( + "AbstractComponentConnector.onStateChanged updateWidgetStyleNames"); /* * updateComponentSize need to be after caption update so caption can be * taken into account */ - Profiler.enter("AbstractComponentConnector.onStateChanged updateComponentSize"); + Profiler.enter( + "AbstractComponentConnector.onStateChanged updateComponentSize"); updateComponentSize(); - Profiler.leave("AbstractComponentConnector.onStateChanged updateComponentSize"); + Profiler.leave( + "AbstractComponentConnector.onStateChanged updateComponentSize"); - Profiler.enter("AbstractComponentContainer.onStateChanged check tooltip"); + Profiler.enter( + "AbstractComponentContainer.onStateChanged check tooltip"); if (!tooltipListenersAttached && hasTooltip()) { /* * Add event handlers for tooltips if they are needed but have not @@ -463,7 +475,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector tooltipListenersAttached = true; getConnection().getVTooltip().connectHandlersToWidget(getWidget()); } - Profiler.leave("AbstractComponentContainer.onStateChanged check tooltip"); + Profiler.leave( + "AbstractComponentContainer.onStateChanged check tooltip"); Profiler.leave("AbstractComponentConnector.onStateChanged"); } @@ -518,16 +531,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector if (newWidth.endsWith("%") != lastKnownWidth.endsWith("%")) { Connector parent = getParent(); if (parent instanceof ManagedLayout) { - getLayoutManager().setNeedsHorizontalLayout( - (ManagedLayout) parent); + getLayoutManager() + .setNeedsHorizontalLayout((ManagedLayout) parent); } } if (newHeight.endsWith("%") != lastKnownHeight.endsWith("%")) { Connector parent = getParent(); if (parent instanceof ManagedLayout) { - getLayoutManager().setNeedsVerticalLayout( - (ManagedLayout) parent); + getLayoutManager() + .setNeedsVerticalLayout((ManagedLayout) parent); } } @@ -537,14 +550,18 @@ public abstract class AbstractComponentConnector extends AbstractConnector // Set defined sizes Widget widget = getWidget(); - Profiler.enter("AbstractComponentConnector.updateComponentSize update styleNames"); + Profiler.enter( + "AbstractComponentConnector.updateComponentSize update styleNames"); widget.setStyleName("v-has-width", !isUndefinedWidth()); widget.setStyleName("v-has-height", !isUndefinedHeight()); - Profiler.leave("AbstractComponentConnector.updateComponentSize update styleNames"); + Profiler.leave( + "AbstractComponentConnector.updateComponentSize update styleNames"); - Profiler.enter("AbstractComponentConnector.updateComponentSize update DOM"); + Profiler.enter( + "AbstractComponentConnector.updateComponentSize update DOM"); updateWidgetSize(newWidth, newHeight); - Profiler.leave("AbstractComponentConnector.updateComponentSize update DOM"); + Profiler.leave( + "AbstractComponentConnector.updateComponentSize update DOM"); Profiler.leave("AbstractComponentConnector.updateComponentSize"); } @@ -617,8 +634,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector setWidgetStyleName("v-readonly", isReadOnly()); // add / remove error style name - setWidgetStyleNameWithPrefix(primaryStyleName, - StyleConstants.ERROR_EXT, null != state.errorMessage); + setWidgetStyleNameWithPrefix(primaryStyleName, StyleConstants.ERROR_EXT, + null != state.errorMessage); // add additional user defined style names as class names, prefixed with // component default class name. remove nonexistent style names. @@ -693,8 +710,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector * prefixes. */ @Deprecated - protected void setWidgetStyleNameWithPrefix(String prefix, - String styleName, boolean add) { + protected void setWidgetStyleNameWithPrefix(String prefix, String styleName, + boolean add) { if (!styleName.startsWith("-")) { if (!prefix.endsWith("-")) { prefix += "-"; @@ -738,9 +755,10 @@ public abstract class AbstractComponentConnector extends AbstractConnector // at this point. if (getWidget() != null && getWidget().isAttached()) { getWidget().removeFromParent(); - VConsole.error("Widget is still attached to the DOM after the connector (" - + Util.getConnectorString(this) - + ") has been unregistered. Widget was removed."); + VConsole.error( + "Widget is still attached to the DOM after the connector (" + + Util.getConnectorString(this) + + ") has been unregistered. Widget was removed."); } } @@ -755,7 +773,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector AbstractComponentState state = getState(); if (state.description != null && !state.description.equals("")) { return true; - } else if (state.errorMessage != null && !state.errorMessage.equals("")) { + } else if (state.errorMessage != null + && !state.errorMessage.equals("")) { return true; } else { return false; diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractComponentContainerConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractComponentContainerConnector.java index f808fb194c..a7867effbd 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractComponentContainerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractComponentContainerConnector.java @@ -20,7 +20,7 @@ package com.vaadin.client.ui; * * @since 7.0 */ -public abstract class AbstractComponentContainerConnector extends - AbstractHasComponentsConnector { +public abstract class AbstractComponentContainerConnector + extends AbstractHasComponentsConnector { } diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java index 7f8d6c2b14..c6348e9de1 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractConnector.java @@ -54,8 +54,8 @@ import com.vaadin.shared.communication.URLReference; * @since 7.0.0 * */ -public abstract class AbstractConnector implements ServerConnector, - StateChangeHandler { +public abstract class AbstractConnector + implements ServerConnector, StateChangeHandler { private ApplicationConnection connection; private String id; @@ -120,13 +120,13 @@ public abstract class AbstractConnector implements ServerConnector, addStateChangeHandler(this); if (Profiler.isEnabled()) { - Profiler.enter("AbstractConnector.init " - + getClass().getSimpleName()); + Profiler.enter( + "AbstractConnector.init " + getClass().getSimpleName()); } init(); if (Profiler.isEnabled()) { - Profiler.leave("AbstractConnector.init " - + getClass().getSimpleName()); + Profiler.leave( + "AbstractConnector.init " + getClass().getSimpleName()); } Profiler.leave("AbstractConnector.doInit"); } @@ -225,7 +225,8 @@ public abstract class AbstractConnector implements ServerConnector, } if (statePropertyHandlerManagers != null && event instanceof StateChangeEvent) { - Profiler.enter("AbstractConnector.fireEvent statePropertyHandlerManagers"); + Profiler.enter( + "AbstractConnector.fireEvent statePropertyHandlerManagers"); StateChangeEvent stateChangeEvent = (StateChangeEvent) event; JsArrayString keys = statePropertyHandlerManagers.getKeys(); for (int i = 0; i < keys.length(); i++) { @@ -234,7 +235,8 @@ public abstract class AbstractConnector implements ServerConnector, statePropertyHandlerManagers.get(property).fireEvent(event); } } - Profiler.leave("AbstractConnector.fireEvent statePropertyHandlerManagers"); + Profiler.leave( + "AbstractConnector.fireEvent statePropertyHandlerManagers"); } if (Profiler.isEnabled()) { Profiler.leave(profilerKey); @@ -251,9 +253,10 @@ public abstract class AbstractConnector implements ServerConnector, } @Override - public HandlerRegistration addStateChangeHandler(StateChangeHandler handler) { - return ensureHandlerManager() - .addHandler(StateChangeEvent.TYPE, handler); + public HandlerRegistration addStateChangeHandler( + StateChangeHandler handler) { + return ensureHandlerManager().addHandler(StateChangeEvent.TYPE, + handler); } @Override @@ -264,8 +267,8 @@ public abstract class AbstractConnector implements ServerConnector, @Override public HandlerRegistration addStateChangeHandler(String propertyName, StateChangeHandler handler) { - return ensureHandlerManager(propertyName).addHandler( - StateChangeEvent.TYPE, handler); + return ensureHandlerManager(propertyName) + .addHandler(StateChangeEvent.TYPE, handler); } @Override @@ -339,8 +342,8 @@ public abstract class AbstractConnector implements ServerConnector, @Override public void onUnregister() { if (debugLogging) { - VConsole.log("Unregistered connector " - + Util.getConnectorString(this)); + VConsole.log( + "Unregistered connector " + Util.getConnectorString(this)); } } diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java index 8d8df81bd8..f54ff85a13 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractFieldConnector.java @@ -18,7 +18,8 @@ package com.vaadin.client.ui; import com.vaadin.client.StyleConstants; import com.vaadin.shared.AbstractFieldState; -public abstract class AbstractFieldConnector extends AbstractComponentConnector { +public abstract class AbstractFieldConnector + extends AbstractComponentConnector { @Override public AbstractFieldState getState() { diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java index 27210de10d..c340c8ae31 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractHasComponentsConnector.java @@ -24,9 +24,9 @@ import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; import com.vaadin.client.HasComponentsConnector; -public abstract class AbstractHasComponentsConnector extends - AbstractComponentConnector implements HasComponentsConnector, - ConnectorHierarchyChangeHandler { +public abstract class AbstractHasComponentsConnector + extends AbstractComponentConnector + implements HasComponentsConnector, ConnectorHierarchyChangeHandler { List<ComponentConnector> childComponents; @@ -65,7 +65,7 @@ public abstract class AbstractHasComponentsConnector extends @Override public HandlerRegistration addConnectorHierarchyChangeHandler( ConnectorHierarchyChangeHandler handler) { - return ensureHandlerManager().addHandler( - ConnectorHierarchyChangeEvent.TYPE, handler); + return ensureHandlerManager() + .addHandler(ConnectorHierarchyChangeEvent.TYPE, handler); } } diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java index 6e1dde3863..32157dce9e 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractLayoutConnector.java @@ -17,8 +17,8 @@ package com.vaadin.client.ui; import com.vaadin.shared.ui.AbstractLayoutState; -public abstract class AbstractLayoutConnector extends - AbstractComponentContainerConnector { +public abstract class AbstractLayoutConnector + extends AbstractComponentContainerConnector { @Override public AbstractLayoutState getState() { diff --git a/client/src/main/java/com/vaadin/client/ui/AbstractSingleComponentContainerConnector.java b/client/src/main/java/com/vaadin/client/ui/AbstractSingleComponentContainerConnector.java index 954803b64c..ff633b0728 100644 --- a/client/src/main/java/com/vaadin/client/ui/AbstractSingleComponentContainerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/AbstractSingleComponentContainerConnector.java @@ -25,8 +25,8 @@ import com.vaadin.client.ComponentConnector; * * @since 7.0 */ -public abstract class AbstractSingleComponentContainerConnector extends - AbstractHasComponentsConnector { +public abstract class AbstractSingleComponentContainerConnector + extends AbstractHasComponentsConnector { /** * Returns the content (only/first child) of the container. diff --git a/client/src/main/java/com/vaadin/client/ui/ConnectorFocusAndBlurHandler.java b/client/src/main/java/com/vaadin/client/ui/ConnectorFocusAndBlurHandler.java index 8272f99d25..ede1cfa3ae 100644 --- a/client/src/main/java/com/vaadin/client/ui/ConnectorFocusAndBlurHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/ConnectorFocusAndBlurHandler.java @@ -35,8 +35,8 @@ import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc; * @since 7.6 * @author Vaadin Ltd */ -public class ConnectorFocusAndBlurHandler implements StateChangeHandler, - FocusHandler, BlurHandler { +public class ConnectorFocusAndBlurHandler + implements StateChangeHandler, FocusHandler, BlurHandler { private final AbstractComponentConnector connector; private final Widget widget; diff --git a/client/src/main/java/com/vaadin/client/ui/FocusUtil.java b/client/src/main/java/com/vaadin/client/ui/FocusUtil.java index 4750b89173..98520f249a 100644 --- a/client/src/main/java/com/vaadin/client/ui/FocusUtil.java +++ b/client/src/main/java/com/vaadin/client/ui/FocusUtil.java @@ -38,7 +38,8 @@ public class FocusUtil { * The access key to set */ public static void setAccessKey(Widget focusable, char key) { - assert (focusable != null && focusable.getElement() != null) : "Can't setAccessKey for a widget without an element"; + assert (focusable != null && focusable + .getElement() != null) : "Can't setAccessKey for a widget without an element"; focusable.getElement().setPropertyString("accessKey", "" + key); } @@ -52,7 +53,8 @@ public class FocusUtil { * whether this widget should take focus or release it */ public static void setFocus(Widget focusable, boolean focus) { - assert (focusable != null && focusable.getElement() != null) : "Can't setFocus for a widget without an element"; + assert (focusable != null && focusable + .getElement() != null) : "Can't setFocus for a widget without an element"; if (focus) { focusable.getElement().focus(); @@ -73,7 +75,8 @@ public class FocusUtil { * the widget's tab index */ public static void setTabIndex(Widget focusable, int tabIndex) { - assert (focusable != null && focusable.getElement() != null) : "Can't setTabIndex for a widget without an element"; + assert (focusable != null && focusable + .getElement() != null) : "Can't setTabIndex for a widget without an element"; focusable.getElement().setTabIndex(tabIndex); } @@ -87,7 +90,8 @@ public class FocusUtil { * @return the widget's tab index */ public static int getTabIndex(Widget focusable) { - assert (focusable != null && focusable.getElement() != null) : "Can't getTabIndex for a widget without an element"; + assert (focusable != null && focusable + .getElement() != null) : "Can't getTabIndex for a widget without an element"; return focusable.getElement().getTabIndex(); } diff --git a/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java b/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java index 1ac5a08ccd..3815372923 100644 --- a/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java @@ -39,8 +39,8 @@ import com.vaadin.client.BrowserInfo; * A scrollhandlers similar to {@link ScrollPanel}. * */ -public class FocusableScrollPanel extends SimpleFocusablePanel implements - HasScrollHandlers, ScrollHandler { +public class FocusableScrollPanel extends SimpleFocusablePanel + implements HasScrollHandlers, ScrollHandler { public FocusableScrollPanel() { // Prevent IE standard mode bug when a AbsolutePanel is contained. @@ -174,8 +174,8 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements .getElements(getElement()); for (com.google.gwt.dom.client.Element el : elements) { final Style style = el.getStyle(); - style.setProperty("webkitTransform", "translate3d(0px," - + -position + "px,0px)"); + style.setProperty("webkitTransform", + "translate3d(0px," + -position + "px,0px)"); } getElement().setPropertyInt("_vScrollTop", position); } else { diff --git a/client/src/main/java/com/vaadin/client/ui/FontIcon.java b/client/src/main/java/com/vaadin/client/ui/FontIcon.java index 74d094a0f2..aa7a0d3b2b 100644 --- a/client/src/main/java/com/vaadin/client/ui/FontIcon.java +++ b/client/src/main/java/com/vaadin/client/ui/FontIcon.java @@ -43,9 +43,10 @@ public class FontIcon extends Icon { @Override public void setUri(String uri) { - String[] parts = uri.substring( - ApplicationConstants.FONTICON_PROTOCOL_PREFIX.length()).split( - "/"); + String[] parts = uri + .substring( + ApplicationConstants.FONTICON_PROTOCOL_PREFIX.length()) + .split("/"); setFontFamily(URL.decode(parts[0])); setCodepoint(Integer.parseInt(parts[1], 16)); } @@ -134,8 +135,8 @@ public class FontIcon extends Icon { * @return true if it's a fonticon uri */ public static boolean isFontIconUri(String uri) { - return uri != null - && uri.startsWith(ApplicationConstants.FONTICON_PROTOCOL_PREFIX); + return uri != null && uri + .startsWith(ApplicationConstants.FONTICON_PROTOCOL_PREFIX); } @Override diff --git a/client/src/main/java/com/vaadin/client/ui/LayoutClickEventHandler.java b/client/src/main/java/com/vaadin/client/ui/LayoutClickEventHandler.java index 6eccb9cb3b..ca23890310 100644 --- a/client/src/main/java/com/vaadin/client/ui/LayoutClickEventHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/LayoutClickEventHandler.java @@ -22,7 +22,8 @@ import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.LayoutClickRpc; -public abstract class LayoutClickEventHandler extends AbstractClickEventHandler { +public abstract class LayoutClickEventHandler + extends AbstractClickEventHandler { public LayoutClickEventHandler(ComponentConnector connector) { this(connector, EventId.LAYOUT_CLICK_EVENT_IDENTIFIER); diff --git a/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java b/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java index f938b2e74f..0cc5ff6ef5 100644 --- a/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java +++ b/client/src/main/java/com/vaadin/client/ui/SimpleFocusablePanel.java @@ -38,8 +38,8 @@ import com.vaadin.client.Focusable; * Compared to FocusPanel in GWT this panel does not support eg. accesskeys, but * is simpler by its dom hierarchy nor supports focusing via java api. */ -public class SimpleFocusablePanel extends SimplePanel implements - HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers, +public class SimpleFocusablePanel extends SimplePanel + implements HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers, HasKeyPressHandlers, Focusable { public SimpleFocusablePanel() { diff --git a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java index f53b32b4e1..c6a63cbd6b 100644 --- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java +++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java @@ -602,8 +602,8 @@ public class TouchScrollDelegate implements NativePreviewHandler { private void translateTo(double translateY) { for (Element el : layers) { Style style = el.getStyle(); - style.setProperty("webkitTransform", "translate3d(0px," - + translateY + "px,0px)"); + style.setProperty("webkitTransform", + "translate3d(0px," + translateY + "px,0px)"); } } @@ -621,8 +621,8 @@ public class TouchScrollDelegate implements NativePreviewHandler { @Override protected void onUpdate(double progress) { - lastAnimatedTranslateY = (fromY + (finalY - fromY) - * progress); + lastAnimatedTranslateY = (fromY + + (finalY - fromY) * progress); translateTo(lastAnimatedTranslateY); } @@ -651,8 +651,8 @@ public class TouchScrollDelegate implements NativePreviewHandler { } private int getMaxOverScroll() { - return androidWithBrokenScrollTop ? 0 : scrolledElement - .getClientHeight() / 3; + return androidWithBrokenScrollTop ? 0 + : scrolledElement.getClientHeight() / 3; } private int getMaxFinalY() { diff --git a/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java index 50ded0aeba..2a631d62e3 100644 --- a/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/UnknownComponentConnector.java @@ -31,17 +31,13 @@ public class UnknownComponentConnector extends AbstractComponentConnector { } public void setServerSideClassName(String serverClassName) { - getWidget() - .setCaption( - "Widgetset '" - + GWT.getModuleName() - + "' does not contain implementation for " - + serverClassName - + ". Check its component connector's @Connect mapping, widgetsets " - + "GWT module description file and re-compile your" - + " widgetset. In case you have downloaded a vaadin" - + " add-on package, you might want to refer to " - + "<a href='http://vaadin.com/using-addons'>add-on " - + "instructions</a>."); + getWidget().setCaption("Widgetset '" + GWT.getModuleName() + + "' does not contain implementation for " + serverClassName + + ". Check its component connector's @Connect mapping, widgetsets " + + "GWT module description file and re-compile your" + + " widgetset. In case you have downloaded a vaadin" + + " add-on package, you might want to refer to " + + "<a href='http://vaadin.com/using-addons'>add-on " + + "instructions</a>."); } } diff --git a/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java b/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java index 44230288a7..e85b6583b2 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbsoluteLayout.java @@ -353,7 +353,8 @@ public class VAbsoluteLayout extends ComplexPanel { * @param stylenames * The style names that should be added to the wrapper */ - public void setWidgetWrapperStyleNames(Widget widget, String... stylenames) { + public void setWidgetWrapperStyleNames(Widget widget, + String... stylenames) { AbsoluteWrapper wrapper = getChildWrapper(widget); if (wrapper == null) { throw new IllegalArgumentException( @@ -474,8 +475,8 @@ public class VAbsoluteLayout extends ComplexPanel { Style style = caption.getElement().getStyle(); style.setProperty("position", "absolute"); style.setPropertyPx("left", getElement().getOffsetLeft()); - style.setPropertyPx("top", getElement().getOffsetTop() - - caption.getHeight()); + style.setPropertyPx("top", + getElement().getOffsetTop() - caption.getHeight()); } } @@ -495,8 +496,8 @@ public class VAbsoluteLayout extends ComplexPanel { * Updates the style names using the primary style name as prefix */ protected void updateStyleNames() { - setStyleName(VAbsoluteLayout.this.getStylePrimaryName() - + "-wrapper"); + setStyleName( + VAbsoluteLayout.this.getStylePrimaryName() + "-wrapper"); if (extraStyleNames != null) { for (String stylename : extraStyleNames) { addStyleDependentName(stylename); diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java index 6c11783d34..81cd4f7b09 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java @@ -259,11 +259,10 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { private float convertToPixels(String pos) { float posAsFloat; if (pos.indexOf("%") > 0) { - posAsFloat = Math.round(Float.parseFloat(pos.substring(0, - pos.length() - 1)) - / 100 - * (orientation == Orientation.HORIZONTAL ? getOffsetWidth() - : getOffsetHeight())); + posAsFloat = Math + .round(Float.parseFloat(pos.substring(0, pos.length() - 1)) + / 100 * (orientation == Orientation.HORIZONTAL + ? getOffsetWidth() : getOffsetHeight())); } else { posAsFloat = Float.parseFloat(pos.substring(0, pos.length() - 2)); } @@ -279,10 +278,10 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { */ private float convertToPercentage(String pos) { if (pos.endsWith("px")) { - float pixelPosition = Float.parseFloat(pos.substring(0, - pos.length() - 2)); - int offsetLength = orientation == Orientation.HORIZONTAL ? getOffsetWidth() - : getOffsetHeight(); + float pixelPosition = Float + .parseFloat(pos.substring(0, pos.length() - 2)); + int offsetLength = orientation == Orientation.HORIZONTAL + ? getOffsetWidth() : getOffsetHeight(); // Take splitter size into account at the edge if (pixelPosition + getSplitterSize() >= offsetLength) { @@ -359,8 +358,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { if (pos.indexOf("%") > 0) { int size = orientation == Orientation.HORIZONTAL ? getOffsetWidth() : getOffsetHeight(); - float percentage = Float.parseFloat(pos.substring(0, - pos.length() - 1)); + float percentage = Float + .parseFloat(pos.substring(0, pos.length() - 1)); pos = percentage / 100 * size + "px"; } @@ -419,7 +418,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { } firstContainer.getStyle().setHeight(pixelPosition, Unit.PX); - int secondContainerHeight = (wholeSize - pixelPosition - getSplitterSize()); + int secondContainerHeight = (wholeSize - pixelPosition + - getSplitterSize()); if (secondContainerHeight < 0) { secondContainerHeight = 0; } @@ -468,7 +468,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { } firstContainer.getStyle().setWidth(pixelPosition, Unit.PX); - int secondContainerWidth = (wholeSize - pixelPosition - getSplitterSize()); + int secondContainerWidth = (wholeSize - pixelPosition + - getSplitterSize()); if (secondContainerWidth < 0) { secondContainerWidth = 0; } @@ -732,8 +733,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { public interface SplitterMoveHandler extends EventHandler { public void splitterMoved(SplitterMoveEvent event); - public static class SplitterMoveEvent extends - GwtEvent<SplitterMoveHandler> { + public static class SplitterMoveEvent + extends GwtEvent<SplitterMoveHandler> { public static final Type<SplitterMoveHandler> TYPE = new Type<SplitterMoveHandler>(); @@ -836,8 +837,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { secondContainer.setClassName(secondContainerClass); for (String styleName : componentStyleNames) { - splitter.addClassName(splitterClass + "-" + styleName - + lockedSuffix); + splitter.addClassName( + splitterClass + "-" + styleName + lockedSuffix); firstContainer.addClassName(firstContainerClass + "-" + styleName); secondContainer .addClassName(secondContainerClass + "-" + styleName); diff --git a/client/src/main/java/com/vaadin/client/ui/VAccordion.java b/client/src/main/java/com/vaadin/client/ui/VAccordion.java index afc66d0f7b..74de41d513 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAccordion.java +++ b/client/src/main/java/com/vaadin/client/ui/VAccordion.java @@ -151,8 +151,8 @@ public class VAccordion extends VTabsheetBase { addStyleDependentName("loading"); - connector.getRpcProxy(TabsheetServerRpc.class).setSelected( - tabKeys.get(index).toString()); + connector.getRpcProxy(TabsheetServerRpc.class) + .setSelected(tabKeys.get(index).toString()); } } @@ -361,13 +361,11 @@ public class VAccordion extends VTabsheetBase { public void updateCaption(TabState tabState) { // TODO need to call this because the caption does not have an owner caption.setCaptionAsHtml(isTabCaptionsAsHtml()); - caption.updateCaptionWithoutOwner( - tabState.caption, - !tabState.enabled, - hasAttribute(tabState.description), + caption.updateCaptionWithoutOwner(tabState.caption, + !tabState.enabled, hasAttribute(tabState.description), hasAttribute(tabState.componentError), - connector.getResourceUrl(ComponentConstants.ICON_RESOURCE - + tabState.key)); + connector.getResourceUrl( + ComponentConstants.ICON_RESOURCE + tabState.key)); } private boolean hasAttribute(String string) { diff --git a/client/src/main/java/com/vaadin/client/ui/VButton.java b/client/src/main/java/com/vaadin/client/ui/VButton.java index 2eb967c4fa..cb6f2aa61b 100644 --- a/client/src/main/java/com/vaadin/client/ui/VButton.java +++ b/client/src/main/java/com/vaadin/client/ui/VButton.java @@ -168,8 +168,8 @@ public class VButton extends FocusWidget implements ClickHandler { boolean isPhantomClickPossible = BrowserInfo.get().isSafari() && BrowserInfo.get().isTouchDevice() && BrowserInfo.get().getBrowserMajorVersion() == 8; - long clickTime = isPhantomClickPossible ? System - .currentTimeMillis() : 0; + long clickTime = isPhantomClickPossible ? System.currentTimeMillis() + : 0; // If clicks are currently disallowed or phantom, keep it from // bubbling or being passed to the superclass. if (disallowNextClick || isPhantomClickPossible @@ -251,8 +251,10 @@ public class VButton extends FocusWidget implements ClickHandler { case Event.ONMOUSEOUT: if (isTargetInsideButton(event)) { if (clickPending - && Math.abs(mousedownX - event.getClientX()) < MOVE_THRESHOLD - && Math.abs(mousedownY - event.getClientY()) < MOVE_THRESHOLD) { + && Math.abs(mousedownX + - event.getClientX()) < MOVE_THRESHOLD + && Math.abs(mousedownY + - event.getClientY()) < MOVE_THRESHOLD) { onClick(); break; } @@ -435,15 +437,15 @@ public class VButton extends FocusWidget implements ClickHandler { var convertToPixel = function(elem, value) { // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - + // Remember the original values var left = elem.style.left, rsLeft = elem.runtimeStyle.left; - + // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; elem.style.left = value || 0; var ret = elem.style.pixelLeft; - + // Revert the changed values elem.style.left = left; elem.runtimeStyle.left = rsLeft; @@ -452,7 +454,7 @@ public class VButton extends FocusWidget implements ClickHandler { } var ret = 0; - + var sides = ["Right","Left"]; for(var i=0; i<2; i++) { var side = sides[i]; @@ -475,7 +477,7 @@ public class VButton extends FocusWidget implements ClickHandler { ret += parseInt(value.substr(0, value.length-2)); } } - + return ret; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ui/VCalendar.java b/client/src/main/java/com/vaadin/client/ui/VCalendar.java index 08d4351931..cc4b7aa520 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VCalendar.java @@ -262,7 +262,7 @@ public class VCalendar extends Composite implements VHasDropHandler { e.onselectstart = function() { return false; } - + e.ondragstart = function() { return false; } @@ -308,7 +308,8 @@ public class VCalendar extends Composite implements VHasDropHandler { } } - private void addEventToMonthGrid(CalendarEvent e, boolean renderImmediately) { + private void addEventToMonthGrid(CalendarEvent e, + boolean renderImmediately) { Date when = e.getStart(); Date to = e.getEnd(); boolean eventAdded = false; @@ -374,7 +375,8 @@ public class VCalendar extends Composite implements VHasDropHandler { && from.getDay() != to.getDay() && isMidnight(endTime))); } - private void updateEventSlotIndex(CalendarEvent e, List<SimpleDayCell> cells) { + private void updateEventSlotIndex(CalendarEvent e, + List<SimpleDayCell> cells) { if (cells.isEmpty()) { return; } @@ -437,8 +439,8 @@ public class VCalendar extends Composite implements VHasDropHandler { // Remove event for (int row = 0; row < monthGrid.getRowCount(); row++) { for (int cell = 0; cell < monthGrid.getCellCount(row); cell++) { - SimpleDayCell sdc = (SimpleDayCell) monthGrid.getWidget( - row, cell); + SimpleDayCell sdc = (SimpleDayCell) monthGrid.getWidget(row, + cell); if (sdc == null) { return; } @@ -467,7 +469,8 @@ public class VCalendar extends Composite implements VHasDropHandler { * The events to sort * @return An array where the events has been sorted */ - public CalendarEvent[] sortEventsByDuration(Collection<CalendarEvent> events) { + public CalendarEvent[] sortEventsByDuration( + Collection<CalendarEvent> events) { CalendarEvent[] sorted = events .toArray(new CalendarEvent[events.size()]); Arrays.sort(sorted, getEventComparator()); @@ -649,13 +652,13 @@ public class VCalendar extends Composite implements VHasDropHandler { monthGrid.updateCellSizes(intWidth - weekToolbar.getOffsetWidth(), intHeight - nameToolbar.getOffsetHeight()); - weekToolbar.setHeightPX((intHeight == -1) ? intHeight : intHeight - - nameToolbar.getOffsetHeight()); + weekToolbar.setHeightPX((intHeight == -1) ? intHeight + : intHeight - nameToolbar.getOffsetHeight()); } else if (weekGrid != null) { - weekGrid.setHeightPX((intHeight == -1) ? intHeight : intHeight - - weeklyLongEvents.getOffsetHeight() - - dayToolbar.getOffsetHeight()); + weekGrid.setHeightPX((intHeight == -1) ? intHeight + : intHeight - weeklyLongEvents.getOffsetHeight() + - dayToolbar.getOffsetHeight()); } } @@ -669,8 +672,8 @@ public class VCalendar extends Composite implements VHasDropHandler { if (monthGrid != null) { monthGrid.updateCellSizes( - intWidth - weekToolbar.getOffsetWidth(), intHeight - - nameToolbar.getOffsetHeight()); + intWidth - weekToolbar.getOffsetWidth(), + intHeight - nameToolbar.getOffsetHeight()); } else if (weekGrid != null) { weekGrid.setWidthPX(intWidth); weeklyLongEvents.setWidthPX(weekGrid.getInternalWidth()); @@ -846,8 +849,9 @@ public class VCalendar extends Composite implements VHasDropHandler { int r = 0; if (!d1.equals(0L) && !d2.equals(0L)) { r = d2.compareTo(d1); - return (r == 0) ? ((Integer) o2.getIndex()).compareTo(o1 - .getIndex()) : r; + return (r == 0) + ? ((Integer) o2.getIndex()).compareTo(o1.getIndex()) + : r; } if (d2.equals(0L) && d1.equals(0L)) { @@ -862,8 +866,9 @@ public class VCalendar extends Composite implements VHasDropHandler { return -1; } r = d2.compareTo(d1); - return (r == 0) ? ((Integer) o2.getIndex()).compareTo(o1 - .getIndex()) : r; + return (r == 0) + ? ((Integer) o2.getIndex()).compareTo(o1.getIndex()) + : r; } }; } @@ -878,8 +883,8 @@ public class VCalendar extends Composite implements VHasDropHandler { */ @SuppressWarnings("deprecation") public static boolean isMidnight(Date date) { - return (date.getHours() == 0 && date.getMinutes() == 0 && date - .getSeconds() == 0); + return (date.getHours() == 0 && date.getMinutes() == 0 + && date.getSeconds() == 0); } /** @@ -1102,9 +1107,8 @@ public class VCalendar extends Composite implements VHasDropHandler { * @param days * The day information */ - public void updateMonthView(int firstDayOfWeek, Date today, - int daysInMonth, Collection<CalendarEvent> events, - List<CalendarDay> days) { + public void updateMonthView(int firstDayOfWeek, Date today, int daysInMonth, + Collection<CalendarEvent> events, List<CalendarDay> days) { // Remove all week numbers from bar while (outer.getWidgetCount() > 0) { diff --git a/client/src/main/java/com/vaadin/client/ui/VCalendarPanel.java b/client/src/main/java/com/vaadin/client/ui/VCalendarPanel.java index e1b906b6e4..bb87492c9d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCalendarPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VCalendarPanel.java @@ -238,7 +238,8 @@ public class VCalendarPanel extends FocusableFlexTable implements */ private void focusDay(Date date) { // Only used when calender body is present - if (resolution.getCalendarField() > Resolution.MONTH.getCalendarField()) { + if (resolution.getCalendarField() > Resolution.MONTH + .getCalendarField()) { if (focusedDay != null) { focusedDay.removeStyleDependentName(CN_FOCUSED); } @@ -275,8 +276,8 @@ public class VCalendarPanel extends FocusableFlexTable implements private void selectDate(Date date) { if (selectedDay != null) { selectedDay.removeStyleDependentName(CN_SELECTED); - Roles.getGridcellRole().removeAriaSelectedState( - selectedDay.getElement()); + Roles.getGridcellRole() + .removeAriaSelectedState(selectedDay.getElement()); } int rowCount = days.getRowCount(); @@ -446,8 +447,8 @@ public class VCalendarPanel extends FocusableFlexTable implements updateControlButtonRangeStyles(needsMonth); - final String monthName = needsMonth ? getDateTimeService().getMonth( - displayedMonth.getMonth()) : ""; + final String monthName = needsMonth + ? getDateTimeService().getMonth(displayedMonth.getMonth()) : ""; final int year = displayedMonth.getYear() + 1900; getFlexCellFormatter().setStyleName(0, 2, @@ -461,9 +462,10 @@ public class VCalendarPanel extends FocusableFlexTable implements getFlexCellFormatter().setStyleName(0, 1, parent.getStylePrimaryName() + "-calendarpanel-prevmonth"); - setHTML(0, 2, "<span class=\"" + parent.getStylePrimaryName() - + "-calendarpanel-month\">" + monthName + " " + year - + "</span>"); + setHTML(0, 2, + "<span class=\"" + parent.getStylePrimaryName() + + "-calendarpanel-month\">" + monthName + " " + year + + "</span>"); } private void updateControlButtonRangeStyles(boolean needsMonth) { @@ -555,7 +557,8 @@ public class VCalendarPanel extends FocusableFlexTable implements * @param minResolution * @return */ - private boolean isAcceptedByRangeStart(Date date, Resolution minResolution) { + private boolean isAcceptedByRangeStart(Date date, + Resolution minResolution) { assert (date != null); // rangeStart == null means that we accept all values below rangeEnd @@ -663,11 +666,9 @@ public class VCalendarPanel extends FocusableFlexTable implements "v-first"); days.getFlexCellFormatter().setStyleName(headerRow, firstWeekdayColumn, ""); - days.getRowFormatter() - .addStyleName( - headerRow, - parent.getStylePrimaryName() - + "-calendarpanel-weeknumbers"); + days.getRowFormatter().addStyleName(headerRow, + parent.getStylePrimaryName() + + "-calendarpanel-weeknumbers"); } else { days.getFlexCellFormatter().setStyleName(headerRow, weekColumn, ""); days.getFlexCellFormatter().setStyleName(headerRow, @@ -692,9 +693,8 @@ public class VCalendarPanel extends FocusableFlexTable implements days.setHTML(headerRow, firstWeekdayColumn + i, ""); } - Roles.getColumnheaderRole().set( - days.getCellFormatter().getElement(headerRow, - firstWeekdayColumn + i)); + Roles.getColumnheaderRole().set(days.getCellFormatter() + .getElement(headerRow, firstWeekdayColumn + i)); } // Zero out hours, minutes, seconds, and milliseconds to compare dates @@ -703,11 +703,11 @@ public class VCalendarPanel extends FocusableFlexTable implements final Date today = new Date(tmp.getYear(), tmp.getMonth(), tmp.getDate()); - final Date selectedDate = value == null ? null : new Date( - value.getYear(), value.getMonth(), value.getDate()); + final Date selectedDate = value == null ? null + : new Date(value.getYear(), value.getMonth(), value.getDate()); - final int startWeekDay = getDateTimeService().getStartWeekDay( - displayedMonth); + final int startWeekDay = getDateTimeService() + .getStartWeekDay(displayedMonth); final Date curr = (Date) displayedMonth.clone(); // Start from the first day of the week that at least partially belongs // to the current month @@ -721,8 +721,8 @@ public class VCalendarPanel extends FocusableFlexTable implements Date dayDate = (Date) curr.clone(); Day day = new Day(dayDate); - day.setStyleName(parent.getStylePrimaryName() - + "-calendarpanel-day"); + day.setStyleName( + parent.getStylePrimaryName() + "-calendarpanel-day"); if (!isDateInsideRange(dayDate, Resolution.DAY)) { day.addStyleDependentName(CN_OUTSIDE_RANGE); @@ -747,10 +747,10 @@ public class VCalendarPanel extends FocusableFlexTable implements day.addStyleDependentName(CN_OFFMONTH); } - days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, day); - Roles.getGridcellRole().set( - days.getCellFormatter().getElement(weekOfMonth, - firstWeekdayColumn + dayOfWeek)); + days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, + day); + Roles.getGridcellRole().set(days.getCellFormatter().getElement( + weekOfMonth, firstWeekdayColumn + dayOfWeek)); // ISO week numbers if requested days.getCellFormatter().setVisible(weekOfMonth, weekColumn, @@ -763,9 +763,8 @@ public class VCalendarPanel extends FocusableFlexTable implements int weekNumber = DateTimeService.getISOWeekNumber(curr); - days.setHTML(weekOfMonth, 0, "<span class=\"" - + weekCssClass + "\"" + ">" + weekNumber - + "</span>"); + days.setHTML(weekOfMonth, 0, "<span class=\"" + weekCssClass + + "\"" + ">" + weekNumber + "</span>"); } curr.setDate(curr.getDate() + 1); } @@ -802,8 +801,8 @@ public class VCalendarPanel extends FocusableFlexTable implements */ public void renderCalendar(boolean updateDate) { - super.setStylePrimaryName(parent.getStylePrimaryName() - + "-calendarpanel"); + super.setStylePrimaryName( + parent.getStylePrimaryName() + "-calendarpanel"); if (focusedDate == null) { Date now = new Date(); @@ -813,14 +812,13 @@ public class VCalendarPanel extends FocusableFlexTable implements displayedMonth = new FocusedDate(now.getYear(), now.getMonth(), 1); } - if (updateDate - && getResolution().getCalendarField() <= Resolution.MONTH - .getCalendarField() && focusChangeListener != null) { + if (updateDate && getResolution().getCalendarField() <= Resolution.MONTH + .getCalendarField() && focusChangeListener != null) { focusChangeListener.focusChanged(new Date(focusedDate.getTime())); } - final boolean needsMonth = getResolution().getCalendarField() > Resolution.YEAR - .getCalendarField(); + final boolean needsMonth = getResolution() + .getCalendarField() > Resolution.YEAR.getCalendarField(); boolean needsBody = getResolution().getCalendarField() >= Resolution.DAY .getCalendarField(); buildCalendarHeader(needsMonth); @@ -901,7 +899,8 @@ public class VCalendarPanel extends FocusableFlexTable implements // inside, // correct it if (!isDateInsideRange(requestedNextMonthDate, Resolution.DAY)) { - requestedNextMonthDate = adjustDateToFitInsideRange(requestedNextMonthDate); + requestedNextMonthDate = adjustDateToFitInsideRange( + requestedNextMonthDate); } focusedDate.setTime(requestedNextMonthDate.getTime()); @@ -957,7 +956,8 @@ public class VCalendarPanel extends FocusableFlexTable implements } if (!isDateInsideRange(requestedPreviousMonthDate, Resolution.DAY)) { - requestedPreviousMonthDate = adjustDateToFitInsideRange(requestedPreviousMonthDate); + requestedPreviousMonthDate = adjustDateToFitInsideRange( + requestedPreviousMonthDate); } focusedDate.setTime(requestedPreviousMonthDate.getTime()); displayedMonth.setMonth(displayedMonth.getMonth() - 1); @@ -1106,9 +1106,8 @@ public class VCalendarPanel extends FocusableFlexTable implements */ private void handleKeyPress(DomEvent<?> event) { // Special handling for events from time ListBoxes. - if (time != null - && time.getElement().isOrHasChild( - (Node) event.getNativeEvent().getEventTarget().cast())) { + if (time != null && time.getElement().isOrHasChild( + (Node) event.getNativeEvent().getEventTarget().cast())) { int nativeKeyCode = event.getNativeEvent().getKeyCode(); if (nativeKeyCode == getSelectKey()) { onSubmit(); // submit if enter key hit down on listboxes @@ -1125,16 +1124,18 @@ public class VCalendarPanel extends FocusableFlexTable implements // Check tabs int keycode = event.getNativeEvent().getKeyCode(); - if (keycode == KeyCodes.KEY_TAB && event.getNativeEvent().getShiftKey()) { + if (keycode == KeyCodes.KEY_TAB + && event.getNativeEvent().getShiftKey()) { if (onTabOut(event)) { return; } } // Handle the navigation - if (handleNavigation(keycode, event.getNativeEvent().getCtrlKey() - || event.getNativeEvent().getMetaKey(), event.getNativeEvent() - .getShiftKey())) { + if (handleNavigation(keycode, + event.getNativeEvent().getCtrlKey() + || event.getNativeEvent().getMetaKey(), + event.getNativeEvent().getShiftKey())) { event.preventDefault(); } @@ -1390,7 +1391,8 @@ public class VCalendarPanel extends FocusableFlexTable implements * @return Return true if key press was handled by the component, else * return false */ - protected boolean handleNavigation(int keycode, boolean ctrl, boolean shift) { + protected boolean handleNavigation(int keycode, boolean ctrl, + boolean shift) { if (!isEnabled() || isReadonly()) { return false; } @@ -1580,7 +1582,8 @@ public class VCalendarPanel extends FocusableFlexTable implements } boolean currentDateWasAdjusted = false; // Check that selected date is inside the allowed range - if (currentDate != null && !isDateInsideRange(currentDate, resolution)) { + if (currentDate != null + && !isDateInsideRange(currentDate, resolution)) { currentDate = adjustDateToFitInsideRange(currentDate); currentDateWasAdjusted = true; } @@ -1595,9 +1598,9 @@ public class VCalendarPanel extends FocusableFlexTable implements // If ranges enabled, we may need to focus on a different view to // potentially not get stuck if (rangeStart != null || rangeEnd != null) { - Date dateThatFitsInsideRange = adjustDateToFitInsideRange(new Date()); - focusedDate = new FocusedDate( - dateThatFitsInsideRange.getYear(), + Date dateThatFitsInsideRange = adjustDateToFitInsideRange( + new Date()); + focusedDate = new FocusedDate(dateThatFitsInsideRange.getYear(), dateThatFitsInsideRange.getMonth(), dateThatFitsInsideRange.getDate()); displayedMonth = new FocusedDate( @@ -2054,7 +2057,8 @@ public class VCalendarPanel extends FocusableFlexTable implements private Date rangeEnd; @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (contains(nextMonth, subElement)) { return SUBPART_NEXT_MONTH; } else if (contains(prevMonth, subElement)) { @@ -2090,7 +2094,8 @@ public class VCalendarPanel extends FocusableFlexTable implements return SUBPART_AMPM_SELECT; } - } else if (getCellFormatter().getElement(0, 2).isOrHasChild(subElement)) { + } else if (getCellFormatter().getElement(0, 2) + .isOrHasChild(subElement)) { return SUBPART_MONTH_YEAR_HEADER; } @@ -2113,7 +2118,8 @@ public class VCalendarPanel extends FocusableFlexTable implements } @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (SUBPART_NEXT_MONTH.equals(subPart)) { return nextMonth.getElement(); } @@ -2141,8 +2147,8 @@ public class VCalendarPanel extends FocusableFlexTable implements if (subPart.startsWith(SUBPART_DAY)) { // Zero or negative ids map to days in the preceding month, // past-the-end-of-month ids to days in the following month - int dayOfMonth = Integer.parseInt(subPart.substring(SUBPART_DAY - .length())); + int dayOfMonth = Integer + .parseInt(subPart.substring(SUBPART_DAY.length())); Date date = new Date(displayedMonth.getYear(), displayedMonth.getMonth(), dayOfMonth); Iterator<Widget> iter = days.iterator(); @@ -2158,8 +2164,8 @@ public class VCalendarPanel extends FocusableFlexTable implements } if (SUBPART_MONTH_YEAR_HEADER.equals(subPart)) { - return DOM.asOld((Element) getCellFormatter().getElement(0, 2) - .getChild(0)); + return DOM.asOld( + (Element) getCellFormatter().getElement(0, 2).getChild(0)); } return null; } diff --git a/client/src/main/java/com/vaadin/client/ui/VCheckBox.java b/client/src/main/java/com/vaadin/client/ui/VCheckBox.java index 887dba262a..55db9ad523 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCheckBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VCheckBox.java @@ -29,8 +29,8 @@ import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.client.ui.aria.HandlesAriaInvalid; import com.vaadin.client.ui.aria.HandlesAriaRequired; -public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements - Field, HandlesAriaInvalid, HandlesAriaRequired { +public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox + implements Field, HandlesAriaInvalid, HandlesAriaRequired { public static final String CLASSNAME = "v-checkbox"; diff --git a/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java b/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java index 23a9379c80..c2940ea4d5 100644 --- a/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java +++ b/client/src/main/java/com/vaadin/client/ui/VColorPickerArea.java @@ -31,8 +31,8 @@ import com.google.gwt.user.client.ui.Widget; * * @since 7.0.0 */ -public class VColorPickerArea extends Widget implements ClickHandler, HasHTML, - HasClickHandlers { +public class VColorPickerArea extends Widget + implements ClickHandler, HasHTML, HasClickHandlers { public static final String CLASSNAME = "v-colorpicker"; private String color = null; @@ -84,7 +84,8 @@ public class VColorPickerArea extends Widget implements ClickHandler, HasHTML, int type = DOM.eventGetType(event); switch (type) { case Event.ONCLICK: - if (DOM.isOrHasChild(area.getElement(), DOM.eventGetTarget(event))) { + if (DOM.isOrHasChild(area.getElement(), + DOM.eventGetTarget(event))) { super.onBrowserEvent(event); } break; diff --git a/client/src/main/java/com/vaadin/client/ui/VContextMenu.java b/client/src/main/java/com/vaadin/client/ui/VContextMenu.java index 6028eea52c..2411eafabb 100644 --- a/client/src/main/java/com/vaadin/client/ui/VContextMenu.java +++ b/client/src/main/java/com/vaadin/client/ui/VContextMenu.java @@ -90,10 +90,9 @@ public class VContextMenu extends VOverlay implements SubPartAware { @Override public void onClose(CloseEvent<PopupPanel> event) { Element currentFocus = WidgetUtil.getFocusedElement(); - if (focusedElement != null - && (currentFocus == null - || menu.getElement().isOrHasChild(currentFocus) || RootPanel - .getBodyElement().equals(currentFocus))) { + if (focusedElement != null && (currentFocus == null + || menu.getElement().isOrHasChild(currentFocus) + || RootPanel.getBodyElement().equals(currentFocus))) { focusedElement.focus(); focusedElement = null; } @@ -197,9 +196,9 @@ public class VContextMenu extends VOverlay implements SubPartAware { * Extend standard Gwt MenuBar to set proper settings and to override * onPopupClosed method so that PopupPanel gets closed. */ - class CMenuBar extends MenuBar implements HasFocusHandlers, - HasBlurHandlers, HasKeyDownHandlers, HasKeyPressHandlers, - Focusable, LoadHandler, KeyUpHandler { + class CMenuBar extends MenuBar + implements HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers, + HasKeyPressHandlers, Focusable, LoadHandler, KeyUpHandler { public CMenuBar() { super(true); addDomHandler(this, LoadEvent.getType()); @@ -282,7 +281,8 @@ public class VContextMenu extends VOverlay implements SubPartAware { } @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { int index = Integer.parseInt(subPart.substring(6)); // ApplicationConnection.getConsole().log( // "Searching element for selection index " + index); @@ -293,11 +293,13 @@ public class VContextMenu extends VOverlay implements SubPartAware { } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (getElement().isOrHasChild(subElement)) { com.google.gwt.dom.client.Element e = subElement; { - while (e != null && !e.getTagName().toLowerCase().equals("tr")) { + while (e != null + && !e.getTagName().toLowerCase().equals("tr")) { e = e.getParentElement(); // ApplicationConnection.getConsole().log("Found row"); } diff --git a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java index 0ee50fe0dd..3a1b56bb2d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -126,8 +126,8 @@ public class VCustomLayout extends ComplexPanel { // If no given location is found in the layout, and exception is throws Element elem = locationToElement.get(location); if (elem == null && hasTemplate()) { - throw new IllegalArgumentException("No location " + location - + " found"); + throw new IllegalArgumentException( + "No location " + location + " found"); } // Get previous widget @@ -168,15 +168,13 @@ public class VCustomLayout extends ComplexPanel { "<((?:img)|(?:IMG))\\s([^>]*)src=\"((?![a-z]+:)[^/][^\"]+)\"", "<$1 $2src=\"" + relImgPrefix + "$3\""); // also support src attributes without quotes - template = template - .replaceAll( - "<((?:img)|(?:IMG))\\s([^>]*)src=[^\"]((?![a-z]+:)[^/][^ />]+)[ />]", - "<$1 $2src=\"" + relImgPrefix + "$3\""); + template = template.replaceAll( + "<((?:img)|(?:IMG))\\s([^>]*)src=[^\"]((?![a-z]+:)[^/][^ />]+)[ />]", + "<$1 $2src=\"" + relImgPrefix + "$3\""); // also prefix relative style="...url(...)..." - template = template - .replaceAll( - "(<[^>]+style=\"[^\"]*url\\()((?![a-z]+:)[^/][^\"]+)(\\)[^>]*>)", - "$1 " + relImgPrefix + "$2 $3"); + template = template.replaceAll( + "(<[^>]+style=\"[^\"]*url\\()((?![a-z]+:)[^/][^\"]+)(\\)[^>]*>)", + "$1 " + relImgPrefix + "$2 $3"); getElement().setInnerHTML(template); diff --git a/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java b/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java index 759ebef102..0947cebccf 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java @@ -87,24 +87,26 @@ public class VDateFieldCalendar extends VDateField { .getCalendarField()) { getClient().updateVariable(getId(), "day", date2.getDate(), false); - if (getCurrentResolution().getCalendarField() > Resolution.DAY - .getCalendarField()) { + if (getCurrentResolution() + .getCalendarField() > Resolution.DAY + .getCalendarField()) { getClient().updateVariable(getId(), "hour", date2.getHours(), false); - if (getCurrentResolution().getCalendarField() > Resolution.HOUR - .getCalendarField()) { + if (getCurrentResolution() + .getCalendarField() > Resolution.HOUR + .getCalendarField()) { getClient().updateVariable(getId(), "min", date2.getMinutes(), false); - if (getCurrentResolution().getCalendarField() > Resolution.MINUTE - .getCalendarField()) { + if (getCurrentResolution() + .getCalendarField() > Resolution.MINUTE + .getCalendarField()) { getClient().updateVariable(getId(), "sec", date2.getSeconds(), false); - if (getCurrentResolution().getCalendarField() > Resolution.SECOND - .getCalendarField()) { - getClient().updateVariable( - getId(), - "msec", - DateTimeService + if (getCurrentResolution() + .getCalendarField() > Resolution.SECOND + .getCalendarField()) { + getClient().updateVariable(getId(), + "msec", DateTimeService .getMilliseconds(date2), false); } diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java index 4ecdec8b6f..779a3fbf0b 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java @@ -66,8 +66,8 @@ import com.vaadin.shared.ui.dd.VerticalDropLocation; * drop details: locations + sizes in document hierarchy up to wrapper * */ -public class VDragAndDropWrapper extends VCustomComponent implements - VHasDropHandler { +public class VDragAndDropWrapper extends VCustomComponent + implements VHasDropHandler { /** * Minimum pixel delta is used to detect click from drag. #12838 @@ -91,7 +91,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements @Override public void onMouseDown(final MouseDownEvent event) { if (getConnector().isEnabled() - && event.getNativeEvent().getButton() == Event.BUTTON_LEFT + && event.getNativeEvent() + .getButton() == Event.BUTTON_LEFT && startDrag(event.getNativeEvent())) { event.preventDefault(); // prevent text selection startX = event.getClientX(); @@ -149,8 +150,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements Element.as(event.getEventTarget())); Widget widget = paintable.getWidget(); transferable.setData("component", paintable); - VDragEvent dragEvent = VDragAndDropManager.get().startDrag( - transferable, event, true); + VDragEvent dragEvent = VDragAndDropManager.get() + .startDrag(transferable, event, true); transferable.setData("mouseDown", MouseEventDetailsBuilder .buildMouseEventDetails(event).serialize()); @@ -253,9 +254,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements uploading = true; final Integer fileId = fileIds.remove(0); VHtml5File file = files.remove(0); - final String receiverUrl = client - .translateVaadinUri(fileIdToReceiver - .remove(fileId.toString())); + final String receiverUrl = client.translateVaadinUri( + fileIdToReceiver.remove(fileId.toString())); ExtendedXHR extendedXHR = (ExtendedXHR) ExtendedXHR .create(); extendedXHR @@ -297,14 +297,15 @@ public class VDragAndDropWrapper extends VCustomComponent implements dragleavetimer.cancel(); dragleavetimer = null; } - if (VDragAndDropManager.get().getCurrentDropHandler() != getDropHandler()) { + if (VDragAndDropManager.get() + .getCurrentDropHandler() != getDropHandler()) { VTransferable transferable = new VTransferable(); transferable.setDragSource(getConnector()); - vaadinDragEvent = VDragAndDropManager.get().startDrag( - transferable, event, false); - VDragAndDropManager.get().setCurrentDropHandler( - getDropHandler()); + vaadinDragEvent = VDragAndDropManager.get() + .startDrag(transferable, event, false); + VDragAndDropManager.get() + .setCurrentDropHandler(getDropHandler()); } try { event.preventDefault(); @@ -334,9 +335,8 @@ public class VDragAndDropWrapper extends VCustomComponent implements // this // is what IE does). // In Vaadin we fire it only if drop did not happen. - if (vaadinDragEvent != null - && VDragAndDropManager.get() - .getCurrentDropHandler() == getDropHandler()) { + if (vaadinDragEvent != null && VDragAndDropManager.get() + .getCurrentDropHandler() == getDropHandler()) { VDragAndDropManager.get().interruptDrag(); } } @@ -466,11 +466,11 @@ public class VDragAndDropWrapper extends VCustomComponent implements public final native void postFile(VHtml5File file) /*-{ - + this.setRequestHeader('Content-Type', 'multipart/form-data'); // Seems like IE10 will loose the file if we don't keep a reference to it... this.fileBeingUploaded = file; - + this.send(file); }-*/; @@ -626,19 +626,19 @@ public class VDragAndDropWrapper extends VCustomComponent implements protected native void hookHtml5Events(com.google.gwt.user.client.Element el) /*-{ var me = this; - + el.addEventListener("dragenter", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); - + el.addEventListener("dragleave", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); - + el.addEventListener("dragover", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); - + el.addEventListener("drop", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); }), false); @@ -676,10 +676,12 @@ public class VDragAndDropWrapper extends VCustomComponent implements protected void deEmphasis(boolean doLayout) { if (emphasizedVDrop != null) { VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE, false); - VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" - + emphasizedVDrop.toString().toLowerCase(), false); - VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" - + emphasizedHDrop.toString().toLowerCase(), false); + VDragAndDropWrapper.setStyleName(getElement(), + OVER_STYLE + "-" + emphasizedVDrop.toString().toLowerCase(), + false); + VDragAndDropWrapper.setStyleName(getElement(), + OVER_STYLE + "-" + emphasizedHDrop.toString().toLowerCase(), + false); } if (doLayout) { notifySizePotentiallyChanged(); @@ -695,8 +697,10 @@ public class VDragAndDropWrapper extends VCustomComponent implements VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE, true); VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" + verticalDropLocation.toString().toLowerCase(), true); - VDragAndDropWrapper.setStyleName(getElement(), OVER_STYLE + "-" - + horizontalDropLocation.toString().toLowerCase(), true); + VDragAndDropWrapper.setStyleName(getElement(), + OVER_STYLE + "-" + + horizontalDropLocation.toString().toLowerCase(), + true); emphasizedVDrop = verticalDropLocation; emphasizedHDrop = horizontalDropLocation; diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java index b32b36d13b..f9085dd7e4 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java +++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapperIE.java @@ -53,7 +53,7 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { com.google.gwt.user.client.Element el) /*-{ var me = this; - + el.attachEvent("ondragstart", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragStart(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); @@ -69,19 +69,19 @@ public class VDragAndDropWrapperIE extends VDragAndDropWrapper { protected native void hookHtml5Events(com.google.gwt.user.client.Element el) /*-{ var me = this; - + el.attachEvent("ondragenter", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragEnter(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); - + el.attachEvent("ondragleave", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragLeave(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); - + el.attachEvent("ondragover", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragOver(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); - + el.attachEvent("ondrop", $entry(function(ev) { return me.@com.vaadin.client.ui.VDragAndDropWrapper::html5DragDrop(Lcom/vaadin/client/ui/dd/VHtml5DragEvent;)(ev); })); diff --git a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java index f3970f9ac7..1ac755d23a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java +++ b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java @@ -83,11 +83,14 @@ public class VEmbedded extends HTML { * this by setting his own classid. */ if (uidl.hasAttribute("classid")) { - html.append("classid=\"" - + WidgetUtil.escapeAttribute(uidl - .getStringAttribute("classid")) + "\" "); + html.append( + "classid=\"" + + WidgetUtil.escapeAttribute( + uidl.getStringAttribute("classid")) + + "\" "); } else { - html.append("classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "); + html.append( + "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "); } /* @@ -99,15 +102,18 @@ public class VEmbedded extends HTML { * codebase */ if (uidl.hasAttribute("codebase")) { - html.append("codebase=\"" - + WidgetUtil.escapeAttribute(uidl - .getStringAttribute("codebase")) + "\" "); + html.append( + "codebase=\"" + + WidgetUtil.escapeAttribute( + uidl.getStringAttribute("codebase")) + + "\" "); } else { - html.append("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" "); + html.append( + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" "); } - ComponentConnector paintable = ConnectorMap.get(client).getConnector( - this); + ComponentConnector paintable = ConnectorMap.get(client) + .getConnector(this); String height = paintable.getState().height; String width = paintable.getState().width; @@ -118,23 +124,29 @@ public class VEmbedded extends HTML { // Codetype if (uidl.hasAttribute("codetype")) { - html.append("codetype=\"" - + WidgetUtil.escapeAttribute(uidl - .getStringAttribute("codetype")) + "\" "); + html.append( + "codetype=\"" + + WidgetUtil.escapeAttribute( + uidl.getStringAttribute("codetype")) + + "\" "); } // Standby if (uidl.hasAttribute("standby")) { - html.append("standby=\"" - + WidgetUtil.escapeAttribute(uidl - .getStringAttribute("standby")) + "\" "); + html.append( + "standby=\"" + + WidgetUtil.escapeAttribute( + uidl.getStringAttribute("standby")) + + "\" "); } // Archive if (uidl.hasAttribute("archive")) { - html.append("archive=\"" - + WidgetUtil.escapeAttribute(uidl - .getStringAttribute("archive")) + "\" "); + html.append( + "archive=\"" + + WidgetUtil.escapeAttribute( + uidl.getStringAttribute("archive")) + + "\" "); } // End object tag @@ -175,8 +187,8 @@ public class VEmbedded extends HTML { html.append("></embed>"); if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) { - html.append(uidl - .getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT)); + html.append( + uidl.getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT)); } // End object tag diff --git a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java index cbaefde22f..4d908ddc17 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java @@ -90,10 +90,10 @@ import com.vaadin.shared.util.SharedUtil; * TODO needs major refactoring (to be extensible etc) */ @SuppressWarnings("deprecation") -public class VFilterSelect extends Composite implements Field, KeyDownHandler, - KeyUpHandler, ClickHandler, FocusHandler, BlurHandler, Focusable, - SubPartAware, HandlesAriaCaption, HandlesAriaInvalid, - HandlesAriaRequired, DeferredWorker { +public class VFilterSelect extends Composite + implements Field, KeyDownHandler, KeyUpHandler, ClickHandler, + FocusHandler, BlurHandler, Focusable, SubPartAware, HandlesAriaCaption, + HandlesAriaInvalid, HandlesAriaRequired, DeferredWorker { /** * Represents a suggestion in the suggestion popup box @@ -136,8 +136,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, public String getDisplayString() { final StringBuffer sb = new StringBuffer(); ApplicationConnection client = connector.getConnection(); - final Icon icon = client.getIcon(client - .translateVaadinUri(untranslatedIconUri)); + final Icon icon = client + .getIcon(client.translateVaadinUri(untranslatedIconUri)); if (icon != null) { sb.append(icon.getElement().getString()); } @@ -247,7 +247,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.client.ui.VFilterSelect.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode); }); }-*/; @@ -322,8 +322,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, * Represents the popup box with the selection options. Wraps a suggestion * menu. */ - public class SuggestionPopup extends VOverlay implements PositionCallback, - CloseHandler<PopupPanel> { + public class SuggestionPopup extends VOverlay + implements PositionCallback, CloseHandler<PopupPanel> { private static final int Z_INDEX = 30000; @@ -442,9 +442,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, boolean firstPage = (currentPage == 0); final int first = currentPage * pageLength + 1 - (firstPage ? 0 : nullOffset); - final int last = first - + currentSuggestions.size() - - 1 + final int last = first + currentSuggestions.size() - 1 - (firstPage && "".equals(lastFilter) ? nullOffset : 0); final int matches = totalSuggestions - nullOffset; @@ -476,7 +474,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, // box-shadow. // IE9 and IE10 need explicit update to remove extra // box-shadows - if (BrowserInfo.get().isIE9() || BrowserInfo.get().isIE10()) { + if (BrowserInfo.get().isIE9() + || BrowserInfo.get().isIE10()) { forceReflow(); } } @@ -494,8 +493,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } if (active) { DOM.sinkEvents(down, Event.ONCLICK); - down.setClassName(VFilterSelect.this.getStylePrimaryName() - + "-nextpage"); + down.setClassName( + VFilterSelect.this.getStylePrimaryName() + "-nextpage"); } else { DOM.sinkEvents(down, 0); down.setClassName(VFilterSelect.this.getStylePrimaryName() @@ -515,8 +514,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (active) { DOM.sinkEvents(up, Event.ONCLICK); - up.setClassName(VFilterSelect.this.getStylePrimaryName() - + "-prevpage"); + up.setClassName( + VFilterSelect.this.getStylePrimaryName() + "-prevpage"); } else { DOM.sinkEvents(up, 0); up.setClassName(VFilterSelect.this.getStylePrimaryName() @@ -826,7 +825,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, menuHeight -= up.getOffsetHeight() + down.getOffsetHeight() + status.getOffsetHeight(); } else { - final ComputedStyle s = new ComputedStyle(menu.getElement()); + final ComputedStyle s = new ComputedStyle( + menu.getElement()); menuHeight -= s.getIntProperty("marginBottom") + s.getIntProperty("marginTop"); } @@ -896,8 +896,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } else if (isrelativeUnits(suggestionPopupWidth)) { float mainComponentWidth = desiredWidth - popupOuterPadding; // convert percentage value to fraction - int widthInPx = Math.round(mainComponentWidth - * asFraction(suggestionPopupWidth)); + int widthInPx = Math.round( + mainComponentWidth * asFraction(suggestionPopupWidth)); width = widthInPx + "px"; } else { // use as fixed width CSS definition @@ -917,8 +917,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, int compensation = WidgetUtil .measureHorizontalPaddingAndBorder( menu.getElement(), 4); - setTdWidth(menu.getElement(), menu.getOffsetWidth() - - compensation); + setTdWidth(menu.getElement(), + menu.getOffsetWidth() - compensation); } } @@ -1003,12 +1003,12 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ public void updateStyleNames(AbstractComponentState componentState) { debug("VFS.SP: updateStyleNames()"); - setStyleName(VFilterSelect.this.getStylePrimaryName() - + "-suggestpopup"); - menu.setStyleName(VFilterSelect.this.getStylePrimaryName() - + "-suggestmenu"); - status.setClassName(VFilterSelect.this.getStylePrimaryName() - + "-status"); + setStyleName( + VFilterSelect.this.getStylePrimaryName() + "-suggestpopup"); + menu.setStyleName( + VFilterSelect.this.getStylePrimaryName() + "-suggestmenu"); + status.setClassName( + VFilterSelect.this.getStylePrimaryName() + "-status"); if (ComponentStateUtil.hasStyles(componentState)) { for (String style : componentState.styles) { if (!"".equals(style)) { @@ -1023,8 +1023,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, /** * The menu where the suggestions are rendered */ - public class SuggestionMenu extends MenuBar implements SubPartAware, - LoadHandler { + public class SuggestionMenu extends MenuBar + implements SubPartAware, LoadHandler { private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor( 100, new ScheduledCommand() { @@ -1068,8 +1068,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ String getPreferredHeight(int pageItemsCount) { if (currentSuggestions.size() > 0) { - final int pixels = (getPreferredHeight() / currentSuggestions - .size()) * pageItemsCount; + final int pixels = (getPreferredHeight() + / currentSuggestions.size()) * pageItemsCount; return pixels + "px"; } else { return ""; @@ -1123,8 +1123,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, && BrowserInfo.get().getBrowserMajorVersion() < 10) { // set TD width to a low value so that they won't mandate the // suggestion pop-up width - suggestionPopup - .setTdWidth(suggestionPopup.menu.getElement(), 1); + suggestionPopup.setTdWidth(suggestionPopup.menu.getElement(), + 1); } } @@ -1167,13 +1167,14 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (p > 0) { for (int i = 0; i < p; i++) { final MenuItem potentialExactMatch = getItems().get(i); - if (potentialExactMatch.getText().equals(enteredItemValue)) { + if (potentialExactMatch.getText() + .equals(enteredItemValue)) { selectItem(potentialExactMatch); // do not send a value change event if null was and // stays selected if (!"".equals(enteredItemValue) - || (selectedOptionKey != null && !"" - .equals(selectedOptionKey))) { + || (selectedOptionKey != null + && !"".equals(selectedOptionKey))) { doItemAction(potentialExactMatch, true); } suggestionPopup.hide(); @@ -1190,13 +1191,12 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, lastNewItemString = enteredItemValue; connector.sendNewItem(enteredItemValue); } - } else if (item != null - && !"".equals(lastFilter) - && (filteringmode == FilteringMode.CONTAINS ? item - .getText().toLowerCase() - .contains(lastFilter.toLowerCase()) : item - .getText().toLowerCase() - .startsWith(lastFilter.toLowerCase()))) { + } else if (item != null && !"".equals(lastFilter) + && (filteringmode == FilteringMode.CONTAINS + ? item.getText().toLowerCase() + .contains(lastFilter.toLowerCase()) + : item.getText().toLowerCase() + .startsWith(lastFilter.toLowerCase()))) { doItemAction(item, true); } else { // currentSuggestion has key="" for nullselection @@ -1220,8 +1220,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, @Override public com.google.gwt.user.client.Element getSubPartElement( String subPart) { - int index = Integer.parseInt(subPart.substring(SUBPART_PREFIX - .length())); + int index = Integer + .parseInt(subPart.substring(SUBPART_PREFIX.length())); MenuItem item = getItems().get(index); @@ -1287,8 +1287,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ int getItemOffsetHeight() { List<MenuItem> items = getItems(); - return items != null && items.size() > 0 ? items.get(0) - .getOffsetHeight() : 0; + return items != null && items.size() > 0 + ? items.get(0).getOffsetHeight() : 0; } /* @@ -1296,8 +1296,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ int getItemOffsetWidth() { List<MenuItem> items = getItems(); - return items != null && items.size() > 0 ? items.get(0) - .getOffsetWidth() : 0; + return items != null && items.size() > 0 + ? items.get(0).getOffsetWidth() : 0; } /** @@ -1313,8 +1313,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, String height = getElement().getStyle().getHeight(); String preferredHeight = getPreferredHeight(pageLength); - return !(height == null || height.length() == 0 || height - .equals(preferredHeight)); + return !(height == null || height.length() == 0 + || height.equals(preferredHeight)); } } @@ -1730,8 +1730,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, suggestionPopup = createSuggestionPopup(); popupOpener.sinkEvents(Event.ONMOUSEDOWN); - Roles.getButtonRole() - .setAriaHiddenState(popupOpener.getElement(), true); + Roles.getButtonRole().setAriaHiddenState(popupOpener.getElement(), + true); Roles.getButtonRole().set(popupOpener.getElement()); panel.add(tb); @@ -1865,8 +1865,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (filter.equals(lastFilter) && currentPage == page) { if (!suggestionPopup.isAttached()) { - suggestionPopup.showSuggestions(currentSuggestions, - currentPage, totalMatches); + suggestionPopup.showSuggestions(currentSuggestions, currentPage, + totalMatches); } return; } @@ -2001,7 +2001,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } setSelectedItemIcon(suggestion.getIconUri()); - if (!(newKey.equals(selectedOptionKey) || ("".equals(newKey) && selectedOptionKey == null))) { + if (!(newKey.equals(selectedOptionKey) + || ("".equals(newKey) && selectedOptionKey == null))) { selectedOptionKey = newKey; connector.sendSelection(selectedOptionKey); @@ -2039,8 +2040,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, if (selectedItemIcon != null) { panel.remove(selectedItemIcon); } - selectedItemIcon = new IconWidget(connector.getConnection() - .getIcon(iconUri)); + selectedItemIcon = new IconWidget( + connector.getConnection().getIcon(iconUri)); // Older IE versions don't scale icon correctly if DOM // contains height and width attributes. selectedItemIcon.getElement().removeAttribute("height"); @@ -2094,8 +2095,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, // at this point, suggestion key matches the new selection key if (updatePromptAndSelectionIfMatchFound) { if (!suggestionKey.equals(selectedOptionKey) - || suggestion.getReplacementString().equals( - tb.getText()) + || suggestion.getReplacementString() + .equals(tb.getText()) || oldSuggestionTextMatchTheOldSelection) { // Update text field if we've got a new // selection @@ -2164,8 +2165,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, int iconHeight = WidgetUtil.getRequiredHeight(selectedItemIcon); int marginTop = (availableHeight - iconHeight) / 2; - selectedItemIcon.getElement().getStyle() - .setMarginTop(marginTop, Unit.PX); + selectedItemIcon.getElement().getStyle().setMarginTop(marginTop, + Unit.PX); } private static Set<Integer> navigationKeyCodes = new HashSet<Integer>(); @@ -2201,8 +2202,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, * items, wrongly interpreted responses and more. */ if (enableDebug) { - debug("Ignoring " - + keyCode + debug("Ignoring " + keyCode + " because we are waiting for a filtering response"); } DOM.eventPreventDefault(DOM.eventGetCurrentEvent()); @@ -2260,9 +2260,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, return; } - if (currentSuggestion != null - && tb.getText().equals( - currentSuggestion.getReplacementString())) { + if (currentSuggestion != null && tb.getText() + .equals(currentSuggestion.getReplacementString())) { // Retain behavior from #6686 by returning without stopping // propagation if there's nothing to do return; @@ -2439,9 +2438,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, @Override public void onClick(ClickEvent event) { debug("VFS: onClick()"); - if (textInputEnabled - && event.getNativeEvent().getEventTarget().cast() == tb - .getElement()) { + if (textInputEnabled && event.getNativeEvent().getEventTarget() + .cast() == tb.getElement()) { // Don't process clicks on the text field if text input is enabled return; } @@ -2581,9 +2579,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, preventNextBlurEventInIE = false; Element focusedElement = WidgetUtil.getFocusedElement(); - if (getElement().isOrHasChild(focusedElement) - || suggestionPopup.getElement() - .isOrHasChild(focusedElement)) { + if (getElement().isOrHasChild(focusedElement) || suggestionPopup + .getElement().isOrHasChild(focusedElement)) { // IF the suggestion popup or another part of the VFilterSelect // was focused, move the focus back to the textfield and prevent @@ -2664,10 +2661,10 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, // Use util.getRequiredWidth instead of getOffsetWidth here - int iconWidth = selectedItemIcon == null ? 0 : WidgetUtil - .getRequiredWidth(selectedItemIcon); - int buttonWidth = popupOpener == null ? 0 : WidgetUtil - .getRequiredWidth(popupOpener); + int iconWidth = selectedItemIcon == null ? 0 + : WidgetUtil.getRequiredWidth(selectedItemIcon); + int buttonWidth = popupOpener == null ? 0 + : WidgetUtil.getRequiredWidth(popupOpener); /* * Instead of setting the width of the wrapper, set the width of @@ -2685,8 +2682,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, * locked */ if (!tb.getElement().getStyle().getWidth().endsWith("px")) { - int iconWidth = selectedItemIcon == null ? 0 : selectedItemIcon - .getOffsetWidth(); + int iconWidth = selectedItemIcon == null ? 0 + : selectedItemIcon.getOffsetWidth(); tb.setWidth((tb.getOffsetWidth() - iconWidth) + "px"); } } @@ -2745,7 +2742,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { String[] parts = subPart.split("/"); if ("textbox".equals(parts[0])) { return tb.getElement(); @@ -2761,7 +2759,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (tb.getElement().isOrHasChild(subElement)) { return "textbox"; } else if (popupOpener.getElement().isOrHasChild(subElement)) { @@ -2795,8 +2794,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } /** - * Sets the caption of selected item, if "scroll to page" is disabled. - * This method is meant for internal use and may change in future versions. + * Sets the caption of selected item, if "scroll to page" is disabled. This + * method is meant for internal use and may change in future versions. * * @since 7.7 * @param selectedCaption diff --git a/client/src/main/java/com/vaadin/client/ui/VFlash.java b/client/src/main/java/com/vaadin/client/ui/VFlash.java index eaf53836ee..f6d62f0c07 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFlash.java +++ b/client/src/main/java/com/vaadin/client/ui/VFlash.java @@ -156,10 +156,11 @@ public class VFlash extends HTML { * this by setting his own classid. */ if (classId != null) { - html.append("classid=\"" + WidgetUtil.escapeAttribute(classId) - + "\" "); + html.append( + "classid=\"" + WidgetUtil.escapeAttribute(classId) + "\" "); } else { - html.append("classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "); + html.append( + "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "); } /* @@ -174,7 +175,8 @@ public class VFlash extends HTML { html.append("codebase=\"" + WidgetUtil.escapeAttribute(codebase) + "\" "); } else { - html.append("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" "); + html.append( + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" "); } // Add width and height @@ -190,14 +192,14 @@ public class VFlash extends HTML { // Standby if (standby != null) { - html.append("standby=\"" + WidgetUtil.escapeAttribute(standby) - + "\" "); + html.append( + "standby=\"" + WidgetUtil.escapeAttribute(standby) + "\" "); } // Archive if (archive != null) { - html.append("archive=\"" + WidgetUtil.escapeAttribute(archive) - + "\" "); + html.append( + "archive=\"" + WidgetUtil.escapeAttribute(archive) + "\" "); } // End object tag @@ -213,7 +215,8 @@ public class VFlash extends HTML { html.append("<param "); html.append("name=\"" + WidgetUtil.escapeAttribute(name) + "\" "); html.append("value=\"" - + WidgetUtil.escapeAttribute(embedParams.get(name)) + "\" "); + + WidgetUtil.escapeAttribute(embedParams.get(name)) + + "\" "); html.append("/>"); } @@ -228,8 +231,8 @@ public class VFlash extends HTML { for (String name : embedParams.keySet()) { html.append(WidgetUtil.escapeAttribute(name)); html.append("="); - html.append("\"" - + WidgetUtil.escapeAttribute(embedParams.get(name)) + "\""); + html.append("\"" + WidgetUtil.escapeAttribute(embedParams.get(name)) + + "\""); } // End embed tag diff --git a/client/src/main/java/com/vaadin/client/ui/VFormLayout.java b/client/src/main/java/com/vaadin/client/ui/VFormLayout.java index 3719688f2b..150328e867 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VFormLayout.java @@ -111,7 +111,8 @@ public class VFormLayout extends SimplePanel { if (caption.getOwner() != null) { if (caption.getOwner() instanceof Focusable) { ((Focusable) caption.getOwner()).focus(); - } else if (caption.getOwner() instanceof com.google.gwt.user.client.ui.Focusable) { + } else if (caption + .getOwner() instanceof com.google.gwt.user.client.ui.Focusable) { ((com.google.gwt.user.client.ui.Focusable) caption .getOwner()).setFocus(true); } @@ -124,8 +125,7 @@ public class VFormLayout extends SimplePanel { margins.hasTop()); setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_RIGHT, margins.hasRight()); - setStyleName(margin, - CLASSNAME + "-" + StyleConstants.MARGIN_BOTTOM, + setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_BOTTOM, margins.hasBottom()); setStyleName(margin, CLASSNAME + "-" + StyleConstants.MARGIN_LEFT, margins.hasLeft()); @@ -253,7 +253,8 @@ public class VFormLayout extends SimplePanel { setStyleName(styleName); } - public void updateCaption(AbstractComponentState state, boolean enabled) { + public void updateCaption(AbstractComponentState state, + boolean enabled) { // Update styles as they might have changed when the caption changed setStyles(getStylesFromState(state, enabled)); @@ -264,9 +265,8 @@ public class VFormLayout extends SimplePanel { icon = null; } if (state.resources.containsKey(ComponentConstants.ICON_RESOURCE)) { - icon = owner.getConnection().getIcon( - state.resources.get(ComponentConstants.ICON_RESOURCE) - .getURL()); + icon = owner.getConnection().getIcon(state.resources + .get(ComponentConstants.ICON_RESOURCE).getURL()); DOM.insertChild(getElement(), icon.getElement(), 0); isEmpty = false; @@ -317,8 +317,8 @@ public class VFormLayout extends SimplePanel { // Hide the required indicator from screen reader, as this // information is set directly at the input field - Roles.getTextboxRole().setAriaHiddenState( - requiredFieldIndicator, true); + Roles.getTextboxRole() + .setAriaHiddenState(requiredFieldIndicator, true); } } else { if (requiredFieldIndicator != null) { @@ -378,8 +378,8 @@ public class VFormLayout extends SimplePanel { // Hide the error indicator from screen reader, as this // information is set directly at the input field - Roles.getFormRole().setAriaHiddenState( - errorIndicatorElement, true); + Roles.getFormRole() + .setAriaHiddenState(errorIndicatorElement, true); } } else if (errorIndicatorElement != null) { diff --git a/client/src/main/java/com/vaadin/client/ui/VGridLayout.java b/client/src/main/java/com/vaadin/client/ui/VGridLayout.java index 9e13bb7fb2..3578ab8c36 100644 --- a/client/src/main/java/com/vaadin/client/ui/VGridLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VGridLayout.java @@ -155,7 +155,8 @@ public class VGridLayout extends ComplexPanel { expandRatioSum += actualExpandRatio[i]; } for (int i = 0; i < rowHeights.length; i++) { - int ew = (int) (excessSpace * actualExpandRatio[i] / expandRatioSum); + int ew = (int) (excessSpace * actualExpandRatio[i] + / expandRatioSum); rowHeights[i] = minRowHeights[i] + ew; distributed += ew; } @@ -236,7 +237,8 @@ public class VGridLayout extends ComplexPanel { expandRatioSum += actualExpandRatio[i]; } for (int i = 0; i < columnWidths.length; i++) { - int ew = (int) (excessSpace * actualExpandRatio[i] / expandRatioSum); + int ew = (int) (excessSpace * actualExpandRatio[i] + / expandRatioSum); columnWidths[i] = minColumnWidths[i] + ew; distributed += ew; } @@ -533,9 +535,8 @@ public class VGridLayout extends ComplexPanel { } } - private static void distributeSpanSize(int[] dimensions, - int spanStartIndex, int spanSize, int spacingSize, int size, - float[] expansionRatios) { + private static void distributeSpanSize(int[] dimensions, int spanStartIndex, + int spanSize, int spacingSize, int size, float[] expansionRatios) { int allocated = dimensions[spanStartIndex]; for (int i = 1; i < spanSize; i++) { allocated += spacingSize + dimensions[spanStartIndex + i]; diff --git a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java index b3825d2de5..e0358413ac 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -53,8 +53,8 @@ import com.vaadin.client.Util; import com.vaadin.client.WidgetUtil; import com.vaadin.shared.ui.menubar.MenuBarConstants; -public class VMenuBar extends SimpleFocusablePanel implements - CloseHandler<PopupPanel>, KeyPressHandler, KeyDownHandler, +public class VMenuBar extends SimpleFocusablePanel + implements CloseHandler<PopupPanel>, KeyPressHandler, KeyDownHandler, FocusHandler, SubPartAware { // The hierarchy of VMenuBar is a bit weird as VMenuBar is the Paintable, @@ -171,8 +171,8 @@ public class VMenuBar extends SimpleFocusablePanel implements } protected void updateStyleNames() { - String primaryStyleName = getParentMenu() != null ? getParentMenu() - .getStylePrimaryName() : getStylePrimaryName(); + String primaryStyleName = getParentMenu() != null + ? getParentMenu().getStylePrimaryName() : getStylePrimaryName(); // Reset the style name for all the items for (CustomMenuItem item : items) { @@ -184,8 +184,8 @@ public class VMenuBar extends SimpleFocusablePanel implements /* * Sub-menus should get the sub-menu prefix */ - super.setStylePrimaryName(primaryStyleName - + SUBMENU_CLASSNAME_PREFIX); + super.setStylePrimaryName( + primaryStyleName + SUBMENU_CLASSNAME_PREFIX); } } @@ -224,7 +224,8 @@ public class VMenuBar extends SimpleFocusablePanel implements if (item.getChildCount() > 0) { String bgStyle = ""; itemHTML.append("<span class=\"" + getStylePrimaryName() - + "-submenu-indicator\"" + bgStyle + ">►</span>"); + + "-submenu-indicator\"" + bgStyle + + ">►</span>"); } itemHTML.append("<span class=\"" + getStylePrimaryName() @@ -467,7 +468,8 @@ public class VMenuBar extends SimpleFocusablePanel implements * @param item */ public void itemOver(CustomMenuItem item) { - if ((openRootOnHover || subMenu || menuVisible) && !item.isSeparator()) { + if ((openRootOnHover || subMenu || menuVisible) + && !item.isSeparator()) { setSelected(item); if (!subMenu && openRootOnHover && !menuVisible) { menuVisible = true; // start opening menus @@ -576,11 +578,11 @@ public class VMenuBar extends SimpleFocusablePanel implements * Use parents primary style name if possible and remove the submenu * prefix if needed */ - String primaryStyleName = parentMenu != null ? parentMenu - .getStylePrimaryName() : getStylePrimaryName(); + String primaryStyleName = parentMenu != null + ? parentMenu.getStylePrimaryName() : getStylePrimaryName(); if (subMenu) { - primaryStyleName = primaryStyleName.replace( - SUBMENU_CLASSNAME_PREFIX, ""); + primaryStyleName = primaryStyleName + .replace(SUBMENU_CLASSNAME_PREFIX, ""); } popup.setStyleName(primaryStyleName + "-popup"); @@ -649,8 +651,8 @@ public class VMenuBar extends SimpleFocusablePanel implements private int adjustPopupHeight(int top, final int shadowSpace) { // Check that the popup will fit the screen - int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - - top - shadowSpace; + int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - top + - shadowSpace; int missingHeight = popup.getOffsetHeight() - availableHeight; if (missingHeight > 0) { // First move the top of the popup to get more space @@ -922,8 +924,8 @@ public class VMenuBar extends SimpleFocusablePanel implements String primaryStyleName = parentMenu.getStylePrimaryName(); if (parentMenu.subMenu) { - primaryStyleName = primaryStyleName.replace( - SUBMENU_CLASSNAME_PREFIX, ""); + primaryStyleName = primaryStyleName + .replace(SUBMENU_CLASSNAME_PREFIX, ""); } String currentStyles = super.getStyleName(); @@ -1055,20 +1057,21 @@ public class VMenuBar extends SimpleFocusablePanel implements // if the selected attribute is present (either true or false), // the item is selectable setCheckable(true); - setChecked(uidl - .getBooleanAttribute(MenuBarConstants.ATTRIBUTE_CHECKED)); + setChecked(uidl.getBooleanAttribute( + MenuBarConstants.ATTRIBUTE_CHECKED)); } else { setCheckable(false); } if (uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE)) { - styleName = uidl - .getStringAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE); + styleName = uidl.getStringAttribute( + MenuBarConstants.ATTRIBUTE_ITEM_STYLE); } - if (uidl.hasAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION)) { - description = uidl - .getStringAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION); + if (uidl.hasAttribute( + MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION)) { + description = uidl.getStringAttribute( + MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION); } updateStyleNames(); @@ -1104,8 +1107,8 @@ public class VMenuBar extends SimpleFocusablePanel implements public void iLayout(boolean iconLoadEvent) { // Only collapse if there is more than one item in the root menu and the // menu has an explicit size - if ((getItems().size() > 1 || (collapsedRootItems != null && collapsedRootItems - .getItems().size() > 0)) + if ((getItems().size() > 1 || (collapsedRootItems != null + && collapsedRootItems.getItems().size() > 0)) && getElement().getStyle().getProperty("width") != null && moreItem != null) { @@ -1117,8 +1120,8 @@ public class VMenuBar extends SimpleFocusablePanel implements removeItem(moreItem); } - int availableWidth = LayoutManager.get(client).getInnerWidth( - getElement()); + int availableWidth = LayoutManager.get(client) + .getInnerWidth(getElement()); // Used width includes the "more" item if present int usedWidth = getConsumedWidth(); @@ -1135,8 +1138,8 @@ public class VMenuBar extends SimpleFocusablePanel implements while (widthReduced < widthNeeded && getItems().size() > 0) { // Move last root menu item to collapsed menu - CustomMenuItem collapse = getItems().get( - getItems().size() - 1); + CustomMenuItem collapse = getItems() + .get(getItems().size() - 1); widthReduced += collapse.getOffsetWidth(); removeItem(collapse); collapsedRootItems.addItem(collapse, 0); @@ -1587,10 +1590,11 @@ public class VMenuBar extends SimpleFocusablePanel implements private final String SUBPART_PREFIX = "item"; @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (subPart.startsWith(SUBPART_PREFIX)) { - int index = Integer.parseInt(subPart.substring(SUBPART_PREFIX - .length())); + int index = Integer + .parseInt(subPart.substring(SUBPART_PREFIX.length())); CustomMenuItem item = getItems().get(index); return item.getElement(); @@ -1609,7 +1613,8 @@ public class VMenuBar extends SimpleFocusablePanel implements if (!item.isSeparator() && isItemNamed(item, subPart)) { return item.getElement(); } - if (item.getSubMenu() != null && item.getSubMenu().menuVisible) { + if (item.getSubMenu() != null + && item.getSubMenu().menuVisible) { submenuItems.addAll(item.getSubMenu().getItems()); } @@ -1654,7 +1659,8 @@ public class VMenuBar extends SimpleFocusablePanel implements } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (!getElement().isOrHasChild(subElement)) { return null; } diff --git a/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java b/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java index 330442b550..d3c29b64ad 100644 --- a/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VNativeSelect.java @@ -92,8 +92,8 @@ public class VNativeSelect extends VOptionGroupBase implements Field { client.updateVariable(paintableId, "selected", getSelectedItems(), isImmediate()); } else { - client.updateVariable(paintableId, "selected", new String[] { "" - + getSelectedItem() }, isImmediate()); + client.updateVariable(paintableId, "selected", + new String[] { "" + getSelectedItem() }, isImmediate()); } if (firstValueIsTemporaryNullItem) { // remove temporary empty item diff --git a/client/src/main/java/com/vaadin/client/ui/VNotification.java b/client/src/main/java/com/vaadin/client/ui/VNotification.java index 1ff51df8d0..c33c0e4835 100644 --- a/client/src/main/java/com/vaadin/client/ui/VNotification.java +++ b/client/src/main/java/com/vaadin/client/ui/VNotification.java @@ -227,8 +227,8 @@ public class VNotification extends VOverlay { return null; } - return getApplicationConnection().getUIConnector().getState().notificationConfigurations - .get(style); + return getApplicationConnection().getUIConnector() + .getState().notificationConfigurations.get(style); } private void setWaiAriaRole(NotificationTypeConfiguration styleSetup) { @@ -296,14 +296,13 @@ public class VNotification extends VOverlay { // Still animating in, wait for it to finish before touching // the animation delay (which would restart the animation-in // in some browsers) - if (getStyleName().contains( - VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN)) { + if (getStyleName() + .contains(VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN)) { AnimationUtil.addAnimationEndListener(getElement(), new AnimationEndListener() { @Override public void onAnimationEnd(NativeEvent event) { - if (AnimationUtil - .getAnimationName(event) + if (AnimationUtil.getAnimationName(event) .contains( VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN)) { VNotification.this.hide(); @@ -439,8 +438,10 @@ public class VNotification extends VOverlay { if (x < 0) { x = DOM.eventGetClientX(event); y = DOM.eventGetClientY(event); - } else if (Math.abs(DOM.eventGetClientX(event) - x) > mouseMoveThreshold - || Math.abs(DOM.eventGetClientY(event) - y) > mouseMoveThreshold) { + } else if (Math + .abs(DOM.eventGetClientX(event) - x) > mouseMoveThreshold + || Math.abs(DOM.eventGetClientY(event) + - y) > mouseMoveThreshold) { hideAfterDelay(); } break; @@ -487,18 +488,19 @@ public class VNotification extends VOverlay { public static void showNotification(ApplicationConnection client, final UIDL notification) { - boolean onlyPlainText = notification - .hasAttribute(UIConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); + boolean onlyPlainText = notification.hasAttribute( + UIConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); String html = ""; - if (notification.hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_ICON)) { - String iconUri = notification - .getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_ICON); + if (notification + .hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_ICON)) { + String iconUri = notification.getStringAttribute( + UIConstants.ATTRIBUTE_NOTIFICATION_ICON); html += client.getIcon(iconUri).getElement().getString(); } if (notification .hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION)) { - String caption = notification - .getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION); + String caption = notification.getStringAttribute( + UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION); if (onlyPlainText) { caption = WidgetUtil.escapeHTML(caption); caption = caption.replaceAll("\\n", "<br />"); @@ -508,20 +510,21 @@ public class VNotification extends VOverlay { } if (notification .hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE)) { - String message = notification - .getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE); + String message = notification.getStringAttribute( + UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE); if (onlyPlainText) { message = WidgetUtil.escapeHTML(message); message = message.replaceAll("\\n", "<br />"); } - html += "<p class='" + getDependentStyle(client, DESCRIPTION) - + "'>" + message + "</p>"; + html += "<p class='" + getDependentStyle(client, DESCRIPTION) + "'>" + + message + "</p>"; } final String style = notification - .hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_STYLE) ? notification - .getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_STYLE) - : null; + .hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_STYLE) + ? notification.getStringAttribute( + UIConstants.ATTRIBUTE_NOTIFICATION_STYLE) + : null; final int pos = notification .getIntAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_POSITION); @@ -529,8 +532,8 @@ public class VNotification extends VOverlay { final int delay = notification .getIntAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_DELAY); - createNotification(delay, client.getUIConnector().getWidget()).show( - html, position, style); + createNotification(delay, client.getUIConnector().getWidget()) + .show(html, position, style); } /** @@ -546,15 +549,16 @@ public class VNotification extends VOverlay { */ public static String getDependentStyle(ApplicationConnection client, String style) { - VNotification notification = createNotification(-1, client - .getUIConnector().getWidget()); + VNotification notification = createNotification(-1, + client.getUIConnector().getWidget()); String styleName = notification.getStyleName(); notification.addStyleDependentName(style); String extendedStyle = notification.getStyleName(); return extendedStyle.substring(styleName.length()).trim(); } - public static VNotification createNotification(int delayMsec, Widget owner) { + public static VNotification createNotification(int delayMsec, + Widget owner) { final VNotification notification = GWT.create(VNotification.class); notification.setWaiAriaRole(null); notification.setDelay(delayMsec); @@ -665,8 +669,8 @@ public class VNotification extends VOverlay { * messages, such as session expired. * */ - private static class NotificationRedirect implements - VNotification.EventListener { + private static class NotificationRedirect + implements VNotification.EventListener { String url; NotificationRedirect(String url) { diff --git a/client/src/main/java/com/vaadin/client/ui/VOptionGroup.java b/client/src/main/java/com/vaadin/client/ui/VOptionGroup.java index a3c9f069b3..4391683ac7 100644 --- a/client/src/main/java/com/vaadin/client/ui/VOptionGroup.java +++ b/client/src/main/java/com/vaadin/client/ui/VOptionGroup.java @@ -48,8 +48,8 @@ import com.vaadin.client.WidgetUtil; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.optiongroup.OptionGroupConstants; -public class VOptionGroup extends VOptionGroupBase implements FocusHandler, - BlurHandler { +public class VOptionGroup extends VOptionGroupBase + implements FocusHandler, BlurHandler { public static final String CLASSNAME = "v-select-optiongroup"; @@ -150,7 +150,8 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, // Need to recreate object if isMultiselect is changed (#10451) // OR if htmlContentAllowed changed due to Safari 5 issue - if ((op == null) || (isHtmlContentAllowed() != wasHtmlContentAllowed) + if ((op == null) + || (isHtmlContentAllowed() != wasHtmlContentAllowed) || (isMultiselect() != wasMultiselect)) { // Create a new element if (isMultiselect()) { @@ -172,8 +173,8 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, op.setHTML(itemHtml); op.setValue(opUidl.getBooleanAttribute("selected")); - boolean optionEnabled = !opUidl - .getBooleanAttribute(OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED); + boolean optionEnabled = !opUidl.getBooleanAttribute( + OptionGroupConstants.ATTRIBUTE_OPTION_DISABLED); boolean enabled = optionEnabled && !isReadonly() && isEnabled(); op.setEnabled(enabled); optionsEnabled.put(op, optionEnabled); @@ -234,7 +235,8 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, @Override public void setTabIndex(int tabIndex) { - for (Iterator<Widget> iterator = panel.iterator(); iterator.hasNext();) { + for (Iterator<Widget> iterator = panel.iterator(); iterator + .hasNext();) { FocusWidget widget = (FocusWidget) iterator.next(); widget.setTabIndex(tabIndex); } diff --git a/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java b/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java index 5bee6b51ae..d94f205edc 100644 --- a/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java +++ b/client/src/main/java/com/vaadin/client/ui/VOptionGroupBase.java @@ -160,8 +160,8 @@ public abstract class VOptionGroupBase extends Composite implements Field, client.updateVariable(paintableId, "selected", getSelectedItems(), immediate); } else { - client.updateVariable(paintableId, "selected", new String[] { "" - + getSelectedItem() }, immediate); + client.updateVariable(paintableId, "selected", + new String[] { "" + getSelectedItem() }, immediate); } } diff --git a/client/src/main/java/com/vaadin/client/ui/VOverlay.java b/client/src/main/java/com/vaadin/client/ui/VOverlay.java index 5dc29f5a42..52b5fbb3c1 100644 --- a/client/src/main/java/com/vaadin/client/ui/VOverlay.java +++ b/client/src/main/java/com/vaadin/client/ui/VOverlay.java @@ -119,9 +119,8 @@ public class VOverlay extends Overlay implements CloseHandler<PopupPanel> { if (ac == null) { // could not figure out which one we belong to, styling will // probably fail - Logger.getLogger(getClass().getSimpleName()) - .warning( - "Could not determine ApplicationConnection for Overlay. Overlay will be attached directly to the root panel"); + Logger.getLogger(getClass().getSimpleName()).warning( + "Could not determine ApplicationConnection for Overlay. Overlay will be attached directly to the root panel"); return super.getOverlayContainer(); } else { return getOverlayContainer(ac); diff --git a/client/src/main/java/com/vaadin/client/ui/VPanel.java b/client/src/main/java/com/vaadin/client/ui/VPanel.java index 946ff83180..1bda29fbbf 100644 --- a/client/src/main/java/com/vaadin/client/ui/VPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VPanel.java @@ -27,8 +27,8 @@ import com.vaadin.client.Focusable; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; -public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, - Focusable { +public class VPanel extends SimplePanel + implements ShortcutActionHandlerOwner, Focusable { public static final String CLASSNAME = "v-panel"; @@ -175,8 +175,8 @@ public class VPanel extends SimplePanel implements ShortcutActionHandlerOwner, "scrollTop"); int newscrollLeft = DOM.getElementPropertyInt(contentNode, "scrollLeft"); - if (client != null - && (newscrollLeft != scrollLeft || newscrollTop != scrollTop)) { + if (client != null && (newscrollLeft != scrollLeft + || newscrollTop != scrollTop)) { scrollLeft = newscrollLeft; scrollTop = newscrollTop; client.updateVariable(id, "scrollTop", scrollTop, false); diff --git a/client/src/main/java/com/vaadin/client/ui/VPopupCalendar.java b/client/src/main/java/com/vaadin/client/ui/VPopupCalendar.java index 47f11b09b1..1b0f26d08a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VPopupCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VPopupCalendar.java @@ -64,8 +64,8 @@ import com.vaadin.shared.ui.datefield.Resolution; * method. * */ -public class VPopupCalendar extends VTextualDate implements Field, - ClickHandler, CloseHandler<PopupPanel>, SubPartAware { +public class VPopupCalendar extends VTextualDate + implements Field, ClickHandler, CloseHandler<PopupPanel>, SubPartAware { /** For internal use only. May be removed or replaced in the future. */ public final Button calendarToggle = new Button(); @@ -129,8 +129,8 @@ public class VPopupCalendar extends VTextualDate implements Field, // Description of the usage of the widget for assisitve device users descriptionForAssisitveDevicesElement = DOM.createDiv(); - descriptionForAssisitveDevicesElement - .setInnerText(PopupDateFieldState.DESCRIPTION_FOR_ASSISTIVE_DEVICES); + descriptionForAssisitveDevicesElement.setInnerText( + PopupDateFieldState.DESCRIPTION_FOR_ASSISTIVE_DEVICES); AriaHelper.ensureHasId(descriptionForAssisitveDevicesElement); Roles.getTextboxRole().setAriaDescribedbyProperty(text.getElement(), Id.of(descriptionForAssisitveDevicesElement)); @@ -230,16 +230,19 @@ public class VPopupCalendar extends VTextualDate implements Field, .getCalendarField()) { getClient().updateVariable(getId(), "day", newDate.getDate(), false); - if (getCurrentResolution().getCalendarField() > Resolution.DAY - .getCalendarField()) { + if (getCurrentResolution() + .getCalendarField() > Resolution.DAY + .getCalendarField()) { getClient().updateVariable(getId(), "hour", newDate.getHours(), false); - if (getCurrentResolution().getCalendarField() > Resolution.HOUR - .getCalendarField()) { + if (getCurrentResolution() + .getCalendarField() > Resolution.HOUR + .getCalendarField()) { getClient().updateVariable(getId(), "min", newDate.getMinutes(), false); - if (getCurrentResolution().getCalendarField() > Resolution.MINUTE - .getCalendarField()) { + if (getCurrentResolution() + .getCalendarField() > Resolution.MINUTE + .getCalendarField()) { getClient().updateVariable(getId(), "sec", newDate.getSeconds(), false); } @@ -294,12 +297,12 @@ public class VPopupCalendar extends VTextualDate implements Field, if (reallyEnabled) { calendarToggle.setTabIndex(-1); - Roles.getButtonRole().setAriaHiddenState( - calendarToggle.getElement(), true); + Roles.getButtonRole() + .setAriaHiddenState(calendarToggle.getElement(), true); } else { calendarToggle.setTabIndex(0); - Roles.getButtonRole().setAriaHiddenState( - calendarToggle.getElement(), false); + Roles.getButtonRole() + .setAriaHiddenState(calendarToggle.getElement(), false); } handleAriaAttributes(); @@ -349,11 +352,11 @@ public class VPopupCalendar extends VTextualDate implements Field, removeFromWidget = text; } - Roles.getFormRole().removeAriaLabelledbyProperty( - removeFromWidget.getElement()); + Roles.getFormRole() + .removeAriaLabelledbyProperty(removeFromWidget.getElement()); if (captionId == null) { - Roles.getFormRole().removeAriaLabelledbyProperty( - setForWidget.getElement()); + Roles.getFormRole() + .removeAriaLabelledbyProperty(setForWidget.getElement()); } else { Roles.getFormRole().setAriaLabelledbyProperty( setForWidget.getElement(), Id.of(captionId)); @@ -562,7 +565,8 @@ public class VPopupCalendar extends VTextualDate implements Field, private final String CALENDAR_TOGGLE_ID = "popupButton"; @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (subPart.equals(CALENDAR_TOGGLE_ID)) { return calendarToggle.getElement(); } @@ -571,7 +575,8 @@ public class VPopupCalendar extends VTextualDate implements Field, } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (calendarToggle.getElement().isOrHasChild(subElement)) { return CALENDAR_TOGGLE_ID; } diff --git a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java index cb4482f7cb..14cd17ea2e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java +++ b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java @@ -47,8 +47,8 @@ import com.vaadin.client.ui.richtextarea.VRichTextToolbar; * @author Vaadin Ltd. * */ -public class VRichTextArea extends Composite implements Field, KeyPressHandler, - KeyDownHandler, Focusable { +public class VRichTextArea extends Composite + implements Field, KeyPressHandler, KeyDownHandler, Focusable { /** * The input node CSS classname. @@ -232,10 +232,9 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler, ShortcutActionHandler shortcutHandler = getShortcutHandlerOwner() .getShortcutActionHandler(); if (shortcutHandler != null) { - shortcutHandler - .handleKeyboardEvent(com.google.gwt.user.client.Event - .as(event.getNativeEvent()), - ConnectorMap.get(client).getConnector(this)); + shortcutHandler.handleKeyboardEvent( + com.google.gwt.user.client.Event.as(event.getNativeEvent()), + ConnectorMap.get(client).getConnector(this)); } } diff --git a/client/src/main/java/com/vaadin/client/ui/VScrollTable.java b/client/src/main/java/com/vaadin/client/ui/VScrollTable.java index 107b267fa5..54eae33400 100644 --- a/client/src/main/java/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/main/java/com/vaadin/client/ui/VScrollTable.java @@ -131,9 +131,9 @@ import com.vaadin.shared.ui.table.TableConstants; * * TODO implement unregistering for child components in Cells */ -public class VScrollTable extends FlowPanel implements HasWidgets, - ScrollHandler, VHasDropHandler, FocusHandler, BlurHandler, Focusable, - ActionOwner, SubPartAware, DeferredWorker { +public class VScrollTable extends FlowPanel + implements HasWidgets, ScrollHandler, VHasDropHandler, FocusHandler, + BlurHandler, Focusable, ActionOwner, SubPartAware, DeferredWorker { /** * Simple interface for parts of the table capable of owning a context menu. @@ -469,8 +469,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, int endOfFirstRange = row.getIndex() - 1; if (endOfFirstRange >= startRow.getIndex()) { // create range of first part unless its length is < 1 - ranges.add(new SelectionRange(startRow, endOfFirstRange - - startRow.getIndex() + 1)); + ranges.add(new SelectionRange(startRow, + endOfFirstRange - startRow.getIndex() + 1)); } int startOfSecondRange = row.getIndex() + 1; if (getEndIndex() >= startOfSecondRange) { @@ -478,8 +478,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, VScrollTableRow startOfRange = scrollBody .getRowByRowIndex(startOfSecondRange); if (startOfRange != null) { - ranges.add(new SelectionRange(startOfRange, getEndIndex() - - startOfSecondRange + 1)); + ranges.add(new SelectionRange(startOfRange, + getEndIndex() - startOfSecondRange + 1)); } } return ranges; @@ -635,8 +635,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // (prevents scrolling) event.preventDefault(); } else if (hasFocus()) { - if (handleNavigation(event.getKeyCode(), event.getCtrlKey() - || event.getMetaKey(), event.getShiftKey())) { + if (handleNavigation(event.getKeyCode(), + event.getCtrlKey() || event.getMetaKey(), + event.getShiftKey())) { navKeyDown = true; event.preventDefault(); } @@ -807,12 +808,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // capture is in use Element elementUnderMouse = WidgetUtil .getElementUnderMouse(event.getNativeEvent()); - if (lastMouseDownTarget != null - && lastMouseDownTarget.isOrHasChild(elementUnderMouse)) { + if (lastMouseDownTarget != null && lastMouseDownTarget + .isOrHasChild(elementUnderMouse)) { mouseUpPreviewMatched = true; } else { - getLogger().log( - Level.FINEST, + getLogger().log(Level.FINEST, "Ignoring mouseup from " + elementUnderMouse + " when mousedown was on " + lastMouseDownTarget); @@ -868,8 +868,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, scrollBodyPanel.removeStyleName(getStylePrimaryName() + "-body"); if (scrollBody != null) { - scrollBody.removeStyleName(getStylePrimaryName() - + "-body-noselection"); + scrollBody.removeStyleName( + getStylePrimaryName() + "-body-noselection"); } if (isPrimary) { @@ -893,8 +893,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, this.client = client; // Add a handler to clear saved context menu details when the menu // closes. See #8526. - addCloseHandler = client.getContextMenu().addCloseHandler( - new CloseHandler<PopupPanel>() { + addCloseHandler = client.getContextMenu() + .addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { @@ -981,8 +981,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (focusedRow == null && scrollBody.iterator().hasNext()) { // FIXME should focus first visible from top, not first rendered // ?? - return setRowFocus((VScrollTableRow) scrollBody.iterator() - .next()); + return setRowFocus( + (VScrollTableRow) scrollBody.iterator().next()); } else { VScrollTableRow next = getNextRow(focusedRow, offset); if (next != null) { @@ -1015,8 +1015,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (focusedRow == null && scrollBody.iterator().hasNext()) { // FIXME logic is exactly the same as in moveFocusDown, should // be the opposite?? - return setRowFocus((VScrollTableRow) scrollBody.iterator() - .next()); + return setRowFocus( + (VScrollTableRow) scrollBody.iterator().next()); } else { VScrollTableRow prev = getPreviousRow(focusedRow, offset); if (prev != null) { @@ -1096,12 +1096,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Send the selected row ranges client.updateVariable(paintableId, "selectedRanges", - ranges.toArray(new String[selectedRowRanges.size()]), false); + ranges.toArray(new String[selectedRowRanges.size()]), + false); selectedRowRanges.clear(); // clean selectedRowKeys so that they don't contain excess values - for (Iterator<String> iterator = selectedRowKeys.iterator(); iterator - .hasNext();) { + for (Iterator<String> iterator = selectedRowKeys + .iterator(); iterator.hasNext();) { String key = iterator.next(); VScrollTableRow renderedRowByKey = getRenderedRowByKey(key); if (renderedRowByKey != null) { @@ -1313,10 +1314,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ VScrollTableRow row = (VScrollTableRow) iterator.next(); boolean selected = selectedKeys.contains(row.getKey()); - if (!selected - && unSyncedselectionsBeforeRowFetch != null - && unSyncedselectionsBeforeRowFetch.contains(row - .getKey())) { + if (!selected && unSyncedselectionsBeforeRowFetch != null + && unSyncedselectionsBeforeRowFetch + .contains(row.getKey())) { selected = true; keyboardSelectionOverRowFetchInProgress = true; } @@ -1410,11 +1410,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (firstvisible >= 0) { firstRowInViewPort = firstvisible; if (firstvisibleOnLastPage > -1) { - scrollBodyPanel - .setScrollPosition(measureRowHeightOffset(firstvisibleOnLastPage)); + scrollBodyPanel.setScrollPosition( + measureRowHeightOffset(firstvisibleOnLastPage)); } else { - scrollBodyPanel - .setScrollPosition(measureRowHeightOffset(firstvisible)); + scrollBodyPanel.setScrollPosition( + measureRowHeightOffset(firstvisible)); } } disableLazyScroller(); @@ -1423,10 +1423,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** For internal use only. May be removed or replaced in the future. */ public void updateFirstVisibleAndScrollIfNeeded(UIDL uidl) { - firstvisible = uidl.hasVariable("firstvisible") ? uidl - .getIntVariable("firstvisible") : 0; - firstvisibleOnLastPage = uidl.hasVariable("firstvisibleonlastpage") ? uidl - .getIntVariable("firstvisibleonlastpage") : -1; + firstvisible = uidl.hasVariable("firstvisible") + ? uidl.getIntVariable("firstvisible") : 0; + firstvisibleOnLastPage = uidl.hasVariable("firstvisibleonlastpage") + ? uidl.getIntVariable("firstvisibleonlastpage") : -1; if (firstvisible != lastRequestedFirstvisible && scrollBody != null) { // Update lastRequestedFirstvisible right away here @@ -1463,11 +1463,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** For internal use only. May be removed or replaced in the future. */ public void updateSelectionProperties(UIDL uidl, AbstractComponentState state, boolean readOnly) { - setMultiSelectMode(uidl.hasAttribute("multiselectmode") ? uidl - .getIntAttribute("multiselectmode") : MULTISELECT_MODE_DEFAULT); + setMultiSelectMode(uidl.hasAttribute("multiselectmode") + ? uidl.getIntAttribute("multiselectmode") + : MULTISELECT_MODE_DEFAULT); - nullSelectionAllowed = uidl.hasAttribute("nsa") ? uidl - .getBooleanAttribute("nsa") : true; + nullSelectionAllowed = uidl.hasAttribute("nsa") + ? uidl.getBooleanAttribute("nsa") : true; if (uidl.hasAttribute("selectmode")) { if (readOnly) { @@ -1484,8 +1485,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** For internal use only. May be removed or replaced in the future. */ public void updateDragMode(UIDL uidl) { - dragmode = uidl.hasAttribute("dragmode") ? uidl - .getIntAttribute("dragmode") : 0; + dragmode = uidl.hasAttribute("dragmode") + ? uidl.getIntAttribute("dragmode") : 0; if (BrowserInfo.get().isIE()) { if (dragmode > 0) { getElement().setPropertyJSO("onselectstart", @@ -1560,9 +1561,11 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // try to focus a row currently selected and in viewport String selectedRowKey = selectedRowKeys.iterator().next(); if (selectedRowKey != null) { - VScrollTableRow renderedRow = getRenderedRowByKey(selectedRowKey); + VScrollTableRow renderedRow = getRenderedRowByKey( + selectedRowKey); if (renderedRow == null || !renderedRow.isInViewPort()) { - setRowFocus(scrollBody.getRowByRowIndex(firstRowInViewPort)); + setRowFocus( + scrollBody.getRowByRowIndex(firstRowInViewPort)); } else { setRowFocus(renderedRow); } @@ -1591,8 +1594,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (lastRowInViewport == null) { // this should not happen in normal situations (white space at the // end of viewport). Select the last rendered as a fallback. - lastRowInViewport = scrollBody.getRowByRowIndex(scrollBody - .getLastRendered()); + lastRowInViewport = scrollBody + .getRowByRowIndex(scrollBody.getLastRendered()); if (lastRowInViewport == null) { return; // empty table } @@ -1785,10 +1788,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * caching window. */ protected void discardRowsOutsideCacheWindow() { - int firstRowToKeep = (int) (firstRowInViewPort - pageLength - * cache_rate); - int lastRowToKeep = (int) (firstRowInViewPort + pageLength + pageLength - * cache_rate); + int firstRowToKeep = (int) (firstRowInViewPort + - pageLength * cache_rate); + int lastRowToKeep = (int) (firstRowInViewPort + pageLength + + pageLength * cache_rate); // sanity checks: if (firstRowToKeep < 0) { firstRowToKeep = 0; @@ -2205,8 +2208,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, tHead.enableBrowserIntelligence(); tFoot.enableBrowserIntelligence(); - int hierarchyColumnIndent = scrollBody != null ? scrollBody - .getMaxIndent() : 0; + int hierarchyColumnIndent = scrollBody != null + ? scrollBody.getMaxIndent() : 0; HeaderCell hierarchyHeaderWithExpandRatio = null; // first loop: collect natural widths @@ -2320,9 +2323,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (hierarchyHeaderWithExpandRatio != null) { // ensure first that the hierarchyColumn gets at least the // space allocated for indent - final int newSpace = Math - .round((extraSpace * (hierarchyHeaderWithExpandRatio - .getExpandRatio() / expandRatioDivider))); + final int newSpace = Math.round((extraSpace + * (hierarchyHeaderWithExpandRatio.getExpandRatio() + / expandRatioDivider))); if (newSpace < hierarchyColumnIndent) { // not enough space for indent, remove indent from the // extraSpace again and handle hierarchy column's header @@ -2341,14 +2344,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (hCell.getExpandRatio() > 0) { int w = widths[i]; if (setIndentToHierarchyHeader - && hierarchyHeaderWithExpandRatio.equals(hCell)) { + && hierarchyHeaderWithExpandRatio + .equals(hCell)) { // hierarchy column's header is no longer part of // the expansion divide and only gets indent w += hierarchyColumnIndent; } else { final int newSpace = Math - .round((extraSpace * (hCell - .getExpandRatio() / expandRatioDivider))); + .round((extraSpace * (hCell.getExpandRatio() + / expandRatioDivider))); w += newSpace; } widths[i] = w; @@ -2367,8 +2371,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, HeaderCell hCell = (HeaderCell) headCells.next(); if (!hCell.isDefinedWidth()) { int w = widths[i]; - final int newSpace = Math.round((float) extraSpace - * (float) w / totalWidthR); + final int newSpace = Math.round( + (float) extraSpace * (float) w / totalWidthR); w += newSpace; widths[i] = w; } @@ -2445,8 +2449,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // int bodyHeight = scrollBody.getOffsetHeight(); bodyHeight = scrollBody.getRequiredHeight(); } else { - bodyHeight = (int) Math.round(scrollBody.getRowHeight(true) - * pageLength); + bodyHeight = (int) Math + .round(scrollBody.getRowHeight(true) * pageLength); } boolean needsSpaceForHorizontalSrollbar = (total > availW); if (needsSpaceForHorizontalSrollbar) { @@ -2469,8 +2473,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (totalRows - 1 > scrollBody.getLastRendered()) { // fetch cache rows int firstInNewSet = scrollBody.getLastRendered() + 1; - int lastInNewSet = (int) (firstRowInViewPort + pageLength + cache_rate - * pageLength); + int lastInNewSet = (int) (firstRowInViewPort + pageLength + + cache_rate * pageLength); if (lastInNewSet > totalRows - 1) { lastInNewSet = totalRows - 1; } @@ -2484,8 +2488,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * Ensures the column alignments are correct at initial loading. <br/> * (child components widths are correct) */ - WidgetUtil.runWebkitOverflowAutoFixDeferred(scrollBodyPanel - .getElement()); + WidgetUtil + .runWebkitOverflowAutoFixDeferred(scrollBodyPanel.getElement()); hadScrollBars = willHaveScrollbarz; } @@ -2502,10 +2506,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return true; } } else { - int fakeheight = (int) Math.round(scrollBody.getRowHeight() - * totalRows); - int availableHeight = scrollBodyPanel.getElement().getPropertyInt( - "clientHeight"); + int fakeheight = (int) Math + .round(scrollBody.getRowHeight() * totalRows); + int availableHeight = scrollBodyPanel.getElement() + .getPropertyInt("clientHeight"); if (fakeheight > availableHeight) { return true; } @@ -2516,8 +2520,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private void announceScrollPosition() { if (scrollPositionElement == null) { scrollPositionElement = DOM.createDiv(); - scrollPositionElement.setClassName(getStylePrimaryName() - + "-scrollposition"); + scrollPositionElement + .setClassName(getStylePrimaryName() + "-scrollposition"); scrollPositionElement.getStyle().setPosition(Position.ABSOLUTE); scrollPositionElement.getStyle().setDisplay(Display.NONE); getElement().appendChild(scrollPositionElement); @@ -2546,9 +2550,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** For internal use only. May be removed or replaced in the future. */ public boolean isScrollPositionVisible() { - return scrollPositionElement != null - && !scrollPositionElement.getStyle().getDisplay() - .equals(Display.NONE.toString()); + return scrollPositionElement != null && !scrollPositionElement + .getStyle().getDisplay().equals(Display.NONE.toString()); } /** For internal use only. May be removed or replaced in the future. */ @@ -2585,9 +2588,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // tell scroll position to user if currently "visible" rows are // not rendered - if (totalRows > pageLength - && ((firstRowInViewPort + pageLength > scrollBody - .getLastRendered()) || (firstRowInViewPort < scrollBody + if (totalRows > pageLength && ((firstRowInViewPort + + pageLength > scrollBody.getLastRendered()) + || (firstRowInViewPort < scrollBody .getFirstRendered()))) { announceScrollPosition(); } else { @@ -2639,7 +2642,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * reqFirstRow and reqRows before needing them. See (#14135) */ - setReqFirstRow((firstRowInViewPort - (int) (pageLength * cache_rate))); + setReqFirstRow( + (firstRowInViewPort - (int) (pageLength * cache_rate))); int last = firstRowInViewPort + (int) (cache_rate * pageLength) + pageLength - 1; if (last >= totalRows) { @@ -2662,7 +2666,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (reqFirstRow < firstToBeRendered) { firstToBeRendered = reqFirstRow; - } else if (firstRowInViewPort - (int) (cache_rate * pageLength) > firstToBeRendered) { + } else if (firstRowInViewPort + - (int) (cache_rate * pageLength) > firstToBeRendered) { firstToBeRendered = firstRowInViewPort - (int) (cache_rate * pageLength); if (firstToBeRendered < 0) { @@ -2686,9 +2691,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (lastReqRow > lastToBeRendered) { lastToBeRendered = lastReqRow; - } else if (firstRowInViewPort + pageLength + pageLength - * cache_rate < lastToBeRendered) { - lastToBeRendered = (firstRowInViewPort + pageLength + (int) (pageLength * cache_rate)); + } else if (firstRowInViewPort + pageLength + + pageLength * cache_rate < lastToBeRendered) { + lastToBeRendered = (firstRowInViewPort + pageLength + + (int) (pageLength * cache_rate)); if (lastToBeRendered >= totalRows) { lastToBeRendered = totalRows - 1; } @@ -2708,7 +2714,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, lastToBeRendered = totalRows - 1; } if (reqFirstRow < firstToBeRendered - || (reqFirstRow > firstToBeRendered && (reqFirstRow < firstRendered || reqFirstRow > lastRendered + 1))) { + || (reqFirstRow > firstToBeRendered + && (reqFirstRow < firstRendered + || reqFirstRow > lastRendered + 1))) { setReqFirstRow(firstToBeRendered); } if (lastRendered < lastToBeRendered @@ -2824,8 +2832,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * of the caption container element by the correct amount */ public void resizeCaptionContainer(int rightSpacing) { - int captionContainerWidth = width - - colResizeWidget.getOffsetWidth() - rightSpacing; + int captionContainerWidth = width - colResizeWidget.getOffsetWidth() + - rightSpacing; if (td.getClassName().contains("-asc") || td.getClassName().contains("-desc")) { @@ -2877,8 +2885,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, protected void updateStyleNames(String primaryStyleName) { colResizeWidget.setClassName(primaryStyleName + "-resizer"); sortIndicator.setClassName(primaryStyleName + "-sort-indicator"); - captionContainer.setClassName(primaryStyleName - + "-caption-container"); + captionContainer + .setClassName(primaryStyleName + "-caption-container"); if (sorted) { if (sortAscending) { setStyleName(primaryStyleName + "-header-cell-asc"); @@ -3054,9 +3062,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (enabled && event != null) { if (isResizing || event.getEventTarget().cast() == colResizeWidget) { - if (dragging - && (event.getTypeInt() == Event.ONMOUSEUP || event - .getTypeInt() == Event.ONTOUCHEND)) { + if (dragging && (event.getTypeInt() == Event.ONMOUSEUP + || event.getTypeInt() == Event.ONTOUCHEND)) { // Handle releasing column header on spacer #5318 handleCaptionEvent(event); } else { @@ -3093,8 +3100,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private void createFloatingCopy() { floatingCopyOfHeaderCell = DOM.createDiv(); DOM.setInnerHTML(floatingCopyOfHeaderCell, DOM.getInnerHTML(td)); - floatingCopyOfHeaderCell = DOM - .getChild(floatingCopyOfHeaderCell, 2); + floatingCopyOfHeaderCell = DOM.getChild(floatingCopyOfHeaderCell, + 2); // #12714 the shown "ghost element" should be inside // v-overlay-container, and it should contain the same styles as the // table to enable theming (except v-table & v-widget). @@ -3208,8 +3215,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (!moved) { // mouse event was a click to header -> sort column - if (sortable - && WidgetUtil.isTouchEventOrLeftMouseButton(event)) { + if (sortable && WidgetUtil + .isTouchEventOrLeftMouseButton(event)) { if (sortColumn.equals(cid)) { // just toggle order client.updateVariable(paintableId, "sortascending", @@ -3223,8 +3230,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, scrollBodyPanel.setScrollPosition(0); firstvisible = 0; rowRequestHandler.setReqFirstRow(0); - rowRequestHandler.setReqRows((int) (2 * pageLength - * cache_rate + pageLength)); + rowRequestHandler + .setReqRows((int) (2 * pageLength * cache_rate + + pageLength)); rowRequestHandler.deferRowFetch(); // some validation + // defer 250ms rowRequestHandler.cancel(); // instead of waiting @@ -3251,10 +3259,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // distance in x-axis (the same idea as in #13381) int currentX = WidgetUtil.getTouchOrMouseClientX(event); - if (currentDragX == null - || Math.abs(currentDragX - currentX) > VDragAndDropManager.MINIMUM_DISTANCE_TO_START_DRAG) { - if (dragging - && WidgetUtil.isTouchEventOrLeftMouseButton(event)) { + if (currentDragX == null || Math.abs(currentDragX + - currentX) > VDragAndDropManager.MINIMUM_DISTANCE_TO_START_DRAG) { + if (dragging && WidgetUtil + .isTouchEventOrLeftMouseButton(event)) { if (event.getTypeInt() == Event.ONTOUCHMOVE) { /* * prevent using this event in e.g. scrolling @@ -3289,7 +3297,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, + scrollBody.getCellExtraWidth(); } final int dist = Math.abs(x - slotX); - if (closestDistance == -1 || dist < closestDistance) { + if (closestDistance == -1 + || dist < closestDistance) { closestDistance = dist; closestSlot = i; } @@ -3328,8 +3337,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Ensure last header cell is taking into account possible // column selector - HeaderCell lastCell = tHead.getHeaderCell(tHead - .getVisibleCellCount() - 1); + HeaderCell lastCell = tHead + .getHeaderCell(tHead.getVisibleCellCount() - 1); tHead.resizeCaptionContainer(lastCell); triggerLazyColumnAdjustment(true); @@ -3430,7 +3439,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } if (columnIndex < 0) { columnIndex = 0; - for (Iterator<Widget> it = tHead.iterator(); it.hasNext(); columnIndex++) { + for (Iterator<Widget> it = tHead.iterator(); it + .hasNext(); columnIndex++) { if (it.next() == this) { break; } @@ -3452,8 +3462,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * @return */ public int getNaturalColumnWidth(int columnIndex) { - final int iw = columnIndex == getHierarchyColumnIndex() ? scrollBody - .getMaxIndent() : 0; + final int iw = columnIndex == getHierarchyColumnIndex() + ? scrollBody.getMaxIndent() : 0; saveNaturalColumnWidthIfNotSaved(columnIndex); if (isDefinedWidth()) { if (iw > width) { @@ -3574,7 +3584,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, for (Widget w : visibleCells) { int cellExtraWidth = w.getOffsetWidth(); if (scrollBody != null - && visibleCells.indexOf(w) == getHierarchyColumnIndex() + && visibleCells + .indexOf(w) == getHierarchyColumnIndex() && cellExtraWidth < scrollBody.getMaxIndent()) { // indent must be taken into consideration even if it // hasn't been applied yet @@ -3872,14 +3883,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets, removeSlotFocus(); if (index > 0) { Element child = tr.getChild(index - 1).getFirstChild().cast(); - child.setClassName(VScrollTable.this.getStylePrimaryName() - + "-resizer"); + child.setClassName( + VScrollTable.this.getStylePrimaryName() + "-resizer"); child.addClassName(VScrollTable.this.getStylePrimaryName() + "-focus-slot-right"); } else { Element child = tr.getChild(index).getFirstChild().cast(); - child.setClassName(VScrollTable.this.getStylePrimaryName() - + "-resizer"); + child.setClassName( + VScrollTable.this.getStylePrimaryName() + "-resizer"); child.addClassName(VScrollTable.this.getStylePrimaryName() + "-focus-slot-left"); } @@ -3892,13 +3903,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } if (focusedSlot == 0) { Element child = tr.getChild(focusedSlot).getFirstChild().cast(); - child.setClassName(VScrollTable.this.getStylePrimaryName() - + "-resizer"); + child.setClassName( + VScrollTable.this.getStylePrimaryName() + "-resizer"); } else if (focusedSlot > 0) { Element child = tr.getChild(focusedSlot - 1).getFirstChild() .cast(); - child.setClassName(VScrollTable.this.getStylePrimaryName() - + "-resizer"); + child.setClassName( + VScrollTable.this.getStylePrimaryName() + "-resizer"); } focusedSlot = -1; } @@ -3954,9 +3965,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } // update variable to server - client.updateVariable(paintableId, "collapsedcolumns", - collapsedColumns.toArray(new String[collapsedColumns - .size()]), false); + client.updateVariable( + paintableId, "collapsedcolumns", collapsedColumns + .toArray(new String[collapsedColumns.size()]), + false); // let rowRequestHandler determine proper rows rowRequestHandler.refreshContent(); lazyRevertFocusToRow(currentlyFocusedRow); @@ -4112,8 +4124,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, DOM.appendChild(td, captionContainer); - DOM.sinkEvents(td, Event.MOUSEEVENTS | Event.ONDBLCLICK - | Event.ONCONTEXTMENU); + DOM.sinkEvents(td, + Event.MOUSEEVENTS | Event.ONDBLCLICK | Event.ONCONTEXTMENU); setElement(td); @@ -4121,8 +4133,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } protected void updateStyleNames(String primaryStyleName) { - captionContainer.setClassName(primaryStyleName - + "-footer-container"); + captionContainer + .setClassName(primaryStyleName + "-footer-container"); } /** @@ -4218,8 +4230,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ if (scrollBody != null) { int maxIndent = scrollBody.getMaxIndent(); - if (w < maxIndent - && tFoot.visibleCells.indexOf(this) == getHierarchyColumnIndex()) { + if (w < maxIndent && tFoot.visibleCells + .indexOf(this) == getHierarchyColumnIndex()) { // ensure there's room for the indent w = maxIndent; } @@ -4234,7 +4246,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, int tdWidth = width; int maxIndent = scrollBody.getMaxIndent(); if (tdWidth < maxIndent - && tFoot.visibleCells.indexOf(this) == getHierarchyColumnIndex()) { + && tFoot.visibleCells.indexOf( + this) == getHierarchyColumnIndex()) { // ensure there's room for the indent tdWidth = maxIndent; } @@ -4384,7 +4397,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, .getOffsetWidth() + getHeaderPadding(); if (columnIndex < 0) { columnIndex = 0; - for (Iterator<Widget> it = tHead.iterator(); it.hasNext(); columnIndex++) { + for (Iterator<Widget> it = tHead.iterator(); it + .hasNext(); columnIndex++) { if (it.next() == this) { break; } @@ -4406,8 +4420,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * @return */ public int getNaturalColumnWidth(int columnIndex) { - final int iw = columnIndex == getHierarchyColumnIndex() ? scrollBody - .getMaxIndent() : 0; + final int iw = columnIndex == getHierarchyColumnIndex() + ? scrollBody.getMaxIndent() : 0; saveNaturalColumnWidthIfNotSaved(columnIndex); if (isDefinedWidth()) { if (iw > width) { @@ -4569,8 +4583,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, final String cid = col.getStringAttribute("cid"); updated.add(cid); - String caption = col.hasAttribute("fcaption") ? col - .getStringAttribute("fcaption") : ""; + String caption = col.hasAttribute("fcaption") + ? col.getStringAttribute("fcaption") : ""; FooterCell c = getFooterCell(cid); if (c == null) { c = new FooterCell(cid, caption); @@ -4928,10 +4942,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return; } - int reactFirstRow = (int) (firstRowInViewPort - pageLength - * cache_react_rate); - int reactLastRow = (int) (firstRowInViewPort + pageLength + pageLength - * cache_react_rate); + int reactFirstRow = (int) (firstRowInViewPort + - pageLength * cache_react_rate); + int reactLastRow = (int) (firstRowInViewPort + pageLength + + pageLength * cache_react_rate); if (reactFirstRow < 0) { reactFirstRow = 0; } @@ -4948,8 +4962,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * not waste time rendering a set of rows that will never be * visible... */ - rowRequestHandler.triggerRowFetch(reactFirstRow, reactLastRow - - reactFirstRow + 1, 1); + rowRequestHandler.triggerRowFetch(reactFirstRow, + reactLastRow - reactFirstRow + 1, 1); } else if (lastRendered < reactLastRow) { // get some cache rows below visible area rowRequestHandler.triggerRowFetch(lastRendered + 1, @@ -4963,8 +4977,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * some rare situations the table may make two cache visits to * server. */ - rowRequestHandler.triggerRowFetch(reactFirstRow, firstRendered - - reactFirstRow, 1); + rowRequestHandler.triggerRowFetch(reactFirstRow, + firstRendered - reactFirstRow, 1); } } @@ -4977,8 +4991,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * the number of rows * @return a list of the rows added. */ - protected List<VScrollTableRow> insertRows(UIDL rowData, - int firstIndex, int rows) { + protected List<VScrollTableRow> insertRows(UIDL rowData, int firstIndex, + int rows) { aligns = tHead.getColumnAlignments(); final Iterator<?> it = rowData.getChildIterator(); List<VScrollTableRow> insertedRows = new ArrayList<VScrollTableRow>(); @@ -5101,8 +5115,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } if (index > 0) { VScrollTableRow sibling = getRowByRowIndex(index - 1); - tBodyElement - .insertAfter(row.getElement(), sibling.getElement()); + tBodyElement.insertAfter(row.getElement(), + sibling.getElement()); } else { VScrollTableRow sibling = getRowByRowIndex(index); tBodyElement.insertBefore(row.getElement(), @@ -5311,8 +5325,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Spanned rows might cause an NPE. if (columnIndex < tr.getChildCount()) { Element wrapperdiv = tr.getCells() - .getItem(columnIndex) - .getFirstChildElement().cast(); + .getItem(columnIndex).getFirstChildElement() + .cast(); return wrapperdiv.getOffsetWidth(); } } @@ -5356,8 +5370,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** * This method exists for the needs of {@link VTreeTable} only. May be - * removed or replaced in the future.</br> </br> Returns the maximum - * indent of the hierarcyColumn, if applicable. + * removed or replaced in the future.</br> + * </br> + * Returns the maximum indent of the hierarcyColumn, if applicable. * * @see {@link VScrollTable#getHierarchyColumnIndex()} * @@ -5369,8 +5384,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, /** * This method exists for the needs of {@link VTreeTable} only. May be - * removed or replaced in the future.</br> </br> Calculates the maximum - * indent of the hierarcyColumn, if applicable. + * removed or replaced in the future.</br> + * </br> + * Calculates the maximum indent of the hierarcyColumn, if applicable. */ protected void calculateMaxIndent() { // NOP @@ -5381,8 +5397,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (rows.getLength() == 0) { /* need to temporary add empty row and detect */ VScrollTableRow scrollTableRow = new VScrollTableRow(); - scrollTableRow.updateStyleNames(VScrollTable.this - .getStylePrimaryName()); + scrollTableRow.updateStyleNames( + VScrollTable.this.getStylePrimaryName()); tBodyElement.appendChild(scrollTableRow.getElement()); detectExtrawidth(); tBodyElement.removeChild(scrollTableRow.getElement()); @@ -5395,8 +5411,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // for measuring noCells = true; VScrollTableRow next = (VScrollTableRow) iterator().next(); - boolean sorted = tHead.getHeaderCell(0) != null ? tHead - .getHeaderCell(0).isSorted() : false; + boolean sorted = tHead.getHeaderCell(0) != null + ? tHead.getHeaderCell(0).isSorted() : false; next.addCell(null, "", ALIGN_LEFT, "", true, sorted); firstTD = item.getCells().getItem(0); } @@ -5451,8 +5467,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return -1; } - public class VScrollTableRow extends Panel implements ActionOwner, - ContextMenuOwner { + public class VScrollTableRow extends Panel + implements ActionOwner, ContextMenuOwner { private static final int TOUCHSCROLL_TIMEOUT = 100; private static final int DRAGMODE_MULTIROW = 2; @@ -5484,9 +5500,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, this.rowKey = rowKey; rowElement = Document.get().createTRElement(); setElement(rowElement); - DOM.sinkEvents(getElement(), Event.MOUSEEVENTS - | Event.TOUCHEVENTS | Event.ONDBLCLICK - | Event.ONCONTEXTMENU | VTooltip.TOOLTIP_EVENTS); + DOM.sinkEvents(getElement(), + Event.MOUSEEVENTS | Event.TOUCHEVENTS | Event.ONDBLCLICK + | Event.ONCONTEXTMENU + | VTooltip.TOOLTIP_EVENTS); } public VScrollTableRow(UIDL uidl, char[] aligns) { @@ -5611,8 +5628,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, String description = null; if (uidl.hasAttribute("descr-" + columnId)) { - description = uidl.getStringAttribute("descr-" - + columnId); + description = uidl + .getStringAttribute("descr-" + columnId); } boolean sorted = tHead.getHeaderCell(col).isSorted(); @@ -5688,8 +5705,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, addStyleName(VScrollTable.this.getStylePrimaryName() + "-row-odd"); } else { - addStyleName(VScrollTable.this.getStylePrimaryName() - + "-row"); + addStyleName( + VScrollTable.this.getStylePrimaryName() + "-row"); } } @@ -5763,8 +5780,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ String className = td.getClassName(); String oldPrimaryName = className.split("-cell-content")[0]; - td.setClassName(className.replaceAll(oldPrimaryName, - primaryStyleName)); + td.setClassName( + className.replaceAll(oldPrimaryName, primaryStyleName)); } public void addCell(UIDL rowUidl, Widget w, char align, @@ -5890,8 +5907,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, TooltipInfo info = null; final Element targetTdOrTr = getTdOrTr(target); - if (targetTdOrTr != null - && "td".equals(targetTdOrTr.getTagName().toLowerCase())) { + if (targetTdOrTr != null && "td" + .equals(targetTdOrTr.getTagName().toLowerCase())) { TableCellElement td = (TableCellElement) targetTdOrTr .cast(); info = cellToolTips.get(td); @@ -6049,11 +6066,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, final Element targetTdOrTr = getEventTargetTdOrTr(event); if (type == Event.ONCONTEXTMENU) { showContextMenu(event); - if (enabled - && (actionKeys != null || client - .hasEventListeners( - VScrollTable.this, - TableConstants.ITEM_CLICK_EVENT_ID))) { + if (enabled && (actionKeys != null + || client.hasEventListeners(VScrollTable.this, + TableConstants.ITEM_CLICK_EVENT_ID))) { /* * Prevent browser context menu only if there are * action handlers or item click listeners @@ -6081,10 +6096,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * event there as the event might get canceled before it * gets here. */ - if (mouseUpPreviewMatched - && lastMouseDownTarget != null - && lastMouseDownTarget == getElementTdOrTr(WidgetUtil - .getElementUnderMouse(event))) { + if (mouseUpPreviewMatched && lastMouseDownTarget != null + && lastMouseDownTarget == getElementTdOrTr( + WidgetUtil + .getElementUnderMouse(event))) { // "Click" with left, right or middle button if (targetCellOrRowFound) { @@ -6092,23 +6107,23 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * Queue here, send at the same time as the * corresponding value change event - see #7127 */ - boolean clickEventSent = handleClickEvent( - event, targetTdOrTr, false); + boolean clickEventSent = handleClickEvent(event, + targetTdOrTr, false); if (event.getButton() == Event.BUTTON_LEFT && isSelectable()) { // Ctrl+Shift click - if ((event.getCtrlKey() || event - .getMetaKey()) + if ((event.getCtrlKey() + || event.getMetaKey()) && event.getShiftKey() && isMultiSelectModeDefault()) { toggleShiftSelection(false); setRowFocus(this); // Ctrl click - } else if ((event.getCtrlKey() || event - .getMetaKey()) + } else if ((event.getCtrlKey() + || event.getMetaKey()) && isMultiSelectModeDefault()) { boolean wasSelected = isSelected(); toggleSelection(); @@ -6119,16 +6134,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ selectionRangeStart = this; if (wasSelected) { - removeRowFromUnsentSelectionRanges(this); + removeRowFromUnsentSelectionRanges( + this); } - } else if ((event.getCtrlKey() || event - .getMetaKey()) + } else if ((event.getCtrlKey() + || event.getMetaKey()) && isSingleSelectMode()) { // Ctrl (or meta) click (Single // selection) - if (!isSelected() - || (isSelected() && nullSelectionAllowed)) { + if (!isSelected() || (isSelected() + && nullSelectionAllowed)) { if (!isSelected()) { deselectAll(); @@ -6167,14 +6183,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, deselectAll(); } toggleSelection(); - } else if ((isSingleSelectMode() || isMultiSelectModeSimple()) + } else if ((isSingleSelectMode() + || isMultiSelectModeSimple()) && nullSelectionAllowed) { toggleSelection(); - }/* - * else NOP to avoid excessive server - * visits (selection is removed with - * CTRL/META click) - */ + } /* + * else NOP to avoid excessive server + * visits (selection is removed with + * CTRL/META click) + */ selectionRangeStart = this; setRowFocus(this); @@ -6184,7 +6201,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (BrowserInfo.get().isIE()) { ((Element) event.getEventTarget() .cast()).setPropertyJSO( - "onselectstart", null); + "onselectstart", null); } // Queue value change sendSelectedRows(false); @@ -6223,8 +6240,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * if row is selected. Null check for active * delegate is as a workaround. */ - if (dragmode != 0 - && touchStart != null + if (dragmode != 0 && touchStart != null && (TouchScrollDelegate .getActiveScrollDelegate() == null)) { startRowDrag(touchStart, type, targetTdOrTr); @@ -6313,8 +6329,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * the corresponding mouseup event if it's on a * different part of the page. */ - lastMouseDownTarget = getElementTdOrTr(WidgetUtil - .getElementUnderMouse(event)); + lastMouseDownTarget = getElementTdOrTr( + WidgetUtil.getElementUnderMouse(event)); mouseUpPreviewMatched = false; mouseUpEventPreviewRegistration = Event .addNativePreviewHandler(mouseUpPreviewHandler); @@ -6322,14 +6338,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (targetCellOrRowFound) { setRowFocus(this); ensureFocus(); - if (dragmode != 0 - && (event.getButton() == NativeEvent.BUTTON_LEFT)) { + if (dragmode != 0 && (event + .getButton() == NativeEvent.BUTTON_LEFT)) { startRowDrag(event, type, targetTdOrTr); - } else if (event.getCtrlKey() - || event.getShiftKey() + } else if (event.getCtrlKey() || event.getShiftKey() || event.getMetaKey() - && isMultiSelectModeDefault()) { + && isMultiSelectModeDefault()) { // Prevent default text selection in Firefox event.preventDefault(); @@ -6337,8 +6352,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Prevent default text selection in IE if (BrowserInfo.get().isIE()) { ((Element) event.getEventTarget().cast()) - .setPropertyJSO( - "onselectstart", + .setPropertyJSO("onselectstart", getPreventTextSelectionIEHack()); } @@ -6365,10 +6379,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * axis checks */ Touch touch = event.getChangedTouches().get(0); - if (Math.abs(touch.getClientX() - touchStartX) > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD) { + if (Math.abs(touch.getClientX() + - touchStartX) > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD) { return true; } - if (Math.abs(touch.getClientY() - touchStartY) > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD) { + if (Math.abs(touch.getClientY() + - touchStartY) > TouchScrollDelegate.SIGNIFICANT_MOVE_THRESHOLD) { return true; } return false; @@ -6410,8 +6426,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } } - VDragEvent ev = VDragAndDropManager.get().startDrag( - transferable, event, true); + VDragEvent ev = VDragAndDropManager.get() + .startDrag(transferable, event, true); if (dragmode == DRAGMODE_MULTIROW && isMultiSelectModeAny() && rowKeyIsSelected(rowKey)) { @@ -6421,8 +6437,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Hide rows which are not selected Element dragImage = ev.getDragImage(); int i = 0; - for (Iterator<Widget> iterator = scrollBody.iterator(); iterator - .hasNext();) { + for (Iterator<Widget> iterator = scrollBody + .iterator(); iterator.hasNext();) { VScrollTableRow next = (VScrollTableRow) iterator .next(); @@ -6473,8 +6489,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (!(widget instanceof VLabel) && !(widget instanceof VEmbedded) - && !(widget instanceof VLegacyTextField && ((VLegacyTextField) widget) - .isReadOnly())) { + && !(widget instanceof VLegacyTextField + && ((VLegacyTextField) widget) + .isReadOnly())) { return null; } } @@ -6709,9 +6726,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (cells.hasNext()) { final Object cell = cells.next(); if (cell instanceof String) { - addSpannedCell(uidl, cell.toString(), aligns[0], - "", htmlContentAllowed, false, null, - colCount); + addSpannedCell(uidl, cell.toString(), aligns[0], "", + htmlContentAllowed, false, null, colCount); } else { addSpannedCell(uidl, (Widget) cell, aligns[0], "", false, colCount); @@ -7018,7 +7034,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, - totalExplicitColumnsWidths; if (hierarchyHeaderInNeedOfFurtherHandling != null - && !hierarchyHeaderInNeedOfFurtherHandling.isDefinedWidth()) { + && !hierarchyHeaderInNeedOfFurtherHandling + .isDefinedWidth()) { // ensure the cell gets enough space for the indent int w = hierarchyHeaderInNeedOfFurtherHandling .getNaturalColumnWidth(hierarchyColumnIndex); @@ -7103,8 +7120,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, while (headCells.hasNext()) { HeaderCell hc = (HeaderCell) headCells.next(); if (!hc.isResizing && !hc.isDefinedWidth()) { - setColWidth(colIndex, hc.getWidthWithIndent() + availW - - checksum, false); + setColWidth(colIndex, + hc.getWidthWithIndent() + availW - checksum, + false); break; } colIndex++; @@ -7285,8 +7303,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, @Override public void execute() { - scrollBodyPanel - .setScrollPosition(measureRowHeightOffset(firstRowInViewPort)); + scrollBodyPanel.setScrollPosition( + measureRowHeightOffset(firstRowInViewPort)); } }); } @@ -7302,8 +7320,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * @return html snippet containing possibly an icon + caption text */ protected String buildCaptionHtmlSnippet(UIDL uidl) { - String s = uidl.hasAttribute("caption") ? uidl - .getStringAttribute("caption") : ""; + String s = uidl.hasAttribute("caption") + ? uidl.getStringAttribute("caption") : ""; if (uidl.hasAttribute("icon")) { Icon icon = client.getIcon(uidl.getStringAttribute("icon")); icon.setAlternateText("icon"); @@ -7353,8 +7371,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return; } if (!enabled) { - scrollBodyPanel - .setScrollPosition(measureRowHeightOffset(firstRowInViewPort)); + scrollBodyPanel.setScrollPosition( + measureRowHeightOffset(firstRowInViewPort)); return; } @@ -7392,13 +7410,13 @@ public class VScrollTable extends FlowPanel implements HasWidgets, firstRowInViewPort = maxFirstRow; } - int postLimit = (int) (firstRowInViewPort + (pageLength - 1) + pageLength - * cache_react_rate); + int postLimit = (int) (firstRowInViewPort + (pageLength - 1) + + pageLength * cache_react_rate); if (postLimit > totalRows - 1) { postLimit = totalRows - 1; } - int preLimit = (int) (firstRowInViewPort - pageLength - * cache_react_rate); + int preLimit = (int) (firstRowInViewPort + - pageLength * cache_react_rate); if (preLimit < 0) { preLimit = 0; } @@ -7417,15 +7435,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (allRenderedRowsAreNew()) { // need a totally new set of rows - rowRequestHandler - .setReqFirstRow((firstRowInViewPort - (int) (pageLength * cache_rate))); + rowRequestHandler.setReqFirstRow( + (firstRowInViewPort - (int) (pageLength * cache_rate))); int last = firstRowInViewPort + (int) (cache_rate * pageLength) + pageLength - 1; if (last >= totalRows) { last = totalRows - 1; } - rowRequestHandler.setReqRows(last - - rowRequestHandler.getReqFirstRow() + 1); + rowRequestHandler + .setReqRows(last - rowRequestHandler.getReqFirstRow() + 1); updatedReqRows = false; rowRequestHandler.deferRowFetch(); return; @@ -7433,19 +7451,18 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (preLimit < firstRendered) { // need some rows to the beginning of the rendered area - rowRequestHandler - .setReqFirstRow((int) (firstRowInViewPort - pageLength - * cache_rate)); - rowRequestHandler.setReqRows(firstRendered - - rowRequestHandler.getReqFirstRow()); + rowRequestHandler.setReqFirstRow( + (int) (firstRowInViewPort - pageLength * cache_rate)); + rowRequestHandler.setReqRows( + firstRendered - rowRequestHandler.getReqFirstRow()); rowRequestHandler.deferRowFetch(); return; } if (postLimit > lastRendered) { // need some rows to the end of the rendered area - int reqRows = (int) ((firstRowInViewPort + pageLength + pageLength - * cache_rate) - lastRendered); + int reqRows = (int) ((firstRowInViewPort + pageLength + + pageLength * cache_rate) - lastRendered); rowRequestHandler.triggerRowFetch(lastRendered + 1, reqRows); } } @@ -7454,8 +7471,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, int firstRowInViewPort = calcFirstRowInViewPort(); int firstRendered = scrollBody.getFirstRendered(); int lastRendered = scrollBody.getLastRendered(); - return (firstRowInViewPort - pageLength * cache_rate > lastRendered || firstRowInViewPort - + pageLength + pageLength * cache_rate < firstRendered); + return (firstRowInViewPort - pageLength * cache_rate > lastRendered + || firstRowInViewPort + pageLength + + pageLength * cache_rate < firstRendered); } protected int calcFirstRowInViewPort() { @@ -7478,7 +7496,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, TableDDDetails other = (TableDDDetails) obj; return dropLocation == other.dropLocation && overkey == other.overkey - && ((colkey != null && colkey.equals(other.colkey)) || (colkey == null && other.colkey == null)); + && ((colkey != null && colkey.equals(other.colkey)) + || (colkey == null && other.colkey == null)); } return false; } @@ -7525,10 +7544,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } drag.getDropDetails().put("itemIdOver", dropDetails.overkey + ""); - drag.getDropDetails().put( - "detail", - dropDetails.dropLocation != null ? dropDetails.dropLocation - .toString() : null); + drag.getDropDetails().put("detail", dropDetails.dropLocation != null + ? dropDetails.dropLocation.toString() : null); } @@ -7579,8 +7596,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } private void deEmphasis() { - UIObject.setStyleName(getElement(), - getStylePrimaryName() + "-drag", false); + UIObject.setStyleName(getElement(), getStylePrimaryName() + "-drag", + false); if (lastEmphasized == null) { return; } @@ -7605,8 +7622,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private void emphasis(TableDDDetails details) { deEmphasis(); - UIObject.setStyleName(getElement(), - getStylePrimaryName() + "-drag", true); + UIObject.setStyleName(getElement(), getStylePrimaryName() + "-drag", + true); // iterate old and new emphasized row for (Widget w : scrollBody.renderedRows) { VScrollTableRow row = (VScrollTableRow) w; @@ -7710,7 +7727,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * The keyboard event received * @return true iff the navigation event was handled */ - protected boolean handleNavigation(int keycode, boolean ctrl, boolean shift) { + protected boolean handleNavigation(int keycode, boolean ctrl, + boolean shift) { if (keycode == KeyCodes.KEY_TAB || keycode == KeyCodes.KEY_SHIFT) { // Do not handle tab key return false; @@ -7718,8 +7736,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Down navigation if (!isSelectable() && keycode == getNavigationDownKey()) { - scrollBodyPanel.setScrollPosition(scrollBodyPanel - .getScrollPosition() + scrollingVelocity); + scrollBodyPanel.setScrollPosition( + scrollBodyPanel.getScrollPosition() + scrollingVelocity); return true; } else if (keycode == getNavigationDownKey()) { if (isMultiSelectModeAny() && moveFocusDown()) { @@ -7733,8 +7751,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, // Up navigation if (!isSelectable() && keycode == getNavigationUpKey()) { - scrollBodyPanel.setScrollPosition(scrollBodyPanel - .getScrollPosition() - scrollingVelocity); + scrollBodyPanel.setScrollPosition( + scrollBodyPanel.getScrollPosition() - scrollingVelocity); return true; } else if (keycode == getNavigationUpKey()) { if (isMultiSelectModeAny() && moveFocusUp()) { @@ -7747,14 +7765,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (keycode == getNavigationLeftKey()) { // Left navigation - scrollBodyPanel.setHorizontalScrollPosition(scrollBodyPanel - .getHorizontalScrollPosition() - scrollingVelocity); + scrollBodyPanel.setHorizontalScrollPosition( + scrollBodyPanel.getHorizontalScrollPosition() + - scrollingVelocity); return true; } else if (keycode == getNavigationRightKey()) { // Right navigation - scrollBodyPanel.setHorizontalScrollPosition(scrollBodyPanel - .getHorizontalScrollPosition() + scrollingVelocity); + scrollBodyPanel.setHorizontalScrollPosition( + scrollBodyPanel.getHorizontalScrollPosition() + + scrollingVelocity); return true; } @@ -7946,8 +7966,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } private int getFullyVisibleRowCount() { - return (int) (scrollBodyPanel.getOffsetHeight() / scrollBody - .getRowHeight()); + return (int) (scrollBodyPanel.getOffsetHeight() + / scrollBody.getRowHeight()); } private void scrollByPagelength(int i) { @@ -8010,7 +8030,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, && focusedElement != scrollBodyPanel.getFocusElement() && Util.getConnectorForElement(client, getParent(), focusedElement) == ConnectorMap.get(client) - .getConnector(this)) { + .getConnector(this)) { /* * Steal focus back to the focus handler if it was moved to some * other part of the table. Avoid stealing focus in other cases. @@ -8034,8 +8054,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ private void removeRowFromUnsentSelectionRanges(VScrollTableRow row) { Collection<SelectionRange> newRanges = null; - for (Iterator<SelectionRange> iterator = selectedRowRanges.iterator(); iterator - .hasNext();) { + for (Iterator<SelectionRange> iterator = selectedRowRanges + .iterator(); iterator.hasNext();) { SelectionRange range = iterator.next(); if (range.inRange(row)) { // Split the range if given row is in range @@ -8059,7 +8079,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, */ public boolean isFocusable() { if (scrollBody != null && enabled) { - return !(!hasHorizontalScrollbar() && !hasVerticalScrollbar() && !isSelectable()); + return !(!hasHorizontalScrollbar() && !hasVerticalScrollbar() + && !isSelectable()); } return false; } @@ -8158,7 +8179,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, || keyCode == getNavigationStartKey(); } - public void lazyRevertFocusToRow(final VScrollTableRow currentlyFocusedRow) { + public void lazyRevertFocusToRow( + final VScrollTableRow currentlyFocusedRow) { Scheduler.get().scheduleFinally(new ScheduledCommand() { @Override public void execute() { @@ -8221,14 +8243,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } private boolean isDynamicWidth() { - ComponentConnector paintable = ConnectorMap.get(client).getConnector( - this); + ComponentConnector paintable = ConnectorMap.get(client) + .getConnector(this); return paintable.isUndefinedWidth(); } private boolean isDynamicHeight() { - ComponentConnector paintable = ConnectorMap.get(client).getConnector( - this); + ComponentConnector paintable = ConnectorMap.get(client) + .getConnector(this); if (paintable == null) { // This should be refactored. As isDynamicHeight can be called from // a timer it is possible that the connector has been unregistered @@ -8265,15 +8287,17 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private static final RegExp SUBPART_FOOTER_REGEXP = RegExp .compile(SUBPART_FOOTER + "\\[(\\d+)\\]"); /** Matches row[ix] - used for extracting the index of the targeted row */ - private static final RegExp SUBPART_ROW_REGEXP = RegExp.compile(SUBPART_ROW - + "\\[(\\d+)]"); - /** Matches col[ix] - used for extracting the index of the targeted column */ - private static final RegExp SUBPART_ROW_COL_REGEXP = RegExp - .compile(SUBPART_ROW + "\\[(\\d+)\\]/" + SUBPART_COL - + "\\[(\\d+)\\]"); + private static final RegExp SUBPART_ROW_REGEXP = RegExp + .compile(SUBPART_ROW + "\\[(\\d+)]"); + /** + * Matches col[ix] - used for extracting the index of the targeted column + */ + private static final RegExp SUBPART_ROW_COL_REGEXP = RegExp.compile( + SUBPART_ROW + "\\[(\\d+)\\]/" + SUBPART_COL + "\\[(\\d+)\\]"); @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (SUBPART_ROW_COL_REGEXP.test(subPart)) { MatchResult result = SUBPART_ROW_COL_REGEXP.exec(subPart); int rowIx = Integer.valueOf(result.getGroup(1)); @@ -8315,7 +8339,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { Widget widget = WidgetUtil.findWidget(subElement, null); if (widget instanceof HeaderCell) { return SUBPART_HEADER + "[" + tHead.visibleCells.indexOf(widget) @@ -8330,7 +8355,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (rowIx >= 0) { int colIx = -1; for (int ix = 0; ix < row.getElement().getChildCount(); ix++) { - if (row.getElement().getChild(ix).isOrHasChild(subElement)) { + if (row.getElement().getChild(ix) + .isOrHasChild(subElement)) { colIx = ix; break; } diff --git a/client/src/main/java/com/vaadin/client/ui/VSlider.java b/client/src/main/java/com/vaadin/client/ui/VSlider.java index 952c387539..0d7ab474e1 100644 --- a/client/src/main/java/com/vaadin/client/ui/VSlider.java +++ b/client/src/main/java/com/vaadin/client/ui/VSlider.java @@ -37,8 +37,8 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.WidgetUtil; import com.vaadin.shared.ui.slider.SliderOrientation; -public class VSlider extends SimpleFocusablePanel implements Field, - HasValue<Double>, SubPartAware { +public class VSlider extends SimpleFocusablePanel + implements Field, HasValue<Double>, SubPartAware { public static final String CLASSNAME = "v-slider"; @@ -137,7 +137,8 @@ public class VSlider extends SimpleFocusablePanel implements Field, updateStyleNames(style, true); } - protected void updateStyleNames(String styleName, boolean isPrimaryStyleName) { + protected void updateStyleNames(String styleName, + boolean isPrimaryStyleName) { feedbackPopup.removeStyleName(getStylePrimaryName() + "-feedback"); removeStyleName(getStylePrimaryName() + "-vertical"); @@ -282,8 +283,10 @@ public class VSlider extends SimpleFocusablePanel implements Field, increaseValue(true); } else if (DOM.eventGetType(event) == Event.MOUSEEVENTS) { processBaseEvent(event); - } else if ((BrowserInfo.get().isGecko() && DOM.eventGetType(event) == Event.ONKEYPRESS) - || (!BrowserInfo.get().isGecko() && DOM.eventGetType(event) == Event.ONKEYDOWN)) { + } else if ((BrowserInfo.get().isGecko() + && DOM.eventGetType(event) == Event.ONKEYPRESS) + || (!BrowserInfo.get().isGecko() + && DOM.eventGetType(event) == Event.ONKEYDOWN)) { if (handleNavigation(event.getKeyCode(), event.getCtrlKey(), event.getShiftKey())) { @@ -403,8 +406,8 @@ public class VSlider extends SimpleFocusablePanel implements Field, } if (isVertical()) { - v = ((baseSize - (coord - baseOffset)) / (double) (baseSize - handleSize)) - * (max - min) + min; + v = ((baseSize - (coord - baseOffset)) + / (double) (baseSize - handleSize)) * (max - min) + min; } else { v = ((coord - baseOffset) / (double) (baseSize - handleSize)) * (max - min) + min; @@ -657,7 +660,8 @@ public class VSlider extends SimpleFocusablePanel implements Field, } @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (subPart.equals("popup")) { feedbackPopup.show(); return feedbackPopup.getElement(); @@ -666,7 +670,8 @@ public class VSlider extends SimpleFocusablePanel implements Field, } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (feedbackPopup.getElement().isOrHasChild(subElement)) { return "popup"; } diff --git a/client/src/main/java/com/vaadin/client/ui/VSplitPanelVertical.java b/client/src/main/java/com/vaadin/client/ui/VSplitPanelVertical.java index 7baed03ca3..5f645887bc 100644 --- a/client/src/main/java/com/vaadin/client/ui/VSplitPanelVertical.java +++ b/client/src/main/java/com/vaadin/client/ui/VSplitPanelVertical.java @@ -32,7 +32,8 @@ public class VSplitPanelVertical extends VAbstractSplitPanel { getFirstContainer().getStyle().setOverflow(Overflow.HIDDEN); } - if (getSecondWidget() != null && isWidgetFullHeight(getSecondWidget())) { + if (getSecondWidget() != null + && isWidgetFullHeight(getSecondWidget())) { getSecondContainer().getStyle().setOverflow(Overflow.HIDDEN); } } diff --git a/client/src/main/java/com/vaadin/client/ui/VTabsheet.java b/client/src/main/java/com/vaadin/client/ui/VTabsheet.java index 9b1608cb65..74b3cf3871 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/main/java/com/vaadin/client/ui/VTabsheet.java @@ -77,7 +77,8 @@ import com.vaadin.shared.ui.tabsheet.TabState; import com.vaadin.shared.ui.tabsheet.TabsheetServerRpc; import com.vaadin.shared.ui.tabsheet.TabsheetState; -public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware { +public class VTabsheet extends VTabsheetBase + implements Focusable, SubPartAware { private static final String PREV_SCROLLER_DISABLED_CLASSNAME = "Prev-disabled"; @@ -284,7 +285,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } @Override - public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { + public HandlerRegistration addMouseDownHandler( + MouseDownHandler handler) { return addDomHandler(handler, MouseDownEvent.getType()); } @@ -334,7 +336,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } private boolean update(TabState tabState) { - if (tabState.description != null || tabState.componentError != null) { + if (tabState.description != null + || tabState.componentError != null) { setTooltipInfo(new TooltipInfo(tabState.description, tabState.componentError, this)); } else { @@ -348,9 +351,9 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware boolean ret = updateCaptionWithoutOwner(captionString, !tabState.enabled, hasAttribute(tabState.description), hasAttribute(tabState.componentError), - tab.getTabsheet().connector - .getResourceUrl(ComponentConstants.ICON_RESOURCE - + tabState.key), tabState.iconAltText); + tab.getTabsheet().connector.getResourceUrl( + ComponentConstants.ICON_RESOURCE + tabState.key), + tabState.iconAltText); setClosable(tabState.closable); @@ -602,7 +605,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } // FIXME: Shouldn't something be selected instead? - int scrollerIndexCandidate = getTabIndex(getTabsheet().scrollerPositionTabId); + int scrollerIndexCandidate = getTabIndex( + getTabsheet().scrollerPositionTabId); if (scrollerIndexCandidate < 0) { // The tab with id scrollerPositionTabId has been removed scrollerIndexCandidate = getTabsheet().scrollerIndex; @@ -901,15 +905,15 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware scrollerPrev = DOM.createButton(); scrollerPrev.setTabIndex(-1); - DOM.setElementProperty(scrollerPrev, "className", SCROLLER_CLASSNAME - + "Prev"); + DOM.setElementProperty(scrollerPrev, "className", + SCROLLER_CLASSNAME + "Prev"); Roles.getTablistRole().setAriaHiddenState(scrollerPrev, true); DOM.sinkEvents(scrollerPrev, Event.ONCLICK | Event.ONMOUSEDOWN); scrollerNext = DOM.createButton(); scrollerNext.setTabIndex(-1); - DOM.setElementProperty(scrollerNext, "className", SCROLLER_CLASSNAME - + "Next"); + DOM.setElementProperty(scrollerNext, "className", + SCROLLER_CLASSNAME + "Next"); Roles.getTablistRole().setAriaHiddenState(scrollerNext, true); DOM.sinkEvents(scrollerNext, Event.ONCLICK | Event.ONMOUSEDOWN); @@ -923,7 +927,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware deco = DOM.createDiv(); tb.setStyleName(CLASSNAME + "-tabs"); - DOM.setElementProperty(contentNode, "className", CLASSNAME + "-content"); + DOM.setElementProperty(contentNode, "className", + CLASSNAME + "-content"); DOM.setElementProperty(deco, "className", CLASSNAME + "-deco"); add(tb, tabs); @@ -1020,7 +1025,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware // style inheritance) if (ComponentStateUtil.hasStyles(state)) { final List<String> styles = state.styles; - if (currentStyle == null || !currentStyle.equals(styles.toString())) { + if (currentStyle == null + || !currentStyle.equals(styles.toString())) { currentStyle = styles.toString(); final String tabsBaseClass = TABS_CLASSNAME; String tabsClass = tabsBaseClass; @@ -1041,8 +1047,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } else { tb.setStyleName(CLASSNAME + "-tabs"); DOM.setElementProperty(tabs, "className", TABS_CLASSNAME); - DOM.setElementProperty(contentNode, "className", CLASSNAME - + "-content"); + DOM.setElementProperty(contentNode, "className", + CLASSNAME + "-content"); DOM.setElementProperty(deco, "className", CLASSNAME + "-deco"); } } @@ -1109,8 +1115,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } private boolean isScrollerPrevDisabled() { - return scrollerPrev.getClassName().contains( - PREV_SCROLLER_DISABLED_CLASSNAME); + return scrollerPrev.getClassName() + .contains(PREV_SCROLLER_DISABLED_CLASSNAME); } private boolean isScrollerHidden() { @@ -1319,18 +1325,16 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware boolean clipped = isClippedTabs(); if (tb.getTabCount() > 0 && tb.isVisible() && (scrolled || clipped)) { scroller.getStyle().clearDisplay(); - DOM.setElementProperty(scrollerPrev, "className", - SCROLLER_CLASSNAME - + (scrolled ? "Prev" - : PREV_SCROLLER_DISABLED_CLASSNAME)); + DOM.setElementProperty(scrollerPrev, "className", SCROLLER_CLASSNAME + + (scrolled ? "Prev" : PREV_SCROLLER_DISABLED_CLASSNAME)); DOM.setElementProperty(scrollerNext, "className", SCROLLER_CLASSNAME + (clipped ? "Next" : "Next-disabled")); // the active tab should be focusable if and only if it is visible boolean isActiveTabVisible = scrollerIndex <= activeTabIndex && !isClipped(tb.selected); - tb.selected.setTabulatorIndex(isActiveTabVisible ? tabulatorIndex - : -1); + tb.selected.setTabulatorIndex( + isActiveTabVisible ? tabulatorIndex : -1); } else { scroller.getStyle().setDisplay(Display.NONE); @@ -1358,8 +1362,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware /** For internal use only. May be removed or replaced in the future. */ public void showAllTabs() { scrollerIndex = tb.getFirstVisibleTab(); - scrollerPositionTabId = scrollerIndex < 0 ? null : tb - .getTab(scrollerIndex).id; + scrollerPositionTabId = scrollerIndex < 0 ? null + : tb.getTab(scrollerIndex).id; for (int i = 0; i < tb.getTabCount(); i++) { Tab t = tb.getTab(i); if (!t.isHiddenOnServer()) { @@ -1373,9 +1377,10 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } private boolean isClippedTabs() { - return (tb.getOffsetWidth() - DOM.getElementPropertyInt((Element) tb - .getContainerElement().getLastChild().cast(), "offsetWidth")) > getOffsetWidth() - - (isScrolledTabs() ? scroller.getOffsetWidth() : 0); + return (tb.getOffsetWidth() - DOM.getElementPropertyInt( + (Element) tb.getContainerElement().getLastChild().cast(), + "offsetWidth")) > getOffsetWidth() + - (isScrolledTabs() ? scroller.getOffsetWidth() : 0); } private boolean isClipped(Tab tab) { @@ -1733,8 +1738,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware focusBlurManager.onFocus(focusSource); if (focusSource.hasTooltip()) { - focusSource.setAssistiveDescription(getVTooltip() - .getUniqueId()); + focusSource.setAssistiveDescription( + getVTooltip().getUniqueId()); getVTooltip().showAssistive(focusSource.getTooltipInfo()); } @@ -1968,7 +1973,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware .compile("tab\\[(\\d+)](.*)"); @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if ("tabpanel".equals(subPart)) { return DOM.asOld(tabPanel.getElement().getFirstChildElement()); } else if (SUBPART_TAB_REGEXP.test(subPart)) { @@ -1989,16 +1995,16 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (tabPanel.getElement().equals(subElement.getParentElement()) || tabPanel.getElement().equals(subElement)) { return "tabpanel"; } else { for (int i = 0; i < tb.getTabCount(); ++i) { Tab tab = tb.getTab(i); - if (tab.isClosable() - && tab.tabCaption.getCloseButton().isOrHasChild( - subElement)) { + if (tab.isClosable() && tab.tabCaption.getCloseButton() + .isOrHasChild(subElement)) { return "tab[" + i + "]/close"; } else if (tab.getElement().isOrHasChild(subElement)) { return "tab[" + i + "]"; diff --git a/client/src/main/java/com/vaadin/client/ui/VTabsheetPanel.java b/client/src/main/java/com/vaadin/client/ui/VTabsheetPanel.java index 240f493907..6360a32785 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTabsheetPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VTabsheetPanel.java @@ -129,8 +129,8 @@ public class VTabsheetPanel extends ComplexPanel { hide(DOM.getParent(visibleWidget.getElement())); } visibleWidget = newVisible; - touchScrollHandler.setElements(visibleWidget.getElement() - .getParentElement()); + touchScrollHandler + .setElements(visibleWidget.getElement().getParentElement()); } // Always ensure the selected tab is visible. If server prevents a tab // change we might end up here with visibleWidget == newVisible but its diff --git a/client/src/main/java/com/vaadin/client/ui/VTextualDate.java b/client/src/main/java/com/vaadin/client/ui/VTextualDate.java index 96f6ce490d..c71108c86f 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTextualDate.java +++ b/client/src/main/java/com/vaadin/client/ui/VTextualDate.java @@ -80,11 +80,10 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, text.setText(""); setPrompting(false); } - if (getClient() != null - && getClient().hasEventListeners(VTextualDate.this, - EventId.FOCUS)) { - getClient() - .updateVariable(getId(), EventId.FOCUS, "", true); + if (getClient() != null && getClient() + .hasEventListeners(VTextualDate.this, EventId.FOCUS)) { + getClient().updateVariable(getId(), EventId.FOCUS, "", + true); } // Needed for tooltip event handling @@ -102,9 +101,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, if (prompting) { text.setText(readonly ? "" : inputPrompt); } - if (getClient() != null - && getClient().hasEventListeners(VTextualDate.this, - EventId.BLUR)) { + if (getClient() != null && getClient() + .hasEventListeners(VTextualDate.this, EventId.BLUR)) { getClient().updateVariable(getId(), EventId.BLUR, "", true); } @@ -144,11 +142,13 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, } else { frmString += " HH"; } - if (currentResolution.getCalendarField() >= Resolution.MINUTE - .getCalendarField()) { + if (currentResolution + .getCalendarField() >= Resolution.MINUTE + .getCalendarField()) { frmString += ":mm"; - if (currentResolution.getCalendarField() >= Resolution.SECOND - .getCalendarField()) { + if (currentResolution + .getCalendarField() >= Resolution.SECOND + .getCalendarField()) { frmString += ":ss"; } } @@ -253,9 +253,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, // presentation. // FIXME: Add a description/example here of when this is // needed - text.setValue( - getDateTimeService().formatDate(getDate(), - getFormatString()), false); + text.setValue(getDateTimeService().formatDate(getDate(), + getFormatString()), false); } // remove possibly added invalid value indication @@ -275,8 +274,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME); } // always send the date string - getClient() - .updateVariable(getId(), "dateString", text.getText(), false); + getClient().updateVariable(getId(), "dateString", text.getText(), + false); // Update variables // (only the smallest defining resolution needs to be @@ -364,12 +363,9 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, } protected void setText(String text) { - if (inputPrompt != null - && (text == null || "".equals(text)) - && !this.text.getStyleName() - .contains( - VLegacyTextField.CLASSNAME + "-" - + VLegacyTextField.CLASSNAME_FOCUS)) { + if (inputPrompt != null && (text == null || "".equals(text)) + && !this.text.getStyleName().contains(VLegacyTextField.CLASSNAME + + "-" + VLegacyTextField.CLASSNAME_FOCUS)) { text = readonly ? "" : inputPrompt; setPrompting(true); } else { @@ -382,7 +378,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, private final String TEXTFIELD_ID = "field"; @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (subPart.equals(TEXTFIELD_ID)) { return text.getElement(); } @@ -391,7 +388,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (text.getElement().isOrHasChild(subElement)) { return TEXTFIELD_ID; } diff --git a/client/src/main/java/com/vaadin/client/ui/VTree.java b/client/src/main/java/com/vaadin/client/ui/VTree.java index efbafd0cb7..86d5c0afcd 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTree.java +++ b/client/src/main/java/com/vaadin/client/ui/VTree.java @@ -81,9 +81,9 @@ import com.vaadin.shared.ui.tree.TreeConstants; /** * */ -public class VTree extends FocusElementPanel implements VHasDropHandler, - FocusHandler, BlurHandler, KeyPressHandler, KeyDownHandler, - SubPartAware, ActionOwner, HandlesAriaCaption { +public class VTree extends FocusElementPanel + implements VHasDropHandler, FocusHandler, BlurHandler, KeyPressHandler, + KeyDownHandler, SubPartAware, ActionOwner, HandlesAriaCaption { private String lastNodeKey = ""; public static final String CLASSNAME = "v-tree"; @@ -254,8 +254,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, } else if (event.getTypeInt() == Event.ONMOUSEUP) { // Remove IE text selection hack if (BrowserInfo.get().isIE()) { - ((Element) event.getEventTarget().cast()).setPropertyJSO( - "onselectstart", null); + ((Element) event.getEventTarget().cast()) + .setPropertyJSO("onselectstart", null); } } else if (event.getTypeInt() == Event.ONKEYUP) { if (selectionHasChanged) { @@ -333,8 +333,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, drag.getDropDetails().put("itemIdOver", currentMouseOverKey); if (currentMouseOverKey != null) { TreeNode treeNode = getNodeByKey(currentMouseOverKey); - VerticalDropLocation detail = treeNode.getDropDetail(drag - .getCurrentGwtEvent()); + VerticalDropLocation detail = treeNode + .getDropDetail(drag.getCurrentGwtEvent()); Boolean overTreeNode = null; if (treeNode != null && !treeNode.isLeaf() && detail == VerticalDropLocation.MIDDLE) { @@ -370,17 +370,20 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, @Override public void dragOver(final VDragEvent currentDrag) { - final Object oldIdOver = currentDrag.getDropDetails().get( - "itemIdOver"); + final Object oldIdOver = currentDrag.getDropDetails() + .get("itemIdOver"); final VerticalDropLocation oldDetail = (VerticalDropLocation) currentDrag .getDropDetails().get("detail"); updateTreeRelatedDragData(currentDrag); final VerticalDropLocation detail = (VerticalDropLocation) currentDrag .getDropDetails().get("detail"); - boolean nodeHasChanged = (currentMouseOverKey != null && currentMouseOverKey != oldIdOver) - || (currentMouseOverKey == null && oldIdOver != null); - boolean detailHasChanded = (detail != null && detail != oldDetail) + boolean nodeHasChanged = (currentMouseOverKey != null + && currentMouseOverKey != oldIdOver) + || (currentMouseOverKey == null + && oldIdOver != null); + boolean detailHasChanded = (detail != null + && detail != oldDetail) || (detail == null && oldDetail != null); if (nodeHasChanged || detailHasChanded) { @@ -396,8 +399,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, public void accepted(VDragEvent event) { VerticalDropLocation curDetail = (VerticalDropLocation) event .getDropDetails().get("detail"); - if (curDetail == detail - && newKey.equals(currentMouseOverKey)) { + if (curDetail == detail && newKey + .equals(currentMouseOverKey)) { getNodeByKey(newKey).emphasis(detail); } /* @@ -710,7 +713,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, final int type = DOM.eventGetType(event); final Element target = DOM.eventGetTarget(event); - if (type == Event.ONLOAD && icon != null && target == icon.getElement()) { + if (type == Event.ONLOAD && icon != null + && target == icon.getElement()) { iconLoaded.trigger(); } @@ -719,9 +723,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, } final boolean inCaption = isCaptionElement(target); - if (inCaption - && client.hasEventListeners(VTree.this, - TreeConstants.ITEM_CLICK_EVENT_ID) + if (inCaption && client.hasEventListeners(VTree.this, + TreeConstants.ITEM_CLICK_EVENT_ID) && (type == Event.ONDBLCLICK || type == Event.ONMOUSEUP)) { fireClick(event); @@ -751,11 +754,10 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, if (dragMode != 0 || dropHandler != null) { if (type == Event.ONMOUSEDOWN || type == Event.ONTOUCHSTART) { - if (nodeCaptionDiv.isOrHasChild((Node) event - .getEventTarget().cast())) { - if (dragMode > 0 - && (type == Event.ONTOUCHSTART || event - .getButton() == NativeEvent.BUTTON_LEFT)) { + if (nodeCaptionDiv.isOrHasChild( + (Node) event.getEventTarget().cast())) { + if (dragMode > 0 && (type == Event.ONTOUCHSTART || event + .getButton() == NativeEvent.BUTTON_LEFT)) { mouseDownEvent = event; // save event for possible // dd operation if (type == Event.ONMOUSEDOWN) { @@ -775,18 +777,17 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, } } } - } else if (type == Event.ONMOUSEMOVE - || type == Event.ONMOUSEOUT + } else if (type == Event.ONMOUSEMOVE || type == Event.ONMOUSEOUT || type == Event.ONTOUCHMOVE) { if (mouseDownEvent != null) { // start actual drag on slight move when mouse is down VTransferable t = new VTransferable(); - t.setDragSource(ConnectorMap.get(client).getConnector( - VTree.this)); + t.setDragSource(ConnectorMap.get(client) + .getConnector(VTree.this)); t.setData("itemId", key); - VDragEvent drag = VDragAndDropManager.get().startDrag( - t, mouseDownEvent, true); + VDragEvent drag = VDragAndDropManager.get().startDrag(t, + mouseDownEvent, true); drag.createDragImage(nodeCaptionDiv, true); event.stopPropagation(); @@ -815,9 +816,10 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, * The element to check * @return true if the element is the caption or the icon */ - public boolean isCaptionElement(com.google.gwt.dom.client.Element target) { - return (target == nodeCaptionSpan || (icon != null && target == icon - .getElement())); + public boolean isCaptionElement( + com.google.gwt.dom.client.Element target) { + return (target == nodeCaptionSpan + || (icon != null && target == icon.getElement())); } private void fireClick(final Event evt) { @@ -849,8 +851,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, // selection event happening after this. In all other cases // we want to send it immediately. clickEventPending = false; - if ((details.getButton() == MouseButton.LEFT || details - .getButton() == MouseButton.MIDDLE) + if ((details.getButton() == MouseButton.LEFT + || details.getButton() == MouseButton.MIDDLE) && !details.isDoubleClick() && selectable) { // Probably a selection that will cause a value change // event to be sent @@ -864,7 +866,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, clickEventPending = false; } } - client.updateVariable(paintableId, "clickedKey", key, false); + client.updateVariable(paintableId, "clickedKey", key, + false); client.updateVariable(paintableId, "clickEvent", details.toString(), !clickEventPending); } @@ -906,8 +909,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, Id.of(labelId)); nodeCaptionDiv = DOM.createDiv(); - DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME - + "-caption"); + DOM.setElementProperty(nodeCaptionDiv, "className", + CLASSNAME + "-caption"); Element wrapper = DOM.createDiv(); wrapper.setId(labelId); wrapper.setAttribute("for", treeItemId); @@ -948,8 +951,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, } if (state) { if (!childrenLoaded && notifyServer) { - client.updateVariable(paintableId, "requestChildTree", - true, false); + client.updateVariable(paintableId, "requestChildTree", true, + false); } if (notifyServer) { client.updateVariable(paintableId, "expand", @@ -1160,10 +1163,10 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, public void setNodeStyleName(String styleName) { addStyleName(TreeNode.CLASSNAME + "-" + styleName); - setStyleName(nodeCaptionDiv, TreeNode.CLASSNAME + "-caption-" - + styleName, true); - childNodeContainer.addStyleName(TreeNode.CLASSNAME + "-children-" - + styleName); + setStyleName(nodeCaptionDiv, + TreeNode.CLASSNAME + "-caption-" + styleName, true); + childNodeContainer.addStyleName( + TreeNode.CLASSNAME + "-children-" + styleName); } @@ -1369,8 +1372,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, TreeNode currentNode = startNode; while (startParent != null && startParent != commonParent) { List<TreeNode> startChildren = startParent.getChildren(); - for (int i = startChildren.indexOf(currentNode) + 1; i < startChildren - .size(); i++) { + for (int i = startChildren.indexOf(currentNode) + + 1; i < startChildren.size(); i++) { selectAllChildren(startChildren.get(i), true); } @@ -1418,7 +1421,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, } /** - * Selects a range of items which are in direct relation with each other.<br/> + * Selects a range of items which are in direct relation with each + * other.<br/> * NOTE: The start node <b>MUST</b> be before the end node! * * @param startNode @@ -1820,9 +1824,9 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, // Selection if (keycode == getNavigationSelectKey()) { if (!focusedNode.isSelected()) { - selectNode( - focusedNode, - (!isMultiselect || multiSelectMode == MULTISELECT_MODE_SIMPLE) + selectNode(focusedNode, + (!isMultiselect + || multiSelectMode == MULTISELECT_MODE_SIMPLE) && selectable); } else { deselectNode(focusedNode); @@ -1899,7 +1903,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, * @return The bottom most child */ private TreeNode getLastVisibleChildInTree(TreeNode root) { - if (root.isLeaf() || !root.getState() || root.getChildren().size() == 0) { + if (root.isLeaf() || !root.getState() + || root.getChildren().size() == 0) { return root; } List<TreeNode> children = root.getChildren(); @@ -2082,7 +2087,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, * .lang.String) */ @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if ("fe".equals(subPart)) { if (BrowserInfo.get().isOpera() && focusedNode != null) { return focusedNode.getElement(); @@ -2135,7 +2141,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, * .gwt.user.client.Element) */ @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { // Supported identifiers: // // n[index]/n[index]/n[index]{/expand} diff --git a/client/src/main/java/com/vaadin/client/ui/VTreeTable.java b/client/src/main/java/com/vaadin/client/ui/VTreeTable.java index 0ba84af4bb..2dd912acaa 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTreeTable.java +++ b/client/src/main/java/com/vaadin/client/ui/VTreeTable.java @@ -48,7 +48,8 @@ public class VTreeTable extends VScrollTable { public final boolean ctrl; public final boolean shift; - public PendingNavigationEvent(int keycode, boolean ctrl, boolean shift) { + public PendingNavigationEvent(int keycode, boolean ctrl, + boolean shift) { this.keycode = keycode; this.ctrl = ctrl; this.shift = shift; @@ -143,8 +144,8 @@ public class VTreeTable extends VScrollTable { return new VTreeTableRow(uidl, aligns2); } - public class VTreeTableRow extends - VScrollTable.VScrollTableBody.VScrollTableRow { + public class VTreeTableRow + extends VScrollTable.VScrollTableBody.VScrollTableRow { private boolean isTreeCellAdded = false; private SpanElement treeSpacer; @@ -163,8 +164,8 @@ public class VTreeTable extends VScrollTable { public void addCell(UIDL rowUidl, String text, char align, String style, boolean textIsHTML, boolean isSorted, String description) { - super.addCell(rowUidl, text, align, style, textIsHTML, - isSorted, description); + super.addCell(rowUidl, text, align, style, textIsHTML, isSorted, + description); addTreeSpacer(rowUidl); } @@ -175,8 +176,8 @@ public class VTreeTable extends VScrollTable { .getFirstChild(); if (rowUidl.hasAttribute("icon")) { - Icon icon = client.getIcon(rowUidl - .getStringAttribute("icon")); + Icon icon = client + .getIcon(rowUidl.getStringAttribute("icon")); icon.setAlternateText("icon"); container.insertFirst(icon.getElement()); } @@ -193,8 +194,8 @@ public class VTreeTable extends VScrollTable { treeSpacer.setClassName(classname); container.insertFirst(treeSpacer); - depth = rowUidl.hasAttribute("depth") ? rowUidl - .getIntAttribute("depth") : 0; + depth = rowUidl.hasAttribute("depth") + ? rowUidl.getIntAttribute("depth") : 0; setIndent(); isTreeCellAdded = true; return true; @@ -355,9 +356,8 @@ public class VTreeTable extends VScrollTable { if (cells.hasNext()) { final Object cell = cells.next(); if (cell instanceof String) { - addSpannedCell(uidl, cell.toString(), aligns[0], - "", htmlContentAllowed, false, null, - colCount); + addSpannedCell(uidl, cell.toString(), aligns[0], "", + htmlContentAllowed, false, null, colCount); } else { addSpannedCell(uidl, (Widget) cell, aligns[0], "", false, colCount); @@ -625,7 +625,8 @@ public class VTreeTable extends VScrollTable { public RowExpandAnimation(List<VScrollTableRow> rows) { this.rows = rows; buildAndInsertAnimatingDiv(); - preparator = new AnimationPreparator(rows.get(0).getIndex() - 1); + preparator = new AnimationPreparator( + rows.get(0).getIndex() - 1); preparator.prepareTableForAnimation(); for (VScrollTableRow row : rows) { cloneAndAppendRow(row); @@ -724,7 +725,8 @@ public class VTreeTable extends VScrollTable { return td.getChild(0).cast(); } - private void resetCellWrapperDivsDisplayProperty(VScrollTableRow row) { + private void resetCellWrapperDivsDisplayProperty( + VScrollTableRow row) { Element tr = row.getElement(); for (int ix = 0; ix < tr.getChildCount(); ix++) { getWrapperDiv(tr, ix).getStyle().clearProperty("display"); @@ -804,8 +806,9 @@ public class VTreeTable extends VScrollTable { VTreeTableRow focusedRow = (VTreeTableRow) getFocusedRow(); if (focusedRow != null) { - if (focusedRow.canHaveChildren - && ((keycode == KeyCodes.KEY_RIGHT && !focusedRow.open) || (keycode == KeyCodes.KEY_LEFT && focusedRow.open))) { + if (focusedRow.canHaveChildren && ((keycode == KeyCodes.KEY_RIGHT + && !focusedRow.open) + || (keycode == KeyCodes.KEY_LEFT && focusedRow.open))) { if (!ctrl) { client.updateVariable(paintableId, "selectCollapsed", true, false); diff --git a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java index 8495a25f68..e2d06d811b 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VTwinColSelect.java @@ -74,8 +74,8 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, * A ListBox which catches double clicks * */ - public class DoubleClickListBox extends ListBox implements - HasDoubleClickHandlers { + public class DoubleClickListBox extends ListBox + implements HasDoubleClickHandlers { public DoubleClickListBox(boolean isMultipleSelect) { super(isMultipleSelect); } @@ -170,13 +170,15 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, /** For internal use only. May be removed or replaced in the future. */ public void updateCaptions(UIDL uidl) { String leftCaption = (uidl - .hasAttribute(TwinColSelectConstants.ATTRIBUTE_LEFT_CAPTION) ? uidl - .getStringAttribute(TwinColSelectConstants.ATTRIBUTE_LEFT_CAPTION) - : null); + .hasAttribute(TwinColSelectConstants.ATTRIBUTE_LEFT_CAPTION) + ? uidl.getStringAttribute( + TwinColSelectConstants.ATTRIBUTE_LEFT_CAPTION) + : null); String rightCaption = (uidl - .hasAttribute(TwinColSelectConstants.ATTRIBUTE_RIGHT_CAPTION) ? uidl - .getStringAttribute(TwinColSelectConstants.ATTRIBUTE_RIGHT_CAPTION) - : null); + .hasAttribute(TwinColSelectConstants.ATTRIBUTE_RIGHT_CAPTION) + ? uidl.getStringAttribute( + TwinColSelectConstants.ATTRIBUTE_RIGHT_CAPTION) + : null); boolean hasCaptions = (leftCaption != null || rightCaption != null); @@ -389,13 +391,14 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, /** For internal use only. May be removed or replaced in the future. */ public void setInternalWidths() { getElement().getStyle().setPosition(Position.RELATIVE); - int bordersAndPaddings = WidgetUtil.measureHorizontalPaddingAndBorder( - buttons.getElement(), 0); + int bordersAndPaddings = WidgetUtil + .measureHorizontalPaddingAndBorder(buttons.getElement(), 0); int buttonWidth = WidgetUtil.getRequiredWidth(buttons); int totalWidth = getOffsetWidth(); - int spaceForSelect = (totalWidth - buttonWidth - bordersAndPaddings) / 2; + int spaceForSelect = (totalWidth - buttonWidth - bordersAndPaddings) + / 2; options.setWidth(spaceForSelect + "px"); if (optionsCaption != null) { @@ -563,7 +566,8 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, private static final String SUBPART_REMOVE_BUTTON = "remove"; @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (SUBPART_OPTION_SELECT.equals(subPart)) { return options.getElement(); } else if (subPart.startsWith(SUBPART_OPTION_SELECT_ITEM)) { @@ -573,8 +577,8 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, } else if (SUBPART_SELECTION_SELECT.equals(subPart)) { return selections.getElement(); } else if (subPart.startsWith(SUBPART_SELECTION_SELECT_ITEM)) { - String idx = subPart.substring(SUBPART_SELECTION_SELECT_ITEM - .length()); + String idx = subPart + .substring(SUBPART_SELECTION_SELECT_ITEM.length()); return (com.google.gwt.user.client.Element) selections.getElement() .getChild(Integer.parseInt(idx)); } else if (optionsCaption != null @@ -593,7 +597,8 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (optionsCaption != null && optionsCaption.getElement().isOrHasChild(subElement)) { return SUBPART_LEFT_CAPTION; diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java index 2800acccf9..99d4511b15 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -250,8 +250,9 @@ public class VUpload extends SimplePanel { } VConsole.log("VUpload:Submit complete"); ((UploadConnector) ConnectorMap.get(client) - .getConnector(VUpload.this)).getRpcProxy( - UploadServerRpc.class).poll(); + .getConnector(VUpload.this)) + .getRpcProxy(UploadServerRpc.class) + .poll(); } rebuildPanel(); @@ -293,7 +294,8 @@ public class VUpload extends SimplePanel { // Only visit the server if the upload has not already // finished if (thisUploadId == nextUploadId) { - VConsole.log("Visiting server to see if upload started event changed UI."); + VConsole.log( + "Visiting server to see if upload started event changed UI."); client.updateVariable(paintableId, "pollForStart", thisUploadId, true); } diff --git a/client/src/main/java/com/vaadin/client/ui/VVideo.java b/client/src/main/java/com/vaadin/client/ui/VVideo.java index 023a7f9ee0..93d0a28a59 100644 --- a/client/src/main/java/com/vaadin/client/ui/VVideo.java +++ b/client/src/main/java/com/vaadin/client/ui/VVideo.java @@ -48,7 +48,7 @@ public class VVideo extends VMediaBase { el.addEventListener('loadedmetadata', $entry(function(e) { self.@com.vaadin.client.ui.VVideo::updateElementDynamicSize(II)(el.videoWidth, el.videoHeight); }), false); - + }-*/; /** diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java index de465f6c1f..bd89191a35 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -136,10 +136,14 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, /** For internal use only. May be removed or replaced in the future. */ public ShortcutActionHandler shortcutHandler; - /** Last known positionx read from UIDL or updated to application connection */ + /** + * Last known positionx read from UIDL or updated to application connection + */ private int uidlPositionX = -1; - /** Last known positiony read from UIDL or updated to application connection */ + /** + * Last known positiony read from UIDL or updated to application connection + */ private int uidlPositionY = -1; /** For internal use only. May be removed or replaced in the future. */ @@ -334,8 +338,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, final int order = windowOrder.size(); setWindowOrder(order); windowOrder.add(this); - setPopupPosition(order * STACKING_OFFSET_PIXELS, order - * STACKING_OFFSET_PIXELS); + setPopupPosition(order * STACKING_OFFSET_PIXELS, + order * STACKING_OFFSET_PIXELS); } @@ -374,11 +378,12 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, footer = DOM.createDiv(); DOM.setElementProperty(footer, "className", CLASSNAME + "-footer"); resizeBox = DOM.createDiv(); - DOM.setElementProperty(resizeBox, "className", CLASSNAME + "-resizebox"); + DOM.setElementProperty(resizeBox, "className", + CLASSNAME + "-resizebox"); closeBox = DOM.createDiv(); maximizeRestoreBox = DOM.createDiv(); - DOM.setElementProperty(maximizeRestoreBox, "className", CLASSNAME - + "-maximizebox"); + DOM.setElementProperty(maximizeRestoreBox, "className", + CLASSNAME + "-maximizebox"); DOM.setElementAttribute(maximizeRestoreBox, "tabindex", "0"); DOM.setElementProperty(closeBox, "className", CLASSNAME + "-closebox"); DOM.setElementAttribute(closeBox, "tabindex", "0"); @@ -580,8 +585,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, super.setVisible(visible); } - if (visible - && BrowserInfo.get().requiresPositionAbsoluteOverflowAutoFix()) { + if (visible && BrowserInfo.get() + .requiresPositionAbsoluteOverflowAutoFix()) { /* * Shake up the DOM a bit to make the window shed unnecessary @@ -629,8 +634,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, this.closable = closable; if (closable) { - DOM.setElementProperty(closeBox, "className", CLASSNAME - + "-closebox"); + DOM.setElementProperty(closeBox, "className", + CLASSNAME + "-closebox"); } else { DOM.setElementProperty(closeBox, "className", CLASSNAME @@ -737,8 +742,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } private void showModalityCurtain() { - getModalityCurtain().getStyle().setZIndex( - windowOrder.indexOf(this) + Z_INDEX); + getModalityCurtain().getStyle() + .setZIndex(windowOrder.indexOf(this) + Z_INDEX); if (isShowing()) { getOverlayContainer().insertBefore(getModalityCurtain(), @@ -826,11 +831,11 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, resizable = resizability; if (resizability) { DOM.setElementProperty(footer, "className", CLASSNAME + "-footer"); - DOM.setElementProperty(resizeBox, "className", CLASSNAME - + "-resizebox"); + DOM.setElementProperty(resizeBox, "className", + CLASSNAME + "-resizebox"); } else { - DOM.setElementProperty(footer, "className", CLASSNAME + "-footer " - + CLASSNAME + "-footer-noresize"); + DOM.setElementProperty(footer, "className", + CLASSNAME + "-footer " + CLASSNAME + "-footer-noresize"); DOM.setElementProperty(resizeBox, "className", CLASSNAME + "-resizebox " + CLASSNAME + "-resizebox-disabled"); } @@ -896,9 +901,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } // Provide information to assistive device users that a sub window was // opened - String prefix = "<span class='" - + AriaHelper.ASSISTIVE_DEVICE_ONLY_STYLE + "'>" - + assistivePrefix + "</span>"; + String prefix = "<span class='" + AriaHelper.ASSISTIVE_DEVICE_ONLY_STYLE + + "'>" + assistivePrefix + "</span>"; String postfix = "<span class='" + AriaHelper.ASSISTIVE_DEVICE_ONLY_STYLE + "'>" + assistivePostfix + "</span>"; @@ -1185,8 +1189,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, public void updateContentsSize() { LayoutManager layoutManager = getLayoutManager(); - layoutManager.setNeedsMeasure(ConnectorMap.get(client).getConnector( - this)); + layoutManager + .setNeedsMeasure(ConnectorMap.get(client).getConnector(this)); layoutManager.layoutNow(); } @@ -1347,8 +1351,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, @Override public void onScroll(ScrollEvent event) { - client.updateVariable(id, "scrollTop", - contentPanel.getScrollPosition(), false); + client.updateVariable(id, "scrollTop", contentPanel.getScrollPosition(), + false); client.updateVariable(id, "scrollLeft", contentPanel.getHorizontalScrollPosition(), false); @@ -1356,8 +1360,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, @Override public void onKeyDown(KeyDownEvent event) { - if (vaadinModality - && event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE + if (vaadinModality && event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE && !isFocusedElementEditable()) { event.preventDefault(); } @@ -1423,8 +1426,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, assistiveConnectors = connectors; if (connectors.length == 0) { - Roles.getDialogRole().removeAriaDescribedbyProperty( - getElement()); + Roles.getDialogRole() + .removeAriaDescribedbyProperty(getElement()); } else { Id[] ids = new Id[connectors.length]; for (int index = 0; index < connectors.length; index++) { @@ -1463,8 +1466,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, * Sets the WAI-ARIA role the window. * * This role defines how an assistive device handles a window. Available - * roles are alertdialog and dialog (@see <a - * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles + * roles are alertdialog and dialog (@see + * <a href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles * Model</a>). * * The default role is dialog. diff --git a/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java index 19b66fb72f..f3d1706e4c 100644 --- a/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -40,8 +40,8 @@ import com.vaadin.ui.AbsoluteLayout; * counterpart {@link VAbsoluteLayout} */ @Connect(AbsoluteLayout.class) -public class AbsoluteLayoutConnector extends - AbstractComponentContainerConnector implements DirectionalManagedLayout { +public class AbsoluteLayoutConnector extends AbstractComponentContainerConnector + implements DirectionalManagedLayout { private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler( this) { @@ -120,8 +120,8 @@ public class AbsoluteLayoutConnector extends VAbsoluteLayout absoluteLayoutWidget = getWidget(); boolean captionIsNeeded = VCaption.isNeeded(component.getState()); - VCaption caption = absoluteLayoutWidget.getWidgetCaption(component - .getWidget()); + VCaption caption = absoluteLayoutWidget + .getWidgetCaption(component.getWidget()); if (captionIsNeeded) { if (caption == null) { caption = new VCaption(component, getConnection()); @@ -173,8 +173,8 @@ public class AbsoluteLayoutConnector extends } private void setChildWidgetPosition(ComponentConnector child) { - String position = getState().connectorToCssPosition.get(child - .getConnectorId()); + String position = getState().connectorToCssPosition + .get(child.getConnectorId()); if (position == null) { position = ""; } @@ -204,7 +204,8 @@ public class AbsoluteLayoutConnector extends * @return updated position, or the original string if no updates were * needed */ - private String addDefaultPositionIfMissing(String position, String property) { + private String addDefaultPositionIfMissing(String position, + String property) { if (!position.contains(property)) { position = position + property + ":0.0px;"; } @@ -219,7 +220,8 @@ public class AbsoluteLayoutConnector extends * (com.vaadin.client.ConnectorHierarchyChangeEvent) */ @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { for (ComponentConnector child : getChildComponents()) { if (!getWidget().contains(child.getWidget())) { getWidget().add(child.getWidget()); diff --git a/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java b/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java index 949e19071c..6e74443863 100644 --- a/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/accordion/AccordionConnector.java @@ -29,8 +29,8 @@ import com.vaadin.shared.ui.accordion.AccordionState; import com.vaadin.ui.Accordion; @Connect(Accordion.class) -public class AccordionConnector extends TabsheetBaseConnector implements - SimpleManagedLayout, MayScrollChildren { +public class AccordionConnector extends TabsheetBaseConnector + implements SimpleManagedLayout, MayScrollChildren { @Override protected void init() { @@ -47,8 +47,8 @@ public class AccordionConnector extends TabsheetBaseConnector implements * the content area is */ if (getWidget().selectedItemIndex >= 0) { - StackItem selectedItem = getWidget().getStackItem( - getWidget().selectedItemIndex); + StackItem selectedItem = getWidget() + .getStackItem(getWidget().selectedItemIndex); ComponentConnector contentConnector = getChildComponents().get(0); if (contentConnector != null) { @@ -106,12 +106,12 @@ public class AccordionConnector extends TabsheetBaseConnector implements usedPixels += item.getCaptionHeight(); } else { // This includes the captionNode borders - usedPixels += WidgetUtil.getRequiredHeight(item - .getElement()); + usedPixels += WidgetUtil + .getRequiredHeight(item.getElement()); } } - int rootElementInnerHeight = getLayoutManager().getInnerHeight( - getWidget().getElement()); + int rootElementInnerHeight = getLayoutManager() + .getInnerHeight(getWidget().getElement()); int spaceForOpenItem = rootElementInnerHeight - usedPixels; if (spaceForOpenItem < 0) { diff --git a/client/src/main/java/com/vaadin/client/ui/aria/AriaHelper.java b/client/src/main/java/com/vaadin/client/ui/aria/AriaHelper.java index bf93901a33..368b1b51ef 100644 --- a/client/src/main/java/com/vaadin/client/ui/aria/AriaHelper.java +++ b/client/src/main/java/com/vaadin/client/ui/aria/AriaHelper.java @@ -47,8 +47,8 @@ public class AriaHelper { ((HandlesAriaCaption) widget).bindAriaCaption(null); } else { ensureHasId(captionElement); - ((HandlesAriaCaption) widget).bindAriaCaption(DOM - .asOld(captionElement)); + ((HandlesAriaCaption) widget) + .bindAriaCaption(DOM.asOld(captionElement)); } } else if (captionElement != null) { // Handle the default case @@ -175,8 +175,9 @@ public class AriaHelper { * * @param element * Element to move out of sight - * @param boolean assistiveOnly true when element should only be visible for - * assistive devices, false to make the element visible for all + * @param boolean + * assistiveOnly true when element should only be visible for + * assistive devices, false to make the element visible for all */ public static void setVisibleForAssistiveDevicesOnly(Element element, boolean assistiveOnly) { diff --git a/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java index 2c2006e19b..1b5fd9e509 100644 --- a/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/button/ButtonConnector.java @@ -34,8 +34,8 @@ import com.vaadin.shared.ui.button.ButtonState; import com.vaadin.ui.Button; @Connect(value = Button.class, loadStyle = LoadStyle.EAGER) -public class ButtonConnector extends AbstractComponentConnector implements - ClickHandler { +public class ButtonConnector extends AbstractComponentConnector + implements ClickHandler { @Override public boolean delegateCaptionHandling() { @@ -123,8 +123,8 @@ public class ButtonConnector extends AbstractComponentConnector implements // Add mouse details MouseEventDetails details = MouseEventDetailsBuilder - .buildMouseEventDetails(event.getNativeEvent(), getWidget() - .getElement()); + .buildMouseEventDetails(event.getNativeEvent(), + getWidget().getElement()); getRpcProxy(ButtonServerRpc.class).click(details); } diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/main/java/com/vaadin/client/ui/calendar/CalendarConnector.java index 58cc31a580..753a47265a 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/CalendarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/CalendarConnector.java @@ -82,8 +82,8 @@ import com.vaadin.ui.Calendar; * @author Vaadin Ltd. */ @Connect(value = Calendar.class, loadStyle = LoadStyle.LAZY) -public class CalendarConnector extends AbstractComponentConnector implements - ActionOwner, SimpleManagedLayout, Paintable { +public class CalendarConnector extends AbstractComponentConnector + implements ActionOwner, SimpleManagedLayout, Paintable { private CalendarServerRpc rpc = RpcProxy.create(CalendarServerRpc.class, this); @@ -184,8 +184,8 @@ public class CalendarConnector extends AbstractComponentConnector implements StringBuilder sb = new StringBuilder(); sb.append(DateUtil.formatClientSideDate(event.getStart())); sb.append("-"); - sb.append(DateUtil.formatClientSideTime(event - .getStartTime())); + sb.append(DateUtil + .formatClientSideTime(event.getStartTime())); rpc.eventMove(event.getIndex(), sb.toString()); } } @@ -196,19 +196,20 @@ public class CalendarConnector extends AbstractComponentConnector implements if (hasEventListener(CalendarEventId.EVENTRESIZE)) { StringBuilder buffer = new StringBuilder(); - buffer.append(DateUtil.formatClientSideDate(event - .getStart())); + buffer.append( + DateUtil.formatClientSideDate(event.getStart())); buffer.append("-"); - buffer.append(DateUtil.formatClientSideTime(event - .getStartTime())); + buffer.append(DateUtil + .formatClientSideTime(event.getStartTime())); String newStartDate = buffer.toString(); buffer = new StringBuilder(); - buffer.append(DateUtil.formatClientSideDate(event.getEnd())); + buffer.append( + DateUtil.formatClientSideDate(event.getEnd())); buffer.append("-"); - buffer.append(DateUtil.formatClientSideTime(event - .getEndTime())); + buffer.append( + DateUtil.formatClientSideTime(event.getEndTime())); String newEndDate = buffer.toString(); @@ -233,7 +234,8 @@ public class CalendarConnector extends AbstractComponentConnector implements }); getWidget().setListener(new MouseEventListener() { @Override - public void contextMenu(ContextMenuEvent event, final Widget widget) { + public void contextMenu(ContextMenuEvent event, + final Widget widget) { final NativeEvent ne = event.getNativeEvent(); int left = ne.getClientX(); int top = ne.getClientY(); @@ -259,15 +261,15 @@ public class CalendarConnector extends AbstractComponentConnector implements */ SimpleDayCell cell = (SimpleDayCell) widget; Date start = new Date(cell.getDate().getYear(), - cell.getDate().getMonth(), cell.getDate() - .getDate(), 0, 0, 0); + cell.getDate().getMonth(), + cell.getDate().getDate(), 0, 0, 0); - Date end = new Date(cell.getDate().getYear(), cell - .getDate().getMonth(), cell.getDate() - .getDate(), 23, 59, 59); + Date end = new Date(cell.getDate().getYear(), + cell.getDate().getMonth(), + cell.getDate().getDate(), 23, 59, 59); - return CalendarConnector.this.getActionsBetween( - start, end); + return CalendarConnector.this + .getActionsBetween(start, end); } else if (widget instanceof MonthEventLabel) { MonthEventLabel mel = (MonthEventLabel) widget; @@ -285,9 +287,8 @@ public class CalendarConnector extends AbstractComponentConnector implements * Week and Day view */ DateCell cell = (DateCell) widget; - int slotIndex = DOM.getChildIndex( - cell.getElement(), (Element) ne - .getEventTarget().cast()); + int slotIndex = DOM.getChildIndex(cell.getElement(), + (Element) ne.getEventTarget().cast()); DateCellSlot slot = cell.getSlot(slotIndex); return CalendarConnector.this.getActionsBetween( slot.getFrom(), slot.getTo()); @@ -327,8 +328,10 @@ public class CalendarConnector extends AbstractComponentConnector implements VCalendar widget = getWidget(); // Enable or disable the forward and backward navigation buttons - widget.setForwardNavigationEnabled(hasEventListener(CalendarEventId.FORWARD)); - widget.setBackwardNavigationEnabled(hasEventListener(CalendarEventId.BACKWARD)); + widget.setForwardNavigationEnabled( + hasEventListener(CalendarEventId.FORWARD)); + widget.setBackwardNavigationEnabled( + hasEventListener(CalendarEventId.BACKWARD)); widget.set24HFormat(state.format24H); widget.setDayNames(state.dayNames); @@ -340,10 +343,12 @@ public class CalendarConnector extends AbstractComponentConnector implements widget.setReadOnly(state.readOnly); widget.setDisabled(!state.enabled); - widget.setRangeSelectAllowed(hasEventListener(CalendarEventId.RANGESELECT)); + widget.setRangeSelectAllowed( + hasEventListener(CalendarEventId.RANGESELECT)); widget.setRangeMoveAllowed(hasEventListener(CalendarEventId.EVENTMOVE)); widget.setEventMoveAllowed(hasEventListener(CalendarEventId.EVENTMOVE)); - widget.setEventResizeAllowed(hasEventListener(CalendarEventId.EVENTRESIZE)); + widget.setEventResizeAllowed( + hasEventListener(CalendarEventId.EVENTRESIZE)); widget.setEventCaptionAsHtml(state.eventCaptionAsHtml); @@ -374,9 +379,9 @@ public class CalendarConnector extends AbstractComponentConnector implements /* * (non-Javadoc) * - * @see - * com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal - * .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection) + * @see com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin. + * terminal .gwt.client.UIDL, + * com.vaadin.terminal.gwt.client.ApplicationConnection) */ @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { @@ -385,9 +390,9 @@ public class CalendarConnector extends AbstractComponentConnector implements UIDL child = (UIDL) childIterator.next(); if (DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG.equals(child.getTag())) { if (getWidget().getDropHandler() == null) { - getWidget().setDropHandler( - showingMonthView() ? new CalendarMonthDropHandler( - this) : new CalendarWeekDropHandler(this)); + getWidget().setDropHandler(showingMonthView() + ? new CalendarMonthDropHandler(this) + : new CalendarWeekDropHandler(this)); } getWidget().getDropHandler().updateAcceptRules(child); } else { @@ -420,7 +425,8 @@ public class CalendarConnector extends AbstractComponentConnector implements } @Override - public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element) { + public TooltipInfo getTooltipInfo( + com.google.gwt.dom.client.Element element) { TooltipInfo tooltipInfo = null; Widget w = WidgetUtil.findWidget(element, null); if (w instanceof HasTooltipKey) { @@ -662,10 +668,10 @@ public class CalendarConnector extends AbstractComponentConnector implements calendarEvent.setStart(getWidget().getDateFormat().parse(dateFrom)); calendarEvent.setEnd(getWidget().getDateFormat().parse(dateTo)); calendarEvent.setFormat24h(format24h); - calendarEvent.setStartTime(getWidget().getDateTimeFormat().parse( - dateFrom + " " + timeFrom)); - calendarEvent.setEndTime(getWidget().getDateTimeFormat().parse( - dateTo + " " + timeTo)); + calendarEvent.setStartTime(getWidget().getDateTimeFormat() + .parse(dateFrom + " " + timeFrom)); + calendarEvent.setEndTime(getWidget().getDateTimeFormat() + .parse(dateTo + " " + timeTo)); calendarEvent.setStyleName(event.styleName); calendarEvent.setIndex(event.index); list.add(calendarEvent); diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java index 5630db2415..687dcd2b52 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java @@ -282,10 +282,10 @@ public class CalendarEvent { if (targetDay.compareTo(getStart()) == 0) { // for first day rangeInMinutesForDay = DateConstants.DAYINMINUTES - (getStartTime().getTime() - getStart().getTime()) - / DateConstants.MINUTEINMILLIS; + / DateConstants.MINUTEINMILLIS; } else if (targetDay.compareTo(getEnd()) == 0) { // for last day - rangeInMinutesForDay = (getEndTime().getTime() - getEnd() - .getTime()) / DateConstants.MINUTEINMILLIS; + rangeInMinutesForDay = (getEndTime().getTime() + - getEnd().getTime()) / DateConstants.MINUTEINMILLIS; } else { // for in-between days rangeInMinutesForDay = DateConstants.DAYINMINUTES; } @@ -306,7 +306,8 @@ public class CalendarEvent { // if difference between start and end times is more than day - of // course it is not one day, but several days - if (getEndTime().getTime() - getStartTime().getTime() > DateConstants.DAYINMILLIS) { + if (getEndTime().getTime() + - getStartTime().getTime() > DateConstants.DAYINMILLIS) { isSeveralDays = true; } else { // if difference <= day -> there can be different cases if (getStart().compareTo(getEnd()) != 0 diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCell.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCell.java index 39d516b694..ef200ef095 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCell.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCell.java @@ -45,9 +45,8 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.WidgetUtil; -public class DateCell extends FocusableComplexPanel implements - MouseDownHandler, MouseMoveHandler, MouseUpHandler, KeyDownHandler, - ContextMenuHandler { +public class DateCell extends FocusableComplexPanel implements MouseDownHandler, + MouseMoveHandler, MouseUpHandler, KeyDownHandler, ContextMenuHandler { private static final String DRAGEMPHASISSTYLE = " dragemphasis"; private Date date; private int width; @@ -111,8 +110,8 @@ public class DateCell extends FocusableComplexPanel implements firstHour = weekgrid.getFirstHour(); lastHour = weekgrid.getLastHour(); numberOfSlots = (lastHour - firstHour + 1) * 2; - long slotTime = Math.round(((lastHour - firstHour + 1) * 3600000.0) - / numberOfSlots); + long slotTime = Math.round( + ((lastHour - firstHour + 1) * 3600000.0) / numberOfSlots); slotElements = new Element[numberOfSlots]; slotElementHeights = new int[numberOfSlots]; @@ -176,7 +175,8 @@ public class DateCell extends FocusableComplexPanel implements } } - throw new IllegalArgumentException("Element not found in this DateCell"); + throw new IllegalArgumentException( + "Element not found in this DateCell"); } public DateCellSlot getSlot(int index) { @@ -326,8 +326,8 @@ public class DateCell extends FocusableComplexPanel implements startingSlotHeight = height / numberOfSlots; for (int i = 0; i < slotElements.length; i++) { - slotElements[i].getStyle() - .setHeight(slotElementHeights[i], Unit.PX); + slotElements[i].getStyle().setHeight(slotElementHeights[i], + Unit.PX); } updateEventCellsHeight(); @@ -352,9 +352,10 @@ public class DateCell extends FocusableComplexPanel implements d.setMoveWidth(width); int freeSpaceCol = findFreeColumnSpaceOnLeft( - new WeekGridMinuteTimeRange(d.getCalendarEvent() - .getStartTime(), d.getCalendarEvent() - .getEndTime()), order, columns); + new WeekGridMinuteTimeRange( + d.getCalendarEvent().getStartTime(), + d.getCalendarEvent().getEndTime()), + order, columns); if (freeSpaceCol >= 0) { col = freeSpaceCol; columns.put(eventIndex, col); @@ -378,10 +379,8 @@ public class DateCell extends FocusableComplexPanel implements int eventWidth = (width / colCount); for (Integer index : g.getItems()) { DateCellDayEvent d = (DateCellDayEvent) getWidget(index); - d.getElement() - .getStyle() - .setMarginLeft((eventWidth * columns.get(index)), - Unit.PX); + d.getElement().getStyle().setMarginLeft( + (eventWidth * columns.get(index)), Unit.PX); d.setWidth(eventWidth + "px"); d.setSlotHeightInPX(getSlotHeight()); } @@ -404,9 +403,9 @@ public class DateCell extends FocusableComplexPanel implements } DateCellDayEvent d = (DateCellDayEvent) getWidget(eventIndex); - WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange(d - .getCalendarEvent().getStartTime(), d.getCalendarEvent() - .getEndTime()); + WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange( + d.getCalendarEvent().getStartTime(), + d.getCalendarEvent().getEndTime()); if (WeekGridMinuteTimeRange.doesOverlap(dateRange, nextRange)) { skipIndex = col; @@ -453,8 +452,8 @@ public class DateCell extends FocusableComplexPanel implements int count = getWidgetCount(); DateCellDayEvent target = (DateCellDayEvent) getWidget(targetIndex); WeekGridMinuteTimeRange targetRange = new WeekGridMinuteTimeRange( - target.getCalendarEvent().getStartTime(), target - .getCalendarEvent().getEndTime()); + target.getCalendarEvent().getStartTime(), + target.getCalendarEvent().getEndTime()); Date groupStart = targetRange.getStart(); Date groupEnd = targetRange.getEnd(); @@ -464,9 +463,9 @@ public class DateCell extends FocusableComplexPanel implements } DateCellDayEvent d = (DateCellDayEvent) getWidget(i); - WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange(d - .getCalendarEvent().getStartTime(), d.getCalendarEvent() - .getEndTime()); + WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange( + d.getCalendarEvent().getStartTime(), + d.getCalendarEvent().getEndTime()); if (WeekGridMinuteTimeRange.doesOverlap(targetRange, nextRange)) { g.add(i); @@ -547,8 +546,8 @@ public class DateCell extends FocusableComplexPanel implements events.add(dayEvent.getCalendarEvent()); index = 0; - for (CalendarEvent e : weekgrid.getCalendar().sortEventsByDuration( - events)) { + for (CalendarEvent e : weekgrid.getCalendar() + .sortEventsByDuration(events)) { if (e.equals(dayEvent.getCalendarEvent())) { break; } @@ -584,7 +583,8 @@ public class DateCell extends FocusableComplexPanel implements int eventStartHours = eventStart.getHours(); int eventEndHours = eventEnd.getHours(); - display = !(eventEndHours < firstHour || eventStartHours > lastHour); + display = !(eventEndHours < firstHour + || eventStartHours > lastHour); } return display; } @@ -642,8 +642,8 @@ public class DateCell extends FocusableComplexPanel implements // and then the end for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.getItem(i); - boolean isRangeElement = element.getClassName().contains( - "v-daterange"); + boolean isRangeElement = element.getClassName() + .contains("v-daterange"); if (isRangeElement && slotStart == -1) { slotStart = i; @@ -666,10 +666,8 @@ public class DateCell extends FocusableComplexPanel implements + (currentDate.getMonth() + 1) + "-" + currentDate.getDate(); if (weekgrid.getCalendar().getRangeSelectListener() != null) { - weekgrid.getCalendar() - .getRangeSelectListener() - .rangeSelected( - yr + ":" + startMinutes + ":" + endMinutes); + weekgrid.getCalendar().getRangeSelectListener().rangeSelected( + yr + ":" + startMinutes + ":" + endMinutes); } eventRangeStart = -1; } else { @@ -792,7 +790,8 @@ public class DateCell extends FocusableComplexPanel implements * {@link #addEmphasisStyle(Element)} instead */ @Deprecated - public void addEmphasisStyle(com.google.gwt.user.client.Element elementOver) { + public void addEmphasisStyle( + com.google.gwt.user.client.Element elementOver) { String originalStylename = getStyleName(elementOver); setStyleName(elementOver, originalStylename + DRAGEMPHASISSTYLE); } @@ -812,10 +811,8 @@ public class DateCell extends FocusableComplexPanel implements public void removeEmphasisStyle( com.google.gwt.user.client.Element elementOver) { String originalStylename = getStyleName(elementOver); - setStyleName( - elementOver, - originalStylename.substring(0, originalStylename.length() - - DRAGEMPHASISSTYLE.length())); + setStyleName(elementOver, originalStylename.substring(0, + originalStylename.length() - DRAGEMPHASISSTYLE.length())); } /** @@ -830,8 +827,8 @@ public class DateCell extends FocusableComplexPanel implements if (weekgrid.getCalendar().getMouseEventListener() != null) { event.preventDefault(); event.stopPropagation(); - weekgrid.getCalendar().getMouseEventListener() - .contextMenu(event, DateCell.this); + weekgrid.getCalendar().getMouseEventListener().contextMenu(event, + DateCell.this); } } diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java index 26f5951987..4ba22f61f8 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java @@ -31,8 +31,8 @@ import com.vaadin.client.ui.VCalendar; * * since 7.1 */ -public class DateCellContainer extends FlowPanel implements MouseDownHandler, - MouseUpHandler { +public class DateCellContainer extends FlowPanel + implements MouseDownHandler, MouseUpHandler { private Date date; diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java index 55834397d3..173506497c 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java @@ -49,9 +49,9 @@ import com.vaadin.shared.ui.calendar.DateConstants; * * @since 7.1 */ -public class DateCellDayEvent extends FocusableHTML implements - MouseDownHandler, MouseUpHandler, MouseMoveHandler, KeyDownHandler, - ContextMenuHandler, HasTooltipKey { +public class DateCellDayEvent extends FocusableHTML + implements MouseDownHandler, MouseUpHandler, MouseMoveHandler, + KeyDownHandler, ContextMenuHandler, HasTooltipKey { private final DateCell dateCell; private Element caption = null; @@ -215,20 +215,24 @@ public class DateCellDayEvent extends FocusableHTML implements public void onMouseDown(MouseDownEvent event) { startX = event.getClientX(); startY = event.getClientY(); - if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) { + if (isDisabled() + || event.getNativeButton() != NativeEvent.BUTTON_LEFT) { return; } clickTarget = Element.as(event.getNativeEvent().getEventTarget()); mouseMoveCanceled = false; - if (weekGrid.getCalendar().isEventMoveAllowed() || clickTargetsResize()) { + if (weekGrid.getCalendar().isEventMoveAllowed() + || clickTargetsResize()) { moveRegistration = addMouseMoveHandler(this); setFocus(true); try { - startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight); - startXrelative = (event.getRelativeX(weekGrid.getElement()) - weekGrid.timebar - .getOffsetWidth()) % getDateCellWidth(); + startYrelative = (int) ((double) event.getRelativeY(caption) + % slotHeight); + startXrelative = (event.getRelativeX(weekGrid.getElement()) + - weekGrid.timebar.getOffsetWidth()) + % getDateCellWidth(); } catch (Exception e) { GWT.log("Exception calculating relative start position", e); } @@ -282,7 +286,8 @@ public class DateCellDayEvent extends FocusableHTML implements s.setZIndex(1); if (!clickTargetsResize()) { // check if mouse has moved over threshold of 3 pixels - boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3); + boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 + || yDiff > 3); if (!weekGrid.getCalendar().isDisabledOrReadOnly() && mouseMoved) { // Event Move: @@ -296,7 +301,8 @@ public class DateCellDayEvent extends FocusableHTML implements Element e = Element.as(et); if (e == caption || e == eventContent || e.getParentElement() == caption) { - if (weekGrid.getCalendar().getEventClickListener() != null) { + if (weekGrid.getCalendar() + .getEventClickListener() != null) { weekGrid.getCalendar().getEventClickListener() .eventClick(calendarEvent); } @@ -608,7 +614,8 @@ public class DateCellDayEvent extends FocusableHTML implements */ private boolean clickTargetsResize() { return weekGrid.getCalendar().isEventResizeAllowed() - && (clickTarget == topResizeBar || clickTarget == bottomResizeBar); + && (clickTarget == topResizeBar + || clickTarget == bottomResizeBar); } private void addGlobalResizeStyle() { diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DayToolbar.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DayToolbar.java index 10ed5bb3f9..523410262d 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DayToolbar.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/DayToolbar.java @@ -73,8 +73,8 @@ public class DayToolbar extends HorizontalPanel implements ClickHandler { setCellHorizontalAlignment(nextLabel, ALIGN_RIGHT); int cellw = width / (count - 2); if (cellw > 0) { - int[] cellWidths = VCalendar - .distributeSize(width, count - 2, 0); + int[] cellWidths = VCalendar.distributeSize(width, count - 2, + 0); for (int i = 1; i < count - 1; i++) { Widget widget = getWidget(i); // if (remain > 0) { diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java index cdad83744e..6c629e01a4 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java @@ -39,8 +39,8 @@ import com.vaadin.client.Focusable; * @author Vaadin Ltd. * */ -public class FocusableComplexPanel extends ComplexPanel implements - HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers, +public class FocusableComplexPanel extends ComplexPanel + implements HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers, HasKeyPressHandlers, Focusable { protected void makeFocusable() { diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java index 158241337b..0c3fd30059 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java @@ -47,8 +47,8 @@ import com.vaadin.shared.ui.calendar.DateConstants; * @since 7.1 * @author Vaadin Ltd. */ -public class SimpleDayCell extends FocusableFlowPanel implements - MouseUpHandler, MouseDownHandler, MouseOverHandler, MouseMoveHandler { +public class SimpleDayCell extends FocusableFlowPanel implements MouseUpHandler, + MouseDownHandler, MouseOverHandler, MouseMoveHandler { private static int BOTTOMSPACERHEIGHT = -1; private static int EVENTHEIGHT = -1; @@ -221,9 +221,8 @@ public class SimpleDayCell extends FocusableFlowPanel implements } } - int remainingSpace = intHeight - - ((slots * EVENTHEIGHT) + BOTTOMSPACERHEIGHT + caption - .getOffsetHeight()); + int remainingSpace = intHeight - ((slots * EVENTHEIGHT) + + BOTTOMSPACERHEIGHT + caption.getOffsetHeight()); int newHeight = remainingSpace + BOTTOMSPACERHEIGHT; if (newHeight < 0) { newHeight = EVENTHEIGHT; @@ -344,8 +343,8 @@ public class SimpleDayCell extends FocusableFlowPanel implements public void setMonthNameVisible(boolean b) { monthNameVisible = b; int dateOfMonth = date.getDate(); - caption.setText(dateOfMonth + " " - + calendar.getMonthNames()[date.getMonth()]); + caption.setText( + dateOfMonth + " " + calendar.getMonthNames()[date.getMonth()]); } public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { @@ -517,9 +516,11 @@ public class SimpleDayCell extends FocusableFlowPanel implements } // Check boundaries if (relativeY < 0 - || relativeY >= (calendar.getMonthGrid().getRowCount() * dateCellHeigth) + || relativeY >= (calendar.getMonthGrid().getRowCount() + * dateCellHeigth) || relativeX < 0 - || relativeX >= (calendar.getMonthGrid().getColumnCount() * dateCellWidth)) { + || relativeX >= (calendar.getMonthGrid().getColumnCount() + * dateCellWidth)) { return; } @@ -644,7 +645,8 @@ public class SimpleDayCell extends FocusableFlowPanel implements } } - public void updateDragPosition(MonthEventLabel w, int dayDiff, int weekDiff) { + public void updateDragPosition(MonthEventLabel w, int dayDiff, + int weekDiff) { // Draw event to its new position only when position has changed if (dayDiff == prevDayDiff && weekDiff == prevWeekDiff) { return; diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java index fc79163d3e..e4b1740513 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java @@ -102,8 +102,8 @@ public class SimpleWeekToolbar extends FlexTable implements ClickHandler { public void onClick(ClickEvent event) { WeekLabel wl = (WeekLabel) event.getSource(); if (calendar.getWeekClickListener() != null) { - calendar.getWeekClickListener().weekClick( - wl.getYear() + "w" + wl.getWeek()); + calendar.getWeekClickListener() + .weekClick(wl.getYear() + "w" + wl.getWeek()); } } } diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeekGrid.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeekGrid.java index aecaff1931..ceab62c35e 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeekGrid.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeekGrid.java @@ -165,8 +165,8 @@ public class WeekGrid extends SimplePanel { this.width = content.getOffsetWidth() - timebar.getOffsetWidth(); } else { - this.width = (width == -1) ? width : width - - timebar.getOffsetWidth(); + this.width = (width == -1) ? width + : width - timebar.getOffsetWidth(); if (isVerticalScrollable() && width != -1) { this.width = this.width - WidgetUtil.getNativeScrollbarSize(); @@ -219,12 +219,13 @@ public class WeekGrid extends SimplePanel { int count = content.getWidgetCount(); int datesWidth = width; if (datesWidth > 0 && count > 1) { - cellWidths = VCalendar - .distributeSize(datesWidth, count - 1, -1); + cellWidths = VCalendar.distributeSize(datesWidth, count - 1, + -1); for (int i = 1; i < count; i++) { DateCell dc = (DateCell) content.getWidget(i); - dc.setHorizontalSized(isHorizontalScrollable() || width < 0); + dc.setHorizontalSized( + isHorizontalScrollable() || width < 0); dc.setWidthPX(cellWidths[i - 1]); if (dc.isToday()) { dc.setTimeBarWidth(getOffsetWidth()); @@ -237,7 +238,8 @@ public class WeekGrid extends SimplePanel { if (count > 1) { for (int i = 1; i < count; i++) { DateCell dc = (DateCell) content.getWidget(i); - dc.setHorizontalSized(isHorizontalScrollable() || width < 0); + dc.setHorizontalSized( + isHorizontalScrollable() || width < 0); } } } @@ -269,8 +271,8 @@ public class WeekGrid extends SimplePanel { if (count > 1) { DateCell first = (DateCell) content.getWidget(1); dateCellBorder = first.getSlotBorder(); - int dateHeight = (first.getOffsetHeight() / first - .getNumberOfSlots()) - dateCellBorder; + int dateHeight = (first.getOffsetHeight() + / first.getNumberOfSlots()) - dateCellBorder; cellHeights = new int[48]; Arrays.fill(cellHeights, dateHeight); @@ -291,10 +293,8 @@ public class WeekGrid extends SimplePanel { Date dcDate = dc.getDate(); int comp = dcDate.compareTo(from); int comp2 = dcDate.compareTo(toTime); - if (comp >= 0 - && comp2 < 0 - || (comp == 0 && comp2 == 0 && VCalendar - .isZeroLengthMidnightEvent(e))) { + if (comp >= 0 && comp2 < 0 || (comp == 0 && comp2 == 0 + && VCalendar.isZeroLengthMidnightEvent(e))) { // Same event may be over two DateCells if event's date // range floats over one day. It can't float over two days, // because event which range is over 24 hours, will be handled @@ -322,8 +322,8 @@ public class WeekGrid extends SimplePanel { int shownHeightInMinutes = endHourInMinutes - firstHourInMinutes + DateConstants.HOURINMINUTES; - durationInMinutes = Math.min(durationInMinutes, shownHeightInMinutes - - startFromMinutes); + durationInMinutes = Math.min(durationInMinutes, + shownHeightInMinutes - startFromMinutes); // calculate full slots to event int slotsTillEvent = startFromMinutes / slotInMinutes; @@ -353,25 +353,29 @@ public class WeekGrid extends SimplePanel { // calculate slot overflow at start if (startOverFlowTime > 0 && currentSlot < cellHeights.length) { int lastSlotHeight = cellHeights[currentSlot] + dateCellBorder; - pixelLength += (int) (((double) lastSlotHeight / (double) slotInMinutes) * startOverFlowTime); + pixelLength += (int) (((double) lastSlotHeight + / (double) slotInMinutes) * startOverFlowTime); } // calculate length in full slots int lastFullSlot = currentSlot + durationInSlots; - for (; currentSlot < lastFullSlot && currentSlot < cellHeights.length; currentSlot++) { + for (; currentSlot < lastFullSlot + && currentSlot < cellHeights.length; currentSlot++) { pixelLength += cellHeights[currentSlot] + dateCellBorder; } // calculate overflow at end if (endOverFlowTime > 0 && currentSlot < cellHeights.length) { int lastSlotHeight = cellHeights[currentSlot] + dateCellBorder; - pixelLength += (int) (((double) lastSlotHeight / (double) slotInMinutes) * endOverFlowTime); + pixelLength += (int) (((double) lastSlotHeight + / (double) slotInMinutes) * endOverFlowTime); } // reduce possible underflow at end if (endOverFlowTime < 0) { int lastSlotHeight = cellHeights[currentSlot] + dateCellBorder; - pixelLength += (int) (((double) lastSlotHeight / (double) slotInMinutes) * endOverFlowTime); + pixelLength += (int) (((double) lastSlotHeight + / (double) slotInMinutes) * endOverFlowTime); } return pixelLength; @@ -410,8 +414,8 @@ public class WeekGrid extends SimplePanel { public void eventMoved(DateCellDayEvent dayEvent) { Style s = dayEvent.getElement().getStyle(); - int left = Integer.parseInt(s.getLeft().substring(0, - s.getLeft().length() - 2)); + int left = Integer + .parseInt(s.getLeft().substring(0, s.getLeft().length() - 2)); DateCell previousParent = (DateCell) dayEvent.getParent(); DateCell newParent = (DateCell) content .getWidget((left / getDateCellWidth()) + 1); diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java index 9488c8835a..6b9bdf64d0 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java @@ -78,8 +78,8 @@ public class WeeklyLongEvents extends HorizontalPanel implements HasTooltipKey { Date dcDate = dc.getDate(); int comp = dcDate.compareTo(from); int comp2 = dcDate.compareTo(to); - WeeklyLongEventsDateCell eventLabel = dc.getDateCell(calendarEvent - .getSlotIndex()); + WeeklyLongEventsDateCell eventLabel = dc + .getDateCell(calendarEvent.getSlotIndex()); eventLabel.setStylePrimaryName("v-calendar-event"); if (comp >= 0 && comp2 <= 0) { eventLabel.setEvent(calendarEvent); @@ -176,8 +176,8 @@ public class WeeklyLongEvents extends HorizontalPanel implements HasTooltipKey { dc.setWidth(cellWidth + "px"); } else { - dc.setWidth(calendar.getWeekGrid().getDateCellWidths()[i] - + "px"); + dc.setWidth( + calendar.getWeekGrid().getDateCellWidths()[i] + "px"); } } } diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java index 92046f96ec..ce892c1867 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java @@ -54,9 +54,8 @@ public abstract class CalendarDropHandler extends VAbstractDropHandler { /* * (non-Javadoc) * - * @see - * com.vaadin.terminal.gwt.client.ui.dd.VDropHandler#getApplicationConnection - * () + * @see com.vaadin.terminal.gwt.client.ui.dd.VDropHandler# + * getApplicationConnection () */ @Override public ApplicationConnection getApplicationConnection() { diff --git a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java index e0edf21e89..6af67de15c 100644 --- a/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java @@ -121,7 +121,8 @@ public class CalendarWeekDropHandler extends CalendarDropHandler { return DOM.isOrHasChild(weekGridElement, elementOver) && !DOM.isOrHasChild(timeBarElement, elementOver) && todayBarElement != elementOver - && (WidgetUtil.findWidget(elementOver, DateCellDayEvent.class) == null); + && (WidgetUtil.findWidget(elementOver, + DateCellDayEvent.class) == null); } /* diff --git a/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index 0dc9810c51..36509e62de 100644 --- a/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -37,8 +37,8 @@ import com.vaadin.shared.ui.checkbox.CheckBoxState; import com.vaadin.ui.CheckBox; @Connect(CheckBox.class) -public class CheckBoxConnector extends AbstractFieldConnector implements - ClickHandler { +public class CheckBoxConnector extends AbstractFieldConnector + implements ClickHandler { @Override public boolean delegateCaptionHandling() { @@ -76,8 +76,8 @@ public class CheckBoxConnector extends AbstractFieldConnector implements getWidget().errorIndicatorElement.getStyle().clearDisplay(); } } else if (getWidget().errorIndicatorElement != null) { - getWidget().errorIndicatorElement.getStyle().setDisplay( - Display.NONE); + getWidget().errorIndicatorElement.getStyle() + .setDisplay(Display.NONE); getWidget().setAriaInvalid(false); } @@ -130,8 +130,8 @@ public class CheckBoxConnector extends AbstractFieldConnector implements // Add mouse details MouseEventDetails details = MouseEventDetailsBuilder - .buildMouseEventDetails(event.getNativeEvent(), getWidget() - .getElement()); + .buildMouseEventDetails(event.getNativeEvent(), + getWidget().getElement()); getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked, details); if (getState().immediate) { diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java index cba2a667ca..769ced7ba8 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/AbstractColorPickerConnector.java @@ -27,8 +27,8 @@ import com.vaadin.shared.ui.colorpicker.ColorPickerState; * * @since 7.0.0 */ -public abstract class AbstractColorPickerConnector extends - AbstractComponentConnector implements ClickHandler { +public abstract class AbstractColorPickerConnector + extends AbstractComponentConnector implements ClickHandler { private static final String DEFAULT_WIDTH_STYLE = "v-default-caption-width"; @@ -49,9 +49,8 @@ public abstract class AbstractColorPickerConnector extends if (stateChangeEvent.hasPropertyChanged("color")) { refreshColor(); - if (getState().showDefaultCaption - && (getState().caption == null || "" - .equals(getState().caption))) { + if (getState().showDefaultCaption && (getState().caption == null + || "".equals(getState().caption))) { setCaption(getState().color); } @@ -79,8 +78,8 @@ public abstract class AbstractColorPickerConnector extends * @return */ protected String getCaption() { - if (getState().showDefaultCaption - && (getState().caption == null || "".equals(getState().caption))) { + if (getState().showDefaultCaption && (getState().caption == null + || "".equals(getState().caption))) { return getState().color; } return getState().caption; diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java index 355e705581..238bd2112a 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java @@ -36,8 +36,8 @@ import com.vaadin.ui.ColorPickerArea; @Connect(value = ColorPickerArea.class, loadStyle = LoadStyle.LAZY) public class ColorPickerAreaConnector extends AbstractColorPickerConnector { - private ColorPickerServerRpc rpc = RpcProxy.create( - ColorPickerServerRpc.class, this); + private ColorPickerServerRpc rpc = RpcProxy + .create(ColorPickerServerRpc.class, this); @Override protected Widget createWidget() { diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java index 2f0dbd5ce7..12fb8b241e 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java @@ -35,8 +35,8 @@ import com.vaadin.ui.ColorPicker; @Connect(value = ColorPicker.class, loadStyle = LoadStyle.LAZY) public class ColorPickerConnector extends AbstractColorPickerConnector { - private ColorPickerServerRpc rpc = RpcProxy.create( - ColorPickerServerRpc.class, this); + private ColorPickerServerRpc rpc = RpcProxy + .create(ColorPickerServerRpc.class, this); @Override protected Widget createWidget() { diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGradientConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGradientConnector.java index 223675f660..541b479a61 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGradientConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGradientConnector.java @@ -40,8 +40,8 @@ import com.vaadin.ui.components.colorpicker.ColorPickerGradient; public class ColorPickerGradientConnector extends AbstractComponentConnector implements MouseUpHandler { - private ColorPickerGradientServerRpc rpc = RpcProxy.create( - ColorPickerGradientServerRpc.class, this); + private ColorPickerGradientServerRpc rpc = RpcProxy + .create(ColorPickerGradientServerRpc.class, this); @Override protected Widget createWidget() { diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGridConnector.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGridConnector.java index dc3c3ca790..b212f2e273 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGridConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/ColorPickerGridConnector.java @@ -40,8 +40,8 @@ import com.vaadin.ui.components.colorpicker.ColorPickerGrid; public class ColorPickerGridConnector extends AbstractComponentConnector implements ClickHandler { - private ColorPickerGridServerRpc rpc = RpcProxy.create( - ColorPickerGridServerRpc.class, this); + private ColorPickerGridServerRpc rpc = RpcProxy + .create(ColorPickerGridServerRpc.class, this); @Override protected Widget createWidget() { diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java index 70ced91da4..125ec48370 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGradient.java @@ -190,7 +190,8 @@ public class VColorPickerGradient extends FocusPanel implements } @Override - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { if (subPart.equals(CLICKLAYER_ID)) { return clicklayer.getElement(); } @@ -199,7 +200,8 @@ public class VColorPickerGradient extends FocusPanel implements } @Override - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { if (clicklayer.getElement().isOrHasChild(subElement)) { return CLICKLAYER_ID; } diff --git a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java index c407bdc5ef..04f06c2f4f 100644 --- a/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java +++ b/client/src/main/java/com/vaadin/client/ui/colorpicker/VColorPickerGrid.java @@ -30,8 +30,8 @@ import com.google.gwt.user.client.ui.HTMLTable.Cell; * @since 7.0.0 * */ -public class VColorPickerGrid extends AbsolutePanel implements ClickHandler, - HasClickHandlers { +public class VColorPickerGrid extends AbsolutePanel + implements ClickHandler, HasClickHandlers { private int rows = 1; private int columns = 1; diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index 269e7165ab..1c24f14cd7 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -38,14 +38,14 @@ import com.vaadin.shared.ui.combobox.ComboBoxState; import com.vaadin.ui.ComboBox; @Connect(ComboBox.class) -public class ComboBoxConnector extends AbstractFieldConnector implements - Paintable, SimpleManagedLayout { +public class ComboBoxConnector extends AbstractFieldConnector + implements Paintable, SimpleManagedLayout { protected ComboBoxServerRpc rpc = RpcProxy.create(ComboBoxServerRpc.class, this); - protected FocusAndBlurServerRpc focusAndBlurRpc = RpcProxy.create( - FocusAndBlurServerRpc.class, this); + protected FocusAndBlurServerRpc focusAndBlurRpc = RpcProxy + .create(FocusAndBlurServerRpc.class, this); @Override protected void init() { @@ -198,8 +198,9 @@ public class ComboBoxConnector extends AbstractFieldConnector implements } // TODO even this condition should probably be moved to the handler - if ((getDataReceivedHandler().isWaitingForFilteringResponse() && getWidget().lastFilter - .toLowerCase().equals(uidl.getStringVariable("filter"))) + if ((getDataReceivedHandler().isWaitingForFilteringResponse() + && getWidget().lastFilter.toLowerCase() + .equals(uidl.getStringVariable("filter"))) || popupOpenAndCleared) { getDataReceivedHandler().dataReceived(); } @@ -229,8 +230,8 @@ public class ComboBoxConnector extends AbstractFieldConnector implements private boolean isWidgetsCurrentSelectionTextInTextBox() { return getWidget().currentSuggestion != null - && getWidget().currentSuggestion.getReplacementString().equals( - getWidget().tb.getText()); + && getWidget().currentSuggestion.getReplacementString() + .equals(getWidget().tb.getText()); } @Override diff --git a/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java index 1ec395280d..c40a7d3801 100644 --- a/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/csslayout/CssLayoutConnector.java @@ -111,9 +111,11 @@ public class CssLayoutConnector extends AbstractLayoutConnector { * (com.vaadin.client.ConnectorHierarchyChangeEvent) */ @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange"); - Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange add children"); + Profiler.enter( + "CssLayoutConnector.onConnectorHierarchyChange add children"); int index = 0; for (ComponentConnector child : getChildComponents()) { VCaption childCaption = childIdToCaption @@ -123,10 +125,12 @@ public class CssLayoutConnector extends AbstractLayoutConnector { } getWidget().addOrMove(child.getWidget(), index++); } - Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange add children"); + Profiler.leave( + "CssLayoutConnector.onConnectorHierarchyChange add children"); // Detach old child widgets and possibly their caption - Profiler.enter("CssLayoutConnector.onConnectorHierarchyChange remove old children"); + Profiler.enter( + "CssLayoutConnector.onConnectorHierarchyChange remove old children"); for (ComponentConnector child : event.getOldChildren()) { if (child.getParent() == this) { // Skip current children @@ -139,7 +143,8 @@ public class CssLayoutConnector extends AbstractLayoutConnector { getWidget().remove(vCaption); } } - Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange remove old children"); + Profiler.leave( + "CssLayoutConnector.onConnectorHierarchyChange remove old children"); Profiler.leave("CssLayoutConnector.onConnectorHierarchyChange"); } diff --git a/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java b/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java index e981dc13fc..c2c00a2975 100644 --- a/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/customcomponent/CustomComponentConnector.java @@ -37,7 +37,8 @@ public class CustomComponentConnector extends AbstractHasComponentsConnector { } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { VCustomComponent customComponent = getWidget(); if (getChildComponents().size() == 1) { ComponentConnector newChild = getChildComponents().get(0); diff --git a/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java index d18574d010..75bb63f6e9 100644 --- a/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/customfield/CustomFieldConnector.java @@ -30,8 +30,8 @@ import com.vaadin.shared.ui.Connect; import com.vaadin.ui.CustomField; @Connect(value = CustomField.class) -public class CustomFieldConnector extends AbstractFieldConnector implements - HasComponentsConnector, ConnectorHierarchyChangeHandler { +public class CustomFieldConnector extends AbstractFieldConnector + implements HasComponentsConnector, ConnectorHierarchyChangeHandler { List<ComponentConnector> childComponents; @@ -53,7 +53,8 @@ public class CustomFieldConnector extends AbstractFieldConnector implements } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { // We always have 1 child, unless the child is hidden getWidget().setWidget(getContentWidget()); } @@ -86,8 +87,8 @@ public class CustomFieldConnector extends AbstractFieldConnector implements @Override public HandlerRegistration addConnectorHierarchyChangeHandler( ConnectorHierarchyChangeHandler handler) { - return ensureHandlerManager().addHandler( - ConnectorHierarchyChangeEvent.TYPE, handler); + return ensureHandlerManager() + .addHandler(ConnectorHierarchyChangeEvent.TYPE, handler); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index abbb0ef60b..c8ced70dd7 100644 --- a/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -33,8 +33,8 @@ import com.vaadin.shared.ui.customlayout.CustomLayoutState; import com.vaadin.ui.CustomLayout; @Connect(CustomLayout.class) -public class CustomLayoutConnector extends AbstractLayoutConnector implements - SimpleManagedLayout, Paintable { +public class CustomLayoutConnector extends AbstractLayoutConnector + implements SimpleManagedLayout, Paintable { private boolean templateUpdated; @@ -77,8 +77,8 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements if (templateName != null) { // Get the HTML-template from client. Overrides templateContents // (even though both can never be given at the same time) - templateContents = getConnection().getResource( - "layouts/" + templateName + ".html"); + templateContents = getConnection() + .getResource("layouts/" + templateName + ".html"); } if (templateContents != null) { @@ -88,21 +88,19 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements } else { // Template missing -> show debug notice and render components in // order. - String warning = templateName != null ? "Layout file layouts/" - + templateName + ".html is missing." + String warning = templateName != null + ? "Layout file layouts/" + templateName + + ".html is missing." : "Layout file not specified."; - getWidget() - .getElement() - .setInnerHTML( - "<em>" - + warning - + " Components will be drawn for debug purposes.</em>"); + getWidget().getElement().setInnerHTML("<em>" + warning + + " Components will be drawn for debug purposes.</em>"); } templateUpdated = true; } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { // Must call here in addition to onStateChanged because // onConnectorHierarchyChange is invoked before onStateChanged updateHtmlTemplate(); @@ -113,9 +111,8 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements getWidget().setWidget(child.getWidget(), location); } catch (final IllegalArgumentException e) { // If no location is found, this component is not visible - getLogger().warning( - "Child not rendered as no slot with id '" + location - + "' has been defined"); + getLogger().warning("Child not rendered as no slot with id '" + + location + "' has been defined"); } } for (ComponentConnector oldChild : event.getOldChildren()) { diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java index 6d1c9316f6..e7e52d4021 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java @@ -81,19 +81,17 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector // Remove old stylename that indicates current resolution setWidgetStyleName( - getWidget().getStylePrimaryName() - + "-" - + VDateField.resolutionToString(getWidget() - .getCurrentResolution()), false); + getWidget().getStylePrimaryName() + "-" + VDateField + .resolutionToString(getWidget().getCurrentResolution()), + false); getWidget().setCurrentResolution(newResolution); // Add stylename that indicates current resolution setWidgetStyleName( - getWidget().getStylePrimaryName() - + "-" - + VDateField.resolutionToString(getWidget() - .getCurrentResolution()), true); + getWidget().getStylePrimaryName() + "-" + VDateField + .resolutionToString(getWidget().getCurrentResolution()), + true); final Resolution resolution = getWidget().getCurrentResolution(); final int year = uidl.getIntVariable("year"); @@ -110,9 +108,8 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector // Construct new date for this datefield (only if not null) if (year > -1) { - getWidget().setCurrentDate( - new Date((long) getWidget().getTime(year, month, day, hour, - min, sec, 0))); + getWidget().setCurrentDate(new Date((long) getWidget().getTime(year, + month, day, hour, min, sec, 0))); } else { getWidget().setCurrentDate(null); } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java b/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java index 7b3203f330..bffd3c3353 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/DDEventHandleStrategy.java @@ -151,8 +151,8 @@ public class DDEventHandleStrategy { DDManagerMediator mediator, NativePreviewEvent event) { VDragAndDropManager manager = mediator.getManager(); if (manager.getDragElement() != null) { - manager.getDragElement().getStyle() - .setProperty("display", originalImageDisplay); + manager.getDragElement().getStyle().setProperty("display", + originalImageDisplay); } } @@ -187,7 +187,8 @@ public class DDEventHandleStrategy { // ApplicationConnection // .getConsole() // .log( - // "IGNORING proxy image event, fired because of hack or not significant"); + // "IGNORING proxy image event, fired because of hack or not + // significant"); return true; case Event.ONMOUSEMOVE: case Event.ONTOUCHMOVE: @@ -335,8 +336,8 @@ public class DDEventHandleStrategy { protected void handleMouseOut(Element target, NativePreviewEvent event, DDManagerMediator mediator) { VDragAndDropManager manager = mediator.getManager(); - Element relatedTarget = Element.as(event.getNativeEvent() - .getRelatedEventTarget()); + Element relatedTarget = Element + .as(event.getNativeEvent().getRelatedEventTarget()); VDropHandler newDragHanler = findDragTarget(relatedTarget, mediator); if (manager.getDragElement() != null && manager.getDragElement().isOrHasChild(relatedTarget)) { diff --git a/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java index 63c44f1fd5..f6ae4ba0ab 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/DragAndDropHandler.java @@ -173,9 +173,8 @@ public class DragAndDropHandler { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { final int typeInt = event.getTypeInt(); - if (typeInt == -1 - && event.getNativeEvent().getType() - .toLowerCase().contains("pointer")) { + if (typeInt == -1 && event.getNativeEvent().getType() + .toLowerCase().contains("pointer")) { /* * Ignore PointerEvents since IE10 and IE11 send * also MouseEvents for backwards compatibility. @@ -196,12 +195,10 @@ public class DragAndDropHandler { break; case Event.ONMOUSEMOVE: case Event.ONTOUCHMOVE: - int currentX = WidgetUtil - .getTouchOrMouseClientX(event - .getNativeEvent()); - int currentY = WidgetUtil - .getTouchOrMouseClientY(event - .getNativeEvent()); + int currentX = WidgetUtil.getTouchOrMouseClientX( + event.getNativeEvent()); + int currentY = WidgetUtil.getTouchOrMouseClientY( + event.getNativeEvent()); if (Math.abs(startX - currentX) > 3 || Math.abs(startY - currentY) > 3) { removeStartPreviewHandler(); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java index 61708260a1..025bb49e81 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java @@ -122,7 +122,7 @@ public abstract class VAbstractDropHandler implements VDropHandler { boolean validated = false; /** - * The default implemmentation visits server if {@link AcceptCriterion} + * The default implemmentation visits server if {@link AcceptCriterion} * can't be verified on client or if {@link AcceptCriterion} are met on * client. */ diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java index 109b69f0c4..0afb23ed3e 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -83,8 +83,8 @@ public class VDragAndDropManager { void clearServerCallback(); } - private final class DefaultDragAndDropEventHandler implements - NativePreviewHandler { + private final class DefaultDragAndDropEventHandler + implements NativePreviewHandler { @Override public void onPreviewNativeEvent(NativePreviewEvent event) { @@ -110,8 +110,8 @@ public class VDragAndDropManager { String display = getEventHandleStrategy().updateDragImage(event, managerMediator); - Element targetElement = getEventHandleStrategy().getTargetElement( - event, managerMediator); + Element targetElement = getEventHandleStrategy() + .getTargetElement(event, managerMediator); try { if (handleDragImage(targetElement, event)) { @@ -130,7 +130,8 @@ public class VDragAndDropManager { managerMediator); } - private boolean handleDragImage(Element target, NativePreviewEvent event) { + private boolean handleDragImage(Element target, + NativePreviewEvent event) { if (!WidgetUtil.isTouchEvent(event.getNativeEvent()) && getDragElement() == null) { return false; @@ -265,8 +266,8 @@ public class VDragAndDropManager { addActiveDragSourceStyleName(); VDropHandler dh = null; if (startEvent != null) { - dh = findDragTarget(Element.as(currentDrag - .getCurrentGwtEvent().getEventTarget())); + dh = findDragTarget(Element.as( + currentDrag.getCurrentGwtEvent().getEventTarget())); } if (dh != null) { // drag has started on a DropHandler, kind of drag over @@ -276,8 +277,8 @@ public class VDragAndDropManager { } if (handleDragEvents) { - handlerRegistration = Event - .addNativePreviewHandler(defaultDragAndDropEventHandler); + handlerRegistration = Event.addNativePreviewHandler( + defaultDragAndDropEventHandler); if (dragElement != null && dragElement.getParentElement() == null) { attachDragElement(); @@ -290,32 +291,30 @@ public class VDragAndDropManager { private void addActiveDragSourceStyleName() { ComponentConnector dragSource = currentDrag.getTransferable() .getDragSource(); - dragSource.getWidget().addStyleName( - ACTIVE_DRAG_SOURCE_STYLENAME); + dragSource.getWidget() + .addStyleName(ACTIVE_DRAG_SOURCE_STYLENAME); } }; final int eventType = Event.as(startEvent).getTypeInt(); - if (handleDragEvents - && (eventType == Event.ONMOUSEDOWN || eventType == Event.ONTOUCHSTART)) { + if (handleDragEvents && (eventType == Event.ONMOUSEDOWN + || eventType == Event.ONTOUCHSTART)) { // only really start drag event on mousemove deferredStartRegistration = Event .addNativePreviewHandler(new NativePreviewHandler() { - private int startX = WidgetUtil - .getTouchOrMouseClientX(currentDrag - .getCurrentGwtEvent()); - private int startY = WidgetUtil - .getTouchOrMouseClientY(currentDrag - .getCurrentGwtEvent()); + private int startX = WidgetUtil.getTouchOrMouseClientX( + currentDrag.getCurrentGwtEvent()); + private int startY = WidgetUtil.getTouchOrMouseClientY( + currentDrag.getCurrentGwtEvent()); @Override public void onPreviewNativeEvent( NativePreviewEvent event) { int typeInt = event.getTypeInt(); - if (typeInt == -1 - && event.getNativeEvent().getType() - .toLowerCase().contains("pointer")) { + if (typeInt == -1 && event.getNativeEvent() + .getType().toLowerCase() + .contains("pointer")) { /* * Ignore PointerEvents since IE10 and IE11 send * also MouseEvents for backwards compatibility. @@ -332,8 +331,8 @@ public class VDragAndDropManager { .getNativeEvent() .getCurrentEventTarget(); if (Node.is(currentEventTarget) - && !dragElement.isOrHasChild(Node - .as(currentEventTarget))) { + && !dragElement.isOrHasChild( + Node.as(currentEventTarget))) { // drag image appeared below, ignore break; } @@ -353,24 +352,26 @@ public class VDragAndDropManager { .getNativeEvent() .getRelatedEventTarget(); if (Node.is(relatedEventTarget) - && !dragElement.isOrHasChild(Node - .as(relatedEventTarget))) { + && !dragElement.isOrHasChild( + Node.as(relatedEventTarget))) { // drag image appeared below, ignore break; } case Event.ONMOUSEMOVE: case Event.ONTOUCHMOVE: int currentX = WidgetUtil - .getTouchOrMouseClientX(event - .getNativeEvent()); + .getTouchOrMouseClientX( + event.getNativeEvent()); int currentY = WidgetUtil - .getTouchOrMouseClientY(event - .getNativeEvent()); - if (Math.abs(startX - currentX) > MINIMUM_DISTANCE_TO_START_DRAG - || Math.abs(startY - currentY) > MINIMUM_DISTANCE_TO_START_DRAG) { + .getTouchOrMouseClientY( + event.getNativeEvent()); + if (Math.abs( + startX - currentX) > MINIMUM_DISTANCE_TO_START_DRAG + || Math.abs(startY + - currentY) > MINIMUM_DISTANCE_TO_START_DRAG) { ensureDeferredRegistrationCleanup(); - currentDrag.setCurrentGwtEvent(event - .getNativeEvent()); + currentDrag.setCurrentGwtEvent( + event.getNativeEvent()); startDrag.execute(); } break; @@ -488,8 +489,7 @@ public class VDragAndDropManager { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { - if (!client.getMessageSender() - .hasActiveRequest()) { + if (!client.getMessageSender().hasActiveRequest()) { removeActiveDragSourceStyleName(dragSource); return false; } @@ -514,8 +514,8 @@ public class VDragAndDropManager { * the server visit is done. */ if (!sendTransferableToServer && currentDrag != null) { - removeActiveDragSourceStyleName(currentDrag.getTransferable() - .getDragSource()); + removeActiveDragSourceStyleName( + currentDrag.getTransferable().getDragSource()); } currentDrag = null; @@ -541,7 +541,8 @@ public class VDragAndDropManager { } } - private void removeActiveDragSourceStyleName(ComponentConnector dragSource) { + private void removeActiveDragSourceStyleName( + ComponentConnector dragSource) { dragSource.getWidget().removeStyleName(ACTIVE_DRAG_SOURCE_STYLENAME); } @@ -608,8 +609,8 @@ public class VDragAndDropManager { if (currentDrag.getCurrentGwtEvent() != null) { try { MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder - .buildMouseEventDetails(currentDrag - .getCurrentGwtEvent()); + .buildMouseEventDetails( + currentDrag.getCurrentGwtEvent()); currentDrag.getDropDetails().put("mouseEvent", mouseEventDetails.serialize()); } catch (Exception e) { @@ -700,7 +701,8 @@ public class VDragAndDropManager { ApplicationConnection connection = getCurrentDragApplicationConnection(); Element dragImageParent; if (connection == null) { - VConsole.error("Could not determine ApplicationConnection for current drag operation. The drag image will likely look broken"); + VConsole.error( + "Could not determine ApplicationConnection for current drag operation. The drag image will likely look broken"); dragImageParent = RootPanel.getBodyElement(); } else { dragImageParent = VOverlay.getOverlayContainer(connection); diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java index c889dbf34e..aaa6e5c488 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VDragEvent.java @@ -112,7 +112,8 @@ public class VDragEvent { * instead */ @Deprecated - public void setElementOver(com.google.gwt.user.client.Element targetElement) { + public void setElementOver( + com.google.gwt.user.client.Element targetElement) { elementOver = targetElement; } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java index 672eac9e06..ed4dd1b6cb 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VHtml5DragEvent.java @@ -94,15 +94,15 @@ public class VHtml5DragEvent extends NativeEvent { return item.webkitGetAsEntry().isFile; } } - + // Zero sized files without a type are also likely to be folders var file = this.dataTransfer.files[fileIndex]; if (file.size == 0 && !file.type) { return false; } - + // TODO Make it detect folders on all browsers - + return true; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VOverTreeNode.java b/client/src/main/java/com/vaadin/client/ui/dd/VOverTreeNode.java index c7c00a6bee..2ebde20780 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VOverTreeNode.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VOverTreeNode.java @@ -24,8 +24,8 @@ final public class VOverTreeNode extends VAcceptCriterion { @Override protected boolean accept(VDragEvent drag, UIDL configuration) { - Boolean containsKey = (Boolean) drag.getDropDetails().get( - "itemIdOverIsNode"); + Boolean containsKey = (Boolean) drag.getDropDetails() + .get("itemIdOverIsNode"); return containsKey != null && containsKey.booleanValue(); } } diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VTargetDetailIs.java b/client/src/main/java/com/vaadin/client/ui/dd/VTargetDetailIs.java index 9084d7df89..72cf0b4c2b 100644 --- a/client/src/main/java/com/vaadin/client/ui/dd/VTargetDetailIs.java +++ b/client/src/main/java/com/vaadin/client/ui/dd/VTargetDetailIs.java @@ -28,8 +28,8 @@ final public class VTargetDetailIs extends VAcceptCriterion { @Override protected boolean accept(VDragEvent drag, UIDL configuration) { String name = configuration.getStringAttribute("p"); - String t = configuration.hasAttribute("t") ? configuration - .getStringAttribute("t").intern() : "s"; + String t = configuration.hasAttribute("t") + ? configuration.getStringAttribute("t").intern() : "s"; Object value = null; if (t == "s") { value = configuration.getStringAttribute("v"); diff --git a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java index 7ea9596809..b1d326ee84 100644 --- a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java @@ -78,11 +78,13 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector && !receiverUrl .equals(getWidget().fileIdToReceiver .get(fileId))) { - VConsole.error("Overwriting file receiver mapping for fileId " - + fileId - + " . Old receiver URL: " - + getWidget().fileIdToReceiver.get(fileId) - + " New receiver URL: " + receiverUrl); + VConsole.error( + "Overwriting file receiver mapping for fileId " + + fileId + " . Old receiver URL: " + + getWidget().fileIdToReceiver + .get(fileId) + + " New receiver URL: " + + receiverUrl); } getWidget().fileIdToReceiver.put(fileId, receiverUrl); } @@ -90,11 +92,11 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector } getWidget().startNextUpload(); - getWidget().dragStartMode = uidl - .getIntAttribute(DragAndDropWrapperConstants.DRAG_START_MODE); + getWidget().dragStartMode = uidl.getIntAttribute( + DragAndDropWrapperConstants.DRAG_START_MODE); - String dragImageComponentConnectorId = uidl - .getStringAttribute(DragAndDropWrapperConstants.DRAG_START_COMPONENT_ATTRIBUTE); + String dragImageComponentConnectorId = uidl.getStringAttribute( + DragAndDropWrapperConstants.DRAG_START_COMPONENT_ATTRIBUTE); ComponentConnector connector = null; if (dragImageComponentConnectorId != null) { @@ -102,8 +104,7 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector .getConnector(dragImageComponentConnectorId); if (connector == null) { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, "DragAndDropWrapper drag image component" + " connector now found. Make sure the" + " component is attached."); @@ -112,8 +113,8 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector } } getWidget().initDragStartMode(); - getWidget().html5DataFlavors = uidl - .getMapAttribute(DragAndDropWrapperConstants.HTML5_DATA_FLAVORS); + getWidget().html5DataFlavors = uidl.getMapAttribute( + DragAndDropWrapperConstants.HTML5_DATA_FLAVORS); // Used to prevent wrapper from stealing tooltips when not defined getWidget().hasTooltip = getState().description != null; diff --git a/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java b/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java index 7b837726a7..2419d0f361 100644 --- a/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/embedded/EmbeddedConnector.java @@ -44,8 +44,8 @@ import com.vaadin.shared.ui.embedded.EmbeddedState; import com.vaadin.ui.Embedded; @Connect(Embedded.class) -public class EmbeddedConnector extends AbstractComponentConnector implements - Paintable { +public class EmbeddedConnector extends AbstractComponentConnector + implements Paintable { private Element resourceElement; private ObjectElement objectElement; @@ -136,9 +136,9 @@ public class EmbeddedConnector extends AbstractComponentConnector implements setResourceUrl(getResourceUrl("src")); if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) { - el.setPropertyString( - EmbeddedConstants.ALTERNATE_TEXT, - uidl.getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT)); + el.setPropertyString(EmbeddedConstants.ALTERNATE_TEXT, + uidl.getStringAttribute( + EmbeddedConstants.ALTERNATE_TEXT)); } if (created) { @@ -160,16 +160,16 @@ public class EmbeddedConnector extends AbstractComponentConnector implements + " allowTransparency=\"true\" src=\"\"" + " name=\"" + uidl.getId() + "\"></iframe>"); - getWidget().browserElement = DOM.getFirstChild(getWidget() - .getElement()); + getWidget().browserElement = DOM + .getFirstChild(getWidget().getElement()); } resourceElement = getWidget().browserElement; objectElement = null; setResourceUrl(getResourceUrl("src")); clearBrowserElement = false; } else { - VConsole.error("Unknown Embedded type '" + getWidget().type - + "'"); + VConsole.error( + "Unknown Embedded type '" + getWidget().type + "'"); } } else if (uidl.hasAttribute("mimetype")) { // remove old style name related to type @@ -235,8 +235,8 @@ public class EmbeddedConnector extends AbstractComponentConnector implements } getWidget().getElement().appendChild(obj); if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) { - obj.setInnerText(uidl - .getStringAttribute(EmbeddedConstants.ALTERNATE_TEXT)); + obj.setInnerText(uidl.getStringAttribute( + EmbeddedConstants.ALTERNATE_TEXT)); } } else { VConsole.error("Unknown Embedded mimetype '" + mime + "'"); diff --git a/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java index 39992d91a6..c8cbf6e54c 100644 --- a/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java @@ -45,8 +45,8 @@ import com.vaadin.shared.ui.orderedlayout.FormLayoutState; import com.vaadin.ui.FormLayout; @Connect(FormLayout.class) -public class FormLayoutConnector extends AbstractLayoutConnector implements - PostLayoutListener { +public class FormLayoutConnector extends AbstractLayoutConnector + implements PostLayoutListener { /* * Handlers & Listeners @@ -85,8 +85,8 @@ public class FormLayoutConnector extends AbstractLayoutConnector implements LayoutManager layoutManager = getLayoutManager(); double tableWidth = layoutManager .getOuterWidthDouble(getWidget().table.getElement()); - double ownWidth = layoutManager.getInnerWidthDouble(getWidget() - .getElement()); + double ownWidth = layoutManager + .getInnerWidthDouble(getWidget().getElement()); if (ownWidth < tableWidth) { // Something inside the table prevents it from shrinking, // temporarily force column widths @@ -113,8 +113,8 @@ public class FormLayoutConnector extends AbstractLayoutConnector implements // Restrict content td width // Round down to prevent interactions with fractional sizes of // other columns - int targetWidth = (int) Math.floor(componentColWidth - - excessWidth); + int targetWidth = (int) Math + .floor(componentColWidth - excessWidth); // Target might be negative if captions are wider than the total // available width @@ -152,8 +152,8 @@ public class FormLayoutConnector extends AbstractLayoutConnector implements public void onUnregister() { getLayoutManager().removeElementResizeListener( getWidget().table.getElement(), resizeListener); - getLayoutManager().removeElementResizeListener( - getWidget().getElement(), resizeListener); + getLayoutManager().removeElementResizeListener(getWidget().getElement(), + resizeListener); removeComponentCellListener(); super.onUnregister(); } @@ -176,7 +176,8 @@ public class FormLayoutConnector extends AbstractLayoutConnector implements } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { VFormLayout formLayout = getWidget(); VFormLayoutTable formLayoutTable = getWidget().table; @@ -249,7 +250,8 @@ public class FormLayoutConnector extends AbstractLayoutConnector implements // FIXME This incorrectly depends on AbstractFieldConnector if (component instanceof AbstractFieldConnector) { - hideErrors = ((AbstractFieldConnector) component).getState().hideErrors; + hideErrors = ((AbstractFieldConnector) component) + .getState().hideErrors; } getWidget().table.updateError(component.getWidget(), diff --git a/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java index 03beb3c1e0..1a81c657a0 100644 --- a/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java @@ -111,7 +111,8 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector layout.colExpandRatioArray = getState().colExpand; layout.rowExpandRatioArray = getState().rowExpand; - layout.updateMarginStyleNames(new MarginInfo(getState().marginsBitmask)); + layout.updateMarginStyleNames( + new MarginInfo(getState().marginsBitmask)); layout.updateSpacingStyleName(getState().spacing); getLayoutManager().setNeedsLayout(this); } @@ -132,7 +133,8 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { VGridLayout layout = getWidget(); // clean non rendered components diff --git a/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java b/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java index b323fde1db..80bde33449 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/ComponentConnectorLayoutSlot.java @@ -39,15 +39,15 @@ public class ComponentConnectorLayoutSlot extends VLayoutSlot { @Override protected int getCaptionHeight() { VCaption caption = getCaption(); - return caption != null ? getLayoutManager().getOuterHeight( - caption.getElement()) : 0; + return caption != null + ? getLayoutManager().getOuterHeight(caption.getElement()) : 0; } @Override protected int getCaptionWidth() { VCaption caption = getCaption(); - return caption != null ? getLayoutManager().getOuterWidth( - caption.getElement()) : 0; + return caption != null + ? getLayoutManager().getOuterWidth(caption.getElement()) : 0; } public LayoutManager getLayoutManager() { diff --git a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java index 27733bfbe3..105f905ac4 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/LayoutDependencyTree.java @@ -67,8 +67,8 @@ public class LayoutDependencyTree { layoutBlockers.add(blockerId); if (wasEmpty) { if (needsLayout) { - getLayoutQueue(direction).remove( - connector.getConnectorId()); + getLayoutQueue(direction) + .remove(connector.getConnectorId()); } else { // Propagation already done if needsLayout is set propagatePotentialLayout(); @@ -83,8 +83,8 @@ public class LayoutDependencyTree { layoutBlockers.remove(blockerId); if (layoutBlockers.isEmpty()) { if (needsLayout) { - getLayoutQueue(direction).add( - connector.getConnectorId()); + getLayoutQueue(direction) + .add(connector.getConnectorId()); } else { propagateNoUpcomingLayout(); } @@ -102,8 +102,8 @@ public class LayoutDependencyTree { measureBlockers.add(blockerId); if (wasEmpty) { if (needsMeasure) { - getMeasureQueue(direction).remove( - connector.getConnectorId()); + getMeasureQueue(direction) + .remove(connector.getConnectorId()); } else { propagatePotentialResize(); } @@ -247,7 +247,8 @@ public class LayoutDependencyTree { if (connector instanceof HasComponentsConnector) { HasComponentsConnector container = (HasComponentsConnector) connector; - for (ComponentConnector child : container.getChildComponents()) { + for (ComponentConnector child : container + .getChildComponents()) { if (!Util.shouldSkipMeasurementOfConnector(child, connector) && isRelativeInDirection(child, direction)) { resized.push(child.getConnectorId()); @@ -280,15 +281,19 @@ public class LayoutDependencyTree { LayoutDependency layoutDependency = getDependency(connectorId, direction); if (layoutDependency.connector instanceof ManagedLayout) { - Profiler.enter("LayoutDependency.markSizeAsChanged setNeedsLayout"); + Profiler.enter( + "LayoutDependency.markSizeAsChanged setNeedsLayout"); layoutDependency.setNeedsLayout(true); - Profiler.leave("LayoutDependency.markSizeAsChanged setNeedsLayout"); + Profiler.leave( + "LayoutDependency.markSizeAsChanged setNeedsLayout"); } else { - Profiler.enter("LayoutDependency.markSizeAsChanged propagatePostLayoutMeasure"); + Profiler.enter( + "LayoutDependency.markSizeAsChanged propagatePostLayoutMeasure"); // Should simulate setNeedsLayout(true) + markAsLayouted -> // propagate needs measure layoutDependency.propagatePostLayoutMeasure(); - Profiler.leave("LayoutDependency.markSizeAsChanged propagatePostLayoutMeasure"); + Profiler.leave( + "LayoutDependency.markSizeAsChanged propagatePostLayoutMeasure"); } } Profiler.leave("LayoutDependency.markSizeAsChanged phase 1"); @@ -296,7 +301,8 @@ public class LayoutDependencyTree { Profiler.enter("LayoutDependency.markSizeAsChanged scrollbars"); // Should also go through the hierarchy to discover appeared or // disappeared scrollbars - ComponentConnector scrollingBoundary = getScrollingBoundary(connector); + ComponentConnector scrollingBoundary = getScrollingBoundary( + connector); if (scrollingBoundary != null) { getDependency(scrollingBoundary.getConnectorId(), getOppositeDirection()).setNeedsMeasure(true); @@ -343,28 +349,34 @@ public class LayoutDependencyTree { } private void propagatePostLayoutMeasure() { - Profiler.enter("LayoutDependency.propagatePostLayoutMeasure getResizedByLayout"); + Profiler.enter( + "LayoutDependency.propagatePostLayoutMeasure getResizedByLayout"); JsArrayString resizedByLayout = getResizedByLayout(); - Profiler.leave("LayoutDependency.propagatePostLayoutMeasure getResizedByLayout"); + Profiler.leave( + "LayoutDependency.propagatePostLayoutMeasure getResizedByLayout"); int length = resizedByLayout.length(); for (int i = 0; i < length; i++) { - Profiler.enter("LayoutDependency.propagatePostLayoutMeasure setNeedsMeasure"); + Profiler.enter( + "LayoutDependency.propagatePostLayoutMeasure setNeedsMeasure"); String resizedId = resizedByLayout.get(i); LayoutDependency layoutDependency = getDependency(resizedId, direction); layoutDependency.setNeedsMeasure(true); - Profiler.leave("LayoutDependency.propagatePostLayoutMeasure setNeedsMeasure"); + Profiler.leave( + "LayoutDependency.propagatePostLayoutMeasure setNeedsMeasure"); } // Special case for e.g. wrapping texts - Profiler.enter("LayoutDependency.propagatePostLayoutMeasure horizontal case"); + Profiler.enter( + "LayoutDependency.propagatePostLayoutMeasure horizontal case"); if (direction == HORIZONTAL && !connector.isUndefinedWidth() && connector.isUndefinedHeight()) { LayoutDependency dependency = getDependency( connector.getConnectorId(), VERTICAL); dependency.setNeedsMeasure(true); } - Profiler.leave("LayoutDependency.propagatePostLayoutMeasure horizontal case"); + Profiler.leave( + "LayoutDependency.propagatePostLayoutMeasure horizontal case"); } @Override @@ -377,13 +389,15 @@ public class LayoutDependencyTree { } AbstractComponentState state = connector.getState(); s += " sizing: " - + getSizeDefinition(direction == VERTICAL ? state.height - : state.width) + "\n"; + + getSizeDefinition( + direction == VERTICAL ? state.height : state.width) + + "\n"; if (needsLayout) { s += "Needs layout\n"; } - if (getLayoutQueue(direction).contains(connector.getConnectorId())) { + if (getLayoutQueue(direction) + .contains(connector.getConnectorId())) { s += "In layout queue\n"; } s += "Layout blockers: " + blockersToString(layoutBlockers) + "\n"; @@ -391,7 +405,8 @@ public class LayoutDependencyTree { if (needsMeasure) { s += "Needs measure\n"; } - if (getMeasureQueue(direction).contains(connector.getConnectorId())) { + if (getMeasureQueue(direction) + .contains(connector.getConnectorId())) { s += "In measure queue\n"; } s += "Measure blockers: " + blockersToString(measureBlockers); @@ -441,8 +456,8 @@ public class LayoutDependencyTree { */ @Deprecated public void setNeedsMeasure(String connectorId, boolean needsMeasure) { - ComponentConnector connector = (ComponentConnector) ConnectorMap.get( - connection).getConnector(connectorId); + ComponentConnector connector = (ComponentConnector) ConnectorMap + .get(connection).getConnector(connectorId); if (connector == null) { return; } @@ -459,8 +474,8 @@ public class LayoutDependencyTree { public void setNeedsHorizontalMeasure(String connectorId, boolean needsMeasure) { // Ensure connector exists - ComponentConnector connector = (ComponentConnector) ConnectorMap.get( - connection).getConnector(connectorId); + ComponentConnector connector = (ComponentConnector) ConnectorMap + .get(connection).getConnector(connectorId); if (connector == null) { return; } @@ -474,10 +489,11 @@ public class LayoutDependencyTree { dependency.setNeedsMeasure(needsMeasure); } - public void setNeedsVerticalMeasure(String connectorId, boolean needsMeasure) { + public void setNeedsVerticalMeasure(String connectorId, + boolean needsMeasure) { // Ensure connector exists - ComponentConnector connector = (ComponentConnector) ConnectorMap.get( - connection).getConnector(connectorId); + ComponentConnector connector = (ComponentConnector) ConnectorMap + .get(connection).getConnector(connectorId); if (connector == null) { return; } @@ -503,9 +519,8 @@ public class LayoutDependencyTree { connector = (ComponentConnector) ConnectorMap.get(connection) .getConnector(connectorId); if (connector == null) { - getLogger().warning( - "No connector found for id " + connectorId - + " while creating LayoutDependency"); + getLogger().warning("No connector found for id " + + connectorId + " while creating LayoutDependency"); return null; } } @@ -537,13 +552,14 @@ public class LayoutDependencyTree { setNeedsHorizontalLayout(layout.getConnectorId(), needsLayout); } - public void setNeedsHorizontalLayout(String connectorId, boolean needsLayout) { + public void setNeedsHorizontalLayout(String connectorId, + boolean needsLayout) { LayoutDependency dependency = getDependency(connectorId, HORIZONTAL); if (dependency != null) { dependency.setNeedsLayout(needsLayout); } else { - getLogger().warning( - "No dependency found in setNeedsHorizontalLayout"); + getLogger() + .warning("No dependency found in setNeedsHorizontalLayout"); } } @@ -556,11 +572,13 @@ public class LayoutDependencyTree { * performance. */ @Deprecated - public void setNeedsVerticalLayout(ManagedLayout layout, boolean needsLayout) { + public void setNeedsVerticalLayout(ManagedLayout layout, + boolean needsLayout) { setNeedsVerticalLayout(layout.getConnectorId(), needsLayout); } - public void setNeedsVerticalLayout(String connectorId, boolean needsLayout) { + public void setNeedsVerticalLayout(String connectorId, + boolean needsLayout) { LayoutDependency dependency = getDependency(connectorId, VERTICAL); if (dependency != null) { dependency.setNeedsLayout(needsLayout); @@ -634,8 +652,8 @@ public class LayoutDependencyTree { ConnectorMap connectorMap = ConnectorMap.get(connection); JsArrayString blockersDump = blockers.dump(); for (int i = 0; i < blockersDump.length(); i++) { - ServerConnector blocker = connectorMap.getConnector(blockersDump - .get(i)); + ServerConnector blocker = connectorMap + .getConnector(blockersDump.get(i)); if (b.length() != 1) { b.append(", "); } @@ -678,7 +696,8 @@ public class LayoutDependencyTree { return asManagedLayoutArray(getVerticalLayoutTargetsJsArray()); } - private ManagedLayout[] asManagedLayoutArray(JsArrayString connectorIdArray) { + private ManagedLayout[] asManagedLayoutArray( + JsArrayString connectorIdArray) { int length = connectorIdArray.length(); ConnectorMap connectorMap = ConnectorMap.get(connection); ManagedLayout[] result = new ManagedLayout[length]; @@ -738,7 +757,8 @@ public class LayoutDependencyTree { .noMoreChangesExpected(); } - public ComponentConnector getScrollingBoundary(ComponentConnector connector) { + public ComponentConnector getScrollingBoundary( + ComponentConnector connector) { LayoutDependency dependency = getDependency(connector.getConnectorId(), HORIZONTAL); if (!dependency.scrollingParentCached) { @@ -746,7 +766,8 @@ public class LayoutDependencyTree { if (parent instanceof MayScrollChildren) { dependency.scrollingBoundary = connector; } else if (parent instanceof ComponentConnector) { - dependency.scrollingBoundary = getScrollingBoundary((ComponentConnector) parent); + dependency.scrollingBoundary = getScrollingBoundary( + (ComponentConnector) parent); } else { // No scrolling parent } diff --git a/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java b/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java index 5260e1866e..3dc661cd15 100644 --- a/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java +++ b/client/src/main/java/com/vaadin/client/ui/layout/VLayoutSlot.java @@ -52,7 +52,8 @@ public abstract class VLayoutSlot { this.caption = caption; if (caption != null) { // Physical attach. - DOM.insertBefore(wrapper, caption.getElement(), widget.getElement()); + DOM.insertBefore(wrapper, caption.getElement(), + widget.getElement()); Style style = caption.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setTop(0, Unit.PX); @@ -119,7 +120,8 @@ public abstract class VLayoutSlot { .getWidth(); double percentage = parsePercent(percentWidth); allocatedContentWidth = availableWidth * (percentage / 100); - reportActualRelativeWidth(Math.round((float) allocatedContentWidth)); + reportActualRelativeWidth( + Math.round((float) allocatedContentWidth)); } double usedWidth; // widget width in px @@ -191,8 +193,8 @@ public abstract class VLayoutSlot { String height = getWidget().getElement().getStyle().getHeight(); double percentage = parsePercent(height); allocatedContentHeight = contentHeight * (percentage / 100); - reportActualRelativeHeight(Math - .round((float) allocatedContentHeight)); + reportActualRelativeHeight( + Math.round((float) allocatedContentHeight)); } style.setTop(currentLocation, Unit.PX); diff --git a/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java b/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java index 1e77fb51b4..bc0cf33e98 100644 --- a/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/link/LinkConnector.java @@ -80,8 +80,8 @@ public class LinkConnector extends AbstractComponentConnector { DOM.insertChild(getWidget().getElement(), getWidget().errorIndicatorElement, 0); } else if (getWidget().errorIndicatorElement != null) { - getWidget().errorIndicatorElement.getStyle().setDisplay( - Display.NONE); + getWidget().errorIndicatorElement.getStyle() + .setDisplay(Display.NONE); } if (getWidget().icon != null) { diff --git a/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java b/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java index c3ed73a1d0..42e4d51f03 100644 --- a/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/loginform/LoginFormConnector.java @@ -41,8 +41,8 @@ import com.vaadin.shared.ui.loginform.LoginFormState; import com.google.gwt.core.client.Scheduler; @Connect(com.vaadin.ui.LoginForm.class) -public class LoginFormConnector extends - AbstractSingleComponentContainerConnector { +public class LoginFormConnector + extends AbstractSingleComponentContainerConnector { private VLegacyTextField passwordField; private VLegacyTextField userField; @@ -63,13 +63,15 @@ public class LoginFormConnector extends super.init(); loginFormRpc = getRpcProxy(LoginFormRpc.class); - getWidget().addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { - @Override - public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) { - valuesChanged(); - loginFormRpc.submitCompleted(); - } - }); + getWidget().addSubmitCompleteHandler( + new FormPanel.SubmitCompleteHandler() { + @Override + public void onSubmitComplete( + FormPanel.SubmitCompleteEvent event) { + valuesChanged(); + loginFormRpc.submitCompleted(); + } + }); } @Override @@ -78,7 +80,8 @@ public class LoginFormConnector extends } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { ComponentConnector content = getContent(); if (content != null) { getWidget().setWidget(getContentWidget()); @@ -90,7 +93,8 @@ public class LoginFormConnector extends super.onStateChanged(stateChangeEvent); LoginFormState state = getState(); - userField = configureTextField(state.userNameFieldConnector, "username"); + userField = configureTextField(state.userNameFieldConnector, + "username"); passwordField = configureTextField(state.passwordFieldConnector, "password"); addSubmitButtonClickHandler(state.loginButtonConnector); @@ -98,9 +102,11 @@ public class LoginFormConnector extends getResourceUrl(LoginFormConstants.LOGIN_RESOURCE_NAME)); } - private VLegacyTextField configureTextField(Connector connector, String id) { + private VLegacyTextField configureTextField(Connector connector, + String id) { if (connector != null) { - VLegacyTextField textField = ((LegacyTextFieldConnector) connector).getWidget(); + VLegacyTextField textField = ((LegacyTextFieldConnector) connector) + .getWidget(); textField.addKeyDownHandler(new SubmitKeyHandler()); @@ -135,11 +141,11 @@ public class LoginFormConnector extends private void addSubmitButtonClickHandler(Connector buttonConnector) { if (buttonConnector instanceof ButtonConnector) { - addSubmitButtonClickHandler(((ButtonConnector) buttonConnector) - .getWidget()); + addSubmitButtonClickHandler( + ((ButtonConnector) buttonConnector).getWidget()); } else if (buttonConnector instanceof NativeButtonConnector) { - addSubmitButtonClickHandler(((NativeButtonConnector) buttonConnector) - .getWidget()); + addSubmitButtonClickHandler( + ((NativeButtonConnector) buttonConnector).getWidget()); } } diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java index 833fb5a38a..0b1fbde1c8 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBar.java @@ -60,13 +60,11 @@ import com.vaadin.client.ui.VOverlay; * <ul class='css'> * <li>.gwt-MenuBar { the menu bar itself }</li> * <li>.gwt-MenuBar .gwt-MenuItem { menu items }</li> - * <li> - * .gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li> + * <li>.gwt-MenuBar .gwt-MenuItem-selected { selected menu items }</li> * </ul> * * <p> - * <h3>Example</h3> - * {@example com.google.gwt.examples.MenuBarExample} + * <h3>Example</h3> {@example com.google.gwt.examples.MenuBarExample} * </p> * * @deprecated @@ -377,7 +375,8 @@ public class MenuBar extends Widget implements PopupListener { while (curMenu != null) { curMenu.close(); - if ((curMenu.parentMenu == null) && (curMenu.selectedItem != null)) { + if ((curMenu.parentMenu == null) + && (curMenu.selectedItem != null)) { curMenu.selectedItem.setSelectionStyle(false); curMenu.selectedItem = null; } diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java index 03eeb85165..5aa3a76d33 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java @@ -36,8 +36,8 @@ import com.vaadin.shared.ui.menubar.MenuBarConstants; import com.vaadin.shared.ui.menubar.MenuBarState; @Connect(com.vaadin.ui.MenuBar.class) -public class MenuBarConnector extends AbstractComponentConnector implements - Paintable, SimpleManagedLayout { +public class MenuBarConnector extends AbstractComponentConnector + implements Paintable, SimpleManagedLayout { /** * This method must be implemented to update the client-side component from @@ -78,9 +78,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements if (moreItemUIDL.hasAttribute("icon")) { itemHTML.append("<img src=\"" - + WidgetUtil.escapeAttribute(client - .translateVaadinUri(moreItemUIDL - .getStringAttribute("icon"))) + + WidgetUtil.escapeAttribute(client.translateVaadinUri( + moreItemUIDL.getStringAttribute("icon"))) + "\" class=\"" + ImageIcon.CLASSNAME + "\" alt=\"\" />"); } @@ -97,8 +96,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements getWidget().collapsedRootItems = new VMenuBar(true, getWidget()); getWidget().moreItem.setSubMenu(getWidget().collapsedRootItems); - getWidget().moreItem.addStyleName(getWidget().getStylePrimaryName() - + "-more-menuitem"); + getWidget().moreItem.addStyleName( + getWidget().getStylePrimaryName() + "-more-menuitem"); } UIDL uidlItems = uidl.getChildUIDL(1); @@ -155,7 +154,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements while (!itr.hasNext() && !iteratorStack.empty()) { boolean hasCheckableItem = false; - for (VMenuBar.CustomMenuItem menuItem : currentMenu.getItems()) { + for (VMenuBar.CustomMenuItem menuItem : currentMenu + .getItems()) { hasCheckableItem = hasCheckableItem || menuItem.isCheckable(); } @@ -168,7 +168,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements itr = iteratorStack.pop(); currentMenu = menuStack.pop(); } - }// while + } // while getLayoutManager().setNeedsHorizontalLayout(this); @@ -196,8 +196,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements // Check content of widget to find tooltip for element if (element != getWidget().getElement()) { - VMenuBar.CustomMenuItem item = getWidget().getMenuItemWithElement( - element); + VMenuBar.CustomMenuItem item = getWidget() + .getMenuItemWithElement(element); if (item != null) { info = item.getTooltip(); } diff --git a/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java b/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java index 65d4a1eb9b..6a9ba4a824 100644 --- a/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java @@ -67,8 +67,8 @@ public class NativeButtonConnector extends AbstractComponentConnector { getWidget().captionElement); } else if (getWidget().errorIndicatorElement != null) { - getWidget().getElement().removeChild( - getWidget().errorIndicatorElement); + getWidget().getElement() + .removeChild(getWidget().errorIndicatorElement); getWidget().errorIndicatorElement = null; } diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java index 6d5df17b52..f4dd34f0c8 100644 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java @@ -72,13 +72,13 @@ public abstract class OptionGroupBaseConnector extends AbstractFieldConnector getWidget().newItemField.addStyleName(StyleConstants.UI_WIDGET); } - getWidget().newItemField.setEnabled(getWidget().isEnabled() - && !getWidget().isReadonly()); - getWidget().newItemButton.setEnabled(getWidget().isEnabled() - && !getWidget().isReadonly()); + getWidget().newItemField.setEnabled( + getWidget().isEnabled() && !getWidget().isReadonly()); + getWidget().newItemButton.setEnabled( + getWidget().isEnabled() && !getWidget().isReadonly()); - if (getWidget().newItemField == null - || getWidget().newItemField.getParent() != getWidget().container) { + if (getWidget().newItemField == null || getWidget().newItemField + .getParent() != getWidget().container) { getWidget().container.add(getWidget().newItemField); getWidget().container.add(getWidget().newItemButton); final int w = getWidget().container.getOffsetWidth() diff --git a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java index 6035d5ad26..1762d72abc 100644 --- a/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/optiongroup/OptionGroupConnector.java @@ -62,10 +62,10 @@ public class OptionGroupConnector extends OptionGroupBaseConnector { // add focus and blur handlers to checkboxes / radio buttons for (Widget wid : getWidget().panel) { if (wid instanceof CheckBox) { - getWidget().focusHandlers.add(((CheckBox) wid) - .addFocusHandler(getWidget())); - getWidget().blurHandlers.add(((CheckBox) wid) - .addBlurHandler(getWidget())); + getWidget().focusHandlers + .add(((CheckBox) wid).addFocusHandler(getWidget())); + getWidget().blurHandlers + .add(((CheckBox) wid).addBlurHandler(getWidget())); } } } diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index dbd530dde1..7f37e65ee9 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -52,8 +52,8 @@ import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState; /** * Base class for vertical and horizontal ordered layouts */ -public abstract class AbstractOrderedLayoutConnector extends - AbstractLayoutConnector { +public abstract class AbstractOrderedLayoutConnector + extends AbstractLayoutConnector { /* * Handlers & Listeners @@ -132,11 +132,11 @@ public abstract class AbstractOrderedLayoutConnector extends String widgetWidth = widgetElement.getStyle().getWidth(); String widgetHeight = widgetElement.getStyle().getHeight(); - if (widgetHeight.endsWith("%") - && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) { + if (widgetHeight.endsWith("%") && (pos == CaptionPosition.TOP + || pos == CaptionPosition.BOTTOM)) { getWidget().updateCaptionOffset(captionElement); - } else if (widgetWidth.endsWith("%") - && (pos == CaptionPosition.LEFT || pos == CaptionPosition.RIGHT)) { + } else if (widgetWidth.endsWith("%") && (pos == CaptionPosition.LEFT + || pos == CaptionPosition.RIGHT)) { getWidget().updateCaptionOffset(captionElement); } @@ -226,8 +226,8 @@ public abstract class AbstractOrderedLayoutConnector extends /** * The id of the previous response for which state changes have been * processed. If this is the same as the - * {@link ApplicationConnection#getLastSeenServerSyncId()}, it means that we can - * skip some quite expensive calculations because we know that the state + * {@link ApplicationConnection#getLastSeenServerSyncId()}, it means that we + * can skip some quite expensive calculations because we know that the state * hasn't changed since the last time the values were calculated. */ private int processedResponseId = -1; @@ -286,11 +286,11 @@ public abstract class AbstractOrderedLayoutConnector extends if (slot.hasCaption()) { CaptionPosition pos = slot.getCaptionPosition(); slot.setCaptionResizeListener(slotCaptionResizeListener); - if (child.isRelativeHeight() - && (pos == CaptionPosition.TOP || pos == CaptionPosition.BOTTOM)) { + if (child.isRelativeHeight() && (pos == CaptionPosition.TOP + || pos == CaptionPosition.BOTTOM)) { getWidget().updateCaptionOffset(slot.getCaptionElement()); - } else if (child.isRelativeWidth() - && (pos == CaptionPosition.LEFT || pos == CaptionPosition.RIGHT)) { + } else if (child.isRelativeWidth() && (pos == CaptionPosition.LEFT + || pos == CaptionPosition.RIGHT)) { getWidget().updateCaptionOffset(slot.getCaptionElement()); } } @@ -305,7 +305,8 @@ public abstract class AbstractOrderedLayoutConnector extends * (com.vaadin.client.ConnectorHierarchyChangeEvent) */ @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { Profiler.enter("AOLC.onConnectorHierarchyChange"); List<ComponentConnector> previousChildren = event.getOldChildren(); @@ -314,17 +315,21 @@ public abstract class AbstractOrderedLayoutConnector extends // remove spacing as it is exists as separate elements that cannot be // removed easily after reordering the contents - Profiler.enter("AOLC.onConnectorHierarchyChange temporarily remove spacing"); + Profiler.enter( + "AOLC.onConnectorHierarchyChange temporarily remove spacing"); layout.setSpacing(false); - Profiler.leave("AOLC.onConnectorHierarchyChange temporarily remove spacing"); + Profiler.leave( + "AOLC.onConnectorHierarchyChange temporarily remove spacing"); for (ComponentConnector child : getChildComponents()) { Profiler.enter("AOLC.onConnectorHierarchyChange add children"); Slot slot = layout.getSlot(child.getWidget()); if (slot.getParent() != layout) { - Profiler.enter("AOLC.onConnectorHierarchyChange add state change handler"); + Profiler.enter( + "AOLC.onConnectorHierarchyChange add state change handler"); child.addStateChangeHandler(childStateChangeHandler); - Profiler.leave("AOLC.onConnectorHierarchyChange add state change handler"); + Profiler.leave( + "AOLC.onConnectorHierarchyChange add state change handler"); } Profiler.enter("AOLC.onConnectorHierarchyChange addOrMoveSlot"); layout.addOrMoveSlot(slot, currentIndex++, false); @@ -386,14 +391,15 @@ public abstract class AbstractOrderedLayoutConnector extends * .gwt.dom.client.Element) */ @Override - public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element) { + public TooltipInfo getTooltipInfo( + com.google.gwt.dom.client.Element element) { if (element != getWidget().getElement()) { Slot slot = WidgetUtil.findWidget(element, Slot.class); if (slot != null && slot.getCaptionElement() != null && slot.getParent() == getWidget() && slot.getCaptionElement().isOrHasChild(element)) { - ComponentConnector connector = Util.findConnectorFor(slot - .getWidget()); + ComponentConnector connector = Util + .findConnectorFor(slot.getWidget()); if (connector != null) { return connector.getTooltipInfo(element); } @@ -441,7 +447,8 @@ public abstract class AbstractOrderedLayoutConnector extends boolean onlyZeroExpands = true; if (needsExpand) { for (ComponentConnector child : getChildComponents()) { - double expandRatio = getState().childData.get(child).expandRatio; + double expandRatio = getState().childData + .get(child).expandRatio; if (expandRatio != 0) { onlyZeroExpands = false; break; @@ -478,8 +485,8 @@ public abstract class AbstractOrderedLayoutConnector extends hasChildrenWithMiddleAlignment = true; } - double expandRatio = onlyZeroExpands ? 1 : getState().childData - .get(child).expandRatio; + double expandRatio = onlyZeroExpands ? 1 + : getState().childData.get(child).expandRatio; slot.setExpandRatio(expandRatio); @@ -588,8 +595,8 @@ public abstract class AbstractOrderedLayoutConnector extends if (slot.hasCaption()) { slot.setCaptionResizeListener(slotCaptionResizeListener); } - } else if ((hasChildrenWithRelativeHeight || hasChildrenWithRelativeWidth) - && slot.hasCaption()) { + } else if ((hasChildrenWithRelativeHeight + || hasChildrenWithRelativeWidth) && slot.hasCaption()) { /* * If the slot has caption, we need to listen for its size changes * in order to update the padding/margin offset for relative sized @@ -622,8 +629,8 @@ public abstract class AbstractOrderedLayoutConnector extends return; } h += getLayoutManager().getBorderHeight(getWidget().getElement()) - + getLayoutManager().getPaddingHeight( - getWidget().getElement()); + + getLayoutManager() + .getPaddingHeight(getWidget().getElement()); getWidget().getElement().getStyle().setHeight(h, Unit.PX); getLayoutManager().setNeedsMeasure(this); } @@ -644,8 +651,8 @@ public abstract class AbstractOrderedLayoutConnector extends Element captionElement = slot.getCaptionElement(); CaptionPosition captionPosition = slot.getCaptionPosition(); - int pixelHeight = layoutManager.getOuterHeight(childWidget - .getElement()); + int pixelHeight = layoutManager + .getOuterHeight(childWidget.getElement()); if (pixelHeight == -1) { // Height has not yet been measured -> postpone actions that // depend on the max height @@ -660,8 +667,7 @@ public abstract class AbstractOrderedLayoutConnector extends && captionSizeShouldBeAddedtoComponentHeight; if (includeCaptionHeight) { - int captionHeight = layoutManager - .getOuterHeight(captionElement) + int captionHeight = layoutManager.getOuterHeight(captionElement) - getLayoutManager().getMarginHeight(captionElement); if (captionHeight == -1) { // Height has not yet been measured -> postpone actions that diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java index 2cd1acd78b..9e339f1860 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/HorizontalLayoutConnector.java @@ -31,9 +31,8 @@ public class HorizontalLayoutConnector extends AbstractOrderedLayoutConnector { /* * (non-Javadoc) * - * @see - * com.vaadin.client.ui.orderedlayout.AbstractOrderedLayoutConnector#getWidget - * () + * @see com.vaadin.client.ui.orderedlayout.AbstractOrderedLayoutConnector# + * getWidget () */ @Override public VHorizontalLayout getWidget() { diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java index 564c15472f..e9cf6a0448 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/Slot.java @@ -410,8 +410,8 @@ public class Slot extends SimplePanel { if (caption == null) { return; } - captionWrap.removeClassName("v-caption-on-" - + this.captionPosition.name().toLowerCase()); + captionWrap.removeClassName( + "v-caption-on-" + this.captionPosition.name().toLowerCase()); this.captionPosition = captionPosition; if (captionPosition == CaptionPosition.BOTTOM @@ -421,8 +421,8 @@ public class Slot extends SimplePanel { captionWrap.insertFirst(caption); } - captionWrap.addClassName("v-caption-on-" - + captionPosition.name().toLowerCase()); + captionWrap.addClassName( + "v-caption-on-" + captionPosition.name().toLowerCase()); } /** @@ -489,7 +489,8 @@ public class Slot extends SimplePanel { * Is the component enabled */ public void setCaption(String captionText, Icon icon, List<String> styles, - String error, boolean showError, boolean required, boolean enabled) { + String error, boolean showError, boolean required, + boolean enabled) { setCaption(captionText, icon, styles, error, showError, required, enabled, false); } @@ -540,8 +541,8 @@ public class Slot extends SimplePanel { // Made changes to DOM. Focus can be lost if it was in the // widget. - focusLost = (focusedElement == null ? false : widget - .getElement().isOrHasChild(focusedElement)); + focusLost = (focusedElement == null ? false + : widget.getElement().isOrHasChild(focusedElement)); } } else if (caption != null) { orphan(widget); @@ -552,8 +553,8 @@ public class Slot extends SimplePanel { captionWrap = null; // Made changes to DOM. Focus can be lost if it was in the widget. - focusLost = (focusedElement == null ? false : widget.getElement() - .isOrHasChild(focusedElement)); + focusLost = (focusedElement == null ? false + : widget.getElement().isOrHasChild(focusedElement)); } // Caption text @@ -663,8 +664,8 @@ public class Slot extends SimplePanel { // even if it does it will be stopped once something // is done with the browser. schedule(25); - } else if (WidgetUtil.getFocusedElement().equals( - Document.get().getBody())) { + } else if (WidgetUtil.getFocusedElement() + .equals(Document.get().getBody())) { // Focus found it's way to BodyElement. Now it can // be restored focusedElement.focus(); diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java index 1a36ba9c93..02e4e651a3 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VAbstractOrderedLayout.java @@ -120,24 +120,29 @@ public class VAbstractOrderedLayout extends FlowPanel { * operation */ public void addOrMoveSlot(Slot slot, int index, boolean adjustSpacing) { - Profiler.enter("VAOL.onConnectorHierarchyChange addOrMoveSlot find index"); + Profiler.enter( + "VAOL.onConnectorHierarchyChange addOrMoveSlot find index"); if (slot.getParent() == this) { int currentIndex = getWidgetIndex(slot); if (index == currentIndex) { - Profiler.leave("VAOL.onConnectorHierarchyChange addOrMoveSlot find index"); + Profiler.leave( + "VAOL.onConnectorHierarchyChange addOrMoveSlot find index"); return; } } - Profiler.leave("VAOL.onConnectorHierarchyChange addOrMoveSlot find index"); + Profiler.leave( + "VAOL.onConnectorHierarchyChange addOrMoveSlot find index"); Profiler.enter("VAOL.onConnectorHierarchyChange addOrMoveSlot insert"); insert(slot, index); Profiler.leave("VAOL.onConnectorHierarchyChange addOrMoveSlot insert"); if (adjustSpacing) { - Profiler.enter("VAOL.onConnectorHierarchyChange addOrMoveSlot setSpacing"); + Profiler.enter( + "VAOL.onConnectorHierarchyChange addOrMoveSlot setSpacing"); setSpacing(spacing); - Profiler.leave("VAOL.onConnectorHierarchyChange addOrMoveSlot setSpacing"); + Profiler.leave( + "VAOL.onConnectorHierarchyChange addOrMoveSlot setSpacing"); } } @@ -336,14 +341,14 @@ public class VAbstractOrderedLayout extends FlowPanel { RegExp captionPositionRegexp = RegExp.compile("v-caption-on-(\\S+)"); // Get caption position from the classname - MatchResult matcher = captionPositionRegexp.exec(captionWrap - .getClassName()); + MatchResult matcher = captionPositionRegexp + .exec(captionWrap.getClassName()); if (matcher == null || matcher.getGroupCount() < 2) { return CaptionPosition.TOP; } String captionClass = matcher.getGroup(1); - CaptionPosition captionPosition = CaptionPosition.valueOf( - CaptionPosition.class, captionClass.toUpperCase()); + CaptionPosition captionPosition = CaptionPosition + .valueOf(CaptionPosition.class, captionClass.toUpperCase()); return captionPosition; } @@ -373,7 +378,8 @@ public class VAbstractOrderedLayout extends FlowPanel { * {@link #updateCaptionOffset(Element)} instead */ @Deprecated - public void updateCaptionOffset(com.google.gwt.user.client.Element caption) { + public void updateCaptionOffset( + com.google.gwt.user.client.Element caption) { Element captionWrap = caption.getParentElement(); @@ -390,7 +396,8 @@ public class VAbstractOrderedLayout extends FlowPanel { captionStyle.clearMarginLeft(); // Get caption position from the classname - CaptionPosition captionPosition = getCaptionPositionFromElement(captionWrap); + CaptionPosition captionPosition = getCaptionPositionFromElement( + captionWrap); if (captionPosition == CaptionPosition.LEFT || captionPosition == CaptionPosition.RIGHT) { @@ -644,22 +651,22 @@ public class VAbstractOrderedLayout extends FlowPanel { if (layoutManager != null) { // TODO check caption position if (vertical) { - int size = layoutManager.getOuterHeight(slot - .getWidget().getElement()); + int size = layoutManager.getOuterHeight( + slot.getWidget().getElement()); if (slot.hasCaption()) { - size += layoutManager.getOuterHeight(slot - .getCaptionElement()); + size += layoutManager.getOuterHeight( + slot.getCaptionElement()); } if (size > 0) { totalSize += size; } } else { int max = -1; - max = layoutManager.getOuterWidth(slot.getWidget() - .getElement()); + max = layoutManager.getOuterWidth( + slot.getWidget().getElement()); if (slot.hasCaption()) { - int max2 = layoutManager.getOuterWidth(slot - .getCaptionElement()); + int max2 = layoutManager.getOuterWidth( + slot.getCaptionElement()); max = Math.max(max, max2); } if (max > 0) { @@ -668,13 +675,13 @@ public class VAbstractOrderedLayout extends FlowPanel { } } else { // FIXME expandRatio might be <0 - totalSize += vertical ? slot.getOffsetHeight() : slot - .getOffsetWidth(); + totalSize += vertical ? slot.getOffsetHeight() + : slot.getOffsetWidth(); } } // TODO fails in Opera, always returns 0 - int spacingSize = vertical ? slot.getVerticalSpacing() : slot - .getHorizontalSpacing(); + int spacingSize = vertical ? slot.getVerticalSpacing() + : slot.getHorizontalSpacing(); if (spacingSize > 0) { totalSize += spacingSize; } @@ -702,8 +709,8 @@ public class VAbstractOrderedLayout extends FlowPanel { // FIXME expandRatio might be <0 if (slot.getExpandRatio() != 0) { if (layoutManager != null) { - layoutManager.setNeedsMeasure(Util - .findConnectorFor(slot.getWidget())); + layoutManager.setNeedsMeasure( + Util.findConnectorFor(slot.getWidget())); } else if (slot.getWidget() instanceof RequiresResize) { ((RequiresResize) slot.getWidget()).onResize(); } diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java index 33ff020e89..56a639692c 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/VerticalLayoutConnector.java @@ -31,9 +31,8 @@ public class VerticalLayoutConnector extends AbstractOrderedLayoutConnector { /* * (non-Javadoc) * - * @see - * com.vaadin.client.ui.orderedlayout.AbstractOrderedLayoutConnector#getWidget - * () + * @see com.vaadin.client.ui.orderedlayout.AbstractOrderedLayoutConnector# + * getWidget () */ @Override public VVerticalLayout getWidget() { diff --git a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java index 11111df602..839a9fd3b8 100644 --- a/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/panel/PanelConnector.java @@ -92,8 +92,8 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector // Restore default stylenames getWidget().contentNode.setClassName(VPanel.CLASSNAME + "-content"); - getWidget().bottomDecoration.setClassName(VPanel.CLASSNAME - + "-deco"); + getWidget().bottomDecoration + .setClassName(VPanel.CLASSNAME + "-deco"); getWidget().captionNode.setClassName(VPanel.CLASSNAME + "-caption"); boolean hasCaption = false; if (getState().caption != null && !"".equals(getState().caption)) { @@ -101,8 +101,8 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector hasCaption = true; } else { getWidget().setCaption(""); - getWidget().captionNode.setClassName(VPanel.CLASSNAME - + "-nocaption"); + getWidget().captionNode + .setClassName(VPanel.CLASSNAME + "-nocaption"); } // Add proper stylenames for all elements. This way we can prevent @@ -202,8 +202,8 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector Profiler.enter("PanelConnector.layout modify style"); Style style = panel.getElement().getStyle(); - panel.captionNode.getParentElement().getStyle() - .setMarginTop(-top, Unit.PX); + panel.captionNode.getParentElement().getStyle().setMarginTop(-top, + Unit.PX); panel.bottomDecoration.getStyle().setMarginBottom(-bottom, Unit.PX); style.setPaddingTop(top, Unit.PX); style.setPaddingBottom(bottom, Unit.PX); @@ -248,7 +248,8 @@ public class PanelConnector extends AbstractSingleComponentContainerConnector } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { // We always have 1 child, unless the child is hidden getWidget().setWidget(getContentWidget()); } diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java index 6afceb75de..02ec2ab243 100644 --- a/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/popupview/PopupViewConnector.java @@ -107,8 +107,8 @@ public class PopupViewConnector extends AbstractHasComponentsConnector styleBuf.append(primaryName); // Add "animate-in" class back if already present - boolean isAnimatingIn = getWidget().popup.getStyleName().contains( - VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN); + boolean isAnimatingIn = getWidget().popup.getStyleName() + .contains(VOverlay.ADDITIONAL_CLASSNAME_ANIMATE_IN); if (isAnimatingIn) { styleBuf.append(" "); @@ -138,8 +138,8 @@ public class PopupViewConnector extends AbstractHasComponentsConnector @Override public void onVisibilityChange(VisibilityChangeEvent event) { - getRpcProxy(PopupViewServerRpc.class).setPopupVisibility( - event.isVisible()); + getRpcProxy(PopupViewServerRpc.class) + .setPopupVisibility(event.isVisible()); } } diff --git a/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java b/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java index 2e0554c499..005bb80fa3 100644 --- a/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java +++ b/client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java @@ -181,27 +181,27 @@ public class VRichTextToolbar extends Composite { * We use an inner EventHandler class to avoid exposing event methods on the * RichTextToolbar itself. */ - private class EventHandler implements ClickHandler, ChangeHandler, - KeyUpHandler { + private class EventHandler + implements ClickHandler, ChangeHandler, KeyUpHandler { @Override @SuppressWarnings("deprecation") public void onChange(ChangeEvent event) { Object sender = event.getSource(); if (sender == backColors) { - basic.setBackColor(backColors.getValue(backColors - .getSelectedIndex())); + basic.setBackColor( + backColors.getValue(backColors.getSelectedIndex())); backColors.setSelectedIndex(0); } else if (sender == foreColors) { - basic.setForeColor(foreColors.getValue(foreColors - .getSelectedIndex())); + basic.setForeColor( + foreColors.getValue(foreColors.getSelectedIndex())); foreColors.setSelectedIndex(0); } else if (sender == fonts) { basic.setFontName(fonts.getValue(fonts.getSelectedIndex())); fonts.setSelectedIndex(0); } else if (sender == fontSizes) { - basic.setFontSize(fontSizesConstants[fontSizes - .getSelectedIndex() - 1]); + basic.setFontSize( + fontSizesConstants[fontSizes.getSelectedIndex() - 1]); fontSizes.setSelectedIndex(0); } } @@ -239,8 +239,8 @@ public class VRichTextToolbar extends Composite { extended.insertImage(url); } } else if (sender == createLink) { - final String url = Window - .prompt("Enter a link URL:", "http://"); + final String url = Window.prompt("Enter a link URL:", + "http://"); if (url != null) { extended.createLink(url); } @@ -339,8 +339,8 @@ public class VRichTextToolbar extends Composite { setStyleName("gwt-RichTextToolbar"); if (basic != null) { - topPanel.add(bold = createToggleButton(images.bold(), - strings.bold())); + topPanel.add( + bold = createToggleButton(images.bold(), strings.bold())); topPanel.add(italic = createToggleButton(images.italic(), strings.italic())); topPanel.add(underline = createToggleButton(images.underline(), diff --git a/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java b/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java index 8c3c0254d3..a5e1ef1cb6 100644 --- a/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java @@ -29,11 +29,11 @@ import com.vaadin.shared.ui.slider.SliderState; import com.vaadin.ui.Slider; @Connect(Slider.class) -public class SliderConnector extends AbstractFieldConnector implements - ValueChangeHandler<Double> { +public class SliderConnector extends AbstractFieldConnector + implements ValueChangeHandler<Double> { - protected SliderServerRpc rpc = RpcProxy - .create(SliderServerRpc.class, this); + protected SliderServerRpc rpc = RpcProxy.create(SliderServerRpc.class, + this); private final ElementResizeListener resizeListener = new ElementResizeListener() { @@ -56,8 +56,8 @@ public class SliderConnector extends AbstractFieldConnector implements @Override public void onUnregister() { super.onUnregister(); - getLayoutManager().removeElementResizeListener( - getWidget().getElement(), resizeListener); + getLayoutManager().removeElementResizeListener(getWidget().getElement(), + resizeListener); } @Override diff --git a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java index 6bf03ad880..ba4ec20662 100644 --- a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -62,15 +62,15 @@ public abstract class AbstractSplitPanelConnector extends // Send % values as a fraction to avoid that the splitter // "jumps" when server responds with the integer pct value // (e.g. dragged 16.6% -> should not jump to 17%) - pos = Float.valueOf(position.substring(0, - position.length() - 1)); + pos = Float.valueOf( + position.substring(0, position.length() - 1)); } else { - pos = Integer.parseInt(position.substring(0, - position.length() - 2)); + pos = Integer.parseInt( + position.substring(0, position.length() - 2)); } - getRpcProxy(AbstractSplitPanelRpc.class).setSplitterPosition( - pos); + getRpcProxy(AbstractSplitPanelRpc.class) + .setSplitterPosition(pos); } }, SplitterMoveEvent.TYPE); @@ -86,8 +86,8 @@ public abstract class AbstractSplitPanelConnector extends @Override protected <H extends EventHandler> HandlerRegistration registerHandler( H handler, Type<H> type) { - if ((Event.getEventsSunk(getWidget().splitter) & Event - .getTypeInt(type.getName())) != 0) { + if ((Event.getEventsSunk(getWidget().splitter) + & Event.getTypeInt(type.getName())) != 0) { // If we are already sinking the event for the splitter we do // not want to additionally sink it for the root element return getWidget().addHandler(handler, type); @@ -208,14 +208,14 @@ public abstract class AbstractSplitPanelConnector extends LayoutManager layoutManager = getLayoutManager(); if (this instanceof HorizontalSplitPanelConnector) { if (child.isRelativeHeight()) { - int height = layoutManager.getInnerHeight(getWidget() - .getElement()); + int height = layoutManager + .getInnerHeight(getWidget().getElement()); layoutManager.reportHeightAssignedToRelative(child, height); } } else { if (child.isRelativeWidth()) { - int width = layoutManager.getInnerWidth(getWidget() - .getElement()); + int width = layoutManager + .getInnerWidth(getWidget().getElement()); layoutManager.reportWidthAssignedToRelative(child, width); } } @@ -240,7 +240,8 @@ public abstract class AbstractSplitPanelConnector extends } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { handleHierarchyChange(); } diff --git a/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java b/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java index cfe93b6641..66ac86bf31 100644 --- a/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java @@ -54,9 +54,9 @@ import com.vaadin.shared.ui.table.TableServerRpc; import com.vaadin.shared.ui.table.TableState; @Connect(com.vaadin.ui.Table.class) -public class TableConnector extends AbstractFieldConnector implements - HasComponentsConnector, ConnectorHierarchyChangeHandler, Paintable, - DirectionalManagedLayout, PostLayoutListener, +public class TableConnector extends AbstractFieldConnector + implements HasComponentsConnector, ConnectorHierarchyChangeHandler, + Paintable, DirectionalManagedLayout, PostLayoutListener, HasChildMeasurementHintConnector { private List<ComponentConnector> childComponents; @@ -113,8 +113,9 @@ public class TableConnector extends AbstractFieldConnector implements */ if (w != null) { rowKey = w.getKey(); - colKey = getWidget().tHead.getHeaderCell( - getElementIndex(e, w.getElement())).getColKey(); + colKey = getWidget().tHead + .getHeaderCell(getElementIndex(e, w.getElement())) + .getColKey(); } } } @@ -190,8 +191,8 @@ public class TableConnector extends AbstractFieldConnector implements getWidget().updateDragMode(uidl); // Update child measure hint - int childMeasureHint = uidl.hasAttribute("measurehint") ? uidl - .getIntAttribute("measurehint") : 0; + int childMeasureHint = uidl.hasAttribute("measurehint") + ? uidl.getIntAttribute("measurehint") : 0; getWidget().setChildMeasurementHint( ChildMeasurementHint.values()[childMeasureHint]); @@ -251,8 +252,8 @@ public class TableConnector extends AbstractFieldConnector implements // sanity check (in case the value has slipped beyond the total // amount of rows) - getWidget().scrollBody.setLastRendered(getWidget().scrollBody - .getLastRendered()); + getWidget().scrollBody + .setLastRendered(getWidget().scrollBody.getLastRendered()); getWidget().updateMaxIndent(); } else { getWidget().postponeSanityCheckForLastRendered = false; @@ -284,11 +285,11 @@ public class TableConnector extends AbstractFieldConnector implements showSavedContextMenu(contextMenuBeforeUpdate); if (!getWidget().isSelectable()) { - getWidget().scrollBody.addStyleName(getWidget() - .getStylePrimaryName() + "-body-noselection"); + getWidget().scrollBody.addStyleName( + getWidget().getStylePrimaryName() + "-body-noselection"); } else { - getWidget().scrollBody.removeStyleName(getWidget() - .getStylePrimaryName() + "-body-noselection"); + getWidget().scrollBody.removeStyleName( + getWidget().getStylePrimaryName() + "-body-noselection"); } getWidget().hideScrollPositionAnnotation(); @@ -326,21 +327,19 @@ public class TableConnector extends AbstractFieldConnector implements if (getWidget().focusedRow != null) { if (!getWidget().focusedRow.isAttached() - && !getWidget().rowRequestHandler.isRequestHandlerRunning()) { + && !getWidget().rowRequestHandler + .isRequestHandlerRunning()) { // focused row has been orphaned, can't focus - if (getWidget().selectedRowKeys.contains(getWidget().focusedRow - .getKey())) { + if (getWidget().selectedRowKeys + .contains(getWidget().focusedRow.getKey())) { // if row cache was refreshed, focused row should be // in selection and exists with same index - getWidget().setRowFocus( - getWidget().getRenderedRowByKey( - getWidget().focusedRow.getKey())); + getWidget().setRowFocus(getWidget().getRenderedRowByKey( + getWidget().focusedRow.getKey())); } else if (getWidget().selectedRowKeys.size() > 0) { // try to focus any row in selection - getWidget().setRowFocus( - getWidget().getRenderedRowByKey( - getWidget().selectedRowKeys.iterator() - .next())); + getWidget().setRowFocus(getWidget().getRenderedRowByKey( + getWidget().selectedRowKeys.iterator().next())); } else { // try to focus any row getWidget().focusRowFromBody(); @@ -356,7 +355,8 @@ public class TableConnector extends AbstractFieldConnector implements * (#8584) */ if (uidl.hasAttribute(TableConstants.ATTRIBUTE_KEY_MAPPER_RESET) - && uidl.getBooleanAttribute(TableConstants.ATTRIBUTE_KEY_MAPPER_RESET) + && uidl.getBooleanAttribute( + TableConstants.ATTRIBUTE_KEY_MAPPER_RESET) && getWidget().selectionRangeStart != null) { assert !getWidget().selectionRangeStart.isAttached(); getWidget().selectionRangeStart = getWidget().focusedRow; @@ -437,11 +437,11 @@ public class TableConnector extends AbstractFieldConnector implements getLayoutManager().setNeedsMeasure(TableConnector.this); ServerConnector parent = getParent(); if (parent instanceof ComponentConnector) { - getLayoutManager().setNeedsMeasure( - (ComponentConnector) parent); + getLayoutManager() + .setNeedsMeasure((ComponentConnector) parent); } - getLayoutManager().setNeedsVerticalLayout( - TableConnector.this); + getLayoutManager() + .setNeedsVerticalLayout(TableConnector.this); getLayoutManager().layoutNow(); } }); @@ -544,8 +544,8 @@ public class TableConnector extends AbstractFieldConnector implements @Override public HandlerRegistration addConnectorHierarchyChangeHandler( ConnectorHierarchyChangeHandler handler) { - return ensureHandlerManager().addHandler( - ConnectorHierarchyChangeEvent.TYPE, handler); + return ensureHandlerManager() + .addHandler(ConnectorHierarchyChangeEvent.TYPE, handler); } @Override diff --git a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java index 9de415e74e..e1195ea8fe 100644 --- a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetBaseConnector.java @@ -26,8 +26,8 @@ import com.vaadin.client.ui.VTabsheetBase; import com.vaadin.shared.ui.tabsheet.TabState; import com.vaadin.shared.ui.tabsheet.TabsheetState; -public abstract class TabsheetBaseConnector extends - AbstractComponentContainerConnector { +public abstract class TabsheetBaseConnector + extends AbstractComponentContainerConnector { /* * (non-Javadoc) @@ -57,8 +57,8 @@ public abstract class TabsheetBaseConnector extends // Widgets in the TabSheet before update ArrayList<Widget> oldWidgets = new ArrayList<Widget>(); - for (Iterator<Widget> iterator = getWidget().getWidgetIterator(); iterator - .hasNext();) { + for (Iterator<Widget> iterator = getWidget() + .getWidgetIterator(); iterator.hasNext();) { oldWidgets.add(iterator.next()); } diff --git a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java index 1b043c8a51..f2b3823af6 100644 --- a/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/tabsheet/TabsheetConnector.java @@ -30,8 +30,8 @@ import com.vaadin.shared.ui.tabsheet.TabsheetClientRpc; import com.vaadin.ui.TabSheet; @Connect(TabSheet.class) -public class TabsheetConnector extends TabsheetBaseConnector implements - SimpleManagedLayout, MayScrollChildren { +public class TabsheetConnector extends TabsheetBaseConnector + implements SimpleManagedLayout, MayScrollChildren { public TabsheetConnector() { registerRpc(TabsheetClientRpc.class, new TabsheetClientRpc() { diff --git a/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java b/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java index ebfbcd736b..51e73aa58a 100644 --- a/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java @@ -57,7 +57,8 @@ public class TextAreaConnector extends LegacyTextFieldConnector { updateSize(element.getStyle().getHeight(), getState().height, "height"); - updateSize(element.getStyle().getWidth(), getState().width, "width"); + updateSize(element.getStyle().getWidth(), getState().width, + "width"); } /* @@ -82,8 +83,8 @@ public class TextAreaConnector extends LegacyTextFieldConnector { return; } - getConnection().updateVariable(getConnectorId(), sizeType, - sizeText, false); + getConnection().updateVariable(getConnectorId(), sizeType, sizeText, + false); } } diff --git a/client/src/main/java/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/main/java/com/vaadin/client/ui/tree/TreeConnector.java index f49f44e802..b034780196 100644 --- a/client/src/main/java/com/vaadin/client/ui/tree/TreeConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/tree/TreeConnector.java @@ -43,8 +43,8 @@ import com.vaadin.shared.ui.tree.TreeState; import com.vaadin.ui.Tree; @Connect(Tree.class) -public class TreeConnector extends AbstractComponentConnector implements - Paintable { +public class TreeConnector extends AbstractComponentConnector + implements Paintable { protected final Map<TreeNode, TooltipInfo> tooltipMap = new HashMap<TreeNode, TooltipInfo>(); @@ -80,8 +80,8 @@ public class TreeConnector extends AbstractComponentConnector implements getWidget().disabled = !isEnabled(); getWidget().readonly = isReadOnly(); - getWidget().dragMode = uidl.hasAttribute("dragMode") ? uidl - .getIntAttribute("dragMode") : 0; + getWidget().dragMode = uidl.hasAttribute("dragMode") + ? uidl.getIntAttribute("dragMode") : 0; getWidget().isNullSelectionAllowed = uidl .getBooleanAttribute("nullselect"); @@ -133,8 +133,8 @@ public class TreeConnector extends AbstractComponentConnector implements // shift/ctrl keys (#8595) getWidget().multiSelectMode = MultiSelectMode.SIMPLE; } else { - getWidget().multiSelectMode = MultiSelectMode.valueOf(uidl - .getStringAttribute("multiselectmode")); + getWidget().multiSelectMode = MultiSelectMode + .valueOf(uidl.getStringAttribute("multiselectmode")); } } else { Roles.getTreeRole().setAriaMultiselectableProperty( @@ -148,8 +148,8 @@ public class TreeConnector extends AbstractComponentConnector implements // and keyboard navigation issues as described in #7057 and other // tickets. if (getWidget().lastSelection != null) { - getWidget().lastSelection = getWidget().getNodeByKey( - getWidget().lastSelection.key); + getWidget().lastSelection = getWidget() + .getNodeByKey(getWidget().lastSelection.key); } if (getWidget().focusedNode != null) { @@ -171,12 +171,10 @@ public class TreeConnector extends AbstractComponentConnector implements } } - if (getWidget().lastSelection == null - && getWidget().focusedNode == null + if (getWidget().lastSelection == null && getWidget().focusedNode == null && !getWidget().selectedIds.isEmpty()) { - getWidget().setFocusedNode( - getWidget().getNodeByKey( - getWidget().selectedIds.iterator().next())); + getWidget().setFocusedNode(getWidget() + .getNodeByKey(getWidget().selectedIds.iterator().next())); getWidget().focusedNode.setFocused(false); } @@ -200,8 +198,8 @@ public class TreeConnector extends AbstractComponentConnector implements } private void handleUpdate(UIDL uidl) { - final TreeNode rootNode = getWidget().getNodeByKey( - uidl.getStringAttribute("rootKey")); + final TreeNode rootNode = getWidget() + .getNodeByKey(uidl.getStringAttribute("rootKey")); if (rootNode != null) { if (!rootNode.getState()) { // expanding node happened server side @@ -237,8 +235,8 @@ public class TreeConnector extends AbstractComponentConnector implements String iconUrl = null; if (action.hasAttribute(TreeConstants.ATTRIBUTE_ACTION_ICON)) { iconUrl = getConnection() - .translateVaadinUri( - action.getStringAttribute(TreeConstants.ATTRIBUTE_ACTION_ICON)); + .translateVaadinUri(action.getStringAttribute( + TreeConstants.ATTRIBUTE_ACTION_ICON)); } getWidget().registerAction(key, caption, iconUrl); } @@ -283,8 +281,8 @@ public class TreeConnector extends AbstractComponentConnector implements String description = uidl.getStringAttribute("descr"); if (description != null) { - tooltipMap.put(treeNode, new TooltipInfo(description, null, - treeNode)); + tooltipMap.put(treeNode, + new TooltipInfo(description, null, treeNode)); } if (uidl.getBooleanAttribute("expanded") && !treeNode.getState()) { @@ -321,9 +319,8 @@ public class TreeConnector extends AbstractComponentConnector implements updateNodeFromUIDL(childTree, childUidl, level); containerNode.childNodeContainer.add(childTree); if (!i.hasNext()) { - childTree - .addStyleDependentName(childTree.isLeaf() ? "leaf-last" - : "last"); + childTree.addStyleDependentName( + childTree.isLeaf() ? "leaf-last" : "last"); childTree.childNodeContainer.addStyleDependentName("last"); } } diff --git a/client/src/main/java/com/vaadin/client/ui/tree/VTargetInSubtree.java b/client/src/main/java/com/vaadin/client/ui/tree/VTargetInSubtree.java index a9bddba65a..01ae22ce8e 100644 --- a/client/src/main/java/com/vaadin/client/ui/tree/VTargetInSubtree.java +++ b/client/src/main/java/com/vaadin/client/ui/tree/VTargetInSubtree.java @@ -36,8 +36,8 @@ final public class VTargetInSubtree extends VAcceptCriterion { VTree tree = (VTree) VDragAndDropManager.get().getCurrentDropHandler() .getConnector().getWidget(); - TreeNode treeNode = tree.getNodeByKey((String) drag.getDropDetails() - .get("itemIdOver")); + TreeNode treeNode = tree + .getNodeByKey((String) drag.getDropDetails().get("itemIdOver")); if (treeNode != null) { Widget parent2 = treeNode; int depth = configuration.getIntAttribute("depth"); diff --git a/client/src/main/java/com/vaadin/client/ui/treetable/TreeTableConnector.java b/client/src/main/java/com/vaadin/client/ui/treetable/TreeTableConnector.java index 0e0c190c11..555e86f510 100644 --- a/client/src/main/java/com/vaadin/client/ui/treetable/TreeTableConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/treetable/TreeTableConnector.java @@ -43,10 +43,11 @@ public class TreeTableConnector extends TableConnector { scrollPosition = widget.getScrollPosition(); } getWidget().animationsEnabled = uidl.getBooleanAttribute("animate"); - getWidget().colIndexOfHierarchy = uidl - .hasAttribute(TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) ? uidl - .getIntAttribute(TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) - : 0; + getWidget().colIndexOfHierarchy = uidl.hasAttribute( + TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) + ? uidl.getIntAttribute( + TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) + : 0; int oldTotalRows = getWidget().getTotalRows(); super.updateFromUIDL(uidl, client); @@ -57,8 +58,8 @@ public class TreeTableConnector extends TableConnector { if (getWidget().collapseRequest) { if (getWidget().collapsedRowKey != null && getWidget().scrollBody != null) { - VScrollTableRow row = getWidget().getRenderedRowByKey( - getWidget().collapsedRowKey); + VScrollTableRow row = getWidget() + .getRenderedRowByKey(getWidget().collapsedRowKey); if (row != null) { getWidget().setRowFocus(row); getWidget().focus(); @@ -76,9 +77,8 @@ public class TreeTableConnector extends TableConnector { } // Recalculate table size if collapse request, or if page length is zero // (not sent by server) and row count changes (#7908). - if (getWidget().collapseRequest - || (!uidl.hasAttribute("pagelength") && getWidget() - .getTotalRows() != oldTotalRows)) { + if (getWidget().collapseRequest || (!uidl.hasAttribute("pagelength") + && getWidget().getTotalRows() != oldTotalRows)) { /* * Ensure that possibly removed/added scrollbars are considered. * Triggers row calculations, removes cached rows etc. Basically @@ -107,8 +107,8 @@ public class TreeTableConnector extends TableConnector { // potential content changes pending PendingNavigationEvent event = getWidget().pendingNavigationEvents .removeFirst(); - getWidget() - .handleNavigation(event.keycode, event.ctrl, event.shift); + getWidget().handleNavigation(event.keycode, event.ctrl, + event.shift); } getWidget().rendering = false; } diff --git a/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java b/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java index 0994ac15c3..599c522eca 100644 --- a/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/twincolselect/TwinColSelectConnector.java @@ -26,8 +26,8 @@ import com.vaadin.shared.ui.twincolselect.TwinColSelectState; import com.vaadin.ui.TwinColSelect; @Connect(TwinColSelect.class) -public class TwinColSelectConnector extends OptionGroupBaseConnector implements - DirectionalManagedLayout { +public class TwinColSelectConnector extends OptionGroupBaseConnector + implements DirectionalManagedLayout { @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java index ca9cb879af..66e1fa46cc 100644 --- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java @@ -161,7 +161,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void reportLayoutProblems(String json) { - VConsole.printLayoutProblems(getValueMap(json), getConnection()); + VConsole.printLayoutProblems(getValueMap(json), + getConnection()); } private native ValueMap getValueMap(String json) @@ -239,8 +240,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector while (childIndex < uidl.getChildCount() && "open".equals(uidl.getChildUIDL(childIndex).getTag())) { final UIDL open = uidl.getChildUIDL(childIndex); - final String url = client.translateVaadinUri(open - .getStringAttribute("src")); + final String url = client + .translateVaadinUri(open.getStringAttribute("src")); final String target = open.getStringAttribute("name"); if (target == null) { // source will be opened to this browser window, but we may have @@ -265,7 +266,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } if (alwaysAsPopup) { if (open.hasAttribute("border")) { - if (open.getStringAttribute("border").equals("minimal")) { + if (open.getStringAttribute("border") + .equals("minimal")) { options = "menubar=yes,location=no,status=no"; } else { options = "menubar=no,location=no,status=no"; @@ -350,8 +352,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector + " but it is not focusable. The widget should implement either " + com.google.gwt.user.client.ui.Focusable.class .getName() - + " or " - + Focusable.class.getName()); + + " or " + Focusable.class.getName()); } } }); @@ -378,8 +379,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector int fragmentIndex = location.indexOf('#'); if (fragmentIndex >= 0) { // Decode fragment to avoid double encoding (#10769) - newFragment = URL.decodePathSegment(location - .substring(fragmentIndex + 1)); + newFragment = URL.decodePathSegment( + location.substring(fragmentIndex + 1)); if (newFragment.isEmpty() && Location.getHref().indexOf('#') == -1) { @@ -429,11 +430,10 @@ public class UIConnector extends AbstractSingleComponentContainerConnector // Check if we have resources to inject if (cssInjectionsUidl.getTag().equals("css-resource")) { - String url = getWidget().connection - .translateVaadinUri(cssInjectionsUidl - .getStringAttribute("url")); - LinkElement link = LinkElement.as(DOM - .createElement(LinkElement.TAG)); + String url = getWidget().connection.translateVaadinUri( + cssInjectionsUidl.getStringAttribute("url")); + LinkElement link = LinkElement + .as(DOM.createElement(LinkElement.TAG)); link.setRel("stylesheet"); link.setHref(url); link.setType("text/css"); @@ -468,8 +468,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * the url to match with existing stylesheets */ private void removeStylesheet(String url) { - NodeList<Element> linkTags = getHead().getElementsByTagName( - LinkElement.TAG); + NodeList<Element> linkTags = getHead() + .getElementsByTagName(LinkElement.TAG); for (int i = 0; i < linkTags.getLength(); i++) { LinkElement link = LinkElement.as(linkTags.getItem(i)); if (!"stylesheet".equals(link.getRel())) { @@ -507,14 +507,13 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void onKeyDown(KeyDownEvent event) { if (getWidget().actionHandler != null) { - Element target = Element.as(event.getNativeEvent() - .getEventTarget()); + Element target = Element + .as(event.getNativeEvent().getEventTarget()); if (target == Document.get().getBody() || getWidget().getElement().isOrHasChild(target)) { // Only react to body and elements inside the UI - getWidget().actionHandler - .handleKeyboardEvent((Event) event - .getNativeEvent().cast()); + getWidget().actionHandler.handleKeyboardEvent( + (Event) event.getNativeEvent().cast()); } } @@ -671,7 +670,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } @Override - public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent event) { ComponentConnector oldChild = null; ComponentConnector newChild = getContent(); @@ -763,14 +763,14 @@ public class UIConnector extends AbstractSingleComponentContainerConnector if (stateChangeEvent.hasPropertyChanged("tooltipConfiguration")) { getConnection().getVTooltip().setCloseTimeout( getState().tooltipConfiguration.closeTimeout); - getConnection().getVTooltip().setOpenDelay( - getState().tooltipConfiguration.openDelay); + getConnection().getVTooltip() + .setOpenDelay(getState().tooltipConfiguration.openDelay); getConnection().getVTooltip().setQuickOpenDelay( getState().tooltipConfiguration.quickOpenDelay); getConnection().getVTooltip().setQuickOpenTimeout( getState().tooltipConfiguration.quickOpenTimeout); - getConnection().getVTooltip().setMaxWidth( - getState().tooltipConfiguration.maxWidth); + getConnection().getVTooltip() + .setMaxWidth(getState().tooltipConfiguration.maxWidth); } if (stateChangeEvent @@ -798,7 +798,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector getConnection().getMessageSender().setPushEnabled( getState().pushConfiguration.mode.isEnabled()); } - if (stateChangeEvent.hasPropertyChanged("reconnectDialogConfiguration")) { + if (stateChangeEvent + .hasPropertyChanged("reconnectDialogConfiguration")) { getConnection().getConnectionStateHandler().configurationUpdated(); } @@ -831,9 +832,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector pollTimer.scheduleRepeating(getState().pollInterval); } else { // Ensure no more polls are sent as polling has been disabled - getConnection().getServerRpcQueue().removeMatching( - new MethodInvocation(getConnectorId(), UIServerRpc.class - .getName(), "poll")); + getConnection().getServerRpcQueue() + .removeMatching(new MethodInvocation(getConnectorId(), + UIServerRpc.class.getName(), "poll")); } } @@ -856,8 +857,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * the connector to locate */ public void showServerDebugInfo(ServerConnector serverConnector) { - getRpcProxy(DebugWindowServerRpc.class).showServerDebugInfo( - serverConnector); + getRpcProxy(DebugWindowServerRpc.class) + .showServerDebugInfo(serverConnector); } /** @@ -929,11 +930,10 @@ public class UIConnector extends AbstractSingleComponentContainerConnector if (tagToReplace == null) { getLogger() - .warning( - "Did not find the link tag for the old theme (" - + oldThemeUrl - + "), adding a new stylesheet for the new theme (" - + newThemeUrl + ")"); + .warning("Did not find the link tag for the old theme (" + + oldThemeUrl + + "), adding a new stylesheet for the new theme (" + + newThemeUrl + ")"); } } @@ -950,7 +950,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } private void updateVaadinFavicon(String newTheme) { - NodeList<Element> iconElements = querySelectorAll("link[rel~=\"icon\"]"); + NodeList<Element> iconElements = querySelectorAll( + "link[rel~=\"icon\"]"); for (int i = 0; i < iconElements.getLength(); i++) { Element iconElement = iconElements.getItem(i); @@ -978,8 +979,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * @return the link tag or null if no matching link tag was found */ private LinkElement findStylesheetTag(String url) { - NodeList<Element> linkTags = getHead().getElementsByTagName( - LinkElement.TAG); + NodeList<Element> linkTags = getHead() + .getElementsByTagName(LinkElement.TAG); for (int i = 0; i < linkTags.getLength(); i++) { final LinkElement link = LinkElement.as(linkTags.getItem(i)); if ("stylesheet".equals(link.getRel()) @@ -1014,22 +1015,20 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void onLoad(ResourceLoadEvent event) { - getLogger().info( - "Loading of " + newTheme + " from " - + newThemeUrl + " completed"); + getLogger().info("Loading of " + newTheme + " from " + + newThemeUrl + " completed"); if (tagToReplace != null) { - tagToReplace.getParentElement().removeChild( - tagToReplace); + tagToReplace.getParentElement() + .removeChild(tagToReplace); } activateTheme(newTheme); } @Override public void onError(ResourceLoadEvent event) { - getLogger().warning( - "Could not load theme from " - + getThemeUrl(newTheme)); + getLogger().warning("Could not load theme from " + + getThemeUrl(newTheme)); } }, null); @@ -1051,8 +1050,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector protected void activateTheme(String newTheme) { if (activeTheme != null) { getWidget().getParent().removeStyleName(activeTheme); - VOverlay.getOverlayContainer(getConnection()).removeClassName( - activeTheme); + VOverlay.getOverlayContainer(getConnection()) + .removeClassName(activeTheme); } String oldThemeBase = getConnection().translateVaadinUri("theme://"); @@ -1061,8 +1060,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector if (newTheme != null) { getWidget().getParent().addStyleName(newTheme); - VOverlay.getOverlayContainer(getConnection()).addClassName( - activeTheme); + VOverlay.getOverlayContainer(getConnection()) + .addClassName(activeTheme); updateVaadinFavicon(newTheme); @@ -1109,9 +1108,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * @return The URL the theme can be loaded from */ private String getThemeUrl(String theme) { - String themeUrl = getConnection().translateVaadinUri( - ApplicationConstants.VAADIN_PROTOCOL_PREFIX + "themes/" + theme - + "/styles" + ".css"); + String themeUrl = getConnection() + .translateVaadinUri(ApplicationConstants.VAADIN_PROTOCOL_PREFIX + + "themes/" + theme + "/styles" + ".css"); // Parameter appended to bypass caches after version upgrade. themeUrl += "?v=" + Version.getFullVersion(); return themeUrl; diff --git a/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java b/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java index 9e25770a17..f5f2033d69 100644 --- a/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/upload/UploadConnector.java @@ -32,8 +32,8 @@ import com.vaadin.shared.ui.upload.UploadState; import com.vaadin.ui.Upload; @Connect(Upload.class) -public class UploadConnector extends AbstractComponentConnector implements - Paintable { +public class UploadConnector extends AbstractComponentConnector + implements Paintable { public UploadConnector() { registerRpc(UploadClientRpc.class, new UploadClientRpc() { @@ -52,8 +52,8 @@ public class UploadConnector extends AbstractComponentConnector implements @Override public void onChange(ChangeEvent event) { if (hasEventListener(EventId.CHANGE)) { - getRpcProxy(UploadServerRpc.class).change( - getWidget().fu.getFilename()); + getRpcProxy(UploadServerRpc.class) + .change(getWidget().fu.getFilename()); } } }); @@ -72,12 +72,12 @@ public class UploadConnector extends AbstractComponentConnector implements getWidget().client = client; getWidget().paintableId = uidl.getId(); getWidget().nextUploadId = uidl.getIntAttribute("nextid"); - final String action = client.translateVaadinUri(uidl - .getStringVariable("action")); + final String action = client + .translateVaadinUri(uidl.getStringVariable("action")); getWidget().element.setAction(action); if (uidl.hasAttribute("buttoncaption")) { - getWidget().submitButton.setText(uidl - .getStringAttribute("buttoncaption")); + getWidget().submitButton + .setText(uidl.getStringAttribute("buttoncaption")); getWidget().submitButton.setVisible(true); } else { getWidget().submitButton.setVisible(false); diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightCell.java b/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightCell.java index b77b752327..eba20f83f9 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightCell.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightCell.java @@ -169,8 +169,8 @@ public class FlyweightCell { } private void adjustCellWidthForSpan(final int numberOfCells) { - final int cellsToTheRight = currentIterator.rawPeekNext( - numberOfCells - 1).size(); + final int cellsToTheRight = currentIterator + .rawPeekNext(numberOfCells - 1).size(); final double selfWidth = row.getColumnWidth(column); double widthsOfColumnsToTheRight = 0; @@ -193,8 +193,8 @@ public class FlyweightCell { } } else if (prevColSpan > numberOfCells) { for (int i = 0; i < affectedCells.size(); i++) { - affectedCells.get(numberOfCells + i - 1).getElement() - .getStyle().clearDisplay(); + affectedCells.get(numberOfCells + i - 1).getElement().getStyle() + .clearDisplay(); } } } diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java b/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java index 8628adb05f..832e40ebbc 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/FlyweightRow.java @@ -237,12 +237,13 @@ public class FlyweightRow implements Row { public Iterable<FlyweightCell> getCells(final int offset, final int numberOfCells) { assertSetup(); - assert offset >= 0 && offset + numberOfCells <= cells.size() : "Invalid range of cells"; + assert offset >= 0 && offset + numberOfCells <= cells + .size() : "Invalid range of cells"; return new Iterable<FlyweightCell>() { @Override public Iterator<FlyweightCell> iterator() { - return CellIterator.attached(cells.subList(offset, offset - + numberOfCells)); + return CellIterator.attached( + cells.subList(offset, offset + numberOfCells)); } }; } @@ -265,12 +266,13 @@ public class FlyweightRow implements Row { public Iterable<FlyweightCell> getUnattachedCells(final int offset, final int numberOfCells) { assertSetup(); - assert offset >= 0 && offset + numberOfCells <= cells.size() : "Invalid range of cells"; + assert offset >= 0 && offset + numberOfCells <= cells + .size() : "Invalid range of cells"; return new Iterable<FlyweightCell>() { @Override public Iterator<FlyweightCell> iterator() { - return CellIterator.unattached(cells.subList(offset, offset - + numberOfCells)); + return CellIterator.unattached( + cells.subList(offset, offset + numberOfCells)); } }; } @@ -280,11 +282,12 @@ public class FlyweightRow implements Row { * access any of its data. */ private void assertSetup() { - assert element != null && row != BLANK && columnWidths != null : "Flyweight row was not " - + "properly initialized. Make sure the setup-method is " - + "called before retrieving data. This is either a bug " - + "in Escalator, or the instance of the flyweight row " - + "has been stored and accessed."; + assert element != null && row != BLANK + && columnWidths != null : "Flyweight row was not " + + "properly initialized. Make sure the setup-method is " + + "called before retrieving data. This is either a bug " + + "in Escalator, or the instance of the flyweight row " + + "has been stored and accessed."; } double getColumnWidth(int column) { diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/RowContainer.java b/client/src/main/java/com/vaadin/client/widget/escalator/RowContainer.java index abab25046c..f81e71bf6c 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/RowContainer.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/RowContainer.java @@ -120,7 +120,7 @@ public interface RowContainer { /** * An arbitrary pixel height of a row, before any autodetection for the row * height has been made. - * */ + */ public static final double INITIAL_DEFAULT_ROW_HEIGHT = 20; /** diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java index 5f1531e378..93738fc89b 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/RowVisibilityChangeEvent.java @@ -25,8 +25,8 @@ import com.vaadin.shared.ui.grid.Range; * @since 7.4 * @author Vaadin Ltd */ -public class RowVisibilityChangeEvent extends - GwtEvent<RowVisibilityChangeHandler> { +public class RowVisibilityChangeEvent + extends GwtEvent<RowVisibilityChangeHandler> { /** * The type of this event. */ diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java b/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java index 151deb87d1..09f81251bd 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java @@ -137,8 +137,8 @@ public abstract class ScrollbarBundle implements DeferredWorker { void visibilityChanged(VisibilityChangeEvent event); } - public static class VisibilityChangeEvent extends - GwtEvent<VisibilityHandler> { + public static class VisibilityChangeEvent + extends GwtEvent<VisibilityHandler> { public static final Type<VisibilityHandler> TYPE = new Type<ScrollbarBundle.VisibilityHandler>() { @Override public String toString() { @@ -259,7 +259,8 @@ public abstract class ScrollbarBundle implements DeferredWorker { * * @see HorizontalScrollbarBundle#getElement() */ - public final static class HorizontalScrollbarBundle extends ScrollbarBundle { + public final static class HorizontalScrollbarBundle + extends ScrollbarBundle { @Override public void setStylePrimaryName(String primaryStyleName) { @@ -419,12 +420,13 @@ public abstract class ScrollbarBundle implements DeferredWorker { && newOffsetSizeIsGreaterThanScrollSize; if (offsetSizeBecomesGreaterThanScrollSize && getScrollPos() != 0) { // must be a field because Java insists. - offsetSizeTemporaryScrollHandler = addScrollHandler(new ScrollHandler() { - @Override - public void onScroll(ScrollEvent event) { - setOffsetSizeNow(px); - } - }); + offsetSizeTemporaryScrollHandler = addScrollHandler( + new ScrollHandler() { + @Override + public void onScroll(ScrollEvent event) { + setOffsetSizeNow(px); + } + }); setScrollPos(0); } else { setOffsetSizeNow(px); @@ -557,10 +559,10 @@ public abstract class ScrollbarBundle implements DeferredWorker { * @return the new scroll position in pixels */ public final double getScrollPos() { - assert internalGetScrollPos() == toInt32(scrollPos) : "calculated scroll position (" - + scrollPos - + ") did not match the DOM element scroll position (" - + internalGetScrollPos() + ")"; + assert internalGetScrollPos() == toInt32( + scrollPos) : "calculated scroll position (" + scrollPos + + ") did not match the DOM element scroll position (" + + internalGetScrollPos() + ")"; return scrollPos; } @@ -608,12 +610,13 @@ public abstract class ScrollbarBundle implements DeferredWorker { && newScrollSizeIsSmallerThanOffsetSize; if (scrollSizeBecomesSmallerThanOffsetSize && getScrollPos() != 0) { // must be a field because Java insists. - scrollSizeTemporaryScrollHandler = addScrollHandler(new ScrollHandler() { - @Override - public void onScroll(ScrollEvent event) { - setScrollSizeNow(px); - } - }); + scrollSizeTemporaryScrollHandler = addScrollHandler( + new ScrollHandler() { + @Override + public void onScroll(ScrollEvent event) { + setScrollSizeNow(px); + } + }); setScrollPos(0); } else { setScrollSizeNow(px); diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedHandler.java b/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedHandler.java index 40bd380de2..205d006326 100644 --- a/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/escalator/events/RowHeightChangedHandler.java @@ -29,7 +29,8 @@ public interface RowHeightChangedHandler extends EventHandler { * A row height changed event, fired by Escalator when the header, body or * footer row height has changed. * - * @param event Row height changed event + * @param event + * Row height changed event */ public void onRowHeightChanged(RowHeightChangedEvent event); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java b/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java index 9cc238ac15..858e4a17ac 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java @@ -159,7 +159,8 @@ public class AutoScroller { * direction has started. */ private static final int SCROLL_AREA_REBOUND_PX_PER_SEC = 1; - private static final double SCROLL_AREA_REBOUND_PX_PER_MS = SCROLL_AREA_REBOUND_PX_PER_SEC / 1000.0d; + private static final double SCROLL_AREA_REBOUND_PX_PER_MS = SCROLL_AREA_REBOUND_PX_PER_SEC + / 1000.0d; /** * The lowest y/x-coordinate on the {@link Event#getClientY() client-y} @@ -273,8 +274,8 @@ public class AutoScroller { return; } - int reboundPx = (int) Math.ceil(SCROLL_AREA_REBOUND_PX_PER_MS - * timeDiff); + int reboundPx = (int) Math + .ceil(SCROLL_AREA_REBOUND_PX_PER_MS * timeDiff); if (startBound < finalStartBound) { startBound += reboundPx; startBound = Math.min(startBound, finalStartBound); @@ -378,7 +379,8 @@ public class AutoScroller { final boolean startDidNotMove = oldTopBound == startBound; final boolean endDidNotMove = oldBottomBound == endBound; final boolean wasMovement = pageCordinate != scrollingAxisPageCoordinate; - scrollAreaShouldRebound = (startDidNotMove && endDidNotMove && wasMovement); + scrollAreaShouldRebound = (startDidNotMove && endDidNotMove + && wasMovement); } } } @@ -623,7 +625,8 @@ public class AutoScroller { private int getRealFrozenColumnCount() { if (grid.getFrozenColumnCount() < 0) { return 0; - } else if (grid.getSelectionModel().getSelectionColumnRenderer() != null) { + } else if (grid.getSelectionModel() + .getSelectionColumnRenderer() != null) { // includes the selection column return grid.getFrozenColumnCount() + 1; } else { @@ -633,7 +636,8 @@ public class AutoScroller { private double getMaxScrollLeft() { return grid.getScrollWidth() - - (getTableElement().getParentElement().getOffsetWidth() - getFrozenColumnsWidth()); + - (getTableElement().getParentElement().getOffsetWidth() + - getFrozenColumnsWidth()); } private double getMaxScrollTop() { diff --git a/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java b/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java index e4a8783f54..2329f04878 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java @@ -93,7 +93,8 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { protected boolean isOpenEvent(EditorDomEvent<T> event) { final Event e = event.getDomEvent(); return e.getTypeInt() == Event.ONDBLCLICK - || (e.getTypeInt() == Event.ONKEYDOWN && e.getKeyCode() == KEYCODE_OPEN) + || (e.getTypeInt() == Event.ONKEYDOWN + && e.getKeyCode() == KEYCODE_OPEN) || isTouchOpenEvent(event); } @@ -172,8 +173,8 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { // of range. if (rowDelta == 0) { if (colIndex >= columnCount - && rowIndex < event.getGrid().getDataSource() - .size() - 1) { + && rowIndex < event.getGrid().getDataSource().size() + - 1) { rowDelta = 1; colIndex = 0; } else if (colIndex < 0 && rowIndex > 0) { @@ -208,8 +209,8 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { if (e.getType().equals(BrowserEvents.CLICK) && event.getRowIndex() == event.getCell().getRowIndex()) { - editRow(event, event.getRowIndex(), event.getCell() - .getColumnIndexDOM()); + editRow(event, event.getRowIndex(), + event.getCell().getColumnIndexDOM()); return true; @@ -268,7 +269,8 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { return false; } - protected void editRow(EditorDomEvent<T> event, int rowIndex, int colIndex) { + protected void editRow(EditorDomEvent<T> event, int rowIndex, + int colIndex) { int rowCount = event.getGrid().getDataSource().size(); // Limit rowIndex between 0 and rowCount - 1 rowIndex = Math.max(0, Math.min(rowCount - 1, rowIndex)); @@ -312,8 +314,10 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { final boolean handled; if (event.getGrid().isEditorActive()) { handled = handleCloseEvent(event) - || (!editor.isBuffered() && isBody && handleMoveEvent(event)) - || (editor.isBuffered() && isBody && handleBufferedMoveEvent(event)); + || (!editor.isBuffered() && isBody + && handleMoveEvent(event)) + || (editor.isBuffered() && isBody + && handleBufferedMoveEvent(event)); } else { handled = event.getGrid().isEnabled() && isBody && handleOpenEvent(event); diff --git a/client/src/main/java/com/vaadin/client/widget/grid/HeightAwareDetailsGenerator.java b/client/src/main/java/com/vaadin/client/widget/grid/HeightAwareDetailsGenerator.java index 5364de3411..db3db85c2a 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/HeightAwareDetailsGenerator.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/HeightAwareDetailsGenerator.java @@ -22,7 +22,7 @@ package com.vaadin.client.widget.grid; * temporary workaround and might be removed or renamed at any time. * </p> * - * @since 7.6.1 + * @since 7.6.1 * @author Vaadin Ltd */ @Deprecated diff --git a/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java b/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java index 69bea629b0..3e0d05a414 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java @@ -129,8 +129,8 @@ public class ListSorter<T> { private void sort(final List<SortOrder> order) { DataSource<T> ds = grid.getDataSource(); if (!(ds instanceof ListDataSource)) { - throw new IllegalStateException("Grid " + grid - + " data source is not a ListDataSource!"); + throw new IllegalStateException( + "Grid " + grid + " data source is not a ListDataSource!"); } ((ListDataSource<T>) ds).sort(new Comparator<T>() { @@ -158,15 +158,16 @@ public class ListSorter<T> { } if (result != 0) { - return o.getDirection() == SortDirection.ASCENDING ? result - : -result; + return o.getDirection() == SortDirection.ASCENDING + ? result : -result; } } if (order.size() > 0) { - return order.get(0).getDirection() == SortDirection.ASCENDING ? a - .hashCode() - b.hashCode() - : b.hashCode() - a.hashCode(); + return order.get(0) + .getDirection() == SortDirection.ASCENDING + ? a.hashCode() - b.hashCode() + : b.hashCode() - a.hashCode(); } return a.hashCode() - b.hashCode(); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridKeyEventHandler.java b/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridKeyEventHandler.java index 120c32d380..9106523606 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridKeyEventHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridKeyEventHandler.java @@ -26,18 +26,18 @@ import com.vaadin.client.widgets.Grid.AbstractGridKeyEvent; */ public abstract interface AbstractGridKeyEventHandler extends EventHandler { - public abstract interface GridKeyDownHandler extends - AbstractGridKeyEventHandler { + public abstract interface GridKeyDownHandler + extends AbstractGridKeyEventHandler { public void onKeyDown(GridKeyDownEvent event); } - public abstract interface GridKeyUpHandler extends - AbstractGridKeyEventHandler { + public abstract interface GridKeyUpHandler + extends AbstractGridKeyEventHandler { public void onKeyUp(GridKeyUpEvent event); } - public abstract interface GridKeyPressHandler extends - AbstractGridKeyEventHandler { + public abstract interface GridKeyPressHandler + extends AbstractGridKeyEventHandler { public void onKeyPress(GridKeyPressEvent event); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridMouseEventHandler.java b/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridMouseEventHandler.java index 15e22a6d57..e72b7df934 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridMouseEventHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/AbstractGridMouseEventHandler.java @@ -26,13 +26,13 @@ import com.vaadin.client.widgets.Grid.AbstractGridMouseEvent; */ public abstract interface AbstractGridMouseEventHandler extends EventHandler { - public abstract interface GridClickHandler extends - AbstractGridMouseEventHandler { + public abstract interface GridClickHandler + extends AbstractGridMouseEventHandler { public void onClick(GridClickEvent event); } - public abstract interface GridDoubleClickHandler extends - AbstractGridMouseEventHandler { + public abstract interface GridDoubleClickHandler + extends AbstractGridMouseEventHandler { public void onDoubleClick(GridDoubleClickEvent event); } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java index 63b788bcf2..96e7694251 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeEvent.java @@ -28,8 +28,8 @@ import com.vaadin.client.widgets.Grid.Column; * @since 7.5.0 * @author Vaadin Ltd */ -public class ColumnVisibilityChangeEvent<T> extends - GwtEvent<ColumnVisibilityChangeHandler<T>> { +public class ColumnVisibilityChangeEvent<T> + extends GwtEvent<ColumnVisibilityChangeHandler<T>> { private final static Type<ColumnVisibilityChangeHandler<?>> TYPE = new Type<ColumnVisibilityChangeHandler<?>>(); diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeHandler.java b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeHandler.java index 542fe4e3c1..181a0e69a7 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/ColumnVisibilityChangeHandler.java @@ -21,8 +21,10 @@ import com.google.gwt.event.shared.EventHandler; * Handler for a Grid column visibility change event, called when the Grid's * columns have changed visibility to hidden or visible. * - * @param<T> The row type of the grid. The row type is the POJO type from where - * the data is retrieved into the column cells. + * @param<T> The + * row type of the grid. The row type is the POJO type from where + * the data is retrieved into the column cells. + * * @since 7.5.0 * @author Vaadin Ltd */ diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/GridClickEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/GridClickEvent.java index 33a4c923b7..6d5f5ae38b 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/GridClickEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/GridClickEvent.java @@ -42,8 +42,10 @@ public class GridClickEvent extends AbstractGridMouseEvent<GridClickHandler> { @Override protected void doDispatch(GridClickHandler handler, Section section) { if ((section == Section.BODY && handler instanceof BodyClickHandler) - || (section == Section.HEADER && handler instanceof HeaderClickHandler) - || (section == Section.FOOTER && handler instanceof FooterClickHandler)) { + || (section == Section.HEADER + && handler instanceof HeaderClickHandler) + || (section == Section.FOOTER + && handler instanceof FooterClickHandler)) { handler.onClick(this); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/GridDoubleClickEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/GridDoubleClickEvent.java index 64a1a88b42..f134f863ab 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/GridDoubleClickEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/GridDoubleClickEvent.java @@ -28,8 +28,8 @@ import com.vaadin.shared.ui.grid.GridConstants.Section; * @since 7.4 * @author Vaadin Ltd */ -public class GridDoubleClickEvent extends - AbstractGridMouseEvent<GridDoubleClickHandler> { +public class GridDoubleClickEvent + extends AbstractGridMouseEvent<GridDoubleClickHandler> { public GridDoubleClickEvent(Grid<?> grid, CellReference<?> targetCell) { super(grid, targetCell); @@ -42,9 +42,12 @@ public class GridDoubleClickEvent extends @Override protected void doDispatch(GridDoubleClickHandler handler, Section section) { - if ((section == Section.BODY && handler instanceof BodyDoubleClickHandler) - || (section == Section.HEADER && handler instanceof HeaderDoubleClickHandler) - || (section == Section.FOOTER && handler instanceof FooterDoubleClickHandler)) { + if ((section == Section.BODY + && handler instanceof BodyDoubleClickHandler) + || (section == Section.HEADER + && handler instanceof HeaderDoubleClickHandler) + || (section == Section.FOOTER + && handler instanceof FooterDoubleClickHandler)) { handler.onDoubleClick(this); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyDownEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyDownEvent.java index 9849137982..23efa56eb5 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyDownEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyDownEvent.java @@ -38,8 +38,10 @@ public class GridKeyDownEvent extends AbstractGridKeyEvent<GridKeyDownHandler> { @Override protected void doDispatch(GridKeyDownHandler handler, Section section) { if ((section == Section.BODY && handler instanceof BodyKeyDownHandler) - || (section == Section.HEADER && handler instanceof HeaderKeyDownHandler) - || (section == Section.FOOTER && handler instanceof FooterKeyDownHandler)) { + || (section == Section.HEADER + && handler instanceof HeaderKeyDownHandler) + || (section == Section.FOOTER + && handler instanceof FooterKeyDownHandler)) { handler.onKeyDown(this); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyPressEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyPressEvent.java index 35a3af0c2e..b159b1e0b1 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyPressEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyPressEvent.java @@ -28,8 +28,8 @@ import com.vaadin.shared.ui.grid.GridConstants.Section; * @since 7.4 * @author Vaadin Ltd */ -public class GridKeyPressEvent extends - AbstractGridKeyEvent<GridKeyPressHandler> { +public class GridKeyPressEvent + extends AbstractGridKeyEvent<GridKeyPressHandler> { public GridKeyPressEvent(Grid<?> grid, CellReference<?> targetCell) { super(grid, targetCell); @@ -38,8 +38,10 @@ public class GridKeyPressEvent extends @Override protected void doDispatch(GridKeyPressHandler handler, Section section) { if ((section == Section.BODY && handler instanceof BodyKeyPressHandler) - || (section == Section.HEADER && handler instanceof HeaderKeyPressHandler) - || (section == Section.FOOTER && handler instanceof FooterKeyPressHandler)) { + || (section == Section.HEADER + && handler instanceof HeaderKeyPressHandler) + || (section == Section.FOOTER + && handler instanceof FooterKeyPressHandler)) { handler.onKeyPress(this); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyUpEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyUpEvent.java index d273835233..ec1980b39b 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyUpEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyUpEvent.java @@ -38,8 +38,10 @@ public class GridKeyUpEvent extends AbstractGridKeyEvent<GridKeyUpHandler> { @Override protected void doDispatch(GridKeyUpHandler handler, Section section) { if ((section == Section.BODY && handler instanceof BodyKeyUpHandler) - || (section == Section.HEADER && handler instanceof HeaderKeyUpHandler) - || (section == Section.FOOTER && handler instanceof FooterKeyUpHandler)) { + || (section == Section.HEADER + && handler instanceof HeaderKeyUpHandler) + || (section == Section.FOOTER + && handler instanceof FooterKeyUpHandler)) { handler.onKeyUp(this); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/AbstractRowHandleSelectionModel.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/AbstractRowHandleSelectionModel.java index 6b7bbb6294..bcd8f9beb7 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/AbstractRowHandleSelectionModel.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/AbstractRowHandleSelectionModel.java @@ -29,8 +29,8 @@ import com.vaadin.client.data.DataSource.RowHandle; * The grid's row type * @since 7.4 */ -public abstract class AbstractRowHandleSelectionModel<T> implements - SelectionModel<T> { +public abstract class AbstractRowHandleSelectionModel<T> + implements SelectionModel<T> { /** * Select a row, based on its * {@link com.vaadin.client.data.DataSource.RowHandle RowHandle}. diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java index f244682b49..9650a31b50 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java @@ -55,8 +55,8 @@ import com.vaadin.client.widgets.Grid; * the type of the associated grid * @since 7.4 */ -public class MultiSelectionRenderer<T> extends - ClickableRenderer<Boolean, CheckBox> { +public class MultiSelectionRenderer<T> + extends ClickableRenderer<Boolean, CheckBox> { private static final String SELECTION_CHECKBOX_CLASSNAME = "-selection-checkbox"; @@ -91,16 +91,17 @@ public class MultiSelectionRenderer<T> extends @Override public void onMouseDown(MouseDownEvent event) { - if(checkBox.isEnabled()) { + if (checkBox.isEnabled()) { if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) { - startDragSelect(event.getNativeEvent(), checkBox.getElement()); + startDragSelect(event.getNativeEvent(), + checkBox.getElement()); } } } @Override public void onTouchStart(TouchStartEvent event) { - if(checkBox.isEnabled()) { + if (checkBox.isEnabled()) { startDragSelect(event.getNativeEvent(), checkBox.getElement()); } } @@ -159,8 +160,8 @@ public class MultiSelectionRenderer<T> extends * Remember: targetElement is always where touchstart started, * not where the finger is pointing currently. */ - final Element targetElement = Element.as(event.getNativeEvent() - .getEventTarget()); + final Element targetElement = Element + .as(event.getNativeEvent().getEventTarget()); if (isInFirstColumn(targetElement)) { removeNativeHandler(); event.cancel(); @@ -222,7 +223,8 @@ public class MultiSelectionRenderer<T> extends * direction has started. */ private static final int SCROLL_AREA_REBOUND_PX_PER_SEC = 1; - private static final double SCROLL_AREA_REBOUND_PX_PER_MS = SCROLL_AREA_REBOUND_PX_PER_SEC / 1000.0d; + private static final double SCROLL_AREA_REBOUND_PX_PER_MS = SCROLL_AREA_REBOUND_PX_PER_SEC + / 1000.0d; /** * The lowest y-coordinate on the {@link Event#getClientY() client} from @@ -317,8 +319,8 @@ public class MultiSelectionRenderer<T> extends int constrainedPageY = Math.max(bodyAbsoluteTop, Math.min(bodyAbsoluteBottom, pageY)); - int logicalRow = getLogicalRowIndex(WidgetUtil.getElementFromPoint( - initialPageX, constrainedPageY)); + int logicalRow = getLogicalRowIndex(WidgetUtil + .getElementFromPoint(initialPageX, constrainedPageY)); int incrementOrDecrement = (logicalRow > lastModifiedLogicalRow) ? 1 : -1; @@ -346,8 +348,8 @@ public class MultiSelectionRenderer<T> extends return; } - int reboundPx = (int) Math.ceil(SCROLL_AREA_REBOUND_PX_PER_MS - * timeDiff); + int reboundPx = (int) Math + .ceil(SCROLL_AREA_REBOUND_PX_PER_MS * timeDiff); if (topBound < finalTopBound) { topBound += reboundPx; topBound = Math.min(topBound, finalTopBound); @@ -454,7 +456,8 @@ public class MultiSelectionRenderer<T> extends final boolean topDidNotMove = oldTopBound == topBound; final boolean bottomDidNotMove = oldBottomBound == bottomBound; final boolean wasVerticalMovement = pageY != this.pageY; - scrollAreaShouldRebound = (topDidNotMove && bottomDidNotMove && wasVerticalMovement); + scrollAreaShouldRebound = (topDidNotMove && bottomDidNotMove + && wasVerticalMovement); } } } @@ -604,8 +607,8 @@ public class MultiSelectionRenderer<T> extends @Override public CheckBox createWidget() { final CheckBox checkBox = GWT.create(CheckBox.class); - checkBox.setStylePrimaryName(grid.getStylePrimaryName() - + SELECTION_CHECKBOX_CLASSNAME); + checkBox.setStylePrimaryName( + grid.getStylePrimaryName() + SELECTION_CHECKBOX_CLASSNAME); CheckBoxEventHandler handler = new CheckBoxEventHandler(checkBox); @@ -653,13 +656,13 @@ public class MultiSelectionRenderer<T> extends public boolean onBrowserEvent(final CellReference<?> cell, final NativeEvent event) { if (BrowserEvents.TOUCHSTART.equals(event.getType()) - || (BrowserEvents.MOUSEDOWN.equals(event.getType()) && event - .getButton() == NativeEvent.BUTTON_LEFT)) { + || (BrowserEvents.MOUSEDOWN.equals(event.getType()) + && event.getButton() == NativeEvent.BUTTON_LEFT)) { startDragSelect(event, Element.as(event.getEventTarget())); return true; } else { - throw new IllegalStateException("received unexpected event: " - + event.getType()); + throw new IllegalStateException( + "received unexpected event: " + event.getType()); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelNone.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelNone.java index 4a8b203a94..23ad203072 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelNone.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionModelNone.java @@ -59,15 +59,15 @@ public class SelectionModelNone<T> extends AbstractRowHandleSelectionModel<T> @Override protected boolean selectByHandle(RowHandle<T> handle) throws UnsupportedOperationException { - throw new UnsupportedOperationException("This selection model " - + "does not support selection"); + throw new UnsupportedOperationException( + "This selection model " + "does not support selection"); } @Override protected boolean deselectByHandle(RowHandle<T> handle) throws UnsupportedOperationException { - throw new UnsupportedOperationException("This selection model " - + "does not support deselection"); + throw new UnsupportedOperationException( + "This selection model " + "does not support deselection"); } } diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SpaceSelectHandler.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SpaceSelectHandler.java index 3e04a6dfac..42abb4592c 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SpaceSelectHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SpaceSelectHandler.java @@ -65,8 +65,8 @@ public class SpaceSelectHandler<T> { @Override public void onDataAvailable( DataAvailableEvent dataAvailableEvent) { - if (dataAvailableEvent.getAvailableRows().contains( - rowIndex)) { + if (dataAvailableEvent.getAvailableRows() + .contains(rowIndex)) { setSelected(grid, rowIndex); scrollHandler.removeHandler(); scrollHandler = null; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java index 2aad6e4f95..7945fbb8b5 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/sort/SortEvent.java @@ -46,7 +46,8 @@ public class SortEvent<T> extends GwtEvent<SortHandler<?>> { * @param originator * a value indicating where this event originated from */ - public SortEvent(Grid<T> grid, List<SortOrder> order, boolean userOriginated) { + public SortEvent(Grid<T> grid, List<SortOrder> order, + boolean userOriginated) { this.grid = grid; this.order = order; this.userOriginated = userOriginated; diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index 52f981fe63..7e92087c22 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -239,7 +239,8 @@ abstract class JsniWorkaround { protected JsniWorkaround(final Escalator escalator) { scrollListenerFunction = createScrollListenerFunction(escalator); - mousewheelListenerFunction = createMousewheelListenerFunction(escalator); + mousewheelListenerFunction = createMousewheelListenerFunction( + escalator); touchHandlerBundle = new TouchHandlerBundle(escalator); touchStartFunction = touchHandlerBundle.getTouchStartHandler(); @@ -277,8 +278,8 @@ abstract class JsniWorkaround { * @since 7.4 * @author Vaadin Ltd */ -public class Escalator extends Widget implements RequiresResize, - DeferredWorker, SubPartAware { +public class Escalator extends Widget + implements RequiresResize, DeferredWorker, SubPartAware { // todo comments legend /* @@ -310,8 +311,8 @@ public class Escalator extends Widget implements RequiresResize, /** * A <a href= * "http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsOverlay.html" - * >JavaScriptObject overlay</a> for the <a - * href="http://www.w3.org/TR/touch-events/">JavaScript + * >JavaScriptObject overlay</a> for the + * <a href="http://www.w3.org/TR/touch-events/">JavaScript * TouchEvent</a> object. * <p> * This needs to be used in the touch event handlers, since GWT's @@ -320,8 +321,8 @@ public class Escalator extends Widget implements RequiresResize, * {@link com.google.gwt.dom.client.NativeEvent NativeEvent} isn't * properly populated with the correct values. */ - private final static class CustomTouchEvent extends - JavaScriptObject { + private final static class CustomTouchEvent + extends JavaScriptObject { protected CustomTouchEvent() { } @@ -672,13 +673,13 @@ public class Escalator extends Widget implements RequiresResize, /*-{ var vScroll = esc.@com.vaadin.client.widgets.Escalator::verticalScrollbar; var vScrollElem = vScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); - + var hScroll = esc.@com.vaadin.client.widgets.Escalator::horizontalScrollbar; var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()(); - + return $entry(function(e) { var target = e.target || e.srcElement; // IE8 uses e.scrElement - + // in case the scroll event was native (i.e. scrollbars were dragged, or // the scrollTop/Left was manually modified), the bundles have old cache // values. We need to make sure that the caches are kept up to date. @@ -699,29 +700,29 @@ public class Escalator extends Widget implements RequiresResize, return $entry(function(e) { var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; - + // Delta mode 0 is in pixels; we don't need to do anything... - + // A delta mode of 1 means we're scrolling by lines instead of pixels // We need to scale the number of lines by the default line height if(e.deltaMode === 1) { var brc = esc.@com.vaadin.client.widgets.Escalator::body; deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); } - + // Other delta modes aren't supported if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; - + // Print warning message esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg); } - + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); }); }-*/; @@ -738,8 +739,7 @@ public class Escalator extends Widget implements RequiresResize, double tableWrapperWidth = widthOfEscalator; boolean verticalScrollNeeded = scrollContentHeight > tableWrapperHeight - + WidgetUtil.PIXEL_EPSILON - - header.getHeightOfSection() + + WidgetUtil.PIXEL_EPSILON - header.getHeightOfSection() - footer.getHeightOfSection(); boolean horizontalScrollNeeded = scrollContentWidth > tableWrapperWidth + WidgetUtil.PIXEL_EPSILON; @@ -774,8 +774,8 @@ public class Escalator extends Widget implements RequiresResize, double footerHeight = footer.getHeightOfSection(); double headerHeight = header.getHeightOfSection(); - double vScrollbarHeight = Math.max(0, tableWrapperHeight - - footerHeight - headerHeight); + double vScrollbarHeight = Math.max(0, + tableWrapperHeight - footerHeight - headerHeight); verticalScrollbar.setOffsetSize(vScrollbarHeight); verticalScrollbar.setScrollSize(scrollContentHeight); @@ -795,8 +795,8 @@ public class Escalator extends Widget implements RequiresResize, double hScrollOffsetWidth = tableWrapperWidth - frozenPixels; horizontalScrollbar.setOffsetSize(hScrollOffsetWidth); horizontalScrollbar.setScrollSize(unfrozenPixels); - horizontalScrollbar.getElement().getStyle() - .setLeft(frozenPixels, Unit.PX); + horizontalScrollbar.getElement().getStyle().setLeft(frozenPixels, + Unit.PX); horizontalScrollbar.setScrollPos(prevScrollPos); /* @@ -1019,9 +1019,8 @@ public class Escalator extends Widget implements RequiresResize, + columnConfiguration.getColumnWidthActual(columnIndex); final double viewportStartPx = getScrollLeft(); - double viewportEndPx = viewportStartPx - + WidgetUtil - .getRequiredWidthBoundingClientRectDouble(getElement()) + double viewportEndPx = viewportStartPx + WidgetUtil + .getRequiredWidthBoundingClientRectDouble(getElement()) - frozenPixels; if (verticalScrollbar.showsScrollHandle()) { viewportEndPx -= WidgetUtil.getNativeScrollbarSize(); @@ -1070,7 +1069,9 @@ public class Escalator extends Widget implements RequiresResize, /** * The table section element ({@code <thead>}, {@code <tbody>} or - * {@code <tfoot>}) the rows (i.e. {@code <tr>} tags) are contained in. + * {@code <tfoot>}) the rows (i.e. {@code + * <tr> + * } tags) are contained in. */ protected final TableSectionElement root; @@ -1122,7 +1123,8 @@ public class Escalator extends Widget implements RequiresResize, * @see #hasColumnAndRowData() */ @Override - public void setEscalatorUpdater(final EscalatorUpdater escalatorUpdater) { + public void setEscalatorUpdater( + final EscalatorUpdater escalatorUpdater) { if (escalatorUpdater == null) { throw new IllegalArgumentException( "escalator updater cannot be null"); @@ -1214,8 +1216,8 @@ public class Escalator extends Widget implements RequiresResize, } protected void assertArgumentsAreValidAndWithinRange(final int index, - final int numberOfRows) throws IllegalArgumentException, - IndexOutOfBoundsException { + final int numberOfRows) + throws IllegalArgumentException, IndexOutOfBoundsException { if (numberOfRows < 1) { throw new IllegalArgumentException( "Number of rows must be 1 or greater (was " @@ -1223,8 +1225,8 @@ public class Escalator extends Widget implements RequiresResize, } if (index < 0 || index + numberOfRows > getRowCount()) { - throw new IndexOutOfBoundsException("The given " - + "row range (" + index + ".." + (index + numberOfRows) + throw new IndexOutOfBoundsException("The given " + "row range (" + + index + ".." + (index + numberOfRows) + ") was outside of the current number of rows (" + getRowCount() + ")"); } @@ -1295,8 +1297,8 @@ public class Escalator extends Widget implements RequiresResize, Map<Integer, Double> colWidths = new HashMap<Integer, Double>(); for (int i = 0; i < getColumnConfiguration() .getColumnCount(); i++) { - Double width = Double.valueOf(getColumnConfiguration() - .getColumnWidth(i)); + Double width = Double.valueOf( + getColumnConfiguration().getColumnWidth(i)); Integer col = Integer.valueOf(i); colWidths.put(col, width); } @@ -1337,15 +1339,18 @@ public class Escalator extends Widget implements RequiresResize, referenceRow = null; } - for (int row = visualIndex; row < visualIndex + numberOfRows; row++) { + for (int row = visualIndex; row < visualIndex + + numberOfRows; row++) { final TableRowElement tr = TableRowElement.as(DOM.createTR()); addedRows.add(tr); tr.addClassName(getStylePrimaryName() + "-row"); - for (int col = 0; col < columnConfiguration.getColumnCount(); col++) { + for (int col = 0; col < columnConfiguration + .getColumnCount(); col++) { final double colWidth = columnConfiguration .getColumnWidthActual(col); - final TableCellElement cellElem = createCellElement(colWidth); + final TableCellElement cellElem = createCellElement( + colWidth); tr.appendChild(cellElem); // Set stylename and position if new cell is frozen @@ -1447,8 +1452,8 @@ public class Escalator extends Widget implements RequiresResize, // overridden because of JavaDoc public void refreshRows(final int index, final int numberOfRows) { Range rowRange = Range.withLength(index, numberOfRows); - Range colRange = Range.withLength(0, getColumnConfiguration() - .getColumnCount()); + Range colRange = Range.withLength(0, + getColumnConfiguration().getColumnCount()); refreshCells(rowRange, colRange); } @@ -1464,8 +1469,8 @@ public class Escalator extends Widget implements RequiresResize, Range colRange) { flyweightRow.setup(tr, logicalRowIndex, columnConfiguration.getCalculatedColumnWidths()); - Iterable<FlyweightCell> cellsToUpdate = flyweightRow.getCells( - colRange.getStart(), colRange.length()); + Iterable<FlyweightCell> cellsToUpdate = flyweightRow + .getCells(colRange.getStart(), colRange.length()); updater.update(flyweightRow, cellsToUpdate); /* @@ -1484,8 +1489,8 @@ public class Escalator extends Widget implements RequiresResize, * @return a set-up empty cell element */ public TableCellElement createCellElement(final double width) { - final TableCellElement cellElem = TableCellElement.as(DOM - .createElement(getCellElementTagName())); + final TableCellElement cellElem = TableCellElement + .as(DOM.createElement(getCellElementTagName())); final double height = getDefaultRowHeight(); assert height >= 0 : "defaultRowHeight was negative. There's a setter leak somewhere."; @@ -1522,8 +1527,8 @@ public class Escalator extends Widget implements RequiresResize, flyweightRow.setup(row, i, columnConfiguration.getCalculatedColumnWidths()); - Iterable<FlyweightCell> attachedCells = flyweightRow.getCells( - offset, numberOfColumns); + Iterable<FlyweightCell> attachedCells = flyweightRow + .getCells(offset, numberOfColumns); getEscalatorUpdater().preDetach(flyweightRow, attachedCells); for (int j = 0; j < numberOfColumns; j++) { @@ -1576,15 +1581,17 @@ public class Escalator extends Widget implements RequiresResize, * the number of cells to insert */ private void paintInsertCells(final TableRowElement tr, - int logicalRowIndex, final int offset, final int numberOfCells) { + int logicalRowIndex, final int offset, + final int numberOfCells) { - assert root.isOrHasChild(tr) : "The row must be attached to the document"; + assert root.isOrHasChild( + tr) : "The row must be attached to the document"; flyweightRow.setup(tr, logicalRowIndex, columnConfiguration.getCalculatedColumnWidths()); - Iterable<FlyweightCell> cells = flyweightRow.getUnattachedCells( - offset, numberOfCells); + Iterable<FlyweightCell> cells = flyweightRow + .getUnattachedCells(offset, numberOfCells); for (FlyweightCell cell : cells) { final double colWidth = columnConfiguration @@ -1684,8 +1691,8 @@ public class Escalator extends Widget implements RequiresResize, * @return the pixel width of the widest element in the indicated column */ public double calculateMaxColWidth(int index) { - TableRowElement row = TableRowElement.as(root - .getFirstChildElement()); + TableRowElement row = TableRowElement + .as(root.getFirstChildElement()); double maxWidth = 0; while (row != null) { final TableCellElement cell = row.getCells().getItem(index); @@ -1740,7 +1747,8 @@ public class Escalator extends Widget implements RequiresResize, * Since browsers don't explode with overflowing colspans, escalator * shouldn't either. */ - if (spannedColumns.getEnd() > columnConfiguration.getColumnCount()) { + if (spannedColumns.getEnd() > columnConfiguration + .getColumnCount()) { spannedColumns = Range.between(columnIndex, columnConfiguration.getColumnCount()); } @@ -1752,8 +1760,9 @@ public class Escalator extends Widget implements RequiresResize, * Applies the total length of the columns to each row element. * <p> * <em>Note:</em> In contrast to {@link #reapplyColumnWidths()}, this - * method only modifies the width of the {@code <tr>} element, not the - * cells within. + * method only modifies the width of the {@code + * <tr> + * } element, not the cells within. */ protected void reapplyRowWidths() { double rowWidth = columnConfiguration.calculateRowWidth(); @@ -1796,8 +1805,8 @@ public class Escalator extends Widget implements RequiresResize, Element cell = TableRowElement.as(row).getCells().getItem(0); while (cell != null) { assert TableCellElement.is(cell); - UIObject.setStylePrimaryName(cell, primaryStyleName - + "-cell"); + UIObject.setStylePrimaryName(cell, + primaryStyleName + "-cell"); cell = cell.getNextSiblingElement(); } row = row.getNextSiblingElement(); @@ -1817,8 +1826,8 @@ public class Escalator extends Widget implements RequiresResize, public void setDefaultRowHeight(double px) throws IllegalArgumentException { if (px < 1) { - throw new IllegalArgumentException("Height must be positive. " - + px + " was given."); + throw new IllegalArgumentException( + "Height must be positive. " + px + " was given."); } defaultRowHeightShouldBeAutodetected = false; @@ -1963,7 +1972,8 @@ public class Escalator extends Widget implements RequiresResize, * hierarchy until reaching cell element. */ Element cellElementCandidate = element; - while (cellElementCandidate.getParentElement().getParentElement() != root) { + while (cellElementCandidate.getParentElement() + .getParentElement() != root) { cellElementCandidate = cellElementCandidate.getParentElement(); } final TableCellElement cellElement = TableCellElement @@ -1997,8 +2007,8 @@ public class Escalator extends Widget implements RequiresResize, * explicit dimensions, and measure that instead. */ - TableCellElement cellClone = TableCellElement.as((Element) cell - .cloneNode(withContent)); + TableCellElement cellClone = TableCellElement + .as((Element) cell.cloneNode(withContent)); cellClone.getStyle().clearHeight(); cellClone.getStyle().clearWidth(); @@ -2051,8 +2061,8 @@ public class Escalator extends Widget implements RequiresResize, private boolean cellIsPartOfSpan(TableCellElement cell) { boolean cellHasColspan = cell.getColSpan() > 1; - boolean cellIsHidden = Display.NONE.getCssName().equals( - cell.getStyle().getDisplay()); + boolean cellIsHidden = Display.NONE.getCssName() + .equals(cell.getStyle().getDisplay()); return cellHasColspan || cellIsHidden; } @@ -2082,13 +2092,14 @@ public class Escalator extends Widget implements RequiresResize, } - private abstract class AbstractStaticRowContainer extends - AbstractRowContainer { + private abstract class AbstractStaticRowContainer + extends AbstractRowContainer { /** The height of the combined rows in the DOM. Never negative. */ private double heightOfSection = 0; - public AbstractStaticRowContainer(final TableSectionElement headElement) { + public AbstractStaticRowContainer( + final TableSectionElement headElement) { super(headElement); } @@ -2098,7 +2109,8 @@ public class Escalator extends Widget implements RequiresResize, } @Override - protected void paintRemoveRows(final int index, final int numberOfRows) { + protected void paintRemoveRows(final int index, + final int numberOfRows) { for (int i = index; i < index + numberOfRows; i++) { final TableRowElement tr = root.getRows().getItem(index); paintRemoveRow(tr, index); @@ -2112,8 +2124,8 @@ public class Escalator extends Widget implements RequiresResize, if (index >= 0 && index < root.getChildCount()) { return root.getRows().getItem(index); } else { - throw new IndexOutOfBoundsException("No such visual index: " - + index); + throw new IndexOutOfBoundsException( + "No such visual index: " + index); } } @@ -2151,7 +2163,8 @@ public class Escalator extends Widget implements RequiresResize, return; } - Profiler.enter("Escalator.AbstractStaticRowContainer.reapplyDefaultRowHeights"); + Profiler.enter( + "Escalator.AbstractStaticRowContainer.reapplyDefaultRowHeights"); Element tr = root.getRows().getItem(0); while (tr != null) { @@ -2166,12 +2179,14 @@ public class Escalator extends Widget implements RequiresResize, */ recalculateSectionHeight(); - Profiler.leave("Escalator.AbstractStaticRowContainer.reapplyDefaultRowHeights"); + Profiler.leave( + "Escalator.AbstractStaticRowContainer.reapplyDefaultRowHeights"); } @Override protected void recalculateSectionHeight() { - Profiler.enter("Escalator.AbstractStaticRowContainer.recalculateSectionHeight"); + Profiler.enter( + "Escalator.AbstractStaticRowContainer.recalculateSectionHeight"); double newHeight = calculateTotalRowHeight(); if (newHeight != heightOfSection) { @@ -2185,15 +2200,16 @@ public class Escalator extends Widget implements RequiresResize, * body.verifyEscalatorCount. This is because the logical row * indices are calculated from the scrollbar position. */ - verticalScrollbar.setOffsetSize(heightOfEscalator - - header.getHeightOfSection() - - footer.getHeightOfSection()); + verticalScrollbar.setOffsetSize( + heightOfEscalator - header.getHeightOfSection() + - footer.getHeightOfSection()); body.verifyEscalatorCount(); body.spacerContainer.updateSpacerDecosVisibility(); } - Profiler.leave("Escalator.AbstractStaticRowContainer.recalculateSectionHeight"); + Profiler.leave( + "Escalator.AbstractStaticRowContainer.recalculateSectionHeight"); } /** @@ -2237,7 +2253,8 @@ public class Escalator extends Widget implements RequiresResize, @Override protected boolean rowCanBeFrozen(TableRowElement tr) { - assert root.isOrHasChild(tr) : "Row does not belong to this table section"; + assert root.isOrHasChild( + tr) : "Row does not belong to this table section"; return true; } @@ -2258,8 +2275,8 @@ public class Escalator extends Widget implements RequiresResize, bodyElem.getStyle().setMarginTop(heightOfSection, Unit.PX); spacerDecoContainer.getStyle().setMarginTop(heightOfSection, Unit.PX); - verticalScrollbar.getElement().getStyle() - .setTop(heightOfSection, Unit.PX); + verticalScrollbar.getElement().getStyle().setTop(heightOfSection, + Unit.PX); headerDeco.getStyle().setHeight(heightOfSection, Unit.PX); } @@ -2295,8 +2312,8 @@ public class Escalator extends Widget implements RequiresResize, protected void sectionHeightCalculated() { double headerHeight = header.getHeightOfSection(); double footerHeight = footer.getHeightOfSection(); - int vscrollHeight = (int) Math.floor(heightOfEscalator - - headerHeight - footerHeight); + int vscrollHeight = (int) Math + .floor(heightOfEscalator - headerHeight - footerHeight); final boolean horizontalScrollbarNeeded = columnConfiguration .calculateRowWidth() > widthOfEscalator; @@ -2311,8 +2328,8 @@ public class Escalator extends Widget implements RequiresResize, } } - private class BodyRowContainerImpl extends AbstractRowContainer implements - BodyRowContainer { + private class BodyRowContainerImpl extends AbstractRowContainer + implements BodyRowContainer { /* * TODO [[optimize]]: check whether a native JsArray might be faster * than LinkedList @@ -2338,13 +2355,14 @@ public class Escalator extends Widget implements RequiresResize, private void setTopRowLogicalIndex(int topRowLogicalIndex) { if (LogConfiguration.loggingIsEnabled(Level.INFO)) { - Logger.getLogger("Escalator.BodyRowContainer").fine( - "topRowLogicalIndex: " + this.topRowLogicalIndex + Logger.getLogger("Escalator.BodyRowContainer") + .fine("topRowLogicalIndex: " + this.topRowLogicalIndex + " -> " + topRowLogicalIndex); } assert topRowLogicalIndex >= 0 : "topRowLogicalIndex became negative (top left cell contents: " + visualRowOrder.getFirst().getCells().getItem(0) - .getInnerText() + ") "; + .getInnerText() + + ") "; /* * if there's a smart way of evaluating and asserting the max index, * this would be a nice place to put it. I haven't found out an @@ -2398,7 +2416,8 @@ public class Escalator extends Widget implements RequiresResize, private boolean sortIfConditionsMet() { boolean enoughFramesHavePassed = framesPassed >= REQUIRED_FRAMES_PASSED; - boolean enoughTimeHasPassed = (Duration.currentTimeMillis() - startTime) >= SORT_DELAY_MILLIS; + boolean enoughTimeHasPassed = (Duration.currentTimeMillis() + - startTime) >= SORT_DELAY_MILLIS; boolean notTouchActivity = !scroller.touchHandlerBundle.touching; boolean conditionsMet = enoughFramesHavePassed && enoughTimeHasPassed && notTouchActivity; @@ -2471,8 +2490,8 @@ public class Escalator extends Widget implements RequiresResize, double rowPx = getRowHeightsSumBetweenPx(scrollTop, topElementPosition); - int originalRowsToMove = (int) Math.ceil(rowPx - / getDefaultRowHeight()); + int originalRowsToMove = (int) Math + .ceil(rowPx / getDefaultRowHeight()); int rowsToMove = Math.min(originalRowsToMove, visualRowOrder.size()); @@ -2507,8 +2526,8 @@ public class Escalator extends Widget implements RequiresResize, * We scroll so little that we can just keep adding the rows * below the current escalator */ - logicalRowIndex = getLogicalRowIndex(visualRowOrder - .getLast()) + 1; + logicalRowIndex = getLogicalRowIndex( + visualRowOrder.getLast()) + 1; } else { /* * Since we're moving all escalator rows, we need to @@ -2573,8 +2592,8 @@ public class Escalator extends Widget implements RequiresResize, + originalRowsToMove; final int maxLogicalIndex = getRowCount() - visualRowOrder.size(); - setTopRowLogicalIndex(Math.min(naiveNewLogicalIndex, - maxLogicalIndex)); + setTopRowLogicalIndex( + Math.min(naiveNewLogicalIndex, maxLogicalIndex)); rowsWereMoved = true; } @@ -2602,7 +2621,8 @@ public class Escalator extends Widget implements RequiresResize, } @Override - protected void paintInsertRows(final int index, final int numberOfRows) { + protected void paintInsertRows(final int index, + final int numberOfRows) { if (numberOfRows == 0) { return; } @@ -2630,7 +2650,7 @@ public class Escalator extends Widget implements RequiresResize, * getDefaultRowHeight() < getScrollTop(); final boolean addedRowsBelowCurrentViewport = index * getDefaultRowHeight() > getScrollTop() - + getHeightOfSection(); + + getHeightOfSection(); if (addedRowsAboveCurrentViewport) { /* @@ -2651,8 +2671,8 @@ public class Escalator extends Widget implements RequiresResize, else { // some rows were added inside the current viewport final int unupdatedLogicalStart = index + addedRows.size(); - final int visualOffset = getLogicalRowIndex(visualRowOrder - .getFirst()); + final int visualOffset = getLogicalRowIndex( + visualRowOrder.getFirst()); /* * At this point, we have added new escalator rows, if so @@ -2665,8 +2685,9 @@ public class Escalator extends Widget implements RequiresResize, final int rowsStillNeeded = numberOfRows - addedRows.size(); if (rowsStillNeeded > 0) { - final Range unupdatedVisual = convertToVisual(Range - .withLength(unupdatedLogicalStart, rowsStillNeeded)); + final Range unupdatedVisual = convertToVisual( + Range.withLength(unupdatedLogicalStart, + rowsStillNeeded)); final int end = getDomRowCount(); final int start = end - unupdatedVisual.length(); final int visualTargetIndex = unupdatedLogicalStart @@ -2684,7 +2705,8 @@ public class Escalator extends Widget implements RequiresResize, // the order of operations is, in fact, wrong. try { final ListIterator<TableRowElement> i = visualRowOrder - .listIterator(visualTargetIndex + (end - start)); + .listIterator( + visualTargetIndex + (end - start)); int logicalRowIndexCursor = unupdatedLogicalStart; while (i.hasNext()) { @@ -2697,11 +2719,11 @@ public class Escalator extends Widget implements RequiresResize, } } catch (Exception e) { Logger logger = getLogger(); - logger.warning("Ignored out-of-bounds row element access"); + logger.warning( + "Ignored out-of-bounds row element access"); logger.warning("Escalator state: start=" + start + ", end=" + end + ", visualTargetIndex=" - + visualTargetIndex - + ", visualRowOrder.size()=" + + visualTargetIndex + ", visualRowOrder.size()=" + visualRowOrder.size()); logger.warning(e.toString()); } @@ -2743,15 +2765,16 @@ public class Escalator extends Widget implements RequiresResize, assert visualTargetIndex <= getDomRowCount() : "Visual target " + "must not be greater than the number of escalator rows (was " - + visualTargetIndex + ", escalator rows " - + getDomRowCount() + ")"; + + visualTargetIndex + ", escalator rows " + getDomRowCount() + + ")"; - assert logicalTargetIndex + visualSourceRange.length() <= getRowCount() : "Logical " - + "target leads to rows outside of the data range (" - + Range.withLength(logicalTargetIndex, - visualSourceRange.length()) - + " goes beyond " - + Range.withLength(0, getRowCount()) + ")"; + assert logicalTargetIndex + + visualSourceRange.length() <= getRowCount() : "Logical " + + "target leads to rows outside of the data range (" + + Range.withLength(logicalTargetIndex, + visualSourceRange.length()) + + " goes beyond " + + Range.withLength(0, getRowCount()) + ")"; /* * Since we move a range into another range, the indices might move @@ -2940,14 +2963,15 @@ public class Escalator extends Widget implements RequiresResize, } @Override - protected void paintRemoveRows(final int index, final int numberOfRows) { + protected void paintRemoveRows(final int index, + final int numberOfRows) { if (numberOfRows == 0) { return; } final Range viewportRange = getVisibleRowRange(); - final Range removedRowsRange = Range - .withLength(index, numberOfRows); + final Range removedRowsRange = Range.withLength(index, + numberOfRows); /* * Removing spacers as the very first step will correct the @@ -2965,7 +2989,8 @@ public class Escalator extends Widget implements RequiresResize, .partitionWith(viewportRange); final Range removedAbove = partitions[0]; final Range removedLogicalInside = partitions[1]; - final Range removedVisualInside = convertToVisual(removedLogicalInside); + final Range removedVisualInside = convertToVisual( + removedLogicalInside); /* * TODO: extract the following if-block to a separate method. I'll @@ -3000,7 +3025,8 @@ public class Escalator extends Widget implements RequiresResize, .getScrollPos() - yDelta < firstLogicalRowHeight; if (removedVisualInside.isEmpty() - && (!removalScrollsToShowFirstLogicalRow || !firstVisualRowIsRemoved)) { + && (!removalScrollsToShowFirstLogicalRow + || !firstVisualRowIsRemoved)) { /* * rows were removed from above the viewport, so all we need * to do is to adjust the scroll position to account for the @@ -3066,8 +3092,8 @@ public class Escalator extends Widget implements RequiresResize, */ final int rowsToUpdateDataOn = numberOfRows - escalatorRowsToRemove; - final int start = Math.max(0, escalatorRowCount - - rowsToUpdateDataOn); + final int start = Math.max(0, + escalatorRowCount - rowsToUpdateDataOn); final int end = escalatorRowCount; for (int i = start; i < end; i++) { final TableRowElement tr = visualRowOrder.get(i); @@ -3119,8 +3145,8 @@ public class Escalator extends Widget implements RequiresResize, */ double left = horizontalScrollbar.getScrollPos(); - double top = contentBottom - visualRowOrder.size() - * getDefaultRowHeight(); + double top = contentBottom + - visualRowOrder.size() * getDefaultRowHeight(); setBodyScrollPosition(left, top); Range allEscalatorRows = Range.withLength(0, @@ -3137,7 +3163,8 @@ public class Escalator extends Widget implements RequiresResize, * * TODO: Redesign how to keep it easy to track this. */ - updateTopRowLogicalIndex(-removedLogicalInside.length()); + updateTopRowLogicalIndex( + -removedLogicalInside.length()); /* * Scrolling the body to the correct location will be @@ -3166,7 +3193,8 @@ public class Escalator extends Widget implements RequiresResize, paintRemoveRowsAtBottom(removedLogicalInside, removedVisualInside); - updateTopRowLogicalIndex(-removedLogicalInside.length()); + updateTopRowLogicalIndex( + -removedLogicalInside.length()); } else { @@ -3219,12 +3247,13 @@ public class Escalator extends Widget implements RequiresResize, visualRowOrder.addLast(tr); } - for (int i = removedVisualInside.getStart(); i < escalatorRowCount; i++) { + for (int i = removedVisualInside + .getStart(); i < escalatorRowCount; i++) { final TableRowElement tr = visualRowOrder.get(i); setRowPosition(tr, 0, (int) newTop); newTop += getDefaultRowHeight(); - newTop += spacerContainer.getSpacerHeight(i - + removedLogicalInside.getStart()); + newTop += spacerContainer.getSpacerHeight( + i + removedLogicalInside.getStart()); } /* @@ -3254,9 +3283,9 @@ public class Escalator extends Widget implements RequiresResize, * automatically */ moveAndUpdateEscalatorRows( - Range.withOnly(escalatorRowCount - 1), - 0, - getLogicalRowIndex(visualRowOrder.getFirst()) - 1); + Range.withOnly(escalatorRowCount - 1), 0, + getLogicalRowIndex(visualRowOrder.getFirst()) + - 1); updateTopRowLogicalIndex(-1); /* @@ -3279,8 +3308,8 @@ public class Escalator extends Widget implements RequiresResize, - (removedVisualInside.length() - rowsScrolled); final Range visualRefreshRange = Range.between(start, escalatorRowCount); - final int logicalTargetIndex = getLogicalRowIndex(visualRowOrder - .getFirst()) + start; + final int logicalTargetIndex = getLogicalRowIndex( + visualRowOrder.getFirst()) + start; // in-place move simply re-renders the rows. moveAndUpdateEscalatorRows(visualRefreshRange, start, logicalTargetIndex); @@ -3312,10 +3341,9 @@ public class Escalator extends Widget implements RequiresResize, final int escalatorRowCount = visualRowOrder.size(); - final int logicalTargetIndex = getLogicalRowIndex(visualRowOrder - .getLast()) - - (removedVisualInside.length() - 1) - + logicalOffset; + final int logicalTargetIndex = getLogicalRowIndex( + visualRowOrder.getLast()) + - (removedVisualInside.length() - 1) + logicalOffset; moveAndUpdateEscalatorRows(removedVisualInside, escalatorRowCount, logicalTargetIndex); @@ -3323,15 +3351,15 @@ public class Escalator extends Widget implements RequiresResize, final ListIterator<TableRowElement> iterator = visualRowOrder .listIterator(removedVisualInside.getStart()); - double rowTop = getRowTop(removedLogicalInside.getStart() - + logicalOffset); + double rowTop = getRowTop( + removedLogicalInside.getStart() + logicalOffset); for (int i = removedVisualInside.getStart(); i < escalatorRowCount - removedVisualInside.length(); i++) { final TableRowElement tr = iterator.next(); setRowPosition(tr, 0, rowTop); rowTop += getDefaultRowHeight(); - rowTop += spacerContainer.getSpacerHeight(i - + removedLogicalInside.getStart()); + rowTop += spacerContainer + .getSpacerHeight(i + removedLogicalInside.getStart()); } } @@ -3345,8 +3373,8 @@ public class Escalator extends Widget implements RequiresResize, * |7| |7| */ - final int logicalTargetIndex = getLogicalRowIndex(visualRowOrder - .getFirst()) - removedVisualInside.length(); + final int logicalTargetIndex = getLogicalRowIndex( + visualRowOrder.getFirst()) - removedVisualInside.length(); moveAndUpdateEscalatorRows(removedVisualInside, 0, logicalTargetIndex); @@ -3361,14 +3389,15 @@ public class Escalator extends Widget implements RequiresResize, final TableRowElement tr = iterator.next(); setRowPosition(tr, 0, rowTop); rowTop += getDefaultRowHeight(); - rowTop += spacerContainer.getSpacerHeight(firstUpdatedIndex - + i++); + rowTop += spacerContainer + .getSpacerHeight(firstUpdatedIndex + i++); } } @Override protected int getLogicalRowIndex(final TableRowElement tr) { - assert tr.getParentNode() == root : "The given element isn't a row element in the body"; + assert tr + .getParentNode() == root : "The given element isn't a row element in the body"; int internalIndex = visualRowOrder.indexOf(tr); return getTopRowLogicalIndex() + internalIndex; } @@ -3414,11 +3443,11 @@ public class Escalator extends Widget implements RequiresResize, * spacers. */ final int maxEscalatorRows = getMaxEscalatorRowCapacity(); - final int currentTopRowIndex = getLogicalRowIndex(visualRowOrder - .getFirst()); + final int currentTopRowIndex = getLogicalRowIndex( + visualRowOrder.getFirst()); - final Range[] partitions = logicalRange.partitionWith(Range - .withLength(currentTopRowIndex, maxEscalatorRows)); + final Range[] partitions = logicalRange.partitionWith( + Range.withLength(currentTopRowIndex, maxEscalatorRows)); final Range insideRange = partitions[1]; return insideRange.offsetBy(-currentTopRowIndex); } @@ -3445,10 +3474,11 @@ public class Escalator extends Widget implements RequiresResize, final Range visualRange = convertToVisual(logicalRowRange); if (!visualRange.isEmpty()) { - final int firstLogicalRowIndex = getLogicalRowIndex(visualRowOrder - .getFirst()); - for (int rowNumber = visualRange.getStart(); rowNumber < visualRange - .getEnd(); rowNumber++) { + final int firstLogicalRowIndex = getLogicalRowIndex( + visualRowOrder.getFirst()); + for (int rowNumber = visualRange + .getStart(); rowNumber < visualRange + .getEnd(); rowNumber++) { refreshRow(visualRowOrder.get(rowNumber), firstLogicalRowIndex + rowNumber, colRange); } @@ -3463,16 +3493,16 @@ public class Escalator extends Widget implements RequiresResize, if (index >= 0 && index < visualRowOrder.size()) { return visualRowOrder.get(index); } else { - throw new IndexOutOfBoundsException("No such visual index: " - + index); + throw new IndexOutOfBoundsException( + "No such visual index: " + index); } } @Override public TableRowElement getRowElement(int index) { if (index < 0 || index >= getRowCount()) { - throw new IndexOutOfBoundsException("No such logical index: " - + index); + throw new IndexOutOfBoundsException( + "No such logical index: " + index); } int visualIndex = index - getLogicalRowIndex(visualRowOrder.getFirst()); @@ -3547,8 +3577,8 @@ public class Escalator extends Widget implements RequiresResize, final int index = visualRowOrder.size(); final int nextLastLogicalIndex; if (!visualRowOrder.isEmpty()) { - nextLastLogicalIndex = getLogicalRowIndex(visualRowOrder - .getLast()) + 1; + nextLastLogicalIndex = getLogicalRowIndex( + visualRowOrder.getLast()) + 1; } else { nextLastLogicalIndex = 0; } @@ -3630,13 +3660,13 @@ public class Escalator extends Widget implements RequiresResize, */ if (!visualRowOrder.isEmpty()) { - final double firstRowTop = getRowTop(visualRowOrder - .getFirst()); + final double firstRowTop = getRowTop( + visualRowOrder.getFirst()); final double firstRowMinTop = tBodyScrollTop - getDefaultRowHeight(); if (firstRowTop < firstRowMinTop) { - final int newLogicalIndex = getLogicalRowIndex(visualRowOrder - .getLast()) + 1; + final int newLogicalIndex = getLogicalRowIndex( + visualRowOrder.getLast()) + 1; moveAndUpdateEscalatorRows(Range.withOnly(0), visualRowOrder.size(), newLogicalIndex); } @@ -3656,7 +3686,8 @@ public class Escalator extends Widget implements RequiresResize, return; } - Profiler.enter("Escalator.BodyRowContainer.reapplyDefaultRowHeights"); + Profiler.enter( + "Escalator.BodyRowContainer.reapplyDefaultRowHeights"); /* step 1: resize and reposition rows */ for (int i = 0; i < visualRowOrder.size(); i++) { @@ -3686,13 +3717,17 @@ public class Escalator extends Widget implements RequiresResize, verticalScrollbar.getScrollPos()); scroller.onScroll(); - /* step 3: make sure we have the correct amount of escalator rows. */ + /* + * step 3: make sure we have the correct amount of escalator rows. + */ verifyEscalatorCount(); - int logicalLogical = (int) (getRowTop(visualRowOrder.getFirst()) / getDefaultRowHeight()); + int logicalLogical = (int) (getRowTop(visualRowOrder.getFirst()) + / getDefaultRowHeight()); setTopRowLogicalIndex(logicalLogical); - Profiler.leave("Escalator.BodyRowContainer.reapplyDefaultRowHeights"); + Profiler.leave( + "Escalator.BodyRowContainer.reapplyDefaultRowHeights"); } /** @@ -3712,9 +3747,11 @@ public class Escalator extends Widget implements RequiresResize, final TableRowElement focusedRow = getRowWithFocus(); if (focusedRow != null) { - assert focusedRow.getParentElement() == root : "Trying to sort around a row that doesn't exist in body"; + assert focusedRow + .getParentElement() == root : "Trying to sort around a row that doesn't exist in body"; assert visualRowOrder.contains(focusedRow) - || body.spacerContainer.isSpacer(focusedRow) : "Trying to sort around a row that doesn't exist in visualRowOrder or is not a spacer."; + || body.spacerContainer.isSpacer( + focusedRow) : "Trying to sort around a row that doesn't exist in visualRowOrder or is not a spacer."; } /* @@ -3745,8 +3782,8 @@ public class Escalator extends Widget implements RequiresResize, * viewport, but its parent row is still not shown */ for (int i = -1; i < visualRowOrder.size(); i++) { - SpacerContainer.SpacerImpl spacer = spacers.remove(Integer - .valueOf(getTopRowLogicalIndex() + i)); + SpacerContainer.SpacerImpl spacer = spacers + .remove(Integer.valueOf(getTopRowLogicalIndex() + i)); if (spacer != null) { orderedBodyRows.add(i + 1, spacer.getRootElement()); @@ -3887,10 +3924,11 @@ public class Escalator extends Widget implements RequiresResize, } else if (noRowsAreInView) { return Collections.emptyList(); } else { - int fromIndex = (logicalRow - visibleRowLogicalRange.getStart()) + 1; + int fromIndex = (logicalRow - visibleRowLogicalRange.getStart()) + + 1; int toIndex = visibleRowLogicalRange.length(); - List<TableRowElement> sublist = visualRowOrder.subList( - fromIndex, toIndex); + List<TableRowElement> sublist = visualRowOrder + .subList(fromIndex, toIndex); return Collections.unmodifiableList(sublist); } } @@ -4078,16 +4116,17 @@ public class Escalator extends Widget implements RequiresResize, } } - private void removeColumnsAdjustScrollbar(int index, int numberOfColumns) { + private void removeColumnsAdjustScrollbar(int index, + int numberOfColumns) { if (horizontalScrollbar.getOffsetSize() >= horizontalScrollbar .getScrollSize()) { return; } - double leftPosOfFirstColumnToRemove = getCalculatedColumnsWidth(Range - .between(0, index)); - double widthOfColumnsToRemove = getCalculatedColumnsWidth(Range - .withLength(index, numberOfColumns)); + double leftPosOfFirstColumnToRemove = getCalculatedColumnsWidth( + Range.between(0, index)); + double widthOfColumnsToRemove = getCalculatedColumnsWidth( + Range.withLength(index, numberOfColumns)); double scrollLeft = horizontalScrollbar.getScrollPos(); @@ -4110,7 +4149,8 @@ public class Escalator extends Widget implements RequiresResize, * @return the width of a row, in pixels */ public double calculateRowWidth() { - return getCalculatedColumnsWidth(Range.between(0, getColumnCount())); + return getCalculatedColumnsWidth( + Range.between(0, getColumnCount())); } private void assertArgumentsAreValidAndWithinRange(final int index, @@ -4167,11 +4207,11 @@ public class Escalator extends Widget implements RequiresResize, } // this needs to be before the scrollbar adjustment. - boolean scrollbarWasNeeded = horizontalScrollbar.getOffsetSize() < horizontalScrollbar - .getScrollSize(); + boolean scrollbarWasNeeded = horizontalScrollbar + .getOffsetSize() < horizontalScrollbar.getScrollSize(); scroller.recalculateScrollbarsForVirtualViewport(); - boolean scrollbarIsNowNeeded = horizontalScrollbar.getOffsetSize() < horizontalScrollbar - .getScrollSize(); + boolean scrollbarIsNowNeeded = horizontalScrollbar + .getOffsetSize() < horizontalScrollbar.getScrollSize(); if (!scrollbarWasNeeded && scrollbarIsNowNeeded) { body.verifyEscalatorCount(); } @@ -4201,10 +4241,10 @@ public class Escalator extends Widget implements RequiresResize, if (columnsWereAddedToTheLeftOfViewport) { double insertedColumnsWidth = columnConfiguration - .getCalculatedColumnsWidth(Range.withLength(index, - numberOfColumns)); - horizontalScrollbar.setScrollPos(scroller.lastScrollLeft - + insertedColumnsWidth); + .getCalculatedColumnsWidth( + Range.withLength(index, numberOfColumns)); + horizontalScrollbar.setScrollPos( + scroller.lastScrollLeft + insertedColumnsWidth); } /* @@ -4329,7 +4369,8 @@ public class Escalator extends Widget implements RequiresResize, } @Override - public double getColumnWidth(int index) throws IllegalArgumentException { + public double getColumnWidth(int index) + throws IllegalArgumentException { checkValidColumnIndex(index); return columns.get(index).getDefinedWidth(); } @@ -4376,11 +4417,11 @@ public class Escalator extends Widget implements RequiresResize, * This is an assert instead of an exception, since this is an * internal method. */ - assert columns.isSubsetOf(Range.between(0, getColumnCount())) : "Range " - + "was outside of current column range (i.e.: " - + Range.between(0, getColumnCount()) - + ", but was given :" - + columns; + assert columns + .isSubsetOf(Range.between(0, getColumnCount())) : "Range " + + "was outside of current column range (i.e.: " + + Range.between(0, getColumnCount()) + + ", but was given :" + columns; double sum = 0; for (int i = columns.getStart(); i < columns.getEnd(); i++) { @@ -4410,11 +4451,11 @@ public class Escalator extends Widget implements RequiresResize, } if (index < 0 || index + numberOfColumns > getColumnCount()) { - throw new IndexOutOfBoundsException("The given " - + "column range (" + index + ".." - + (index + numberOfColumns) - + ") was outside of the current number of columns (" - + getColumnCount() + ")"); + throw new IndexOutOfBoundsException( + "The given " + "column range (" + index + ".." + + (index + numberOfColumns) + + ") was outside of the current number of columns (" + + getColumnCount() + ")"); } header.refreshColumns(index, numberOfColumns); @@ -4472,14 +4513,15 @@ public class Escalator extends Widget implements RequiresResize, public void setupDom(double height) { assert !domHasBeenSetup : "DOM can't be set up twice."; - assert RootPanel.get().getElement().isOrHasChild(root) : "Root element should've been attached to the DOM by now."; + assert RootPanel.get().getElement().isOrHasChild( + root) : "Root element should've been attached to the DOM by now."; domHasBeenSetup = true; getRootElement().getStyle().setWidth(getInnerWidth(), Unit.PX); setHeight(height); - spacerElement.setColSpan(getColumnConfiguration() - .getColumnCount()); + spacerElement + .setColSpan(getColumnConfiguration().getColumnCount()); setStylePrimaryName(getStylePrimaryName()); } @@ -4495,8 +4537,8 @@ public class Escalator extends Widget implements RequiresResize, public void setPosition(double x, double y) { positions.set(getRootElement(), x, y); - positions - .set(getDecoElement(), 0, y - getSpacerDecoTopOffset()); + positions.set(getDecoElement(), 0, + y - getSpacerDecoTopOffset()); } private double getSpacerDecoTopOffset() { @@ -4523,8 +4565,9 @@ public class Escalator extends Widget implements RequiresResize, // amount of the border thickness if (defaultCellBorderBottomSize < 0) { defaultCellBorderBottomSize = WidgetUtil - .getBorderBottomThickness(body.getRowElement( - getVisibleRowRange().getStart()) + .getBorderBottomThickness(body + .getRowElement( + getVisibleRowRange().getStart()) .getFirstChildElement()); } root.getStyle().setHeight(height + defaultCellBorderBottomSize, @@ -4540,8 +4583,8 @@ public class Escalator extends Widget implements RequiresResize, */ boolean spacerIsGrowing = heightDiff > 0; if (spacerIsGrowing) { - verticalScrollbar.setScrollSize(verticalScrollbar - .getScrollSize() + heightDiff); + verticalScrollbar.setScrollSize( + verticalScrollbar.getScrollSize() + heightDiff); } /* @@ -4566,8 +4609,8 @@ public class Escalator extends Widget implements RequiresResize, */ for (TableRowElement row : body.visualRowOrder) { - body.setRowPosition(row, 0, body.getRowTop(row) - + heightDiff); + body.setRowPosition(row, 0, + body.getRowTop(row) + heightDiff); } double top = getTop(); @@ -4593,8 +4636,8 @@ public class Escalator extends Widget implements RequiresResize, } else { moveDiff = heightDiff; } - body.setBodyScrollPosition(tBodyScrollLeft, tBodyScrollTop - + moveDiff); + body.setBodyScrollPosition(tBodyScrollLeft, + tBodyScrollTop + moveDiff); verticalScrollbar.setScrollPosByDelta(moveDiff); } else { @@ -4602,8 +4645,8 @@ public class Escalator extends Widget implements RequiresResize, } if (!spacerIsGrowing) { - verticalScrollbar.setScrollSize(verticalScrollbar - .getScrollSize() + heightDiff); + verticalScrollbar.setScrollSize( + verticalScrollbar.getScrollSize() + heightDiff); } updateDecoratorGeometry(height); @@ -4792,8 +4835,8 @@ public class Escalator extends Widget implements RequiresResize, || padding != 0 : "destination/padding check should be done before this method"; if (!rowIndexToSpacer.containsKey(spacerIndex)) { - throw new IllegalArgumentException("No spacer open at index " - + spacerIndex); + throw new IllegalArgumentException( + "No spacer open at index " + spacerIndex); } SpacerImpl spacer = rowIndexToSpacer.get(spacerIndex); @@ -4827,9 +4870,9 @@ public class Escalator extends Widget implements RequiresResize, @SuppressWarnings("boxing") public void removeSpacers(Range removedRange) { - Map<Integer, SpacerImpl> removedSpacers = rowIndexToSpacer - .subMap(removedRange.getStart(), true, - removedRange.getEnd(), false); + Map<Integer, SpacerImpl> removedSpacers = rowIndexToSpacer.subMap( + removedRange.getStart(), true, removedRange.getEnd(), + false); if (removedSpacers.isEmpty()) { return; @@ -4881,8 +4924,8 @@ public class Escalator extends Widget implements RequiresResize, @SuppressWarnings("boxing") public Collection<SpacerImpl> getSpacersForRowAndAfter( int logicalRowIndex) { - return new ArrayList<SpacerImpl>(rowIndexToSpacer.tailMap( - logicalRowIndex, true).values()); + return new ArrayList<SpacerImpl>( + rowIndexToSpacer.tailMap(logicalRowIndex, true).values()); } /** @@ -5004,7 +5047,8 @@ public class Escalator extends Widget implements RequiresResize, && bottom <= rangeBottom; boolean bottomIsBelowRange = rangeBottom < bottom; - assert topIsAboveRange ^ topIsBelowRange ^ topIsInRange : "Bad top logic"; + assert topIsAboveRange ^ topIsBelowRange + ^ topIsInRange : "Bad top logic"; assert bottomIsAboveRange ^ bottomIsBelowRange ^ bottomIsInRange : "Bad bottom logic"; @@ -5097,8 +5141,8 @@ public class Escalator extends Widget implements RequiresResize, */ @SuppressWarnings("boxing") public double getSpacerHeightsSumUntilIndex(int logicalIndex) { - return getHeights(rowIndexToSpacer.headMap(logicalIndex, false) - .values()); + return getHeights( + rowIndexToSpacer.headMap(logicalIndex, false).values()); } private double getHeights(Collection<SpacerImpl> spacers) { @@ -5145,8 +5189,8 @@ public class Escalator extends Widget implements RequiresResize, calculateSpacerTop(rowIndex)); TableRowElement spacerRoot = spacer.getRootElement(); - spacerRoot.getStyle().setWidth( - columnConfiguration.calculateRowWidth(), Unit.PX); + spacerRoot.getStyle() + .setWidth(columnConfiguration.calculateRowWidth(), Unit.PX); body.getElement().appendChild(spacerRoot); spacer.setupDom(height); // set the deco position, requires that spacer is in the DOM @@ -5158,8 +5202,8 @@ public class Escalator extends Widget implements RequiresResize, getElement().appendChild(spacerDecoContainer); // calculate the spacer deco width, it won't change spacerDecoWidth = WidgetUtil - .getRequiredWidthBoundingClientRectDouble(spacer - .getDecoElement()); + .getRequiredWidthBoundingClientRectDouble( + spacer.getDecoElement()); } initSpacerContent(spacer); @@ -5208,11 +5252,15 @@ public class Escalator extends Widget implements RequiresResize, } private void destroySpacerContent(SpacerImpl spacer) { - assert getElement().isOrHasChild(spacer.getRootElement()) : "Spacer's root element somehow got detached from Escalator before detaching"; - assert getElement().isOrHasChild(spacer.getElement()) : "Spacer element somehow got detached from Escalator before detaching"; + assert getElement().isOrHasChild(spacer + .getRootElement()) : "Spacer's root element somehow got detached from Escalator before detaching"; + assert getElement().isOrHasChild(spacer + .getElement()) : "Spacer element somehow got detached from Escalator before detaching"; spacerUpdater.destroy(spacer); - assert getElement().isOrHasChild(spacer.getRootElement()) : "Spacer's root element somehow got detached from Escalator before detaching"; - assert getElement().isOrHasChild(spacer.getElement()) : "Spacer element somehow got detached from Escalator before detaching"; + assert getElement().isOrHasChild(spacer + .getRootElement()) : "Spacer's root element somehow got detached from Escalator before detaching"; + assert getElement().isOrHasChild(spacer + .getElement()) : "Spacer element somehow got detached from Escalator before detaching"; } private void initSpacerContent(Iterable<SpacerImpl> spacers) { @@ -5222,11 +5270,15 @@ public class Escalator extends Widget implements RequiresResize, } private void initSpacerContent(SpacerImpl spacer) { - assert getElement().isOrHasChild(spacer.getRootElement()) : "Spacer's root element somehow got detached from Escalator before attaching"; - assert getElement().isOrHasChild(spacer.getElement()) : "Spacer element somehow got detached from Escalator before attaching"; + assert getElement().isOrHasChild(spacer + .getRootElement()) : "Spacer's root element somehow got detached from Escalator before attaching"; + assert getElement().isOrHasChild(spacer + .getElement()) : "Spacer element somehow got detached from Escalator before attaching"; spacerUpdater.init(spacer); - assert getElement().isOrHasChild(spacer.getRootElement()) : "Spacer's root element somehow got detached from Escalator during attaching"; - assert getElement().isOrHasChild(spacer.getElement()) : "Spacer element somehow got detached from Escalator during attaching"; + assert getElement().isOrHasChild(spacer + .getRootElement()) : "Spacer's root element somehow got detached from Escalator during attaching"; + assert getElement().isOrHasChild(spacer + .getElement()) : "Spacer element somehow got detached from Escalator during attaching"; spacer.updateVisibility(); } @@ -5256,8 +5308,8 @@ public class Escalator extends Widget implements RequiresResize, @SuppressWarnings("boxing") private void shiftSpacerPositionsAfterRow(int changedRowIndex, double diffPx) { - for (SpacerImpl spacer : rowIndexToSpacer.tailMap(changedRowIndex, - false).values()) { + for (SpacerImpl spacer : rowIndexToSpacer + .tailMap(changedRowIndex, false).values()) { spacer.setPositionDiff(0, diffPx); } } @@ -5279,7 +5331,8 @@ public class Escalator extends Widget implements RequiresResize, */ public void shiftSpacersByRows(int index, int numberOfRows) { final double pxDiff = numberOfRows * body.getDefaultRowHeight(); - for (SpacerContainer.SpacerImpl spacer : getSpacersForRowAndAfter(index)) { + for (SpacerContainer.SpacerImpl spacer : getSpacersForRowAndAfter( + index)) { spacer.setPositionDiff(0, pxDiff); spacer.setRowIndex(spacer.getRow() + numberOfRows); } @@ -5287,9 +5340,10 @@ public class Escalator extends Widget implements RequiresResize, private void updateSpacerDecosVisibility() { final Range visibleRowRange = getVisibleRowRange(); - Collection<SpacerImpl> visibleSpacers = rowIndexToSpacer.subMap( - visibleRowRange.getStart() - 1, - visibleRowRange.getEnd() + 1).values(); + Collection<SpacerImpl> visibleSpacers = rowIndexToSpacer + .subMap(visibleRowRange.getStart() - 1, + visibleRowRange.getEnd() + 1) + .values(); if (!visibleSpacers.isEmpty()) { final double top = tableWrapper.getAbsoluteTop() + header.getHeightOfSection(); @@ -5383,8 +5437,8 @@ public class Escalator extends Widget implements RequiresResize, int[] indices = new int[splitArgs.length - 1]; for (int i = 0; i < indices.length; ++i) { String tmp = splitArgs[i + 1]; - indices[i] = Integer.parseInt(tmp.substring(0, - tmp.indexOf("]", 1))); + indices[i] = Integer + .parseInt(tmp.substring(0, tmp.indexOf("]", 1))); } return new SubPartArguments(type, indices); } @@ -5418,14 +5472,14 @@ public class Escalator extends Widget implements RequiresResize, private FlyweightRow flyweightRow = new FlyweightRow(); /** The {@code <thead/>} tag. */ - private final TableSectionElement headElem = TableSectionElement.as(DOM - .createTHead()); + private final TableSectionElement headElem = TableSectionElement + .as(DOM.createTHead()); /** The {@code <tbody/>} tag. */ - private final TableSectionElement bodyElem = TableSectionElement.as(DOM - .createTBody()); + private final TableSectionElement bodyElem = TableSectionElement + .as(DOM.createTBody()); /** The {@code <tfoot/>} tag. */ - private final TableSectionElement footElem = TableSectionElement.as(DOM - .createTFoot()); + private final TableSectionElement footElem = TableSectionElement + .as(DOM.createTFoot()); /** * TODO: investigate whether this field is now unnecessary, as @@ -5449,7 +5503,8 @@ public class Escalator extends Widget implements RequiresResize, private final HorizontalScrollbarBundle horizontalScrollbar = new HorizontalScrollbarBundle(); private final HeaderRowContainer header = new HeaderRowContainer(headElem); - private final BodyRowContainerImpl body = new BodyRowContainerImpl(bodyElem); + private final BodyRowContainerImpl body = new BodyRowContainerImpl( + bodyElem); private final FooterRowContainer footer = new FooterRowContainer(footElem); /** @@ -5462,12 +5517,12 @@ public class Escalator extends Widget implements RequiresResize, private final ColumnConfigurationImpl columnConfiguration = new ColumnConfigurationImpl(); private final DivElement tableWrapper; - private final DivElement horizontalScrollbarDeco = DivElement.as(DOM - .createDiv()); + private final DivElement horizontalScrollbarDeco = DivElement + .as(DOM.createDiv()); private final DivElement headerDeco = DivElement.as(DOM.createDiv()); private final DivElement footerDeco = DivElement.as(DOM.createDiv()); - private final DivElement spacerDecoContainer = DivElement.as(DOM - .createDiv()); + private final DivElement spacerDecoContainer = DivElement + .as(DOM.createDiv()); private PositionFunction position; @@ -5501,9 +5556,8 @@ public class Escalator extends Widget implements RequiresResize, public Escalator() { detectAndApplyPositionFunction(); - getLogger().info( - "Using " + position.getClass().getSimpleName() - + " for position"); + getLogger().info("Using " + position.getClass().getSimpleName() + + " for position"); final Element root = DOM.createDiv(); setElement(root); @@ -5584,8 +5638,8 @@ public class Escalator extends Widget implements RequiresResize, * http://edskes.net/ie/ie8overflowandexpandingboxbugs.htm */ Style vScrollStyle = verticalScrollbar.getElement().getStyle(); - vScrollStyle.setRight( - verticalScrollbar.getScrollbarThickness() - 1, Unit.PX); + vScrollStyle.setRight(verticalScrollbar.getScrollbarThickness() - 1, + Unit.PX); } root.appendChild(horizontalScrollbar.getElement()); @@ -5776,8 +5830,9 @@ public class Escalator extends Widget implements RequiresResize, * are columns */ private boolean hasColumnAndRowData() { - return (header.getRowCount() > 0 || body.getRowCount() > 0 || footer - .getRowCount() > 0) && columnConfiguration.getColumnCount() > 0; + return (header.getRowCount() > 0 || body.getRowCount() > 0 + || footer.getRowCount() > 0) + && columnConfiguration.getColumnCount() > 0; } /** @@ -5987,8 +6042,8 @@ public class Escalator extends Widget implements RequiresResize, verifyValidColumnIndex(columnIndex); if (columnIndex < columnConfiguration.frozenColumns) { - throw new IllegalArgumentException("The given column index " - + columnIndex + " is frozen."); + throw new IllegalArgumentException( + "The given column index " + columnIndex + " is frozen."); } scroller.scrollToColumn(columnIndex, destination, padding); @@ -6038,8 +6093,8 @@ public class Escalator extends Widget implements RequiresResize, private void verifyValidRowIndex(final int rowIndex) { if (rowIndex < 0 || rowIndex >= body.getRowCount()) { - throw new IndexOutOfBoundsException("The given row index " - + rowIndex + " does not exist."); + throw new IndexOutOfBoundsException( + "The given row index " + rowIndex + " does not exist."); } } @@ -6129,7 +6184,8 @@ public class Escalator extends Widget implements RequiresResize, final Range targetRange; if (spacer != null) { final int spacerTop = (int) Math.floor(spacer.getTop()); - final int spacerHeight = (int) Math.ceil(spacer.getHeight()); + final int spacerHeight = (int) Math + .ceil(spacer.getHeight()); Range spacerRange = Range.withLength(spacerTop, spacerHeight); @@ -6207,8 +6263,8 @@ public class Escalator extends Widget implements RequiresResize, * the threshold in ratio (0..1) between x and y for when to snap * @return a two-element array: <code>[snappedX, snappedY]</code> */ - private static double[] snapDeltas(final double deltaX, - final double deltaY, final double thresholdRatio) { + private static double[] snapDeltas(final double deltaX, final double deltaY, + final double thresholdRatio) { final double[] array = new double[2]; if (deltaX != 0 && deltaY != 0) { @@ -6244,10 +6300,10 @@ public class Escalator extends Widget implements RequiresResize, private void fireRowVisibilityChangeEvent() { if (!body.visualRowOrder.isEmpty()) { - int visibleRangeStart = body.getLogicalRowIndex(body.visualRowOrder - .getFirst()); - int visibleRangeEnd = body.getLogicalRowIndex(body.visualRowOrder - .getLast()) + 1; + int visibleRangeStart = body + .getLogicalRowIndex(body.visualRowOrder.getFirst()); + int visibleRangeEnd = body + .getLogicalRowIndex(body.visualRowOrder.getLast()) + 1; int visibleRowCount = visibleRangeEnd - visibleRangeStart; fireEvent(new RowVisibilityChangeEvent(visibleRangeStart, @@ -6306,10 +6362,10 @@ public class Escalator extends Widget implements RequiresResize, UIObject.setStylePrimaryName(tableWrapper, style + "-tablewrapper"); UIObject.setStylePrimaryName(headerDeco, style + "-header-deco"); UIObject.setStylePrimaryName(footerDeco, style + "-footer-deco"); - UIObject.setStylePrimaryName(horizontalScrollbarDeco, style - + "-horizontal-scrollbar-deco"); - UIObject.setStylePrimaryName(spacerDecoContainer, style - + "-spacer-deco-container"); + UIObject.setStylePrimaryName(horizontalScrollbarDeco, + style + "-horizontal-scrollbar-deco"); + UIObject.setStylePrimaryName(spacerDecoContainer, + style + "-spacer-deco-container"); header.setStylePrimaryName(style); body.setStylePrimaryName(style); @@ -6326,9 +6382,8 @@ public class Escalator extends Widget implements RequiresResize, * @param rows * the number of rows that should be visible in Escalator's body * @throws IllegalArgumentException - * if {@code rows} is ≤ 0, - * {@link Double#isInifinite(double) infinite} or - * {@link Double#isNaN(double) NaN}. + * if {@code rows} is ≤ 0, {@link Double#isInifinite(double) + * infinite} or {@link Double#isNaN(double) NaN}. * @see #setHeightMode(HeightMode) */ public void setHeightByRows(double rows) throws IllegalArgumentException { @@ -6364,15 +6419,16 @@ public class Escalator extends Widget implements RequiresResize, * define its height that way. */ private void applyHeightByRows() { - if (heightMode != HeightMode.ROW && heightMode != HeightMode.UNDEFINED) { + if (heightMode != HeightMode.ROW + && heightMode != HeightMode.UNDEFINED) { return; } double headerHeight = header.getHeightOfSection(); double footerHeight = footer.getHeightOfSection(); double bodyHeight = body.getDefaultRowHeight() * heightByRows; - double scrollbar = horizontalScrollbar.showsScrollHandle() ? horizontalScrollbar - .getScrollbarThickness() : 0; + double scrollbar = horizontalScrollbar.showsScrollHandle() + ? horizontalScrollbar.getScrollbarThickness() : 0; double spacerHeight = 0; // ignored if HeightMode.ROW if (heightMode == HeightMode.UNDEFINED) { spacerHeight = body.spacerContainer.getSpacerHeightsSum(); @@ -6484,8 +6540,8 @@ public class Escalator extends Widget implements RequiresResize, verticalScrollbar.setLocked(locked); break; default: - throw new UnsupportedOperationException("Unexpected value: " - + direction); + throw new UnsupportedOperationException( + "Unexpected value: " + direction); } } @@ -6503,8 +6559,8 @@ public class Escalator extends Widget implements RequiresResize, case VERTICAL: return verticalScrollbar.isLocked(); default: - throw new UnsupportedOperationException("Unexpected value: " - + direction); + throw new UnsupportedOperationException( + "Unexpected value: " + direction); } } @@ -6578,7 +6634,8 @@ public class Escalator extends Widget implements RequiresResize, @Override @SuppressWarnings("deprecation") - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { SubPartArguments args = SubPartArguments.create(subPart); Element tableStructureElement = getSubPartElementTableStructure(args); @@ -6656,7 +6713,8 @@ public class Escalator extends Widget implements RequiresResize, return targetElement; } - private static Element getCellFromRow(TableRowElement rowElement, int index) { + private static Element getCellFromRow(TableRowElement rowElement, + int index) { int childCount = rowElement.getCells().getLength(); if (index < 0 || index >= childCount) { return null; @@ -6689,7 +6747,8 @@ public class Escalator extends Widget implements RequiresResize, @Override @SuppressWarnings("deprecation") - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { /* * The spacer check needs to be before table structure check, because @@ -6718,9 +6777,9 @@ public class Escalator extends Widget implements RequiresResize, for (int i = 0; i < containers.size(); ++i) { RowContainer container = containers.get(i); - boolean containerRow = (subElement.getTagName().equalsIgnoreCase( - "tr") && subElement.getParentElement() == container - .getElement()); + boolean containerRow = (subElement.getTagName() + .equalsIgnoreCase("tr") + && subElement.getParentElement() == container.getElement()); if (containerRow) { /* * Wanted SubPart is row that is a child of containers root to diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 7e5838be40..91d72518af 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -224,8 +224,8 @@ import com.vaadin.shared.util.SharedUtil; * @since 7.4 * @author Vaadin Ltd */ -public class Grid<T> extends ResizeComposite implements - HasSelectionHandlers<T>, SubPartAware, DeferredWorker, Focusable, +public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, + SubPartAware, DeferredWorker, Focusable, com.google.gwt.user.client.ui.Focusable, HasWidgets, HasEnabled { private static final String STYLE_NAME = "v-grid"; @@ -359,7 +359,8 @@ public class Grid<T> extends ResizeComposite implements public Widget getWidget() { if (type != GridStaticCellType.WIDGET) { throw new IllegalStateException( - "Cannot fetch Widget from a cell with type " + type); + "Cannot fetch Widget from a cell with type " + + type); } return (Widget) content; } @@ -501,7 +502,8 @@ public class Grid<T> extends ResizeComposite implements for (Column<?, ?> column : columns) { if (!cells.containsKey(column)) { throw new IllegalArgumentException( - "Given column does not exists on row " + column); + "Given column does not exists on row " + + column); } else if (getCellGroupForColumn(column) != null) { throw new IllegalStateException( "Column is already in a group."); @@ -551,7 +553,8 @@ public class Grid<T> extends ResizeComposite implements return join(columns); } - private Set<Column<?, ?>> getCellGroupForColumn(Column<?, ?> column) { + private Set<Column<?, ?>> getCellGroupForColumn( + Column<?, ?> column) { for (Set<Column<?, ?>> group : cellGroups.keySet()) { if (group.contains(column)) { return group; @@ -818,8 +821,8 @@ public class Grid<T> extends ResizeComposite implements try { return rows.get(index); } catch (IndexOutOfBoundsException e) { - throw new IllegalArgumentException("Row with index " + index - + " does not exist"); + throw new IllegalArgumentException( + "Row with index " + index + " does not exist"); } } @@ -1340,8 +1343,8 @@ public class Grid<T> extends ResizeComposite implements private DivElement cellWrapper = DivElement.as(DOM.createDiv()); private DivElement frozenCellWrapper = DivElement.as(DOM.createDiv()); - private DivElement messageAndButtonsWrapper = DivElement.as(DOM - .createDiv()); + private DivElement messageAndButtonsWrapper = DivElement + .as(DOM.createDiv()); private DivElement messageWrapper = DivElement.as(DOM.createDiv()); private DivElement buttonsWrapper = DivElement.as(DOM.createDiv()); @@ -1571,12 +1574,13 @@ public class Grid<T> extends ResizeComposite implements } } if (columnIndex >= grid.getVisibleColumns().size()) { - throw new IllegalArgumentException("Edited column index " - + columnIndex - + " was bigger than visible column count."); + throw new IllegalArgumentException( + "Edited column index " + columnIndex + + " was bigger than visible column count."); } - if (this.rowIndex == rowIndex && focusedColumnIndex == columnIndex) { + if (this.rowIndex == rowIndex + && focusedColumnIndex == columnIndex) { // NO-OP return; } @@ -1618,9 +1622,8 @@ public class Grid<T> extends ResizeComposite implements } } }); - grid.scrollToRow(rowIndex, - isBuffered() ? ScrollDestination.MIDDLE - : ScrollDestination.ANY); + grid.scrollToRow(rowIndex, isBuffered() + ? ScrollDestination.MIDDLE : ScrollDestination.ANY); } } @@ -1658,8 +1661,8 @@ public class Grid<T> extends ResizeComposite implements private void updateSelectionCheckboxesAsNeeded(boolean isEnabled) { // FIXME: This is too much guessing. Define a better way to do this. - if (grid.selectionColumn != null - && grid.selectionColumn.getRenderer() instanceof MultiSelectionRenderer) { + if (grid.selectionColumn != null && grid.selectionColumn + .getRenderer() instanceof MultiSelectionRenderer) { grid.refreshBody(); CheckBox checkBox = (CheckBox) grid.getDefaultHeaderRow() .getCell(grid.selectionColumn).getWidget(); @@ -1838,17 +1841,17 @@ public class Grid<T> extends ResizeComposite implements for (int i = 0; i < tr.getCells().getLength(); i++) { Element cell = createCell(tr.getCells().getItem(i)); - cellHeight = Math.max(cellHeight, WidgetUtil - .getRequiredHeightBoundingClientRectDouble(tr - .getCells().getItem(i))); + cellHeight = Math.max(cellHeight, + WidgetUtil.getRequiredHeightBoundingClientRectDouble( + tr.getCells().getItem(i))); Column<?, T> column = grid.getVisibleColumn(i); if (i < frozenColumns) { frozenCellWrapper.appendChild(cell); frozenColumnsWidth += WidgetUtil - .getRequiredWidthBoundingClientRectDouble(tr - .getCells().getItem(i)); + .getRequiredWidthBoundingClientRectDouble( + tr.getCells().getItem(i)); } else { cellWrapper.appendChild(cell); } @@ -1889,8 +1892,8 @@ public class Grid<T> extends ResizeComposite implements // editor overlay since the original one is hidden by // the overlay final CheckBox checkBox = GWT.create(CheckBox.class); - checkBox.setValue(grid.isSelected(pinnedRowHandle - .getRow())); + checkBox.setValue( + grid.isSelected(pinnedRowHandle.getRow())); checkBox.sinkEvents(Event.ONCLICK); checkBox.addClickHandler(new ClickHandler() { @@ -1910,17 +1913,18 @@ public class Grid<T> extends ResizeComposite implements // Only enable CheckBox in non-buffered mode checkBox.setEnabled(!isBuffered()); - } else if (!(column.getRenderer() instanceof WidgetRenderer)) { + } else if (!(column + .getRenderer() instanceof WidgetRenderer)) { // Copy non-widget content directly - cell.setInnerHTML(tr.getCells().getItem(i) - .getInnerHTML()); + cell.setInnerHTML( + tr.getCells().getItem(i).getInnerHTML()); } } } setBounds(frozenCellWrapper, 0, 0, frozenColumnsWidth, 0); - setBounds(cellWrapper, frozenColumnsWidth, 0, tr.getOffsetWidth() - - frozenColumnsWidth, cellHeight); + setBounds(cellWrapper, frozenColumnsWidth, 0, + tr.getOffsetWidth() - frozenColumnsWidth, cellHeight); // Only add these elements once if (!messageAndButtonsWrapper.isOrHasChild(messageWrapper)) { @@ -1957,10 +1961,9 @@ public class Grid<T> extends ResizeComposite implements // overlay from the bottom editorOverlay.insertFirst(messageAndButtonsWrapper); int gridHeight = grid.getElement().getOffsetHeight(); - editorOverlay.getStyle() - .setBottom( - gridHeight - overlayTop - tr.getOffsetHeight(), - Unit.PX); + editorOverlay.getStyle().setBottom( + gridHeight - overlayTop - tr.getOffsetHeight(), + Unit.PX); editorOverlay.getStyle().clearTop(); } @@ -2177,7 +2180,8 @@ public class Grid<T> extends ResizeComposite implements return cancelButton.getText(); } - public void setEditorColumnError(Column<?, T> column, boolean hasError) { + public void setEditorColumnError(Column<?, T> column, + boolean hasError) { if (state != State.ACTIVE && state != State.SAVING) { throw new IllegalStateException("Cannot set cell error " + "status: editor is neither active nor saving."); @@ -2349,7 +2353,8 @@ public class Grid<T> extends ResizeComposite implements private final Type<HANDLER> associatedType = new Type<HANDLER>( getBrowserEventType(), this); - public AbstractGridMouseEvent(Grid<?> grid, CellReference<?> targetCell) { + public AbstractGridMouseEvent(Grid<?> grid, + CellReference<?> targetCell) { this.grid = grid; this.targetCell = targetCell; } @@ -2469,8 +2474,8 @@ public class Grid<T> extends ResizeComposite implements // Cell is correct but it does not have focused style if (cellWithFocusStyle != null) { // Remove old focus style - setStyleName(cellWithFocusStyle, - cellFocusStyleName, false); + setStyleName(cellWithFocusStyle, cellFocusStyleName, + false); } cellWithFocusStyle = cell.getElement(); @@ -2506,7 +2511,8 @@ public class Grid<T> extends ResizeComposite implements setStyleName(rowWithFocusStyle, rowFocusStyleName, true); } } else if (rowWithFocusStyle == row.getElement() - || (containerWithFocus != escalator.getBody() && rowWithFocusStyle != null)) { + || (containerWithFocus != escalator.getBody() + && rowWithFocusStyle != null)) { // Remove focus style. setStyleName(rowWithFocusStyle, rowFocusStyleName, false); rowWithFocusStyle = null; @@ -2528,8 +2534,7 @@ public class Grid<T> extends ResizeComposite implements */ private void setCellFocus(int rowIndex, int columnIndexDOM, RowContainer container) { - if (container == null - || rowIndex == rowWithFocus + if (container == null || rowIndex == rowWithFocus && cellFocusRange.contains(columnIndexDOM) && container == this.containerWithFocus) { return; @@ -2558,8 +2563,8 @@ public class Grid<T> extends ResizeComposite implements ++i; } while (cell != null); } - int columnIndex = getColumns().indexOf( - getVisibleColumn(columnIndexDOM)); + int columnIndex = getColumns() + .indexOf(getVisibleColumn(columnIndexDOM)); if (columnIndex >= escalator.getColumnConfiguration() .getFrozenColumnCount()) { escalator.scrollToColumn(columnIndexDOM, ScrollDestination.ANY, @@ -2678,7 +2683,8 @@ public class Grid<T> extends ResizeComposite implements case KeyCodes.KEY_PAGEDOWN: case KeyCodes.KEY_PAGEUP: if (newContainer.getRowCount() > 0) { - boolean down = event.getKeyCode() == KeyCodes.KEY_PAGEDOWN; + boolean down = event + .getKeyCode() == KeyCodes.KEY_PAGEDOWN; // If there is a visible focused cell, scroll by one // page from its position. Otherwise, use the first or // the last visible row as the scroll start position. @@ -2692,12 +2698,12 @@ public class Grid<T> extends ResizeComposite implements // Scroll by a little less than the visible area to // account for the possibility that the top and the // bottom row are only partially visible. - int moveFocusBy = Math.max(1, lastVisible - - firstVisible - 1); + int moveFocusBy = Math.max(1, + lastVisible - firstVisible - 1); moveFocusBy *= down ? 1 : -1; newRow += moveFocusBy; - newRow = Math.max(0, Math.min( - newContainer.getRowCount() - 1, newRow)); + newRow = Math.max(0, Math + .min(newContainer.getRowCount() - 1, newRow)); } break; default: @@ -2804,11 +2810,12 @@ public class Grid<T> extends ResizeComposite implements */ public void rowsAddedToBody(Range added) { boolean bodyHasFocus = (containerWithFocus == escalator.getBody()); - boolean insertionIsAboveFocusedCell = (added.getStart() <= rowWithFocus); + boolean insertionIsAboveFocusedCell = (added + .getStart() <= rowWithFocus); if (bodyHasFocus && insertionIsAboveFocusedCell) { rowWithFocus += added.length(); - rowWithFocus = Math.min(rowWithFocus, escalator.getBody() - .getRowCount() - 1); + rowWithFocus = Math.min(rowWithFocus, + escalator.getBody().getRowCount() - 1); refreshRow(rowWithFocus); } } @@ -2836,12 +2843,12 @@ public class Grid<T> extends ResizeComposite implements rowWithFocus = removed.getStart() - 1; } else { if (escalator.getHeader().getRowCount() > 0) { - rowWithFocus = Math.min(lastFocusedHeaderRow, escalator - .getHeader().getRowCount() - 1); + rowWithFocus = Math.min(lastFocusedHeaderRow, + escalator.getHeader().getRowCount() - 1); containerWithFocus = escalator.getHeader(); } else if (escalator.getFooter().getRowCount() > 0) { - rowWithFocus = Math.min(lastFocusedFooterRow, escalator - .getFooter().getRowCount() - 1); + rowWithFocus = Math.min(lastFocusedFooterRow, + escalator.getFooter().getRowCount() - 1); containerWithFocus = escalator.getFooter(); } } @@ -2851,7 +2858,7 @@ public class Grid<T> extends ResizeComposite implements } public final class SelectionColumn extends Column<Boolean, T> - implements GridEnabledHandler { + implements GridEnabledHandler { private boolean initDone = false; private boolean selected = false; @@ -2886,10 +2893,10 @@ public class Grid<T> extends ResizeComposite implements if (selectAllCheckBox == null) { selectAllCheckBox = GWT.create(CheckBox.class); - selectAllCheckBox.setStylePrimaryName(getStylePrimaryName() - + SELECT_ALL_CHECKBOX_CLASSNAME); - selectAllCheckBox - .addValueChangeHandler(new ValueChangeHandler<Boolean>() { + selectAllCheckBox.setStylePrimaryName( + getStylePrimaryName() + SELECT_ALL_CHECKBOX_CLASSNAME); + selectAllCheckBox.addValueChangeHandler( + new ValueChangeHandler<Boolean>() { @Override public void onValueChange( @@ -2909,11 +2916,11 @@ public class Grid<T> extends ResizeComposite implements @Override public void onClick(GridClickEvent event) { CellReference<?> targetCell = event.getTargetCell(); - int defaultRowIndex = getHeader().getRows().indexOf( - getDefaultHeaderRow()); + int defaultRowIndex = getHeader().getRows() + .indexOf(getDefaultHeaderRow()); - if (targetCell.getColumnIndex() == 0 - && targetCell.getRowIndex() == defaultRowIndex) { + if (targetCell.getColumnIndex() == 0 && targetCell + .getRowIndex() == defaultRowIndex) { selectAllCheckBox.setValue( !selectAllCheckBox.getValue(), true); } @@ -2927,12 +2934,13 @@ public class Grid<T> extends ResizeComposite implements if (event.getNativeKeyCode() != KeyCodes.KEY_SPACE) { return; } - HeaderRow targetHeaderRow = getHeader().getRow( - event.getFocusedCell().getRowIndex()); + HeaderRow targetHeaderRow = getHeader() + .getRow(event.getFocusedCell().getRowIndex()); if (!targetHeaderRow.isDefault()) { return; } - if (event.getFocusedCell().getColumn() == SelectionColumn.this) { + if (event.getFocusedCell() + .getColumn() == SelectionColumn.this) { // Send events to ensure state is updated selectAllCheckBox.setValue( !selectAllCheckBox.getValue(), true); @@ -2941,7 +2949,8 @@ public class Grid<T> extends ResizeComposite implements }); } else { for (HeaderRow row : header.getRows()) { - if (row.getCell(this).getType() == GridStaticCellType.WIDGET) { + if (row.getCell(this) + .getType() == GridStaticCellType.WIDGET) { // Detach from old header. row.getCell(this).setText(""); } @@ -3015,11 +3024,12 @@ public class Grid<T> extends ResizeComposite implements * Sets whether the selection column is enabled. * * @since 7.7 - * @param enabled <code>true</code> to enable the column, - * <code>false</code> to disable it. + * @param enabled + * <code>true</code> to enable the column, <code>false</code> + * to disable it. */ public void setEnabled(boolean enabled) { - if(selectAllCheckBox != null) { + if (selectAllCheckBox != null) { selectAllCheckBox.setEnabled(enabled); } } @@ -3247,8 +3257,8 @@ public class Grid<T> extends ResizeComposite implements for (int index = 0; index < columns.size(); index++) { selfWidths.put(index, columns.get(index).getWidth()); } - Grid.this.escalator.getColumnConfiguration().setColumnWidths( - selfWidths); + Grid.this.escalator.getColumnConfiguration() + .setColumnWidths(selfWidths); /* * Step 2: Make sure that each column ends up obeying their min/max @@ -3273,8 +3283,8 @@ public class Grid<T> extends ResizeComposite implements constrainedWidths.put(index, column.getMaximumWidth()); } } - Grid.this.escalator.getColumnConfiguration().setColumnWidths( - constrainedWidths); + Grid.this.escalator.getColumnConfiguration() + .setColumnWidths(constrainedWidths); } private void applyColumnWidthsWithExpansion() { @@ -3301,7 +3311,8 @@ public class Grid<T> extends ResizeComposite implements Math.min(getMaxWidth(column), widthAsIs), column.getMinimumWidth()); defaultExpandRatios = defaultExpandRatios - && (column.getExpandRatio() == -1 || column == selectionColumn); + && (column.getExpandRatio() == -1 + || column == selectionColumn); if (isFixedWidth) { columnSizes.put(visibleColumns.indexOf(column), widthFixed); @@ -3315,8 +3326,8 @@ public class Grid<T> extends ResizeComposite implements setColumnSizes(columnSizes); for (Column<?, T> column : nonFixedColumns) { - final int expandRatio = (defaultExpandRatios ? 1 : column - .getExpandRatio()); + final int expandRatio = (defaultExpandRatios ? 1 + : column.getExpandRatio()); final double maxWidth = getMaxWidth(column); final double newWidth = Math.min(maxWidth, column.getWidthActual()); @@ -3363,8 +3374,8 @@ public class Grid<T> extends ResizeComposite implements final int columnIndex = visibleColumns.indexOf(column); final double autoWidth = columnSizes.get(columnIndex); final double maxWidth = getMaxWidth(column); - double expandedWidth = autoWidth + widthPerRatio - * expandRatio; + double expandedWidth = autoWidth + + widthPerRatio * expandRatio; if (maxWidth <= expandedWidth) { i.remove(); @@ -3381,12 +3392,12 @@ public class Grid<T> extends ResizeComposite implements return; } assert pixelsToDistribute > 0 : "We've run out of pixels to distribute (" - + pixelsToDistribute - + "px to " - + totalRatios + + pixelsToDistribute + "px to " + totalRatios + " ratios between " + columnsToExpand.size() + " columns)"; - assert totalRatios > 0 && !columnsToExpand.isEmpty() : "Bookkeeping out of sync. Ratios: " - + totalRatios + " Columns: " + columnsToExpand.size(); + assert totalRatios > 0 && !columnsToExpand + .isEmpty() : "Bookkeeping out of sync. Ratios: " + + totalRatios + " Columns: " + + columnsToExpand.size(); /* * If we still have anything left, distribute the remaining pixels @@ -3399,8 +3410,8 @@ public class Grid<T> extends ResizeComposite implements // These browsers report subpixels as integers. this usually // results into issues.. widthPerRatio = (int) (pixelsToDistribute / totalRatios); - leftOver = (int) (pixelsToDistribute - widthPerRatio - * totalRatios); + leftOver = (int) (pixelsToDistribute + - widthPerRatio * totalRatios); } else { widthPerRatio = pixelsToDistribute / totalRatios; } @@ -3449,7 +3460,8 @@ public class Grid<T> extends ResizeComposite implements boolean hasAutoWidth = column.getWidth() < 0; if (hasAutoWidth && currentWidth < minWidth) { columnSizes.put(columnIndex, minWidth); - pixelsToRemoveFromOtherColumns += (minWidth - currentWidth); + pixelsToRemoveFromOtherColumns += (minWidth + - currentWidth); minWidthsCausedReflows = true; /* @@ -3475,8 +3487,8 @@ public class Grid<T> extends ResizeComposite implements final double pixelsToRemove = pixelsToRemovePerRatio * getExpandRatio(column, defaultExpandRatios); int colIndex = visibleColumns.indexOf(column); - columnSizes.put(colIndex, columnSizes.get(colIndex) - - pixelsToRemove); + columnSizes.put(colIndex, + columnSizes.get(colIndex) - pixelsToRemove); } } while (minWidthsCausedReflows); @@ -3557,10 +3569,10 @@ public class Grid<T> extends ResizeComposite implements try { detailsWidget = detailsGenerator.getDetails(rowIndex); } catch (Throwable e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Exception while generating details for row " - + rowIndex, e); + + rowIndex, + e); } final double spacerHeight; @@ -3598,7 +3610,8 @@ public class Grid<T> extends ResizeComposite implements .getBorderTopAndBottomThickness(spacerElement); double measuredHeight = contentHeight + borderTopAndBottomHeight; - assert getElement().isOrHasChild(spacerElement) : "The spacer element wasn't in the DOM during measurement, but was assumed to be."; + assert getElement().isOrHasChild( + spacerElement) : "The spacer element wasn't in the DOM during measurement, but was assumed to be."; spacerHeight = measuredHeight; } @@ -3617,8 +3630,8 @@ public class Grid<T> extends ResizeComposite implements + "Grid's DOM. (row: " + spacer.getRow() + ", element: " + spacerElement + ")"; - Widget detailsWidget = elementToWidgetMap.remove(spacerElement - .getFirstChildElement()); + Widget detailsWidget = elementToWidgetMap + .remove(spacerElement.getFirstChildElement()); if (detailsWidget != null) { /* @@ -3629,8 +3642,8 @@ public class Grid<T> extends ResizeComposite implements assert spacerElement.getFirstChild() != null : "The " + "details row to destroy did not contain a widget - " + "probably removed by something else without " - + "permission? (row: " + spacer.getRow() - + ", element: " + spacerElement + ")"; + + "permission? (row: " + spacer.getRow() + ", element: " + + spacerElement + ")"; setParent(detailsWidget, null); spacerElement.removeAllChildren(); @@ -3747,8 +3760,8 @@ public class Grid<T> extends ResizeComposite implements && event.getKeyCode() == KeyCodes.KEY_ENTER) { final MenuItem item = getSelectedItem(); super.onBrowserEvent(event); - Scheduler.get().scheduleDeferred( - new ScheduledCommand() { + Scheduler.get() + .scheduleDeferred(new ScheduledCommand() { @Override public void execute() { @@ -3856,8 +3869,8 @@ public class Grid<T> extends ResizeComposite implements RowContainer header = grid.escalator.getHeader(); if (header.getRowCount() == 0 || !header.getRowElement(0).hasChildNodes()) { - getLogger() - .info("No header cell available when calculating sidebar button height"); + getLogger().info( + "No header cell available when calculating sidebar button height"); openCloseButton.setHeight(header.getDefaultRowHeight() + "px"); return; @@ -3942,8 +3955,8 @@ public class Grid<T> extends ResizeComposite implements } toggle.setStyleName("hidden", column.isHidden()); } else if (columnToHidingToggleMap.containsKey(column)) { - sidebar.menuBar.removeItem((columnToHidingToggleMap - .remove(column))); + sidebar.menuBar + .removeItem((columnToHidingToggleMap.remove(column))); } updateTogglesOrder(); } @@ -4079,8 +4092,11 @@ public class Grid<T> extends ResizeComposite implements * This is a workaround to make Chrome work like Firefox. In Chrome, * normally if you start a drag on one cell and release on: * <ul> - * <li>that same cell, the click event is that {@code <td>}. - * <li>a cell on that same row, the click event is the parent {@code <tr>}. + * <li>that same cell, the click event is that {@code + * <td>}. + * <li>a cell on that same row, the click event is the parent {@code + * <tr> + * }. * <li>a cell on another row, the click event is the table section ancestor * ({@code <thead>}, {@code <tbody>} or {@code <tfoot>}). * </ul> @@ -4179,8 +4195,8 @@ public class Grid<T> extends ResizeComposite implements } // update the style names on each run in case primary name has been // modified - tableHeader.setClassName(escalator.getHeader().getElement() - .getClassName()); + tableHeader.setClassName( + escalator.getHeader().getElement().getClassName()); dropMarker.setClassName(getStylePrimaryName() + "-drop-marker"); int topOffset = 0; for (int i = 0; i < eventCell.getRowIndex(); i++) { @@ -4213,9 +4229,11 @@ public class Grid<T> extends ResizeComposite implements .ceilingEntry(cursorXCoordinate); final Entry<Double, Integer> cellEdgeOnLeft = possibleDropPositions .floorEntry(cursorXCoordinate); - final double diffToRightEdge = cellEdgeOnRight == null ? Double.MAX_VALUE + final double diffToRightEdge = cellEdgeOnRight == null + ? Double.MAX_VALUE : cellEdgeOnRight.getKey() - cursorXCoordinate; - final double diffToLeftEdge = cellEdgeOnLeft == null ? Double.MAX_VALUE + final double diffToLeftEdge = cellEdgeOnLeft == null + ? Double.MAX_VALUE : cursorXCoordinate - cellEdgeOnLeft.getKey(); double dropMarkerLeft = 0 - scrollLeft; @@ -4231,7 +4249,8 @@ public class Grid<T> extends ResizeComposite implements final double frozenColumnsWidth = autoScroller .getFrozenColumnsWidth(); - final double rightBoundaryForDrag = getSidebarBoundaryComparedTo(dropMarkerLeft); + final double rightBoundaryForDrag = getSidebarBoundaryComparedTo( + dropMarkerLeft); final int visibleColumns = getVisibleColumns().size(); // First check if the drop marker should move left because of the @@ -4246,7 +4265,8 @@ public class Grid<T> extends ResizeComposite implements // Check if the drop marker shouldn't be shown at all else if (dropMarkerLeft < frozenColumnsWidth || dropMarkerLeft > Math.min(rightBoundaryForDrag, - escalator.getInnerWidth()) || dropMarkerLeft < 0) { + escalator.getInnerWidth()) + || dropMarkerLeft < 0) { dropMarkerLeft = -10000000; } dropMarker.getStyle().setLeft(dropMarkerLeft, Unit.PX); @@ -4269,8 +4289,8 @@ public class Grid<T> extends ResizeComposite implements // Do not show the drag element beyond the grid final double sidebarBoundary = getSidebarBoundaryComparedTo(left); final double gridBoundary = escalator.getInnerWidth(); - final double rightBoundary = Math - .min(sidebarBoundary, gridBoundary); + final double rightBoundary = Math.min(sidebarBoundary, + gridBoundary); // Do not show on left of the frozen columns (even if scrolled) final int frozenColumnsWidth = (int) autoScroller @@ -4343,13 +4363,15 @@ public class Grid<T> extends ResizeComposite implements final int colspan = header.getRow(eventCell.getRowIndex()) .getCell(eventCell.getColumn()).getColspan(); if (latestColumnDropIndex != draggedColumnIndex - && latestColumnDropIndex != (draggedColumnIndex + colspan)) { + && latestColumnDropIndex != (draggedColumnIndex + + colspan)) { List<Column<?, T>> columns = getColumns(); List<Column<?, T>> reordered = new ArrayList<Column<?, T>>(); if (draggedColumnIndex < latestColumnDropIndex) { reordered.addAll(columns.subList(0, draggedColumnIndex)); - reordered.addAll(columns.subList(draggedColumnIndex - + colspan, latestColumnDropIndex)); + reordered.addAll( + columns.subList(draggedColumnIndex + colspan, + latestColumnDropIndex)); reordered.addAll(columns.subList(draggedColumnIndex, draggedColumnIndex + colspan)); reordered.addAll(columns.subList(latestColumnDropIndex, @@ -4360,8 +4382,8 @@ public class Grid<T> extends ResizeComposite implements draggedColumnIndex + colspan)); reordered.addAll(columns.subList(latestColumnDropIndex, draggedColumnIndex)); - reordered.addAll(columns.subList(draggedColumnIndex - + colspan, columns.size())); + reordered.addAll(columns.subList( + draggedColumnIndex + colspan, columns.size())); } reordered.remove(selectionColumn); // since setColumnOrder will // add it anyway! @@ -4370,12 +4392,12 @@ public class Grid<T> extends ResizeComposite implements Cell focusedCell = cellFocusHandler.getFocusedCell(); if (focusedCell != null) { // take hidden columns into account - focusedColumnIndex = getColumns().indexOf( - getVisibleColumn(focusedCell.getColumn())); + focusedColumnIndex = getColumns() + .indexOf(getVisibleColumn(focusedCell.getColumn())); } - Column<?, T>[] array = reordered.toArray(new Column[reordered - .size()]); + Column<?, T>[] array = reordered + .toArray(new Column[reordered.size()]); setColumnOrder(array); transferCellFocusOnDrop(); } // else no reordering @@ -4392,11 +4414,11 @@ public class Grid<T> extends ResizeComposite implements .findRowContainer(focusedCell.getElement()); if (focusedColumnIndex == draggedColumnIndex) { // move with the dragged column - int adjustedDropIndex = latestColumnDropIndex > draggedColumnIndex ? latestColumnDropIndex - 1 - : latestColumnDropIndex; + int adjustedDropIndex = latestColumnDropIndex > draggedColumnIndex + ? latestColumnDropIndex - 1 : latestColumnDropIndex; // remove hidden columns from indexing - adjustedDropIndex = getVisibleColumns().indexOf( - getColumn(adjustedDropIndex)); + adjustedDropIndex = getVisibleColumns() + .indexOf(getColumn(adjustedDropIndex)); cellFocusHandler.setCellFocus(focusedRowIndex, adjustedDropIndex, rowContainer); } else if (latestColumnDropIndex <= focusedColumnIndex @@ -4454,8 +4476,8 @@ public class Grid<T> extends ResizeComposite implements possibleDropPositions.clear(); final int draggedColumnIndex = eventCell.getColumnIndex(); - final StaticRow<?> draggedCellRow = header.getRow(eventCell - .getRowIndex()); + final StaticRow<?> draggedCellRow = header + .getRow(eventCell.getRowIndex()); final int draggedColumnRightIndex = draggedColumnIndex + draggedCellRow.getCell(eventCell.getColumn()) .getColspan(); @@ -4625,9 +4647,8 @@ public class Grid<T> extends ResizeComposite implements @Override public void render(RendererCellReference cell, Object data) { if (!warned && !(data instanceof String)) { - getLogger().warning( - Column.this.toString() + ": " - + DEFAULT_RENDERER_WARNING); + getLogger().warning(Column.this.toString() + ": " + + DEFAULT_RENDERER_WARNING); warned = true; } @@ -4842,8 +4863,8 @@ public class Grid<T> extends ResizeComposite implements ColumnConfiguration conf = null; int index = 0; - if (grid != null - && (bodyRenderer instanceof WidgetRenderer || renderer instanceof WidgetRenderer)) { + if (grid != null && (bodyRenderer instanceof WidgetRenderer + || renderer instanceof WidgetRenderer)) { // Column needs to be recreated. index = grid.getColumns().indexOf(this); conf = grid.escalator.getColumnConfiguration(); @@ -4938,9 +4959,8 @@ public class Grid<T> extends ResizeComposite implements if (isHidden()) { return 0; } - return grid.escalator.getColumnConfiguration() - .getColumnWidthActual( - grid.getVisibleColumns().indexOf(this)); + return grid.escalator.getColumnConfiguration().getColumnWidthActual( + grid.getVisibleColumns().indexOf(this)); } void reapplyWidth() { @@ -5040,10 +5060,10 @@ public class Grid<T> extends ResizeComposite implements } else { this.hidden = hidden; - final int columnIndex = grid.getVisibleColumns().indexOf( - this); - grid.escalator.getColumnConfiguration().insertColumns( - columnIndex, 1); + final int columnIndex = grid.getVisibleColumns() + .indexOf(this); + grid.escalator.getColumnConfiguration() + .insertColumns(columnIndex, 1); // make sure column is set to frozen if it needs to be, // escalator doesn't handle situation where the added column @@ -5201,8 +5221,8 @@ public class Grid<T> extends ResizeComposite implements /** * Sets the maximum width for this column. * <p> - * This defines the maximum allowed pixel width of the column - * <em>when it is set to expand</em>. + * This defines the maximum allowed pixel width of the column <em>when + * it is set to expand</em>. * <p> * This action is done "finally", once the current execution loop * returns. This is done to reduce overhead of unintentionally always @@ -5387,16 +5407,17 @@ public class Grid<T> extends ResizeComposite implements Renderer<?> renderer = findRenderer(cell); if (renderer instanceof ComplexRenderer) { try { - Column<?, T> column = getVisibleColumn(cell.getColumn()); + Column<?, T> column = getVisibleColumn( + cell.getColumn()); rendererCellReference.set(cell, getColumns().indexOf(column), column); ((ComplexRenderer<?>) renderer) .init(rendererCellReference); } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error initing cell in column " - + cell.getColumn(), e); + + cell.getColumn(), + e); } } } @@ -5412,8 +5433,10 @@ public class Grid<T> extends ResizeComposite implements Widget widget = widgetRenderer.createWidget(); assert widget != null : "WidgetRenderer.createWidget() returned null. It should return a widget."; - assert widget.getParent() == null : "WidgetRenderer.createWidget() returned a widget which already is attached."; - assert cell.getElement().getChildCount() == 0 : "Cell content should be empty when adding Widget"; + assert widget + .getParent() == null : "WidgetRenderer.createWidget() returned a widget which already is attached."; + assert cell.getElement() + .getChildCount() == 0 : "Cell content should be empty when adding Widget"; // Physical attach cell.getElement().appendChild(widget.getElement()); @@ -5421,10 +5444,10 @@ public class Grid<T> extends ResizeComposite implements // Logical attach setParent(widget, Grid.this); } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error attaching child widget in column " - + cell.getColumn(), e); + + cell.getColumn(), + e); } } } @@ -5467,10 +5490,10 @@ public class Grid<T> extends ResizeComposite implements .getStyle(rowReference); setCustomStyleName(rowElement, rowStylename); } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error generating styles for row " - + row.getRow(), e); + + row.getRow(), + e); } } else { // Remove in case there was a generator previously @@ -5496,16 +5519,16 @@ public class Grid<T> extends ResizeComposite implements if (hasData && cellStyleGenerator != null) { try { - cellReference - .set(cell.getColumn(), columnIndex, column); + cellReference.set(cell.getColumn(), columnIndex, + column); String generatedStyle = cellStyleGenerator .getStyle(cellReference); setCustomStyleName(cell.getElement(), generatedStyle); } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error generating style for cell in column " - + cell.getColumn(), e); + + cell.getColumn(), + e); } } else if (hasData || usedToHaveData) { setCustomStyleName(cell.getElement(), null); @@ -5530,8 +5553,8 @@ public class Grid<T> extends ResizeComposite implements } else { // Prepare cell for no data - clxRenderer.setContentVisible( - rendererCellReference, false); + clxRenderer.setContentVisible(rendererCellReference, + false); } } else if (hasData) { @@ -5544,10 +5567,10 @@ public class Grid<T> extends ResizeComposite implements cell.getElement().removeAllChildren(); } } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error rendering cell in column " - + cell.getColumn(), e); + + cell.getColumn(), + e); } } } @@ -5558,8 +5581,8 @@ public class Grid<T> extends ResizeComposite implements Renderer<?> renderer = findRenderer(cell); if (renderer instanceof WidgetRenderer) { try { - Widget w = WidgetUtil.findWidget(cell.getElement() - .getFirstChildElement(), null); + Widget w = WidgetUtil.findWidget( + cell.getElement().getFirstChildElement(), null); if (w != null) { // Logical detach @@ -5569,10 +5592,10 @@ public class Grid<T> extends ResizeComposite implements cell.getElement().removeChild(w.getElement()); } } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error detaching widget in column " - + cell.getColumn(), e); + + cell.getColumn(), + e); } } } @@ -5588,16 +5611,17 @@ public class Grid<T> extends ResizeComposite implements Renderer<?> renderer = findRenderer(cell); if (renderer instanceof ComplexRenderer) { try { - Column<?, T> column = getVisibleColumn(cell.getColumn()); + Column<?, T> column = getVisibleColumn( + cell.getColumn()); rendererCellReference.set(cell, getColumns().indexOf(column), column); ((ComplexRenderer) renderer) .destroy(rendererCellReference); } catch (RuntimeException e) { - getLogger().log( - Level.SEVERE, + getLogger().log(Level.SEVERE, "Error destroying cell in column " - + cell.getColumn(), e); + + cell.getColumn(), + e); } } } @@ -5629,7 +5653,8 @@ public class Grid<T> extends ResizeComposite implements // Decorate default row with sorting indicators if (staticRow instanceof HeaderRow) { - addSortingIndicatorsToHeaderRow((HeaderRow) staticRow, cell); + addSortingIndicatorsToHeaderRow((HeaderRow) staticRow, + cell); } // Assign colspan to cell before rendering @@ -5658,10 +5683,8 @@ public class Grid<T> extends ResizeComposite implements content.setClassName(getStylePrimaryName() + "-column-footer-content"); } else { - getLogger().severe( - "Unhandled static row type " - + staticRow.getClass() - .getCanonicalName()); + getLogger().severe("Unhandled static row type " + + staticRow.getClass().getCanonicalName()); } td.appendChild(content); @@ -5691,11 +5714,12 @@ public class Grid<T> extends ResizeComposite implements && ((HeaderRow) staticRow).isDefault()) { final int column = cell.getColumn(); - DragHandle dragger = new DragHandle(getStylePrimaryName() - + "-column-resize-handle", + DragHandle dragger = new DragHandle( + getStylePrimaryName() + "-column-resize-handle", new DragHandleCallback() { - private Column<?, T> col = getVisibleColumn(column); + private Column<?, T> col = getVisibleColumn( + column); private double initialWidth = 0; private double minCellWidth; @@ -5710,9 +5734,8 @@ public class Grid<T> extends ResizeComposite implements public void onStart() { initialWidth = col.getWidthActual(); - minCellWidth = escalator - .getMinCellWidth(getColumns() - .indexOf(col)); + minCellWidth = escalator.getMinCellWidth( + getColumns().indexOf(col)); for (Column<?, T> c : getVisibleColumns()) { if (selectionColumn == c) { // Don't modify selection column. @@ -5848,8 +5871,8 @@ public class Grid<T> extends ResizeComposite implements List<Column<?, T>> columns = getVisibleColumns(); for (FlyweightCell cell : attachedCells) { - StaticSection.StaticCell metadata = gridRow.getCell(columns - .get(cell.getColumn())); + StaticSection.StaticCell metadata = gridRow + .getCell(columns.get(cell.getColumn())); /* * If the cell contains widgets that are not currently attached * then attach them now. @@ -5867,12 +5890,12 @@ public class Grid<T> extends ResizeComposite implements @Override public void preDetach(Row row, Iterable<FlyweightCell> cellsToDetach) { if (section.getRowCount() > row.getRow()) { - StaticSection.StaticRow<?> gridRow = section.getRow(row - .getRow()); + StaticSection.StaticRow<?> gridRow = section + .getRow(row.getRow()); List<Column<?, T>> columns = getVisibleColumns(); for (FlyweightCell cell : cellsToDetach) { - StaticSection.StaticCell metadata = gridRow.getCell(columns - .get(cell.getColumn())); + StaticSection.StaticCell metadata = gridRow + .getCell(columns.get(cell.getColumn())); if (GridStaticCellType.WIDGET.equals(metadata.getType()) && metadata.getWidget() != null @@ -5926,8 +5949,8 @@ public class Grid<T> extends ResizeComposite implements } }); - escalator - .addRowVisibilityChangeHandler(new RowVisibilityChangeHandler() { + escalator.addRowVisibilityChangeHandler( + new RowVisibilityChangeHandler() { @Override public void onRowVisibilityChange( RowVisibilityChangeEvent event) { @@ -6083,7 +6106,8 @@ public class Grid<T> extends ResizeComposite implements * <code>true</code> if we refreshing the header, else assumed * the footer */ - private void refreshRowContainer(RowContainer rows, StaticSection<?> section) { + private void refreshRowContainer(RowContainer rows, + StaticSection<?> section) { // Add or Remove rows on demand int rowDiff = section.getVisibleRowCount() - rows.getRowCount(); @@ -6111,10 +6135,11 @@ public class Grid<T> extends ResizeComposite implements final Range rowRange = Range.between(0, dataSource.size()); final Range columnRange = Range.between(0, getVisibleColumns().size()); - assert rowRange.contains(rowIndex) : "Illegal row index. Should be in range " - + rowRange; - assert columnRange.contains(columnIndex) : "Illegal column index. Should be in range " - + columnRange; + assert rowRange.contains( + rowIndex) : "Illegal row index. Should be in range " + rowRange; + assert columnRange.contains( + columnIndex) : "Illegal column index. Should be in range " + + columnRange; if (rowRange.contains(rowIndex) && columnRange.contains(columnIndex)) { cellFocusHandler.setCellFocus(rowIndex, columnIndex, @@ -6184,8 +6209,8 @@ public class Grid<T> extends ResizeComposite implements */ public <C extends Column<?, T>> C addColumn(C column, int index) { if (column == selectionColumn) { - throw new IllegalArgumentException("The selection column many " - + "not be added manually"); + throw new IllegalArgumentException( + "The selection column many " + "not be added manually"); } else if (selectionColumn != null && index == 0) { throw new IllegalStateException("A column cannot be inserted " + "before the selection column"); @@ -6277,8 +6302,8 @@ public class Grid<T> extends ResizeComposite implements int columnIndex = columns.indexOf(column); // Remove from column configuration - escalator.getColumnConfiguration().removeColumns( - getVisibleColumns().indexOf(column), 1); + escalator.getColumnConfiguration() + .removeColumns(getVisibleColumns().indexOf(column), 1); updateFrozenColumns(); @@ -6741,12 +6766,12 @@ public class Grid<T> extends ResizeComposite implements if (newSize > oldSize) { body.insertRows(oldSize, newSize - oldSize); - cellFocusHandler.rowsAddedToBody(Range.withLength(oldSize, - newSize - oldSize)); + cellFocusHandler.rowsAddedToBody( + Range.withLength(oldSize, newSize - oldSize)); } else if (newSize < oldSize) { body.removeRows(newSize, oldSize - newSize); - cellFocusHandler.rowsRemovedFromBody(Range.withLength( - newSize, oldSize - newSize)); + cellFocusHandler.rowsRemovedFromBody( + Range.withLength(newSize, oldSize - newSize)); } if (newSize > 0) { @@ -6822,8 +6847,8 @@ public class Grid<T> extends ResizeComposite implements } private void updateFrozenColumns() { - escalator.getColumnConfiguration().setFrozenColumnCount( - getVisibleFrozenColumnCount()); + escalator.getColumnConfiguration() + .setFrozenColumnCount(getVisibleFrozenColumnCount()); } private int getVisibleFrozenColumnCount() { @@ -6934,8 +6959,8 @@ public class Grid<T> extends ResizeComposite implements int maxsize = escalator.getBody().getRowCount() - 1; if (rowIndex < 0) { - throw new IllegalArgumentException("Row index (" + rowIndex - + ") is below zero!"); + throw new IllegalArgumentException( + "Row index (" + rowIndex + ") is below zero!"); } if (rowIndex > maxsize) { @@ -7294,7 +7319,8 @@ public class Grid<T> extends ResizeComposite implements if (gridColumn.getRenderer() instanceof ComplexRenderer) { ComplexRenderer<?> cplxRenderer = (ComplexRenderer<?>) gridColumn .getRenderer(); - if (cplxRenderer.getConsumedEvents().contains(event.getType())) { + if (cplxRenderer.getConsumedEvents() + .contains(event.getType())) { if (cplxRenderer.onBrowserEvent(eventCell, event)) { return true; } @@ -7393,10 +7419,10 @@ public class Grid<T> extends ResizeComposite implements event.preventDefault(); Touch touch = event.getChangedTouches().get(0); - double diffX = Math.abs(touch.getClientX() - - rowEventTouchStartingPoint.getX()); - double diffY = Math.abs(touch.getClientY() - - rowEventTouchStartingPoint.getY()); + double diffX = Math.abs( + touch.getClientX() - rowEventTouchStartingPoint.getX()); + double diffY = Math.abs( + touch.getClientY() - rowEventTouchStartingPoint.getY()); // Cancel long tap if finger strays too far from // starting point @@ -7442,7 +7468,8 @@ public class Grid<T> extends ResizeComposite implements @Override @SuppressWarnings("deprecation") - public com.google.gwt.user.client.Element getSubPartElement(String subPart) { + public com.google.gwt.user.client.Element getSubPartElement( + String subPart) { /* * handles details[] (translated to spacer[] for Escalator), cell[], @@ -7450,17 +7477,16 @@ public class Grid<T> extends ResizeComposite implements */ // "#header[0][0]/DRAGhANDLE" - Element escalatorElement = escalator.getSubPartElement(subPart - .replaceFirst("^details\\[", "spacer[")); + Element escalatorElement = escalator.getSubPartElement( + subPart.replaceFirst("^details\\[", "spacer[")); if (escalatorElement != null) { int detailIdx = subPart.indexOf("/"); if (detailIdx > 0) { String detail = subPart.substring(detailIdx + 1); - getLogger().severe( - "Looking up detail from index " + detailIdx - + " onward: \"" + detail + "\""); + getLogger().severe("Looking up detail from index " + detailIdx + + " onward: \"" + detail + "\""); if (detail.equalsIgnoreCase("content")) { // XXX: Fix this to look up by class name! return DOM.asOld(Element.as(escalatorElement.getChild(0))); @@ -7514,7 +7540,8 @@ public class Grid<T> extends ResizeComposite implements @Override @SuppressWarnings("deprecation") - public String getSubPartName(com.google.gwt.user.client.Element subElement) { + public String getSubPartName( + com.google.gwt.user.client.Element subElement) { String escalatorStructureName = escalator.getSubPartName(subElement); if (escalatorStructureName != null) { @@ -7538,7 +7565,8 @@ public class Grid<T> extends ResizeComposite implements int i = 0; for (Column<?, T> column : columns) { - if (editor.getWidget(column).getElement().isOrHasChild(subElement)) { + if (editor.getWidget(column).getElement() + .isOrHasChild(subElement)) { return "editor[" + i + "]"; } ++i; @@ -7608,8 +7636,8 @@ public class Grid<T> extends ResizeComposite implements this.selectionModel = selectionModel; selectionModel.setGrid(this); - setSelectColumnRenderer(this.selectionModel - .getSelectionColumnRenderer()); + setSelectColumnRenderer( + this.selectionModel.getSelectionColumnRenderer()); // Refresh rendered rows to update selection, if it has changed refreshBody(); @@ -7864,7 +7892,8 @@ public class Grid<T> extends ResizeComposite implements * @param handler * a select all event handler */ - public HandlerRegistration addSelectAllHandler(SelectAllHandler<T> handler) { + public HandlerRegistration addSelectAllHandler( + SelectAllHandler<T> handler) { return addHandler(handler, SelectAllEvent.getType()); } @@ -7887,8 +7916,8 @@ public class Grid<T> extends ResizeComposite implements @Override public void execute() { if (!dataIsBeingFetched) { - handler.onDataAvailable(new DataAvailableEvent( - currentDataAvailable)); + handler.onDataAvailable( + new DataAvailableEvent(currentDataAvailable)); } } }); @@ -7904,7 +7933,8 @@ public class Grid<T> extends ResizeComposite implements * the key handler to register * @return the registration for the event */ - public HandlerRegistration addBodyKeyDownHandler(BodyKeyDownHandler handler) { + public HandlerRegistration addBodyKeyDownHandler( + BodyKeyDownHandler handler) { return addHandler(handler, keyDown.getAssociatedType()); } @@ -7958,7 +7988,8 @@ public class Grid<T> extends ResizeComposite implements * the key handler to register * @return the registration for the event */ - public HandlerRegistration addHeaderKeyUpHandler(HeaderKeyUpHandler handler) { + public HandlerRegistration addHeaderKeyUpHandler( + HeaderKeyUpHandler handler) { return addHandler(handler, keyUp.getAssociatedType()); } @@ -7999,7 +8030,8 @@ public class Grid<T> extends ResizeComposite implements * the key handler to register * @return the registration for the event */ - public HandlerRegistration addFooterKeyUpHandler(FooterKeyUpHandler handler) { + public HandlerRegistration addFooterKeyUpHandler( + FooterKeyUpHandler handler) { return addHandler(handler, keyUp.getAssociatedType()); } @@ -8037,7 +8069,8 @@ public class Grid<T> extends ResizeComposite implements * the click handler to register * @return the registration for the event */ - public HandlerRegistration addHeaderClickHandler(HeaderClickHandler handler) { + public HandlerRegistration addHeaderClickHandler( + HeaderClickHandler handler) { return addHandler(handler, clickEvent.getAssociatedType()); } @@ -8049,7 +8082,8 @@ public class Grid<T> extends ResizeComposite implements * the click handler to register * @return the registration for the event */ - public HandlerRegistration addFooterClickHandler(FooterClickHandler handler) { + public HandlerRegistration addFooterClickHandler( + FooterClickHandler handler) { return addHandler(handler, clickEvent.getAssociatedType()); } @@ -8138,10 +8172,12 @@ public class Grid<T> extends ResizeComposite implements } /** - * Register a enabled status change handler to this Grid. - * The event for this handler is fired when the Grid changes from disabled - * to enabled and vice-versa. - * @param handler the handler for the event + * Register a enabled status change handler to this Grid. The event for this + * handler is fired when the Grid changes from disabled to enabled and + * vice-versa. + * + * @param handler + * the handler for the event * @return the registration for the event */ public HandlerRegistration addEnabledHandler(GridEnabledHandler handler) { @@ -8295,7 +8331,8 @@ public class Grid<T> extends ResizeComposite implements * the cell style generator to set, or <code>null</code> to * remove a previously set generator */ - public void setCellStyleGenerator(CellStyleGenerator<T> cellStyleGenerator) { + public void setCellStyleGenerator( + CellStyleGenerator<T> cellStyleGenerator) { this.cellStyleGenerator = cellStyleGenerator; refreshBody(); } @@ -8536,7 +8573,8 @@ public class Grid<T> extends ResizeComposite implements @Override public void execute() { - if (escalator.getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { + if (escalator + .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { recalculateColumnWidths(); } diff --git a/client/src/main/java/com/vaadin/client/widgets/Overlay.java b/client/src/main/java/com/vaadin/client/widgets/Overlay.java index ee20e1a9f1..7d44b96892 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Overlay.java +++ b/client/src/main/java/com/vaadin/client/widgets/Overlay.java @@ -71,8 +71,8 @@ import com.vaadin.client.WidgetUtil; * </p> * * <p> - * Read more about the DropShadow filter from <a - * href="http://msdn.microsoft.com/en-us/library/ms532985(v=vs.85).aspx" + * Read more about the DropShadow filter from + * <a href="http://msdn.microsoft.com/en-us/library/ms532985(v=vs.85).aspx" * >Microsoft Developer Network</a> * </p> * @@ -583,11 +583,12 @@ public class Overlay extends PopupPanel implements CloseHandler<PopupPanel> { public void onAnimationEnd(NativeEvent event) { String animationName = AnimationUtil .getAnimationName(event); - if (animationName - .contains(ADDITIONAL_CLASSNAME_ANIMATE_IN)) { + if (animationName.contains( + ADDITIONAL_CLASSNAME_ANIMATE_IN)) { AnimationUtil.removeAnimationEndListener( getElement(), animateInListener); - removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_IN); + removeStyleDependentName( + ADDITIONAL_CLASSNAME_ANIMATE_IN); if (isShadowEnabled()) { shadow.removeClassName(CLASSNAME_SHADOW + "-" @@ -770,18 +771,12 @@ public class Overlay extends PopupPanel implements CloseHandler<PopupPanel> { // Opera fix, part 2 (ticket #2704) if (BrowserInfo.get().isOpera()) { // We'll fix the height of all the middle elements - DOM.getChild(shadow, 3) - .getStyle() - .setPropertyPx("height", - DOM.getChild(shadow, 3).getOffsetHeight()); - DOM.getChild(shadow, 4) - .getStyle() - .setPropertyPx("height", - DOM.getChild(shadow, 4).getOffsetHeight()); - DOM.getChild(shadow, 5) - .getStyle() - .setPropertyPx("height", - DOM.getChild(shadow, 5).getOffsetHeight()); + DOM.getChild(shadow, 3).getStyle().setPropertyPx("height", + DOM.getChild(shadow, 3).getOffsetHeight()); + DOM.getChild(shadow, 4).getStyle().setPropertyPx("height", + DOM.getChild(shadow, 4).getOffsetHeight()); + DOM.getChild(shadow, 5).getStyle().setPropertyPx("height", + DOM.getChild(shadow, 5).getOffsetHeight()); } } @@ -1019,14 +1014,13 @@ public class Overlay extends PopupPanel implements CloseHandler<PopupPanel> { if (BrowserInfo.get().isIE8() || BrowserInfo.get().isIE9()) { reallyHide(autoClosed); } else { - if (animateIn - && getStyleName().contains(ADDITIONAL_CLASSNAME_ANIMATE_IN)) { + if (animateIn && getStyleName() + .contains(ADDITIONAL_CLASSNAME_ANIMATE_IN)) { AnimationUtil.addAnimationEndListener(getElement(), new AnimationEndListener() { @Override public void onAnimationEnd(NativeEvent event) { - if (AnimationUtil - .getAnimationName(event) + if (AnimationUtil.getAnimationName(event) .contains( ADDITIONAL_CLASSNAME_ANIMATE_IN)) { reallyHide(autoClosed); @@ -1046,9 +1040,8 @@ public class Overlay extends PopupPanel implements CloseHandler<PopupPanel> { animationName = ""; } - if (animateOut - && animationName - .contains(ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { + if (animateOut && animationName + .contains(ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { // Disable GWT PopupPanel closing animation if used setAnimationEnabled(false); @@ -1058,21 +1051,24 @@ public class Overlay extends PopupPanel implements CloseHandler<PopupPanel> { public void onAnimationEnd(NativeEvent event) { String animationName = AnimationUtil .getAnimationName(event); - if (animationName - .contains(ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { + if (animationName.contains( + ADDITIONAL_CLASSNAME_ANIMATE_OUT)) { AnimationUtil - .removeAllAnimationEndListeners(getElement()); + .removeAllAnimationEndListeners( + getElement()); // Remove both animation styles just in // case - removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_IN); - removeStyleDependentName(ADDITIONAL_CLASSNAME_ANIMATE_OUT); + removeStyleDependentName( + ADDITIONAL_CLASSNAME_ANIMATE_IN); + removeStyleDependentName( + ADDITIONAL_CLASSNAME_ANIMATE_OUT); if (isShadowEnabled()) { - shadow.removeClassName(CLASSNAME_SHADOW - + "-" - + ADDITIONAL_CLASSNAME_ANIMATE_IN); - shadow.removeClassName(CLASSNAME_SHADOW - + "-" - + ADDITIONAL_CLASSNAME_ANIMATE_OUT); + shadow.removeClassName( + CLASSNAME_SHADOW + "-" + + ADDITIONAL_CLASSNAME_ANIMATE_IN); + shadow.removeClassName( + CLASSNAME_SHADOW + "-" + + ADDITIONAL_CLASSNAME_ANIMATE_OUT); } reallyHide(autoClosed); } diff --git a/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java b/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java index 4dd2ddbaa4..8a84208ea8 100644 --- a/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java +++ b/client/src/test/java/com/vaadin/client/ApplicationConnectionURLGenerationTest.java @@ -10,10 +10,8 @@ public class ApplicationConnectionURLGenerationTest { private static final String[] URIS = new String[] { "http://demo.vaadin.com/", // - "https://demo.vaadin.com/", - "http://demo.vaadin.com/foo", - "http://demo.vaadin.com/foo?f", - "http://demo.vaadin.com/foo?f=1", + "https://demo.vaadin.com/", "http://demo.vaadin.com/foo", + "http://demo.vaadin.com/foo?f", "http://demo.vaadin.com/foo?f=1", "http://demo.vaadin.com:1234/foo?a", "http://demo.vaadin.com:1234/foo#frag?fakeparam", // Jetspeed @@ -41,8 +39,7 @@ public class ApplicationConnectionURLGenerationTest { "http://demo.vaadin.com/foo?a=b&c=d#fragment", "http://demo.vaadin.com/foo?f&a=b&c=d#fragment", "http://demo.vaadin.com/foo?f=1&a=b&c=d#fragment", - "http://demo.vaadin.com:1234/foo?a&a=b&c=d#fragment", - "", + "http://demo.vaadin.com:1234/foo?a&a=b&c=d#fragment", "", "http://localhost:8080/jetspeed/portal/_ns:Z3RlbXBsYXRlLXRvcDJfX3BhZ2UtdGVtcGxhdGVfX2RwLTFfX1AtMTJjNTRkYjdlYjUtMTAwMDJ8YzB8ZDF8aVVJREx8Zg__?a=b&c=d#fragment", "http://vaadin.com/directory?p_p_id=Directory_WAR_Directory&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=UIDL&p_p_cacheability=cacheLevelPage&p_p_col_id=row-1&p_p_col_count=1&a=b&c=d#fragment", @@ -60,14 +57,14 @@ public class ApplicationConnectionURLGenerationTest { // Fragments if (URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i].length() > 0) { - assertEquals(URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i], - SharedUtil.addGetParameters(URIS[i] + "#fragment", - "a=b&c=d")); + assertEquals(URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i], SharedUtil + .addGetParameters(URIS[i] + "#fragment", "a=b&c=d")); // Empty fragment - assertEquals(URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i].replace( - "#fragment", "#"), SharedUtil.addGetParameters(URIS[i] - + "#", "a=b&c=d")); + assertEquals( + URIS_WITH_ABCD_PARAM_AND_FRAGMENT[i] + .replace("#fragment", "#"), + SharedUtil.addGetParameters(URIS[i] + "#", "a=b&c=d")); } } } diff --git a/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java b/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java index e5e6cbd7db..97eb22e87d 100755 --- a/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java +++ b/client/src/test/java/com/vaadin/client/DateTimeServiceTest.java @@ -94,9 +94,10 @@ public class DateTimeServiceTest { // System.out.println("Sample: " + d); int expected = isoWeekNumbers.get(d); int calculated = DateTimeService.getISOWeekNumber(d); - Assert.assertEquals(d + " should be week " + expected - + " (Java Calendar is wrong?)", expected, - getCalendarISOWeekNr(d)); + Assert.assertEquals( + d + " should be week " + expected + + " (Java Calendar is wrong?)", + expected, getCalendarISOWeekNr(d)); Assert.assertEquals(d + " should be week " + expected, expected, calculated); diff --git a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java index 41e675cb3a..c7eaf306fe 100644 --- a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java +++ b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java @@ -415,7 +415,8 @@ public class VBrowserDetailsUserAgentParserTest { @Test public void testIE9InIE8CompatibilityMode() { - VBrowserDetails bd = new VBrowserDetails(IE9_BETA_IN_IE8_MODE_WINDOWS_7); + VBrowserDetails bd = new VBrowserDetails( + IE9_BETA_IN_IE8_MODE_WINDOWS_7); // bd.setIE8InCompatibilityMode(); /* @@ -621,8 +622,8 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isAndroid()); } - private void assertAndroid(VBrowserDetails browserDetails, - int majorVersion, int minorVersion) { + private void assertAndroid(VBrowserDetails browserDetails, int majorVersion, + int minorVersion) { assertFalse(browserDetails.isLinux()); assertFalse(browserDetails.isWindows()); assertFalse(browserDetails.isMacOSX()); diff --git a/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java b/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java index 24ccd6c57e..89a2e80679 100644 --- a/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java +++ b/client/src/test/java/com/vaadin/client/ui/grid/ListDataSourceTest.java @@ -185,8 +185,8 @@ public class ListDataSourceTest { } }); - assertTrue(Arrays.equals(ds.asList().toArray(), new Integer[] { 1, 2, - 3, 3, 4 })); + assertTrue(Arrays.equals(ds.asList().toArray(), + new Integer[] { 1, 2, 3, 3, 4 })); } } |