diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-28 10:39:17 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-28 11:39:17 +0300 |
commit | 7065740d6d02954c3483e2f24db36ad1af45c62e (patch) | |
tree | db3a0f0cabb8cc3ce4a4d2636aff9bf1716fcd8b /client | |
parent | 1827ccb5ed99c9b2deeea38e239527420711f5d1 (diff) | |
download | vaadin-framework-7065740d6d02954c3483e2f24db36ad1af45c62e.tar.gz vaadin-framework-7065740d6d02954c3483e2f24db36ad1af45c62e.zip |
Use interface instead of implementation (#10073)
Diffstat (limited to 'client')
34 files changed, 122 insertions, 98 deletions
diff --git a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java index 41ce18e8ee..2f53c24f0d 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConfiguration.java @@ -248,7 +248,7 @@ public class ApplicationConfiguration implements EntryPoint { private ErrorMessage sessionExpiredError; private int heartbeatInterval; - private HashMap<Integer, String> unknownComponents; + private Map<Integer, String> unknownComponents; private Map<Integer, Class<? extends ServerConnector>> classes = new HashMap<>(); @@ -256,11 +256,11 @@ public class ApplicationConfiguration implements EntryPoint { private static boolean moduleLoaded = false; static// TODO consider to make this hashmap per application - LinkedList<Command> callbacks = new LinkedList<>(); + List<Command> callbacks = new LinkedList<>(); private static int dependenciesLoading; - private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<>(); + private static List<ApplicationConnection> runningApplications = new ArrayList<>(); private Map<Integer, Integer> componentInheritanceMap = new HashMap<>(); private Map<Integer, String> tagToServerSideClassName = new HashMap<>(); diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java index aa02cd0a6f..d6a18f485b 100644 --- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java +++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java @@ -115,7 +115,7 @@ public class ApplicationConnection implements HasHandlers { */ public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh"; - private final HashMap<String, String> resourcesMap = new HashMap<>(); + private final Map<String, String> resourcesMap = new HashMap<>(); private WidgetSet widgetSet; @@ -383,8 +383,8 @@ public class ApplicationConnection implements HasHandlers { + cnf.getServletVersion()); if (!cnf.getServletVersion().equals(Version.getFullVersion())) { - getLogger() - .severe("Warning: your widget set seems to be built with a different " + getLogger().severe( + "Warning: your widget set seems to be built with a different " + "version than the one used on server. Unexpected " + "behavior may occur."); } @@ -494,7 +494,7 @@ public class ApplicationConnection implements HasHandlers { return vi; } } - + client.getProfilingData = $entry(function() { var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); var pd = [ @@ -509,7 +509,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); }); @@ -526,7 +526,7 @@ public class ApplicationConnection implements HasHandlers { return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); }); client.initializing = false; - + $wnd.vaadin.clients[TTAppId] = client; }-*/; diff --git a/client/src/main/java/com/vaadin/client/ComponentDetail.java b/client/src/main/java/com/vaadin/client/ComponentDetail.java index ebdcc4414c..a6621ac178 100644 --- a/client/src/main/java/com/vaadin/client/ComponentDetail.java +++ b/client/src/main/java/com/vaadin/client/ComponentDetail.java @@ -16,6 +16,7 @@ package com.vaadin.client; import java.util.HashMap; +import java.util.Map; class ComponentDetail { @@ -54,7 +55,7 @@ class ComponentDetail { this.tooltipInfo = tooltipInfo; } - private HashMap<Object, TooltipInfo> additionalTooltips; + private Map<Object, TooltipInfo> additionalTooltips; public void putAdditionalTooltip(Object key, TooltipInfo tooltip) { if (tooltip == null && additionalTooltips != null) { diff --git a/client/src/main/java/com/vaadin/client/ComponentDetailMap.java b/client/src/main/java/com/vaadin/client/ComponentDetailMap.java index f95c1c1a83..e9cbe75fdf 100644 --- a/client/src/main/java/com/vaadin/client/ComponentDetailMap.java +++ b/client/src/main/java/com/vaadin/client/ComponentDetailMap.java @@ -17,6 +17,7 @@ package com.vaadin.client; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import com.google.gwt.core.client.JavaScriptObject; @@ -80,7 +81,7 @@ final class ComponentDetailMap extends JavaScriptObject { }-*/; final Collection<ComponentDetail> values() { - ArrayList<ComponentDetail> list = new ArrayList<>(); + List<ComponentDetail> list = new ArrayList<>(); fillWithValues(list); return list; } diff --git a/client/src/main/java/com/vaadin/client/ConnectorMap.java b/client/src/main/java/com/vaadin/client/ConnectorMap.java index a2fc8cc81e..1ccfb74434 100644 --- a/client/src/main/java/com/vaadin/client/ConnectorMap.java +++ b/client/src/main/java/com/vaadin/client/ConnectorMap.java @@ -17,6 +17,7 @@ package com.vaadin.client; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.GWT; @@ -205,7 +206,7 @@ public class ConnectorMap { */ @Deprecated public ComponentConnector[] getComponentConnectors() { - ArrayList<ComponentConnector> result = new ArrayList<>(); + List<ComponentConnector> result = new ArrayList<>(); JsArrayObject<ServerConnector> connectors = getConnectorsAsJsArray(); int size = connectors.size(); @@ -255,7 +256,7 @@ public class ConnectorMap { @Deprecated public Collection<? extends ServerConnector> getConnectors() { Collection<ComponentDetail> values = idToComponentDetail.values(); - ArrayList<ServerConnector> arrayList = new ArrayList<>(values.size()); + List<ServerConnector> arrayList = new ArrayList<>(values.size()); for (ComponentDetail componentDetail : values) { arrayList.add(componentDetail.getConnector()); } diff --git a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java index 05449f1126..842526f65a 100644 --- a/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java +++ b/client/src/main/java/com/vaadin/client/JavaScriptConnectorHelper.java @@ -154,7 +154,7 @@ public class JavaScriptConnectorHelper { } protected boolean initJavaScript() { - ArrayList<String> initFunctionNames = getPotentialInitFunctionNames(); + List<String> initFunctionNames = getPotentialInitFunctionNames(); for (String initFunctionName : initFunctionNames) { if (tryInitJs(initFunctionName, getConnectorWrapper())) { getLogger().info("JavaScript connector initialized using " @@ -488,10 +488,10 @@ public class JavaScriptConnectorHelper { return initFunctionName; } - private ArrayList<String> getPotentialInitFunctionNames() { + private List<String> getPotentialInitFunctionNames() { ApplicationConfiguration conf = connector.getConnection() .getConfiguration(); - ArrayList<String> initFunctionNames = new ArrayList<String>(); + List<String> initFunctionNames = new ArrayList<String>(); Integer tag = Integer.valueOf(connector.getTag()); while (tag != null) { String initFunctionName = conf.getServerSideClassNameForTag(tag); diff --git a/client/src/main/java/com/vaadin/client/LayoutManager.java b/client/src/main/java/com/vaadin/client/LayoutManager.java index b679fe980e..117154f9de 100644 --- a/client/src/main/java/com/vaadin/client/LayoutManager.java +++ b/client/src/main/java/com/vaadin/client/LayoutManager.java @@ -621,7 +621,7 @@ public class LayoutManager { int pendingOverflowCount = pendingOverflowConnectorsIds.length(); ConnectorMap connectorMap = ConnectorMap.get(connection); if (pendingOverflowCount > 0) { - HashMap<Element, String> originalOverflows = new HashMap<>(); + Map<Element, String> originalOverflows = new HashMap<>(); FastStringSet delayedOverflowFixes = FastStringSet.create(); @@ -1646,8 +1646,9 @@ 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); diff --git a/client/src/main/java/com/vaadin/client/Profiler.java b/client/src/main/java/com/vaadin/client/Profiler.java index 5ab6b8a64d..caab0bccdc 100644 --- a/client/src/main/java/com/vaadin/client/Profiler.java +++ b/client/src/main/java/com/vaadin/client/Profiler.java @@ -537,7 +537,7 @@ public class Profiler { Map<String, Node> totals = new HashMap<>(); rootNode.sumUpTotals(totals); - ArrayList<Node> totalList = new ArrayList<>(totals.values()); + List<Node> totalList = new ArrayList<>(totals.values()); Collections.sort(totalList, new Comparator<Node>() { @Override public int compare(Node o1, Node o2) { @@ -569,14 +569,14 @@ public class Profiler { if (isEnabled()) { double now = Duration.currentTimeMillis(); - String[] keys = { "navigationStart", - "unloadEventStart", "unloadEventEnd", "redirectStart", - "redirectEnd", "fetchStart", "domainLookupStart", - "domainLookupEnd", "connectStart", "connectEnd", - "requestStart", "responseStart", "responseEnd", - "domLoading", "domInteractive", - "domContentLoadedEventStart", "domContentLoadedEventEnd", - "domComplete", "loadEventStart", "loadEventEnd" }; + String[] keys = { "navigationStart", "unloadEventStart", + "unloadEventEnd", "redirectStart", "redirectEnd", + "fetchStart", "domainLookupStart", "domainLookupEnd", + "connectStart", "connectEnd", "requestStart", + "responseStart", "responseEnd", "domLoading", + "domInteractive", "domContentLoadedEventStart", + "domContentLoadedEventEnd", "domComplete", "loadEventStart", + "loadEventEnd" }; LinkedHashMap<String, Double> timings = new LinkedHashMap<>(); diff --git a/client/src/main/java/com/vaadin/client/Util.java b/client/src/main/java/com/vaadin/client/Util.java index b849d0c0b3..bad1ac1ce2 100644 --- a/client/src/main/java/com/vaadin/client/Util.java +++ b/client/src/main/java/com/vaadin/client/Util.java @@ -727,7 +727,7 @@ public class Util { } private static void printConnectorInvocations( - ArrayList<MethodInvocation> invocations, String id, + List<MethodInvocation> invocations, String id, ApplicationConnection c) { ServerConnector connector = ConnectorMap.get(c).getConnector(id); if (connector != null) { @@ -777,7 +777,7 @@ public class Util { try { getLogger().info("RPC invocations to be sent to the server:"); String curId = null; - ArrayList<MethodInvocation> invocations = new ArrayList<>(); + List<MethodInvocation> invocations = new ArrayList<>(); for (MethodInvocation methodInvocation : methodInvocations) { String id = methodInvocation.getConnectorId(); diff --git a/client/src/main/java/com/vaadin/client/WidgetMap.java b/client/src/main/java/com/vaadin/client/WidgetMap.java index 5a2fb06a69..71c41b4738 100644 --- a/client/src/main/java/com/vaadin/client/WidgetMap.java +++ b/client/src/main/java/com/vaadin/client/WidgetMap.java @@ -16,6 +16,7 @@ package com.vaadin.client; import java.util.HashMap; +import java.util.Map; /** * Abstract class mapping between {@link ComponentConnector} instances and their @@ -26,7 +27,7 @@ import java.util.HashMap; */ abstract class WidgetMap { - protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<>(); + protected static Map<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<>(); /** * Create a new instance of a connector based on its type. 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 77e1ee0a09..b650702c08 100644 --- a/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java +++ b/client/src/main/java/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java @@ -557,7 +557,7 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy { private List<ComponentConnector> collectPotentialMatches( ComponentConnector parent, String pathFragment, boolean collectRecursively) { - ArrayList<ComponentConnector> potentialMatches = new ArrayList<>(); + List<ComponentConnector> potentialMatches = new ArrayList<>(); String widgetName = getWidgetName(pathFragment); // Special case when searching for UIElement. if (LocatorUtil.isUIElement(pathFragment)) { 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 3191be2ed1..dd14d98916 100644 --- a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java @@ -17,6 +17,7 @@ package com.vaadin.client.connectors; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.JavaScriptObject; @@ -65,7 +66,7 @@ public class JavaScriptRendererConnector private static native JavaScriptObject createCellReferenceWrapper() /*-{ var reference = {}; - + var setProperty = function(name, getter, setter) { var descriptor = { get: getter @@ -75,25 +76,25 @@ public class JavaScriptRendererConnector } Object.defineProperty(reference, name, descriptor); }; - + setProperty("element", function() { return reference.target.@CellReference::getElement()(); }, null); - + setProperty("rowIndex", function() { return reference.target.@CellReference::getRowIndex()(); }, null); - + setProperty("columnIndex", function() { return reference.target.@CellReference::getColumnIndex()(); }, null); - + setProperty("colSpan", function() { return reference.target.@RendererCellReference::getColSpan()(); }, function(colSpan) { reference.target.@RendererCellReference::setColSpan(*)(colSpan); }); - + return reference; }-*/; @@ -232,7 +233,7 @@ public class JavaScriptRendererConnector JsArrayString events = getConsumedEvents( helper.getConnectorWrapper()); - ArrayList<String> list = new ArrayList<>(events.length()); + List<String> list = new ArrayList<>(events.length()); for (int i = 0; i < events.length(); i++) { list.add(events.get(i)); } diff --git a/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java b/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java index f7669c53ca..2a03a37e18 100644 --- a/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/data/DataCommunicatorConnector.java @@ -18,6 +18,7 @@ package com.vaadin.client.connectors.data; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import com.vaadin.client.ServerConnector; @@ -63,7 +64,7 @@ public class DataCommunicatorConnector extends AbstractExtensionConnector { @Override public void setData(int firstIndex, JsonArray data) { - ArrayList<JsonObject> rows = new ArrayList<>( + List<JsonObject> rows = new ArrayList<>( data.length()); for (int i = 0; i < data.length(); i++) { JsonObject rowObject = data.getObject(i); 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 ce1acef641..20de99cef0 100644 --- a/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java +++ b/client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java @@ -181,8 +181,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { private Range cached = Range.between(0, 0); - private final HashMap<Integer, T> indexToRowMap = new HashMap<>(); - private final HashMap<Object, Integer> keyToIndexMap = new HashMap<>(); + private final Map<Integer, T> indexToRowMap = new HashMap<>(); + private final Map<Object, Integer> keyToIndexMap = new HashMap<>(); /** * Map used to temporarily store rows invalidated by 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 274255554b..3e443a54cb 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 @@ -17,6 +17,7 @@ package com.vaadin.client.debug.internal; import java.util.ArrayList; import java.util.Date; +import java.util.List; import com.google.gwt.core.client.Duration; import com.google.gwt.core.client.Scheduler; @@ -133,7 +134,7 @@ public final class VDebugWindow extends VOverlay { protected SimplePanel content = new SimplePanel(); // sections - protected ArrayList<Section> sections = new ArrayList<>(); + protected List<Section> sections = new ArrayList<>(); // handles resize/move protected HandlerRegistration mouseDownHandler = null; @@ -786,8 +787,7 @@ public final class VDebugWindow extends VOverlay { protected class Menu extends VOverlay { FlowPanel content = new FlowPanel(); - DebugButton[] sizes = { - new DebugButton(null, "Small", "A"), + DebugButton[] sizes = { new DebugButton(null, "Small", "A"), new DebugButton(null, "Medium", "A"), new DebugButton(null, "Large", "A") }; 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 7c515e2c7c..b4b21ea9e5 100644 --- a/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/main/java/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -248,7 +248,7 @@ public abstract class ConnectorBundleLoader { * @since 8.0.3 */ public List<String> getLoadedBundles() { - ArrayList<String> bundles = new ArrayList<>(); + List<String> bundles = new ArrayList<>(); JsArrayString keys = asyncBlockLoaders.getKeys(); for (int i = 0; i < keys.length(); i++) { 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 1c85c752cf..a85ed4516e 100644 --- a/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java +++ b/client/src/main/java/com/vaadin/client/metadata/TypeDataStore.java @@ -17,6 +17,7 @@ package com.vaadin.client.metadata; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JsArrayString; @@ -260,7 +261,7 @@ public class TypeDataStore { throws NoDataException { JsArrayObject<Property> propertiesArray = getPropertiesAsArray(type); int size = propertiesArray.size(); - ArrayList<Property> properties = new ArrayList<>(size); + List<Property> properties = new ArrayList<>(size); for (int i = 0; i < size; i++) { properties.add(propertiesArray.get(i)); } 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 99696ef2aa..9ec6c0ee2f 100644 --- a/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java @@ -15,7 +15,7 @@ */ package com.vaadin.client.ui; -import java.util.ArrayList; +import java.util.List; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; @@ -170,7 +170,7 @@ public class FocusableScrollPanel extends SimpleFocusablePanel public void setScrollPosition(int position) { if (BrowserInfo.get().isAndroidWithBrokenScrollTop() && BrowserInfo.get().requiresTouchScrollDelegate()) { - ArrayList<com.google.gwt.dom.client.Element> elements = TouchScrollDelegate + List<com.google.gwt.dom.client.Element> elements = TouchScrollDelegate .getElements(getElement()); for (com.google.gwt.dom.client.Element el : elements) { final Style style = el.getStyle(); diff --git a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java index 703df0b96d..9679473c80 100644 --- a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java +++ b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Element; @@ -58,7 +59,7 @@ public class ShortcutActionHandler { ShortcutActionHandler getShortcutActionHandler(); } - private final ArrayList<ShortcutAction> actions = new ArrayList<>(); + private final List<ShortcutAction> actions = new ArrayList<>(); private ApplicationConnection client; private String paintableId; 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 e5eb99ad2d..af8f918a4a 100644 --- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java +++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import com.google.gwt.animation.client.Animation; import com.google.gwt.core.client.Duration; @@ -94,7 +95,7 @@ public class TouchScrollDelegate implements NativePreviewHandler { private int deltaScrollPos; private boolean transitionOn = false; private int finalScrollTop; - private ArrayList<Element> layers; + private List<Element> layers; private boolean moved; private ScrollHandler scrollHandler; 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 88c84ad5bb..82a08a4f12 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VCustomLayout.java @@ -17,6 +17,7 @@ package com.vaadin.client.ui; import java.util.HashMap; +import java.util.Map; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.ImageElement; @@ -49,13 +50,13 @@ public class VCustomLayout extends ComplexPanel { public static final String CLASSNAME = "v-customlayout"; /** Location-name to containing element in DOM map */ - private final HashMap<String, Element> locationToElement = new HashMap<>(); + private final Map<String, Element> locationToElement = new HashMap<>(); /** Location-name to contained widget map */ - final HashMap<String, Widget> locationToWidget = new HashMap<>(); + final Map<String, Widget> locationToWidget = new HashMap<>(); /** Widget to captionwrapper map */ - private final HashMap<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<>(); + private final Map<Widget, VCaptionWrapper> childWidgetToCaptionWrapper = new HashMap<>(); /** * Unexecuted scripts loaded from the template. @@ -420,7 +421,8 @@ public class VCustomLayout extends ComplexPanel { * <p> * For internal use only. May be removed or replaced in the future. * - * @param el The first element of the layout + * @param el + * The first element of the layout * @return true if layout function exists and was run successfully, else * false. */ 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 5704dc497d..58ea0c6abb 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VFormLayout.java @@ -19,6 +19,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import com.google.gwt.aria.client.Roles; import com.google.gwt.dom.client.Element; @@ -90,8 +91,8 @@ public class VFormLayout extends SimplePanel { private static final int COLUMN_ERRORFLAG = 1; public static final int COLUMN_WIDGET = 2; - private HashMap<Widget, Caption> widgetToCaption = new HashMap<>(); - private HashMap<Widget, ErrorFlag> widgetToError = new HashMap<>(); + private Map<Widget, Caption> widgetToCaption = new HashMap<>(); + private Map<Widget, ErrorFlag> widgetToError = new HashMap<>(); public VFormLayoutTable() { DOM.setElementProperty(getElement(), "cellPadding", "0"); 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 c8c6cce0f3..16ae5b46ed 100644 --- a/client/src/main/java/com/vaadin/client/ui/VGridLayout.java +++ b/client/src/main/java/com/vaadin/client/ui/VGridLayout.java @@ -19,6 +19,7 @@ package com.vaadin.client.ui; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import com.google.gwt.dom.client.DivElement; @@ -52,7 +53,7 @@ public class VGridLayout extends ComplexPanel { public ApplicationConnection client; /** For internal use only. May be removed or replaced in the future. */ - public HashMap<Widget, Cell> widgetToCell = new HashMap<>(); + public Map<Widget, Cell> widgetToCell = new HashMap<>(); /** For internal use only. May be removed or replaced in the future. */ public int[] columnWidths; 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 63e0f687b1..f357a6049e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java @@ -96,7 +96,7 @@ public class VMenuBar extends SimpleFocusablePanel /** Widget fields **/ protected boolean subMenu; - protected ArrayList<CustomMenuItem> items; + protected List<CustomMenuItem> items; protected Element containerElement; protected VOverlay popup; protected VMenuBar visibleChildMenu; @@ -176,7 +176,8 @@ public class VMenuBar extends SimpleFocusablePanel protected void updateStyleNames() { String primaryStyleName = getParentMenu() != null - ? getParentMenu().getStylePrimaryName() : getStylePrimaryName(); + ? getParentMenu().getStylePrimaryName() + : getStylePrimaryName(); // Reset the style name for all the items for (CustomMenuItem item : items) { @@ -583,7 +584,8 @@ public class VMenuBar extends SimpleFocusablePanel * prefix if needed */ String primaryStyleName = parentMenu != null - ? parentMenu.getStylePrimaryName() : getStylePrimaryName(); + ? parentMenu.getStylePrimaryName() + : getStylePrimaryName(); if (subMenu) { primaryStyleName = primaryStyleName .replace(SUBMENU_CLASSNAME_PREFIX, ""); diff --git a/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java b/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java index 2da458c7e9..f4c18dd865 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java +++ b/client/src/main/java/com/vaadin/client/ui/VTabsheetBase.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import com.google.gwt.user.client.DOM; @@ -35,7 +36,7 @@ public abstract class VTabsheetBase extends ComplexPanel implements HasEnabled { protected ApplicationConnection client; /** For internal use only. May be removed or replaced in the future. */ - protected final ArrayList<String> tabKeys = new ArrayList<>(); + protected final List<String> tabKeys = new ArrayList<>(); /** For internal use only. May be removed or replaced in the future. */ protected Set<String> disabledTabKeys = new HashSet<>(); 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 9e4aad0d2c..333050c9d9 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -80,7 +80,7 @@ import com.vaadin.shared.ui.window.WindowRole; public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, ScrollHandler, KeyDownHandler, FocusHandler, BlurHandler, Focusable { - private static ArrayList<VWindow> windowOrder = new ArrayList<>(); + private static List<VWindow> windowOrder = new ArrayList<>(); private static HandlerManager WINDOW_ORDER_HANDLER = new HandlerManager( VWindow.class); @@ -307,7 +307,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } private void doFireOrderEvent() { - ArrayList<VWindow> list = new ArrayList<>(); + List<VWindow> list = new ArrayList<>(); list.add(this); fireOrderEvent(list); } @@ -701,7 +701,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, // hanging. windowOrder.remove(curIndex); // Update the z-indices of any remaining windows - ArrayList<VWindow> update = new ArrayList<>( + List<VWindow> update = new ArrayList<>( windowOrder.size() - curIndex + 1); update.add(this); while (curIndex < windowOrder.size()) { 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 b2127c5b94..1db1848f56 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 @@ -55,7 +55,7 @@ public class VDragEvent { private int id; - private HashMap<String, Object> dropDetails = new HashMap<>(); + private Map<String, Object> dropDetails = new HashMap<>(); private Element elementOver; 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 f33b71841d..24e239ca0d 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 @@ -17,6 +17,7 @@ package com.vaadin.client.ui.layout; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.logging.Logger; import com.google.gwt.core.client.JsArrayString; @@ -703,7 +704,7 @@ public class LayoutDependencyTree { public Collection<ComponentConnector> getMeasureTargets() { JsArrayString targetIds = getMeasureTargetsJsArray(); int length = targetIds.length(); - ArrayList<ComponentConnector> targets = new ArrayList<>(length); + List<ComponentConnector> targets = new ArrayList<>(length); ConnectorMap connectorMap = ConnectorMap.get(connection); for (int i = 0; i < length; i++) { 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 696ce2896d..099cf15489 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 @@ -74,7 +74,7 @@ public class MenuBar extends Widget implements PopupListener { private final Element table; private final Element outer; - private final ArrayList<MenuItem> items = new ArrayList<>(); + private final List<MenuItem> items = new ArrayList<>(); private MenuBar parentMenu; private PopupPanel popup; private MenuItem selectedItem; 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 5d49c6cbce..0176da6a4e 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 @@ -17,6 +17,7 @@ package com.vaadin.client.ui.tabsheet; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ComponentConnector; @@ -56,7 +57,7 @@ public abstract class TabsheetBaseConnector getWidget().setEnabled(isEnabled()); // Widgets in the TabSheet before update - ArrayList<Widget> oldWidgets = new ArrayList<>(); + List<Widget> oldWidgets = new ArrayList<>(); for (Iterator<Widget> iterator = getWidget() .getWidgetIterator(); iterator.hasNext();) { oldWidgets.add(iterator.next()); 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 c808ea6c9d..749d72b575 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 @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.logging.Logger; import com.google.gwt.core.client.Scheduler; @@ -137,7 +138,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector @Override public void onWindowOrderChange(WindowOrderEvent event) { VWindow[] windows = event.getWindows(); - HashMap<Integer, Connector> orders = new HashMap<>(); + Map<Integer, Connector> orders = new HashMap<>(); boolean hasEventListener = hasEventListener(EventId.WINDOW_ORDER); for (VWindow window : windows) { Connector connector = Util.findConnectorFor(window); @@ -406,8 +407,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } else if (toBeFocused instanceof Focusable) { ((Focusable) toBeFocused).focus(); } else { - getLogger() - .severe("Server is trying to set focus to the widget of connector " + getLogger().severe( + "Server is trying to set focus to the widget of connector " + Util.getConnectorString(connector) + " but it is not focusable. The widget should implement either " + com.google.gwt.user.client.ui.Focusable.class @@ -671,7 +672,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector * @return */ public List<WindowConnector> getSubWindows() { - ArrayList<WindowConnector> windows = new ArrayList<>(); + List<WindowConnector> windows = new ArrayList<>(); for (ComponentConnector child : getChildComponents()) { if (child instanceof WindowConnector) { windows.add((WindowConnector) child); @@ -1218,8 +1219,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector return window1.getWindowOrder() > window2.getWindowOrder() ? 1 : -1; } - ArrayList<VWindow> getWindows() { - ArrayList<VWindow> result = new ArrayList<>(); + List<VWindow> getWindows() { + List<VWindow> result = new ArrayList<>(); result.addAll(windows); Collections.sort(result, this); return result; 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 e93fe1d3a8..996741ddc5 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 @@ -30,13 +30,14 @@ import com.google.gwt.dom.client.TableRowElement; * * @since 7.4 * @author Vaadin Ltd - * @see com.vaadin.client.widgets.Escalator.AbstractRowContainer#refreshRow(TableRowElement, int) + * @see com.vaadin.client.widgets.Escalator.AbstractRowContainer#refreshRow(TableRowElement, + * int) */ public class FlyweightRow implements Row { static class CellIterator implements Iterator<FlyweightCell> { /** A defensive copy of the cells in the current row. */ - private final ArrayList<FlyweightCell> cells; + private final List<FlyweightCell> cells; private final boolean cellsAttached; private int cursor = 0; private int skipNext = 0; 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 ee432e0892..81c1ec86b3 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -1740,8 +1740,8 @@ public class Escalator extends Widget * @since 7.5.0 * * @param tr - * the row element to check whether it, - * or any of its its descendants can be frozen + * the row element to check whether it, or any of its its + * descendants can be frozen * @return <code>true</code> if the given element, or any of its * descendants, can be frozen */ @@ -3882,8 +3882,8 @@ public class Escalator extends Widget insertFirst = true; } else if (insertFirst) { // remove row explicitly to work around an IE11 bug (#9850) - if (BrowserInfo.get().isIE11() && tr - .equals(root.getFirstChildElement())) { + if (BrowserInfo.get().isIE11() + && tr.equals(root.getFirstChildElement())) { root.removeChild(tr); } root.insertFirst(tr); @@ -4553,11 +4553,11 @@ public class Escalator extends Widget } 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); @@ -5054,7 +5054,7 @@ public class Escalator extends Widget public Collection<SpacerImpl> getSpacersAfterPx(final double px, final SpacerInclusionStrategy strategy) { - ArrayList<SpacerImpl> spacers = new ArrayList<>( + List<SpacerImpl> spacers = new ArrayList<>( rowIndexToSpacer.values()); for (int i = 0; i < spacers.size(); i++) { @@ -6511,7 +6511,8 @@ public class Escalator extends Widget double footerHeight = footer.getHeightOfSection(); double bodyHeight = body.getDefaultRowHeight() * heightByRows; double scrollbar = horizontalScrollbar.showsScrollHandle() - ? horizontalScrollbar.getScrollbarThickness() : 0; + ? horizontalScrollbar.getScrollbarThickness() + : 0; double spacerHeight = 0; // ignored if HeightMode.ROW if (heightMode == HeightMode.UNDEFINED) { spacerHeight = body.spacerContainer.getSpacerHeightsSum(); 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 81b050b63d..8198e34544 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -1630,8 +1630,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } } }); - grid.scrollToRow(rowIndex, isBuffered() - ? ScrollDestination.MIDDLE : ScrollDestination.ANY); + grid.scrollToRow(rowIndex, + isBuffered() ? ScrollDestination.MIDDLE + : ScrollDestination.ANY); } } @@ -4041,7 +4042,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private final class ColumnHider { /** Map from columns to their hiding toggles, component might change */ - private HashMap<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<>(); + private Map<Column<?, T>, MenuItem> columnToHidingToggleMap = new HashMap<>(); /** * When column is being hidden with a toggle, do not refresh toggles for @@ -4375,10 +4376,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, && dropMarkerLeft <= escalator.getInnerWidth()) { dropMarkerLeft = rightBoundaryForDrag - dropMarkerWidthOffset; } else if ( - // Check if the drop marker shouldn't be shown at all - dropMarkerLeft < frozenColumnsWidth - || dropMarkerLeft > Math.min(rightBoundaryForDrag, - escalator.getInnerWidth()) + // Check if the drop marker shouldn't be shown at all + dropMarkerLeft < frozenColumnsWidth || dropMarkerLeft > Math + .min(rightBoundaryForDrag, escalator.getInnerWidth()) || dropMarkerLeft < 0) { dropMarkerLeft = -10000000; } @@ -4533,7 +4533,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (focusedColumnIndex == draggedColumnIndex) { // move with the dragged column int adjustedDropIndex = latestColumnDropIndex > draggedColumnIndex - ? latestColumnDropIndex - 1 : latestColumnDropIndex; + ? latestColumnDropIndex - 1 + : latestColumnDropIndex; // remove hidden columns from indexing adjustedDropIndex = getVisibleColumns() .indexOf(getColumn(adjustedDropIndex)); @@ -6033,7 +6034,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, if (sortIndex > -1 && Grid.this.getSortOrder().size() > 1) { // Show sort order indicator if column is // sorted and other sorted columns also exists. - cellElement.setAttribute("sort-order", String.valueOf(sortIndex + 1)); + cellElement.setAttribute("sort-order", + String.valueOf(sortIndex + 1)); cellElement.setAttribute("aria-sort", "other"); } @@ -6624,7 +6626,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * @return A unmodifiable list of the currently visible columns in the grid */ public List<Column<?, T>> getVisibleColumns() { - ArrayList<Column<?, T>> visible = new ArrayList<>(); + List<Column<?, T>> visible = new ArrayList<>(); for (Column<?, T> c : columns) { if (!c.isHidden()) { visible.add(c); |