diff options
author | Per-Åke Minborg <minborg@speedment.com> | 2016-10-28 10:24:51 -0700 |
---|---|---|
committer | Denis Anisimov <denis@vaadin.com> | 2016-11-09 15:32:57 +0200 |
commit | 0f42869ce1f81270141e94f169f1447febaff446 (patch) | |
tree | ca6ea02cdd637cc533572a19312041d8804c1525 /server/src/main/java/com/vaadin/ui | |
parent | b85f6e4bdc49d9ea8693239fa15d1f2f239f85cf (diff) | |
download | vaadin-framework-0f42869ce1f81270141e94f169f1447febaff446.tar.gz vaadin-framework-0f42869ce1f81270141e94f169f1447febaff446.zip |
Use final modifier where appropriate
Change-Id: I80b73b653e97904605dc62484a7448f3bfbf7226
Diffstat (limited to 'server/src/main/java/com/vaadin/ui')
25 files changed, 49 insertions, 50 deletions
diff --git a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java index e968568a09..49d020d32f 100644 --- a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java @@ -55,12 +55,11 @@ public class AbsoluteLayout extends AbstractLayout private static final String ATTR_Z_INDEX = ":z-index"; private final AbsoluteLayoutServerRpc rpc = (MouseEventDetails mouseDetails, - Connector clickedConnector) -> { - fireEvent(LayoutClickEvent.createEvent(AbsoluteLayout.this, - mouseDetails, clickedConnector)); - }; + Connector clickedConnector) -> fireEvent( + LayoutClickEvent.createEvent(AbsoluteLayout.this, + mouseDetails, clickedConnector)); // Maps each component to a position - private LinkedHashMap<Component, ComponentPosition> componentToCoordinates = new LinkedHashMap<>(); + private final LinkedHashMap<Component, ComponentPosition> componentToCoordinates = new LinkedHashMap<>(); /** * Creates an AbsoluteLayout with full size. diff --git a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java index 7f79cecf55..7a40798815 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java +++ b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java @@ -75,7 +75,7 @@ public abstract class AbstractColorPicker extends AbstractField<Color> { /** A simple popup with only the swatches (palette) tab. */ POPUP_SIMPLE("simple"); - private String style; + private final String style; PopupStyle(String styleName) { style = styleName; diff --git a/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java index 580754be01..8e70e9cb03 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -149,7 +149,7 @@ import elemental.json.JsonValue; * @since 7.0.0 */ public abstract class AbstractJavaScriptComponent extends AbstractComponent { - private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( + private final JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( this); @Override diff --git a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java index 6c995611fb..6858a18999 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java @@ -45,10 +45,10 @@ public abstract class AbstractOrderedLayout extends AbstractLayout LayoutClickNotifier, Layout.MarginHandler { private final AbstractOrderedLayoutServerRpc rpc = ( - MouseEventDetails mouseDetails, Connector clickedConnector) -> { - fireEvent(LayoutClickEvent.createEvent(AbstractOrderedLayout.this, - mouseDetails, clickedConnector)); - }; + MouseEventDetails mouseDetails, + Connector clickedConnector) -> fireEvent( + LayoutClickEvent.createEvent(AbstractOrderedLayout.this, + mouseDetails, clickedConnector)); public static final Alignment ALIGNMENT_DEFAULT = Alignment.TOP_LEFT; diff --git a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java index 73bedc8470..e7a66cebe5 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java @@ -54,7 +54,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { private Unit posMinUnit; private Unit posMaxUnit; - private AbstractSplitPanelRpc rpc = new AbstractSplitPanelRpc() { + private final AbstractSplitPanelRpc rpc = new AbstractSplitPanelRpc() { @Override public void splitterClick(MouseEventDetails mouseDetails) { diff --git a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index fd2c0029d1..2ba6f5e895 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -68,8 +68,8 @@ import elemental.json.JsonObject; public class ConnectorTracker implements Serializable { private final HashMap<String, ClientConnector> connectorIdToConnector = new HashMap<>(); - private Set<ClientConnector> dirtyConnectors = new HashSet<>(); - private Set<ClientConnector> uninitializedConnectors = new HashSet<>(); + private final Set<ClientConnector> dirtyConnectors = new HashSet<>(); + private final Set<ClientConnector> uninitializedConnectors = new HashSet<>(); /** * Connectors that have been unregistered and should be cleaned up the next @@ -80,7 +80,7 @@ public class ConnectorTracker implements Serializable { private boolean writingResponse = false; - private UI uI; + private final UI uI; private transient Map<ClientConnector, JsonObject> diffStates = new HashMap<>(); /** Maps connectorIds to a map of named StreamVariables */ @@ -96,7 +96,7 @@ public class ConnectorTracker implements Serializable { * @see #getCurrentSyncId() * @see #cleanConcurrentlyRemovedConnectorIds(long) */ - private TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<>(); + private final TreeMap<Integer, Set<String>> syncIdToUnregisteredConnectorIds = new TreeMap<>(); /** * Gets a logger for this class diff --git a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java index 7f2e558220..4b9a7afbfb 100644 --- a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java @@ -351,7 +351,7 @@ public class DragAndDropWrapper extends CustomComponent final class ProxyReceiver implements StreamVariable { - private String id; + private final String id; private Html5File file; public ProxyReceiver(String id, Html5File file) { @@ -425,7 +425,7 @@ public class DragAndDropWrapper extends CustomComponent class ReceivingEventWrapper implements StreamingErrorEvent, StreamingEndEvent, StreamingStartEvent, StreamingProgressEvent { - private StreamingEvent wrappedEvent; + private final StreamingEvent wrappedEvent; ReceivingEventWrapper(StreamingEvent e) { wrappedEvent = e; diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index b738b71323..63c8fe3e6f 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -650,8 +650,8 @@ public class Grid<T> extends AbstractSingleSelect<T> implements HasComponents { */ public static class DetailsManager<T> extends AbstractGridExtension<T> { - private Set<T> visibleDetails = new HashSet<>(); - private Map<T, Component> components = new HashMap<>(); + private final Set<T> visibleDetails = new HashSet<>(); + private final Map<T, Component> components = new HashMap<>(); private DetailsGenerator<T> generator; /** @@ -1821,17 +1821,17 @@ public class Grid<T> extends AbstractSingleSelect<T> implements HasComponents { } }; - private Set<Column<T, ?>> columnSet = new LinkedHashSet<>(); - private Map<String, Column<T, ?>> columnKeys = new HashMap<>(); + private final Set<Column<T, ?>> columnSet = new LinkedHashSet<>(); + private final Map<String, Column<T, ?>> columnKeys = new HashMap<>(); - private List<SortOrder<Column<T, ?>>> sortOrder = new ArrayList<>(); - private DetailsManager<T> detailsManager; - private Set<Component> extensionComponents = new HashSet<>(); + private final List<SortOrder<Column<T, ?>>> sortOrder = new ArrayList<>(); + private final DetailsManager<T> detailsManager; + private final Set<Component> extensionComponents = new HashSet<>(); private StyleGenerator<T> styleGenerator = item -> null; private DescriptionGenerator<T> descriptionGenerator; - private Header header = new HeaderImpl(); - private Footer footer = new FooterImpl(); + private final Header header = new HeaderImpl(); + private final Footer footer = new FooterImpl(); private int counter = 0; diff --git a/server/src/main/java/com/vaadin/ui/Html5File.java b/server/src/main/java/com/vaadin/ui/Html5File.java index b3fcdb826f..b4434e75c9 100644 --- a/server/src/main/java/com/vaadin/ui/Html5File.java +++ b/server/src/main/java/com/vaadin/ui/Html5File.java @@ -27,10 +27,10 @@ import com.vaadin.server.StreamVariable; */ public class Html5File implements Serializable { - private String name; - private long size; + private final String name; + private final long size; private StreamVariable streamVariable; - private String type; + private final String type; Html5File(String name, long size, String mimeType) { this.name = name; diff --git a/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java b/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java index 32b9356d76..bd56036aee 100644 --- a/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java @@ -83,7 +83,7 @@ public interface LoadingIndicatorConfiguration extends Serializable { class LoadingIndicatorConfigurationImpl implements LoadingIndicatorConfiguration { - private UI ui; + private final UI ui; public LoadingIndicatorConfigurationImpl(UI ui) { this.ui = ui; diff --git a/server/src/main/java/com/vaadin/ui/LoginForm.java b/server/src/main/java/com/vaadin/ui/LoginForm.java index 74432d001a..9acd0735b1 100644 --- a/server/src/main/java/com/vaadin/ui/LoginForm.java +++ b/server/src/main/java/com/vaadin/ui/LoginForm.java @@ -62,7 +62,7 @@ public class LoginForm extends AbstractSingleComponentContainer { */ public static class LoginEvent extends Component.Event { - private Map<String, String> params; + private final Map<String, String> params; /** * Creates a login event using the given source and the given diff --git a/server/src/main/java/com/vaadin/ui/Notification.java b/server/src/main/java/com/vaadin/ui/Notification.java index 536598448b..7ee78fb807 100644 --- a/server/src/main/java/com/vaadin/ui/Notification.java +++ b/server/src/main/java/com/vaadin/ui/Notification.java @@ -70,7 +70,7 @@ public class Notification implements Serializable { */ ASSISTIVE_NOTIFICATION("assistive"); - private String style; + private final String style; Type(String style) { this.style = style; diff --git a/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java b/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java index f7591af13c..0062bb969f 100644 --- a/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java @@ -118,7 +118,7 @@ public interface NotificationConfiguration extends Serializable { class NotificationConfigurationImpl implements NotificationConfiguration { - private UI ui; + private final UI ui; public NotificationConfigurationImpl(UI ui) { this.ui = ui; diff --git a/server/src/main/java/com/vaadin/ui/PushConfiguration.java b/server/src/main/java/com/vaadin/ui/PushConfiguration.java index cad96a5952..bb722ec2d2 100644 --- a/server/src/main/java/com/vaadin/ui/PushConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/PushConfiguration.java @@ -165,7 +165,7 @@ public interface PushConfiguration extends Serializable { } class PushConfigurationImpl implements PushConfiguration { - private UI ui; + private final UI ui; public PushConfigurationImpl(UI ui) { this.ui = ui; diff --git a/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java b/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java index d4df9fdf28..8a36de3510 100644 --- a/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java @@ -132,7 +132,7 @@ public interface ReconnectDialogConfiguration extends Serializable { } class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration { - private UI ui; + private final UI ui; public ReconnectDialogConfigurationImpl(UI ui) { this.ui = ui; diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index 5623166357..7ad40c2771 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -1101,7 +1101,7 @@ public class TabSheet extends AbstractComponentContainer */ public class TabSheetTabImpl implements Tab { - private TabState tabState; + private final TabState tabState; private Focusable defaultFocus; diff --git a/server/src/main/java/com/vaadin/ui/TooltipConfiguration.java b/server/src/main/java/com/vaadin/ui/TooltipConfiguration.java index b5af10961b..1bf9fd7b81 100644 --- a/server/src/main/java/com/vaadin/ui/TooltipConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/TooltipConfiguration.java @@ -123,7 +123,7 @@ public interface TooltipConfiguration extends Serializable { } class TooltipConfigurationImpl implements TooltipConfiguration { - private UI ui; + private final UI ui; public TooltipConfigurationImpl(UI ui) { this.ui = ui; diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java index a32378aeaf..ae1c304fd2 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java @@ -40,7 +40,7 @@ public class ColorPickerHistory extends CustomField<Color> { private static final int COLUMNS = 15; /** Temporary color history for when the component is detached. */ - private ArrayBlockingQueue<Color> tempHistory = new ArrayBlockingQueue<>( + private final ArrayBlockingQueue<Color> tempHistory = new ArrayBlockingQueue<>( ROWS * COLUMNS); @Override diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java index 20d68da0fa..ec200082ab 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java @@ -38,7 +38,7 @@ public class ColorPickerSelect extends CustomField<Color> { ALL("All colors"), RED("Red colors"), GREEN("Green colors"), BLUE( "Blue colors"); - private String caption; + private final String caption; ColorRange(String caption) { this.caption = caption; diff --git a/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java b/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java index eb02be2bbc..678ab2a935 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java @@ -150,8 +150,8 @@ public abstract class StaticSection<ROW extends StaticSection.StaticRow<?>> */ abstract static class StaticCell implements Serializable { - private CellState cellState = new CellState(); - private StaticRow<?> row; + private final CellState cellState = new CellState(); + private final StaticRow<?> row; protected StaticCell(StaticRow<?> row) { this.row = row; diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index 00fb32392c..5b0968bae6 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -430,7 +430,7 @@ public class DesignAttributeHandler implements Serializable { * @author Vaadin Ltd */ private static class AttributeCacheEntry implements Serializable { - private Map<String, Method[]> accessMethods = new ConcurrentHashMap<>(); + private final Map<String, Method[]> accessMethods = new ConcurrentHashMap<>(); private void addAttribute(String attribute, Method getter, Method setter) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java index c8e794c46a..761c7edd04 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java @@ -686,9 +686,9 @@ public class DesignContext implements Serializable { * @author Vaadin Ltd */ public class ComponentCreatedEvent implements Serializable { - private String localId; - private Component component; - private DesignContext context; + private final String localId; + private final Component component; + private final DesignContext context; /** * Creates a new instance of ComponentCreatedEvent diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java index 93ccee3f37..a32c68998f 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java @@ -33,7 +33,7 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; public class DesignEnumConverter<T extends Enum> implements Converter<String, T> { - private Class<T> type; + private final Class<T> type; /** * Creates a converter for the given enum type. diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index ef6e10ef5c..c03d3750d1 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -170,7 +170,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { return ((ExternalResource) value).getURL(); } - private static Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<>(); + private static final Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<>(); static { typeToConverter.put(ExternalResource.class, HTTP); // ^ any of non-specialized would actually work diff --git a/server/src/main/java/com/vaadin/ui/renderers/ClickableRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/ClickableRenderer.java index 3073517b65..8686c391c5 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/ClickableRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/ClickableRenderer.java @@ -70,8 +70,8 @@ public abstract class ClickableRenderer<T, V> extends AbstractRenderer<T, V> { */ public static class RendererClickEvent<T> extends ClickEvent { - private T item; - private Column column; + private final T item; + private final Column column; protected RendererClickEvent(Grid<T> source, T item, Column column, MouseEventDetails mouseEventDetails) { |