summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-26 13:26:20 +0200
committerPekka Maanpää <pekkamaa@vaadin.com>2017-10-26 14:26:20 +0300
commit10bd7544fd22dccd7e8e32cb236eb50f102892d3 (patch)
treed0e6f2241dc2b612a0deeceeb30399e88e47ed6a /client
parent7c8f440781835dbcf72bfbc47ab8be2f669a40e4 (diff)
downloadvaadin-framework-10bd7544fd22dccd7e8e32cb236eb50f102892d3.tar.gz
vaadin-framework-10bd7544fd22dccd7e8e32cb236eb50f102892d3.zip
Improve naming of fields and variables (#10242)
* Variable names to conform to naming convention. * Use static constants where it makes sense
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/ApplicationConnection.java4
-rw-r--r--client/src/main/java/com/vaadin/client/DateTimeService.java3
-rw-r--r--client/src/main/java/com/vaadin/client/LayoutManager.java10
-rw-r--r--client/src/main/java/com/vaadin/client/MeasuredSize.java4
-rw-r--r--client/src/main/java/com/vaadin/client/Profiler.java10
-rw-r--r--client/src/main/java/com/vaadin/client/VTooltip.java9
-rw-r--r--client/src/main/java/com/vaadin/client/WidgetUtil.java12
-rw-r--r--client/src/main/java/com/vaadin/client/communication/JsonDecoder.java30
-rw-r--r--client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java4
-rw-r--r--client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java4
-rw-r--r--client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java6
-rw-r--r--client/src/main/java/com/vaadin/client/event/PointerEventSupport.java8
-rw-r--r--client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java4
-rw-r--r--client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java14
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VAudio.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VMenuBar.java28
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VNotification.java16
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VSlider.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VTabsheet.java11
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VUI.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VWindow.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java6
-rw-r--r--client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java8
-rw-r--r--client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java4
-rw-r--r--client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java4
-rw-r--r--client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java12
-rw-r--r--client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java6
-rwxr-xr-xclient/src/main/java/com/vaadin/client/widgets/Grid.java2
29 files changed, 116 insertions, 113 deletions
diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java
index d9e8f545d2..3cd2590311 100644
--- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java
@@ -481,7 +481,7 @@ public class ApplicationConnection implements HasHandlers {
}
private native void initializeTestbenchHooks(
- ComponentLocator componentLocator, String TTAppId)
+ ComponentLocator componentLocator, String ttAppId)
/*-{
var ap = this;
var client = {};
@@ -527,7 +527,7 @@ public class ApplicationConnection implements HasHandlers {
});
client.initializing = false;
- $wnd.vaadin.clients[TTAppId] = client;
+ $wnd.vaadin.clients[ttAppId] = client;
}-*/;
/**
diff --git a/client/src/main/java/com/vaadin/client/DateTimeService.java b/client/src/main/java/com/vaadin/client/DateTimeService.java
index 3c37c40b34..4883d34caf 100644
--- a/client/src/main/java/com/vaadin/client/DateTimeService.java
+++ b/client/src/main/java/com/vaadin/client/DateTimeService.java
@@ -40,6 +40,8 @@ public class DateTimeService {
private static int[] maxDaysInMonth = { 31, 28, 31, 30, 31, 30, 31, 31, 30,
31, 30, 31 };
+ private static final long MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
+
/**
* Creates a new date time service with the application default locale.
*/
@@ -286,7 +288,6 @@ public class DateTimeService {
* @return The ISO-8601 week number for {@literal date}
*/
public static int getISOWeekNumber(Date date) {
- final long MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
int dayOfWeek = date.getDay(); // 0 == sunday
// ISO 8601 use weeks that start on monday so we use
diff --git a/client/src/main/java/com/vaadin/client/LayoutManager.java b/client/src/main/java/com/vaadin/client/LayoutManager.java
index 117154f9de..5a161e4bc9 100644
--- a/client/src/main/java/com/vaadin/client/LayoutManager.java
+++ b/client/src/main/java/com/vaadin/client/LayoutManager.java
@@ -43,7 +43,7 @@ public class LayoutManager {
private static final String LOOP_ABORT_MESSAGE = "Aborting layout after 100 passes. This would probably be an infinite loop.";
- private static final boolean debugLogging = false;
+ private static final boolean DEBUG_LOGGING = false;
private ApplicationConnection connection;
private final Set<Element> measuredNonConnectorElements = new HashSet<>();
@@ -457,7 +457,7 @@ public class LayoutManager {
}
countLayout(layoutCounts, rr);
}
- if (debugLogging) {
+ if (DEBUG_LOGGING) {
updatedSet.add(layout.getConnectorId());
}
}
@@ -517,7 +517,7 @@ public class LayoutManager {
}
countLayout(layoutCounts, rr);
}
- if (debugLogging) {
+ if (DEBUG_LOGGING) {
updatedSet.add(layout.getConnectorId());
}
}
@@ -525,7 +525,7 @@ public class LayoutManager {
Profiler.leave("LayoutManager handle ManagedLayout");
- if (debugLogging) {
+ if (DEBUG_LOGGING) {
JsArrayString changedCids = updatedSet.dump();
StringBuilder b = new StringBuilder(" ");
@@ -637,7 +637,7 @@ public class LayoutManager {
continue;
}
- if (debugLogging) {
+ if (DEBUG_LOGGING) {
getLogger().info("Doing overflow fix for "
+ Util.getConnectorString(componentConnector)
+ " in " + Util.getConnectorString(
diff --git a/client/src/main/java/com/vaadin/client/MeasuredSize.java b/client/src/main/java/com/vaadin/client/MeasuredSize.java
index 1fcdb9d17a..bf9b64602b 100644
--- a/client/src/main/java/com/vaadin/client/MeasuredSize.java
+++ b/client/src/main/java/com/vaadin/client/MeasuredSize.java
@@ -21,7 +21,7 @@ import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Element;
public class MeasuredSize {
- private static final boolean debugSizeChanges = false;
+ private static final boolean DEBUG_SIZE_CHANGES = false;
public static class MeasureResult {
private final boolean widthChanged;
@@ -278,7 +278,7 @@ public class MeasuredSize {
private void debugSizeChange(Element element, String sizeChangeType,
String changedFrom, String changedTo) {
- if (debugSizeChanges) {
+ if (DEBUG_SIZE_CHANGES) {
getLogger().info(sizeChangeType + " has changed from " + changedFrom
+ " to " + changedTo + " for " + element);
}
diff --git a/client/src/main/java/com/vaadin/client/Profiler.java b/client/src/main/java/com/vaadin/client/Profiler.java
index 1b445ff2e4..e9e75a6922 100644
--- a/client/src/main/java/com/vaadin/client/Profiler.java
+++ b/client/src/main/java/com/vaadin/client/Profiler.java
@@ -47,7 +47,7 @@ public class Profiler {
private static RelativeTimeSupplier RELATIVE_TIME_SUPPLIER;
- private static final String evtGroup = "VaadinProfiler";
+ private static final String EVT_GROUP = "VaadinProfiler";
private static ProfilerResultConsumer consumer;
@@ -290,7 +290,7 @@ public class Profiler {
private native String getEvtGroup()
/*-{
- return this.evtGroup;
+ return this.EVT_GROUP;
}-*/;
private native double getMillis()
@@ -325,7 +325,7 @@ public class Profiler {
public final String getEventName() {
String group = getEvtGroup();
- if (evtGroup.equals(group)) {
+ if (EVT_GROUP.equals(group)) {
return getSubSystem();
} else {
return group + "." + getSubSystem();
@@ -387,7 +387,7 @@ public class Profiler {
private static final native void logGwtEvent(String name, String type)
/*-{
$wnd.__gwtStatsEvent({
- evtGroup: @com.vaadin.client.Profiler::evtGroup,
+ evtGroup: @com.vaadin.client.Profiler::EVT_GROUP,
moduleName: @com.google.gwt.core.client.GWT::getModuleName()(),
millis: (new Date).getTime(),
sessionId: undefined,
@@ -463,7 +463,7 @@ public class Profiler {
Set<Node> extendedTimeNodes = new HashSet<>();
for (int i = 0; i < gwtStatsEvents.length(); i++) {
GwtStatsEvent gwtStatsEvent = gwtStatsEvents.get(i);
- if (!evtGroup.equals(gwtStatsEvent.getEvtGroup())) {
+ if (!EVT_GROUP.equals(gwtStatsEvent.getEvtGroup())) {
// Only log our own events to avoid problems with events which
// are not of type start+end
continue;
diff --git a/client/src/main/java/com/vaadin/client/VTooltip.java b/client/src/main/java/com/vaadin/client/VTooltip.java
index b0108dff64..399497bea1 100644
--- a/client/src/main/java/com/vaadin/client/VTooltip.java
+++ b/client/src/main/java/com/vaadin/client/VTooltip.java
@@ -56,6 +56,8 @@ public class VTooltip extends VOverlay {
private static final int MARGIN = 4;
public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN | Event.ONMOUSEOVER
| Event.ONMOUSEOUT | Event.ONMOUSEMOVE | Event.ONCLICK;
+ private static final int EVENT_XY_POSITION_OUTSIDE = -5000;
+
VErrorMessage em = new VErrorMessage();
HTML description = GWT.create(HTML.class);
@@ -81,6 +83,9 @@ public class VTooltip extends VOverlay {
*/
private com.google.gwt.dom.client.Element currentElement = null;
+ private int tooltipEventMouseX;
+ private int tooltipEventMouseY;
+
/**
* Used to show tooltips; usually used via the singleton in
* {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be
@@ -471,10 +476,6 @@ public class VTooltip extends VOverlay {
setPopupPosition(tooltipEventMouseX, tooltipEventMouseY);
}
- private int EVENT_XY_POSITION_OUTSIDE = -5000;
- private int tooltipEventMouseX;
- private int tooltipEventMouseY;
-
public void updatePosition(Event event, boolean isFocused) {
tooltipEventMouseX = getEventX(event, isFocused);
tooltipEventMouseY = getEventY(event, isFocused);
diff --git a/client/src/main/java/com/vaadin/client/WidgetUtil.java b/client/src/main/java/com/vaadin/client/WidgetUtil.java
index d9061321ca..3841592704 100644
--- a/client/src/main/java/com/vaadin/client/WidgetUtil.java
+++ b/client/src/main/java/com/vaadin/client/WidgetUtil.java
@@ -131,7 +131,7 @@ public class WidgetUtil {
}
}
- private static final Element escapeHtmlHelper = DOM.createDiv();
+ private static final Element ESCAPE_HTML_HELPER = DOM.createDiv();
/**
* Converts html entities to text.
@@ -140,8 +140,8 @@ public class WidgetUtil {
* @return escaped string presentation of given html
*/
public static String escapeHTML(String html) {
- DOM.setInnerText(escapeHtmlHelper, html);
- String escapedText = DOM.getInnerHTML(escapeHtmlHelper);
+ DOM.setInnerText(ESCAPE_HTML_HELPER, html);
+ String escapedText = DOM.getInnerHTML(ESCAPE_HTML_HELPER);
return escapedText;
}
@@ -1460,7 +1460,7 @@ public class WidgetUtil {
/*
* Regex to parse the size.
*/
- private static final RegExp sizePattern = RegExp
+ private static final RegExp SIZE_PATTERN = RegExp
.compile(SharedUtil.SIZE_PATTERN);
/**
@@ -1483,7 +1483,7 @@ public class WidgetUtil {
float size = 0;
Unit unit = null;
- MatchResult matcher = sizePattern.exec(s);
+ MatchResult matcher = SIZE_PATTERN.exec(s);
if (matcher.getGroupCount() > 1) {
size = Float.parseFloat(matcher.getGroup(1));
@@ -1498,7 +1498,7 @@ public class WidgetUtil {
} else {
throw new IllegalArgumentException(
"Invalid size argument: \"" + s + "\" (should match "
- + sizePattern.getSource() + ")");
+ + SIZE_PATTERN.getSource() + ")");
}
return new CssSize(size, unit);
}
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 9a0eb60983..6e1d9c28d6 100644
--- a/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java
+++ b/client/src/main/java/com/vaadin/client/communication/JsonDecoder.java
@@ -52,22 +52,22 @@ import elemental.json.JsonValue;
*/
public class JsonDecoder {
- private static final FastStringSet decodedWithoutReference = FastStringSet
+ private static final FastStringSet DECODED_WITHOUT_REFERENCE = FastStringSet
.create();
static {
- decodedWithoutReference.add(String.class.getName());
- decodedWithoutReference.add(Boolean.class.getName());
- decodedWithoutReference.add(Byte.class.getName());
- decodedWithoutReference.add(Character.class.getName());
- decodedWithoutReference.add(Short.class.getName());
- decodedWithoutReference.add(Integer.class.getName());
- decodedWithoutReference.add(Long.class.getName());
- decodedWithoutReference.add(Float.class.getName());
- decodedWithoutReference.add(Double.class.getName());
- decodedWithoutReference.add(Connector.class.getName());
- decodedWithoutReference.add(Map.class.getName());
- decodedWithoutReference.add(List.class.getName());
- decodedWithoutReference.add(Set.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(String.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Boolean.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Byte.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Character.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Short.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Integer.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Long.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Float.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Double.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Connector.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Map.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(List.class.getName());
+ DECODED_WITHOUT_REFERENCE.add(Set.class.getName());
}
/**
@@ -193,7 +193,7 @@ public class JsonDecoder {
}
private static boolean needsReferenceValue(Type type) {
- return !decodedWithoutReference.contains(type.getBaseTypeName());
+ return !DECODED_WITHOUT_REFERENCE.contains(type.getBaseTypeName());
}
private static Map<Object, Object> decodeMap(Type type, JsonValue jsonMap,
diff --git a/client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java b/client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java
index cc6d741183..d691bfeac5 100644
--- a/client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java
+++ b/client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java
@@ -38,10 +38,10 @@ public class URLReference_Serializer implements JSONSerializer<URLReference> {
JsonObject json = (JsonObject) jsonValue;
if (json.hasKey(URL_FIELD)) {
JsonValue jsonURL = json.get(URL_FIELD);
- String URL = (String) JsonDecoder.decodeValue(
+ String url = (String) JsonDecoder.decodeValue(
new Type(String.class.getName(), null), jsonURL, null,
connection);
- reference.setURL(URL);
+ reference.setURL(url);
}
return reference;
}
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 d2c818f2f5..e775793e6f 100644
--- a/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
+++ b/client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
@@ -74,7 +74,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
private final ApplicationConnection client;
- private static final RegExp validSyntax = RegExp.compile(
+ private static final RegExp VALID_SYNTAX = RegExp.compile(
"^((\\w+::)?((PID_S)?\\w[-$_a-zA-Z0-9.' ]*)?)?(/[-$_a-zA-Z0-9]+\\[\\d+\\])*/?(#.*)?$");
public LegacyLocatorStrategy(ApplicationConnection clientConnection) {
@@ -83,7 +83,7 @@ public class LegacyLocatorStrategy implements LocatorStrategy {
@Override
public boolean validatePath(String path) {
- return validSyntax.test(path);
+ return VALID_SYNTAX.test(path);
}
@Override
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 7ac67d349a..bfb4ca04ff 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
@@ -111,8 +111,8 @@ public final class VDebugWindow extends VOverlay {
protected int fontSize = 1; // 0-2
// Timers since application start, and last timer reset
- private static final Duration start = new Duration();
- private static Duration lastReset = start;
+ private static final Duration START = new Duration();
+ private static Duration lastReset = START;
// outer panel
protected FlowPanel window = new FlowPanel();
@@ -637,7 +637,7 @@ public final class VDebugWindow extends VOverlay {
* @return
*/
static int getMillisSinceStart() {
- return start.elapsedMillis();
+ return START.elapsedMillis();
}
/**
diff --git a/client/src/main/java/com/vaadin/client/event/PointerEventSupport.java b/client/src/main/java/com/vaadin/client/event/PointerEventSupport.java
index 1a9fefd703..9386e4612e 100644
--- a/client/src/main/java/com/vaadin/client/event/PointerEventSupport.java
+++ b/client/src/main/java/com/vaadin/client/event/PointerEventSupport.java
@@ -27,14 +27,14 @@ import com.vaadin.client.event.PointerEvent.EventType;
*/
public class PointerEventSupport {
- private static final PointerEventSupportImpl impl = GWT
+ private static final PointerEventSupportImpl IMPL = GWT
.create(PointerEventSupportImpl.class);
private PointerEventSupport() {
}
public static void init() {
- impl.init();
+ IMPL.init();
}
/**
@@ -42,7 +42,7 @@ public class PointerEventSupport {
* otherwise
*/
public static boolean isSupported() {
- return impl.isSupported();
+ return IMPL.isSupported();
}
/**
@@ -50,6 +50,6 @@ public class PointerEventSupport {
* @return the native event name of the given event
*/
public static String getNativeEventName(EventType eventType) {
- return impl.getNativeEventName(eventType);
+ return IMPL.getNativeEventName(eventType);
}
}
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 1fc86201bd..4381caddd0 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
@@ -40,8 +40,8 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector {
protected void init() {
registerRpc(ExecuteJavaScriptRpc.class, new ExecuteJavaScriptRpc() {
@Override
- public void executeJavaScript(String Script) {
- eval(Script);
+ public void executeJavaScript(String script) {
+ eval(script);
}
});
}
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 af8f918a4a..185b93c8a8 100644
--- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java
+++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java
@@ -101,7 +101,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
private static TouchScrollDelegate activeScrollDelegate;
- private static final boolean androidWithBrokenScrollTop = BrowserInfo.get()
+ private static final boolean ANDROID_WITH_BROKEN_SCROLL_TOP = BrowserInfo.get()
.isAndroidWithBrokenScrollTop();
/**
@@ -330,7 +330,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
}
private int getScrollTop() {
- if (androidWithBrokenScrollTop) {
+ if (ANDROID_WITH_BROKEN_SCROLL_TOP) {
if (scrolledElement.getPropertyJSO("_vScrollTop") != null) {
return scrolledElement.getPropertyInt("_vScrollTop");
}
@@ -360,7 +360,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
VConsole.log("Animate " + time + " " + from + " " + to);
int translateTo = -to + origScrollTop;
int fromY = -from + origScrollTop;
- if (androidWithBrokenScrollTop) {
+ if (ANDROID_WITH_BROKEN_SCROLL_TOP) {
fromY -= origScrollTop;
translateTo -= origScrollTop;
}
@@ -380,7 +380,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
* scrolltop, causing onscroll event.
*/
private void moveTransformationToScrolloffset() {
- if (androidWithBrokenScrollTop) {
+ if (ANDROID_WITH_BROKEN_SCROLL_TOP) {
scrolledElement.setPropertyInt("_vScrollTop", finalScrollTop);
if (scrollHandler != null) {
scrollHandler.onScroll(null);
@@ -465,7 +465,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
private void quickSetScrollPosition(int deltaX, int deltaY) {
deltaScrollPos = deltaY;
- if (androidWithBrokenScrollTop) {
+ if (ANDROID_WITH_BROKEN_SCROLL_TOP) {
deltaY += origScrollTop;
translateTo(-deltaY);
} else {
@@ -570,7 +570,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
int translateTo = -finalY + origScrollTop;
int fromY = -currentY + origScrollTop;
- if (androidWithBrokenScrollTop) {
+ if (ANDROID_WITH_BROKEN_SCROLL_TOP) {
fromY -= origScrollTop;
translateTo -= origScrollTop;
}
@@ -652,7 +652,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
}
private int getMaxOverScroll() {
- return androidWithBrokenScrollTop ? 0
+ return ANDROID_WITH_BROKEN_SCROLL_TOP ? 0
: scrolledElement.getClientHeight() / 3;
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java b/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java
index 18d8dbdfee..70ada4d70e 100644
--- a/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java
+++ b/client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java
@@ -98,7 +98,7 @@ public abstract class VAbstractPopupCalendar<PANEL extends VAbstractCalendarPane
private Element descriptionForAssistiveDevicesElement;
- private final String CALENDAR_TOGGLE_ID = "popupButton";
+ private static final String CALENDAR_TOGGLE_ID = "popupButton";
public VAbstractPopupCalendar(PANEL calendarPanel, R resolution) {
super(resolution);
diff --git a/client/src/main/java/com/vaadin/client/ui/VAudio.java b/client/src/main/java/com/vaadin/client/ui/VAudio.java
index cf80c80e37..31e3165066 100644
--- a/client/src/main/java/com/vaadin/client/ui/VAudio.java
+++ b/client/src/main/java/com/vaadin/client/ui/VAudio.java
@@ -20,7 +20,7 @@ import com.google.gwt.dom.client.AudioElement;
import com.google.gwt.dom.client.Document;
public class VAudio extends VMediaBase {
- private static String CLASSNAME = "v-audio";
+ private static final String CLASSNAME = "v-audio";
private AudioElement audio;
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 607128c43c..5ee7cb0860 100644
--- a/client/src/main/java/com/vaadin/client/ui/VMenuBar.java
+++ b/client/src/main/java/com/vaadin/client/ui/VMenuBar.java
@@ -505,7 +505,7 @@ public class VMenuBar extends SimpleFocusablePanel
* root menus on mouse hover.
*/
private static class LazyCloser extends Timer {
- static LazyCloser INSTANCE;
+ static LazyCloser instance;
private VMenuBar activeRoot;
@Override
@@ -517,27 +517,27 @@ public class VMenuBar extends SimpleFocusablePanel
}
public static void cancelClosing() {
- if (INSTANCE != null) {
- INSTANCE.cancel();
+ if (instance != null) {
+ instance.cancel();
}
}
public static void prepare(VMenuBar vMenuBar) {
- if (INSTANCE == null) {
- INSTANCE = new LazyCloser();
+ if (instance == null) {
+ instance = new LazyCloser();
}
- if (INSTANCE.activeRoot == vMenuBar) {
- INSTANCE.cancel();
- } else if (INSTANCE.activeRoot != null) {
- INSTANCE.cancel();
- INSTANCE.run();
+ if (instance.activeRoot == vMenuBar) {
+ instance.cancel();
+ } else if (instance.activeRoot != null) {
+ instance.cancel();
+ instance.run();
}
- INSTANCE.activeRoot = vMenuBar;
+ instance.activeRoot = vMenuBar;
}
public static void schedule() {
- if (INSTANCE != null && INSTANCE.activeRoot != null) {
- INSTANCE.schedule(750);
+ if (instance != null && instance.activeRoot != null) {
+ instance.schedule(750);
}
}
@@ -1587,7 +1587,7 @@ public class VMenuBar extends SimpleFocusablePanel
}
- private final String SUBPART_PREFIX = "item";
+ private static final String SUBPART_PREFIX = "item";
@Override
public com.google.gwt.user.client.Element getSubPartElement(
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 7cc47d90f1..37255ff4bb 100644
--- a/client/src/main/java/com/vaadin/client/ui/VNotification.java
+++ b/client/src/main/java/com/vaadin/client/ui/VNotification.java
@@ -75,11 +75,11 @@ public class VNotification extends VOverlay {
public static final int DELAY_NONE = 0;
private static final String STYLENAME = "v-Notification";
- private static final int mouseMoveThreshold = 7;
+ private static final int MOUSE_MOVE_THRESHOLD = 7;
private static final int Z_INDEX_BASE = 20000;
public static final String STYLE_SYSTEM = "system";
- private static final List<VNotification> notifications = new ArrayList<>();
+ private static final List<VNotification> NOTIFICATIONS = new ArrayList<>();
private boolean infiniteDelay = false;
private int hideDelay = 0;
@@ -254,7 +254,7 @@ public class VNotification extends VOverlay {
setPosition(position);
super.show();
updatePositionOffsets(position);
- notifications.add(this);
+ NOTIFICATIONS.add(this);
positionOrSizeUpdated();
/**
* Android 4 fails to render notifications correctly without a little
@@ -288,7 +288,7 @@ public class VNotification extends VOverlay {
delay.cancel();
}
// Run only once
- if (notifications.contains(this)) {
+ if (NOTIFICATIONS.contains(this)) {
DOM.removeEventPreview(this);
// Still animating in, wait for it to finish before touching
@@ -310,7 +310,7 @@ public class VNotification extends VOverlay {
} else {
VNotification.super.hide();
fireEvent(new HideEvent(this));
- notifications.remove(this);
+ NOTIFICATIONS.remove(this);
}
}
}
@@ -433,9 +433,9 @@ public class VNotification extends VOverlay {
x = DOM.eventGetClientX(event);
y = DOM.eventGetClientY(event);
} else if (Math
- .abs(DOM.eventGetClientX(event) - x) > mouseMoveThreshold
+ .abs(DOM.eventGetClientX(event) - x) > MOUSE_MOVE_THRESHOLD
|| Math.abs(DOM.eventGetClientY(event)
- - y) > mouseMoveThreshold) {
+ - y) > MOUSE_MOVE_THRESHOLD) {
hideAfterDelay();
}
break;
@@ -592,7 +592,7 @@ public class VNotification extends VOverlay {
* TODO Should this be a generic Overlay feature instead?
*/
public static void bringNotificationsToFront() {
- for (VNotification notification : notifications) {
+ for (VNotification notification : NOTIFICATIONS) {
DOM.removeEventPreview(notification);
DOM.addEventPreview(notification);
}
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 22c681d5c2..ec4167f9fa 100644
--- a/client/src/main/java/com/vaadin/client/ui/VSlider.java
+++ b/client/src/main/java/com/vaadin/client/ui/VSlider.java
@@ -75,7 +75,7 @@ public class VSlider extends SimpleFocusablePanel
/* DOM element for slider's base */
private final Element base;
- private final int BASE_BORDER_WIDTH = 1;
+ private static final int BASE_BORDER_WIDTH = 1;
/* DOM element for slider's handle */
private final Element handle;
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 c2cbd626e8..e7da389113 100644
--- a/client/src/main/java/com/vaadin/client/ui/VTabsheet.java
+++ b/client/src/main/java/com/vaadin/client/ui/VTabsheet.java
@@ -185,7 +185,7 @@ public class VTabsheet extends VTabsheetBase
setStyleName(td, TD_DISABLED_CLASSNAME, !enabled);
if (!enabled) {
- focusImpl.setTabIndex(td, -1);
+ FOCUS_IMPL.setTabIndex(td, -1);
}
}
@@ -297,11 +297,11 @@ public class VTabsheet extends VTabsheetBase
public void focus() {
getTabsheet().scrollIntoView(this);
- focusImpl.focus(td);
+ FOCUS_IMPL.focus(td);
}
public void blur() {
- focusImpl.blur(td);
+ FOCUS_IMPL.blur(td);
}
public boolean hasTooltip() {
@@ -739,6 +739,9 @@ public class VTabsheet extends VTabsheetBase
public static final String TABS_CLASSNAME = CLASSNAME + "-tabcontainer";
public static final String SCROLLER_CLASSNAME = CLASSNAME + "-scroller";
+ private static final FocusImpl FOCUS_IMPL = FocusImpl
+ .getFocusImplForPanel();
+
/** For internal use only. May be removed or replaced in the future. */
// tabbar and 'scroller' container
public final Element tabs;
@@ -749,8 +752,6 @@ public class VTabsheet extends VTabsheetBase
*/
int tabulatorIndex = 0;
- private static final FocusImpl focusImpl = FocusImpl.getFocusImplForPanel();
-
// tab-scroller element
private final Element scroller;
// tab-scroller next button element
diff --git a/client/src/main/java/com/vaadin/client/ui/VUI.java b/client/src/main/java/com/vaadin/client/ui/VUI.java
index 6e3ffd716f..6ee44aa930 100644
--- a/client/src/main/java/com/vaadin/client/ui/VUI.java
+++ b/client/src/main/java/com/vaadin/client/ui/VUI.java
@@ -50,7 +50,7 @@ public class VUI extends SimplePanel implements ResizeHandler,
com.google.gwt.user.client.ui.Focusable, HasResizeHandlers,
HasScrollHandlers {
- private static int MONITOR_PARENT_TIMER_INTERVAL = 1000;
+ private static final int MONITOR_PARENT_TIMER_INTERVAL = 1000;
/** For internal use only. May be removed or replaced in the future. */
public String id;
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 8ac90386c7..b27c803b75 100644
--- a/client/src/main/java/com/vaadin/client/ui/VWindow.java
+++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java
@@ -81,7 +81,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
private static List<VWindow> windowOrder = new ArrayList<>();
- private static HandlerManager WINDOW_ORDER_HANDLER = new HandlerManager(
+ private static final HandlerManager WINDOW_ORDER_HANDLER = new HandlerManager(
VWindow.class);
private static boolean orderingDefered;
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 ea9fd57c26..857d4e07b3 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
@@ -70,7 +70,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector
private Map<ComponentConnector, String> oldMaxWidths = null;
- private static final ElementResizeListener dummyFirstCellResizeListener = new ElementResizeListener() {
+ private static final ElementResizeListener DUMMY_FIRST_CELL_RESIZE_LISTENER = new ElementResizeListener() {
@Override
public void onElementResize(ElementResizeEvent e) {
// Ignore event, listener added just to make measurements available
@@ -220,7 +220,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector
Element td = findFirstComponentTd();
if (td != null) {
getLayoutManager().addElementResizeListener(td,
- dummyFirstCellResizeListener);
+ DUMMY_FIRST_CELL_RESIZE_LISTENER);
}
}
@@ -228,7 +228,7 @@ public class FormLayoutConnector extends AbstractLayoutConnector
Element td = findFirstComponentTd();
if (td != null) {
getLayoutManager().removeElementResizeListener(td,
- dummyFirstCellResizeListener);
+ DUMMY_FIRST_CELL_RESIZE_LISTENER);
}
}
diff --git a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java
index 06380eef28..02eee0804e 100644
--- a/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java
+++ b/client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java
@@ -19,7 +19,7 @@ import com.google.gwt.event.shared.GwtEvent;
public class VisibilityChangeEvent extends GwtEvent<VisibilityChangeHandler> {
- private static Type<VisibilityChangeHandler> TYPE;
+ private static Type<VisibilityChangeHandler> type;
private boolean visible;
@@ -37,10 +37,10 @@ public class VisibilityChangeEvent extends GwtEvent<VisibilityChangeHandler> {
}
public static Type<VisibilityChangeHandler> getType() {
- if (TYPE == null) {
- TYPE = new Type<>();
+ if (type == null) {
+ type = new Type<>();
}
- return TYPE;
+ return type;
}
@Override
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 d235ddeca3..f3ebb34d7f 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
@@ -201,7 +201,7 @@ public class VRichTextToolbar extends Composite {
fonts.setSelectedIndex(0);
} else if (sender == fontSizes) {
basic.setFontSize(
- fontSizesConstants[fontSizes.getSelectedIndex() - 1]);
+ FONT_SIZES_CONSTANTS[fontSizes.getSelectedIndex() - 1]);
fontSizes.setSelectedIndex(0);
}
}
@@ -275,7 +275,7 @@ public class VRichTextToolbar extends Composite {
}
}
- private static final RichTextArea.FontSize[] fontSizesConstants = {
+ private static final RichTextArea.FontSize[] FONT_SIZES_CONSTANTS = {
RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL,
RichTextArea.FontSize.SMALL, RichTextArea.FontSize.MEDIUM,
RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE,
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 bb1686ae83..c979325f7e 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
@@ -50,7 +50,7 @@ import com.vaadin.client.widget.grid.events.ScrollHandler;
*/
public abstract class ScrollbarBundle implements DeferredWorker {
- private static final boolean supportsRequestAnimationFrame = new AnimationSupportDetector()
+ private static final boolean SUPPORTS_REQUEST_ANIMATION_FRAME = new AnimationSupportDetector()
.isNativelySupported();
private class ScrollEventFirer {
@@ -92,7 +92,7 @@ public abstract class ScrollbarBundle implements DeferredWorker {
* We'll gather all the scroll events, and only fire once, once
* everything has calmed down.
*/
- if (supportsRequestAnimationFrame) {
+ if (SUPPORTS_REQUEST_ANIMATION_FRAME) {
// Chrome MUST use this as deferred commands will sometimes
// be run with a 300+ ms delay when scrolling.
AnimationScheduler.get().requestAnimationFrame(
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 07fc05622b..d5f3e24528 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
@@ -144,17 +144,17 @@ public class ListSorter<T> {
Grid.Column column = o.getColumn();
Comparator cmp = ListSorter.this.comparators.get(column);
int result = 0;
- Object value_a = column.getValue(a);
- Object value_b = column.getValue(b);
+ Object valueA = column.getValue(a);
+ Object valueB = column.getValue(b);
if (cmp != null) {
- result = cmp.compare(value_a, value_b);
+ result = cmp.compare(valueA, valueB);
} else {
- if (!(value_a instanceof Comparable)) {
+ if (!(valueA instanceof Comparable)) {
throw new IllegalStateException("Column " + column
+ " has no assigned comparator and value "
- + value_a + " isn't naturally comparable");
+ + valueA + " isn't naturally comparable");
}
- result = ((Comparable) value_a).compareTo(value_b);
+ result = ((Comparable) valueA).compareTo(valueB);
}
if (result != 0) {
diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java
index 4145919f2f..fd65e63cea 100644
--- a/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java
+++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java
@@ -32,7 +32,7 @@ import com.vaadin.client.widgets.Grid;
@SuppressWarnings("rawtypes")
public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
- private static final Type<SelectionHandler> eventType = new Type<>();
+ private static final Type<SelectionHandler> EVENT_TYPE = new Type<>();
private final Grid<T> grid;
private final List<T> added;
@@ -142,12 +142,12 @@ public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {
* @return a {@link Type} identifier.
*/
public static Type<SelectionHandler> getType() {
- return eventType;
+ return EVENT_TYPE;
}
@Override
public Type<SelectionHandler> getAssociatedType() {
- return eventType;
+ return EVENT_TYPE;
}
@Override
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 73867caa72..e134d01d9b 100755
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -4702,7 +4702,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
*/
private final class DefaultTextRenderer implements Renderer<Object> {
boolean warned = false;
- private final String DEFAULT_RENDERER_WARNING = "This column uses a dummy default TextRenderer. "
+ private static final String DEFAULT_RENDERER_WARNING = "This column uses a dummy default TextRenderer. "
+ "A more suitable renderer should be set using the setRenderer() method.";
@Override