Browse Source

Improve naming of fields and variables (#10242)

* Variable names to conform to naming convention.

* Use static constants where it makes sense
tags/8.2.0.alpha3
Ahmed Ashour 6 years ago
parent
commit
10bd7544fd
87 changed files with 431 additions and 431 deletions
  1. 2
    2
      client/src/main/java/com/vaadin/client/ApplicationConnection.java
  2. 2
    1
      client/src/main/java/com/vaadin/client/DateTimeService.java
  3. 5
    5
      client/src/main/java/com/vaadin/client/LayoutManager.java
  4. 2
    2
      client/src/main/java/com/vaadin/client/MeasuredSize.java
  5. 5
    5
      client/src/main/java/com/vaadin/client/Profiler.java
  6. 5
    4
      client/src/main/java/com/vaadin/client/VTooltip.java
  7. 6
    6
      client/src/main/java/com/vaadin/client/WidgetUtil.java
  8. 15
    15
      client/src/main/java/com/vaadin/client/communication/JsonDecoder.java
  9. 2
    2
      client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java
  10. 2
    2
      client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java
  11. 3
    3
      client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java
  12. 4
    4
      client/src/main/java/com/vaadin/client/event/PointerEventSupport.java
  13. 2
    2
      client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
  14. 7
    7
      client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java
  15. 1
    1
      client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java
  16. 1
    1
      client/src/main/java/com/vaadin/client/ui/VAudio.java
  17. 14
    14
      client/src/main/java/com/vaadin/client/ui/VMenuBar.java
  18. 8
    8
      client/src/main/java/com/vaadin/client/ui/VNotification.java
  19. 1
    1
      client/src/main/java/com/vaadin/client/ui/VSlider.java
  20. 6
    5
      client/src/main/java/com/vaadin/client/ui/VTabsheet.java
  21. 1
    1
      client/src/main/java/com/vaadin/client/ui/VUI.java
  22. 1
    1
      client/src/main/java/com/vaadin/client/ui/VWindow.java
  23. 3
    3
      client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java
  24. 4
    4
      client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java
  25. 2
    2
      client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java
  26. 2
    2
      client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java
  27. 6
    6
      client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java
  28. 3
    3
      client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java
  29. 1
    1
      client/src/main/java/com/vaadin/client/widgets/Grid.java
  30. 3
    3
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendar.java
  31. 1
    1
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java
  32. 34
    34
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
  33. 1
    1
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/VSlider.java
  34. 1
    1
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java
  35. 2
    2
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
  36. 3
    3
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/VCalendarAction.java
  37. 4
    4
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/CalendarEvent.java
  38. 4
    4
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateCellDayEvent.java
  39. 4
    4
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateUtil.java
  40. 2
    2
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java
  41. 10
    10
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/SimpleDayCell.java
  42. 3
    3
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/WeekGrid.java
  43. 2
    2
      compatibility-client/src/main/java/com/vaadin/v7/client/ui/richtextarea/VRichTextToolbar.java
  44. 2
    2
      compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/ScrollbarBundle.java
  45. 6
    6
      compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java
  46. 3
    3
      compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionEvent.java
  47. 2
    1
      compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java
  48. 1
    1
      compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java
  49. 4
    4
      compatibility-server/src/main/java/com/vaadin/v7/data/util/converter/DefaultConverterFactory.java
  50. 1
    1
      compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java
  51. 2
    2
      compatibility-server/src/main/java/com/vaadin/v7/ui/DefaultFieldFactory.java
  52. 36
    38
      compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java
  53. 6
    6
      compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerGrid.java
  54. 8
    8
      compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerHistory.java
  55. 4
    4
      compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerPopup.java
  56. 2
    2
      compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java
  57. 1
    1
      compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/colorpicker/Color.java
  58. 2
    2
      server/src/main/java/com/vaadin/data/BeanPropertySet.java
  59. 2
    2
      server/src/main/java/com/vaadin/event/dd/acceptcriteria/AcceptAll.java
  60. 2
    2
      server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIsTarget.java
  61. 2
    2
      server/src/main/java/com/vaadin/server/AbstractClientConnector.java
  62. 9
    9
      server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
  63. 2
    2
      server/src/main/java/com/vaadin/server/DefaultSystemMessagesProvider.java
  64. 2
    2
      server/src/main/java/com/vaadin/server/GlobalResourceHandler.java
  65. 17
    17
      server/src/main/java/com/vaadin/server/JsonCodec.java
  66. 3
    3
      server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java
  67. 2
    2
      server/src/main/java/com/vaadin/server/LegacyVaadinPortlet.java
  68. 2
    2
      server/src/main/java/com/vaadin/server/LegacyVaadinServlet.java
  69. 5
    5
      server/src/main/java/com/vaadin/server/LocaleService.java
  70. 2
    2
      server/src/main/java/com/vaadin/server/ServerRpcManager.java
  71. 3
    3
      server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java
  72. 3
    3
      server/src/main/java/com/vaadin/server/SizeWithUnit.java
  73. 8
    8
      server/src/main/java/com/vaadin/server/StreamResource.java
  74. 14
    14
      server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
  75. 2
    2
      server/src/main/java/com/vaadin/ui/AbstractComponent.java
  76. 33
    35
      server/src/main/java/com/vaadin/ui/Upload.java
  77. 6
    6
      server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
  78. 7
    7
      server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java
  79. 9
    9
      server/src/main/java/com/vaadin/util/CurrentInstance.java
  80. 8
    8
      server/src/main/java/com/vaadin/util/FileTypeResolver.java
  81. 3
    3
      server/src/main/java/com/vaadin/util/TimeZoneUtil.java
  82. 1
    1
      server/src/test/java/com/vaadin/data/BeanPropertySetTest.java
  83. 1
    1
      server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java
  84. 1
    1
      server/src/test/java/com/vaadin/util/CurrentInstanceTest.java
  85. 5
    5
      shared/src/main/java/com/vaadin/shared/communication/URLReference.java
  86. 1
    1
      shared/src/main/java/com/vaadin/shared/ui/colorpicker/Color.java
  87. 6
    6
      testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractComponentElement.java

+ 2
- 2
client/src/main/java/com/vaadin/client/ApplicationConnection.java View File

@@ -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;
}-*/;

/**

+ 2
- 1
client/src/main/java/com/vaadin/client/DateTimeService.java View File

@@ -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

+ 5
- 5
client/src/main/java/com/vaadin/client/LayoutManager.java View File

@@ -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(

+ 2
- 2
client/src/main/java/com/vaadin/client/MeasuredSize.java View File

@@ -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);
}

+ 5
- 5
client/src/main/java/com/vaadin/client/Profiler.java View File

@@ -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;

+ 5
- 4
client/src/main/java/com/vaadin/client/VTooltip.java View File

@@ -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);

+ 6
- 6
client/src/main/java/com/vaadin/client/WidgetUtil.java View File

@@ -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);
}

+ 15
- 15
client/src/main/java/com/vaadin/client/communication/JsonDecoder.java View File

@@ -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,

+ 2
- 2
client/src/main/java/com/vaadin/client/communication/URLReference_Serializer.java View File

@@ -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;
}

+ 2
- 2
client/src/main/java/com/vaadin/client/componentlocator/LegacyLocatorStrategy.java View File

@@ -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

+ 3
- 3
client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java View File

@@ -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();
}

/**

+ 4
- 4
client/src/main/java/com/vaadin/client/event/PointerEventSupport.java View File

@@ -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);
}
}

+ 2
- 2
client/src/main/java/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java View File

@@ -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);
}
});
}

+ 7
- 7
client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java View File

@@ -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;
}


+ 1
- 1
client/src/main/java/com/vaadin/client/ui/VAbstractPopupCalendar.java View File

@@ -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);

+ 1
- 1
client/src/main/java/com/vaadin/client/ui/VAudio.java View File

@@ -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;


+ 14
- 14
client/src/main/java/com/vaadin/client/ui/VMenuBar.java View File

@@ -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(

+ 8
- 8
client/src/main/java/com/vaadin/client/ui/VNotification.java View File

@@ -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);
}

+ 1
- 1
client/src/main/java/com/vaadin/client/ui/VSlider.java View File

@@ -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;

+ 6
- 5
client/src/main/java/com/vaadin/client/ui/VTabsheet.java View File

@@ -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

+ 1
- 1
client/src/main/java/com/vaadin/client/ui/VUI.java View File

@@ -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;

+ 1
- 1
client/src/main/java/com/vaadin/client/ui/VWindow.java View File

@@ -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;

+ 3
- 3
client/src/main/java/com/vaadin/client/ui/formlayout/FormLayoutConnector.java View File

@@ -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);
}
}


+ 4
- 4
client/src/main/java/com/vaadin/client/ui/popupview/VisibilityChangeEvent.java View File

@@ -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

+ 2
- 2
client/src/main/java/com/vaadin/client/ui/richtextarea/VRichTextToolbar.java View File

@@ -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,

+ 2
- 2
client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java View File

@@ -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(

+ 6
- 6
client/src/main/java/com/vaadin/client/widget/grid/datasources/ListSorter.java View File

@@ -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) {

+ 3
- 3
client/src/main/java/com/vaadin/client/widget/grid/selection/SelectionEvent.java View File

@@ -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

+ 1
- 1
client/src/main/java/com/vaadin/client/widgets/Grid.java View File

@@ -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

+ 3
- 3
compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendar.java View File

@@ -101,7 +101,7 @@ public class VCalendar extends Composite implements VHasDropHandler {

private EventSortOrder eventSortOrder = EventSortOrder.DURATION_DESC;

private static EventDurationComparator DEFAULT_COMPARATOR = new EventDurationComparator(
private static final EventDurationComparator DEFAULT_COMPARATOR = new EventDurationComparator(
false);

private CalendarDropHandler dropHandler;
@@ -656,7 +656,7 @@ public class VCalendar extends Composite implements VHasDropHandler {

for (CalendarDay day : days) {
String date = day.getDate();
String localized_date_format = day.getLocalizedDateFormat();
String localizedDateFormat = day.getLocalizedDateFormat();
Date d = dateformat_date.parse(date);
int dayOfWeek = day.getDayOfWeek();
if (dayOfWeek < getFirstDayNumber()
@@ -670,7 +670,7 @@ public class VCalendar extends Composite implements VHasDropHandler {
isToday = true;
}
dayToolbar.add(realDayNames[dayOfWeek - 1], date,
localized_date_format, isToday ? "today" : null);
localizedDateFormat, isToday ? "today" : null);
weeklyLongEvents.addDate(d);
weekGrid.addDate(d);
if (isToday) {

+ 1
- 1
compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java View File

@@ -540,7 +540,7 @@ public class VPopupCalendar extends VTextualDate
}
}

private final String CALENDAR_TOGGLE_ID = "popupButton";
private static final String CALENDAR_TOGGLE_ID = "popupButton";

@Override
public com.google.gwt.user.client.Element getSubPartElement(

+ 34
- 34
compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java View File

@@ -314,11 +314,11 @@ public class VScrollTable extends FlowPanel
* multiple of pagelength which component will cache when requesting more
* rows
*/
private double cache_rate = CACHE_RATE_DEFAULT;
private double cacheRate = CACHE_RATE_DEFAULT;
/**
* fraction of pageLength which can be scrolled without making new request
*/
private double cache_react_rate = 0.75 * cache_rate;
private double cacheReactRate = 0.75 * cacheRate;

public static final char ALIGN_CENTER = 'c';
public static final char ALIGN_LEFT = 'b';
@@ -404,7 +404,7 @@ public class VScrollTable extends FlowPanel

private boolean enableDebug = false;

private static final boolean hasNativeTouchScrolling = BrowserInfo.get()
private static final boolean HAS_NATIVE_TOUCH_SCROLLLING = BrowserInfo.get()
.isTouchDevice()
&& !BrowserInfo.get().requiresTouchScrollDelegate();

@@ -1649,9 +1649,9 @@ public class VScrollTable extends FlowPanel
}

private void setCacheRate(double d) {
if (cache_rate != d) {
cache_rate = d;
cache_react_rate = 0.75 * d;
if (cacheRate != d) {
cacheRate = d;
cacheReactRate = 0.75 * d;
}
}

@@ -1797,9 +1797,9 @@ public class VScrollTable extends FlowPanel
*/
protected void discardRowsOutsideCacheWindow() {
int firstRowToKeep = (int) (firstRowInViewPort
- pageLength * cache_rate);
- pageLength * cacheRate);
int lastRowToKeep = (int) (firstRowInViewPort + pageLength
+ pageLength * cache_rate);
+ pageLength * cacheRate);
// sanity checks:
if (firstRowToKeep < 0) {
firstRowToKeep = 0;
@@ -2474,12 +2474,12 @@ public class VScrollTable extends FlowPanel
if (enabled) {
// Do we need cache rows
if (scrollBody.getLastRendered() + 1 < firstRowInViewPort
+ pageLength + (int) cache_react_rate * pageLength) {
+ pageLength + (int) cacheReactRate * pageLength) {
if (totalRows - 1 > scrollBody.getLastRendered()) {
// fetch cache rows
int firstInNewSet = scrollBody.getLastRendered() + 1;
int lastInNewSet = (int) (firstRowInViewPort + pageLength
+ cache_rate * pageLength);
+ cacheRate * pageLength);
if (lastInNewSet > totalRows - 1) {
lastInNewSet = totalRows - 1;
}
@@ -2648,8 +2648,8 @@ public class VScrollTable extends FlowPanel
*/

setReqFirstRow(
(firstRowInViewPort - (int) (pageLength * cache_rate)));
int last = firstRowInViewPort + (int) (cache_rate * pageLength)
(firstRowInViewPort - (int) (pageLength * cacheRate)));
int last = firstRowInViewPort + (int) (cacheRate * pageLength)
+ pageLength - 1;
if (last >= totalRows) {
last = totalRows - 1;
@@ -2672,9 +2672,9 @@ public class VScrollTable extends FlowPanel
if (reqFirstRow < firstToBeRendered) {
firstToBeRendered = reqFirstRow;
} else if (firstRowInViewPort
- (int) (cache_rate * pageLength) > firstToBeRendered) {
- (int) (cacheRate * pageLength) > firstToBeRendered) {
firstToBeRendered = firstRowInViewPort
- (int) (cache_rate * pageLength);
- (int) (cacheRate * pageLength);
if (firstToBeRendered < 0) {
firstToBeRendered = 0;
}
@@ -2697,9 +2697,9 @@ public class VScrollTable extends FlowPanel
if (lastReqRow > lastToBeRendered) {
lastToBeRendered = lastReqRow;
} else if (firstRowInViewPort + pageLength
+ pageLength * cache_rate < lastToBeRendered) {
+ pageLength * cacheRate < lastToBeRendered) {
lastToBeRendered = (firstRowInViewPort + pageLength
+ (int) (pageLength * cache_rate));
+ (int) (pageLength * cacheRate));
if (lastToBeRendered >= totalRows) {
lastToBeRendered = totalRows - 1;
}
@@ -2767,8 +2767,8 @@ public class VScrollTable extends FlowPanel
*/
public void refreshContent() {
isRequestHandlerRunning = true;
int first = (int) (firstRowInViewPort - pageLength * cache_rate);
int reqRows = (int) (2 * pageLength * cache_rate + pageLength);
int first = (int) (firstRowInViewPort - pageLength * cacheRate);
int reqRows = (int) (2 * pageLength * cacheRate + pageLength);
if (first < 0) {
reqRows = reqRows + first;
first = 0;
@@ -2906,18 +2906,18 @@ public class VScrollTable extends FlowPanel
addStyleName(primaryStyleName + "-header-sortable");
}

final String ALIGN_PREFIX = primaryStyleName
final String alignPrefix = primaryStyleName
+ "-caption-container-align-";

switch (align) {
case ALIGN_CENTER:
captionContainer.addClassName(ALIGN_PREFIX + "center");
captionContainer.addClassName(alignPrefix + "center");
break;
case ALIGN_RIGHT:
captionContainer.addClassName(ALIGN_PREFIX + "right");
captionContainer.addClassName(alignPrefix + "right");
break;
default:
captionContainer.addClassName(ALIGN_PREFIX + "left");
captionContainer.addClassName(alignPrefix + "left");
break;
}

@@ -3236,7 +3236,7 @@ public class VScrollTable extends FlowPanel
firstvisible = 0;
rowRequestHandler.setReqFirstRow(0);
rowRequestHandler
.setReqRows((int) (2 * pageLength * cache_rate
.setReqRows((int) (2 * pageLength * cacheRate
+ pageLength));
rowRequestHandler.deferRowFetch(); // some validation +
// defer 250ms
@@ -4941,9 +4941,9 @@ public class VScrollTable extends FlowPanel
}

int reactFirstRow = (int) (firstRowInViewPort
- pageLength * cache_react_rate);
- pageLength * cacheReactRate);
int reactLastRow = (int) (firstRowInViewPort + pageLength
+ pageLength * cache_react_rate);
+ pageLength * cacheReactRate);
if (reactFirstRow < 0) {
reactFirstRow = 0;
}
@@ -5944,7 +5944,7 @@ public class VScrollTable extends FlowPanel

boolean touchEventHandled = false;

if (enabled && hasNativeTouchScrolling) {
if (enabled && HAS_NATIVE_TOUCH_SCROLLLING) {
touchContextProvider.handleTouchEvent(event);

final Element targetTdOrTr = getEventTargetTdOrTr(event);
@@ -7390,12 +7390,12 @@ public class VScrollTable extends FlowPanel
}

int postLimit = (int) (firstRowInViewPort + (pageLength - 1)
+ pageLength * cache_react_rate);
+ pageLength * cacheReactRate);
if (postLimit > totalRows - 1) {
postLimit = totalRows - 1;
}
int preLimit = (int) (firstRowInViewPort
- pageLength * cache_react_rate);
- pageLength * cacheReactRate);
if (preLimit < 0) {
preLimit = 0;
}
@@ -7415,8 +7415,8 @@ public class VScrollTable extends FlowPanel
if (allRenderedRowsAreNew()) {
// need a totally new set of rows
rowRequestHandler.setReqFirstRow(
(firstRowInViewPort - (int) (pageLength * cache_rate)));
int last = firstRowInViewPort + (int) (cache_rate * pageLength)
(firstRowInViewPort - (int) (pageLength * cacheRate)));
int last = firstRowInViewPort + (int) (cacheRate * pageLength)
+ pageLength - 1;
if (last >= totalRows) {
last = totalRows - 1;
@@ -7431,7 +7431,7 @@ public class VScrollTable extends FlowPanel
// need some rows to the beginning of the rendered area

rowRequestHandler.setReqFirstRow(
(int) (firstRowInViewPort - pageLength * cache_rate));
(int) (firstRowInViewPort - pageLength * cacheRate));
rowRequestHandler.setReqRows(
firstRendered - rowRequestHandler.getReqFirstRow());
rowRequestHandler.deferRowFetch();
@@ -7441,7 +7441,7 @@ public class VScrollTable extends FlowPanel
if (postLimit > lastRendered) {
// need some rows to the end of the rendered area
int reqRows = (int) ((firstRowInViewPort + pageLength
+ pageLength * cache_rate) - lastRendered);
+ pageLength * cacheRate) - lastRendered);
rowRequestHandler.triggerRowFetch(lastRendered + 1, reqRows);
}
}
@@ -7450,9 +7450,9 @@ public class VScrollTable extends FlowPanel
int firstRowInViewPort = calcFirstRowInViewPort();
int firstRendered = scrollBody.getFirstRendered();
int lastRendered = scrollBody.getLastRendered();
return (firstRowInViewPort - pageLength * cache_rate > lastRendered
return (firstRowInViewPort - pageLength * cacheRate > lastRendered
|| firstRowInViewPort + pageLength
+ pageLength * cache_rate < firstRendered);
+ pageLength * cacheRate < firstRendered);
}

protected int calcFirstRowInViewPort() {

+ 1
- 1
compatibility-client/src/main/java/com/vaadin/v7/client/ui/VSlider.java View File

@@ -82,7 +82,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;

+ 1
- 1
compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java View File

@@ -376,7 +376,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
this.text.setText(text);
}

private final String TEXTFIELD_ID = "field";
private static final String TEXTFIELD_ID = "field";

@Override
public com.google.gwt.user.client.Element getSubPartElement(

+ 2
- 2
compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java View File

@@ -2072,8 +2072,8 @@ public class VTree extends FocusElementPanel
return KeyCodes.KEY_END;
}

private final String SUBPART_NODE_PREFIX = "n";
private final String EXPAND_IDENTIFIER = "expand";
private static final String SUBPART_NODE_PREFIX = "n";
private static final String EXPAND_IDENTIFIER = "expand";

/*
* In webkit, focus may have been requested for this component but not yet

+ 3
- 3
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/VCalendarAction.java View File

@@ -41,7 +41,7 @@ public class VCalendarAction extends Action {

private CalendarEvent event;

private final DateTimeFormat dateformat_datetime = DateTimeFormat
private static final DateTimeFormat DATE_FORMAT_DATE_TIME = DateTimeFormat
.getFormat(DateConstants.ACTION_DATE_FORMAT_PATTERN);

/**
@@ -76,8 +76,8 @@ public class VCalendarAction extends Action {
*/
@Override
public void execute() {
String startDate = dateformat_datetime.format(actionStartDate);
String endDate = dateformat_datetime.format(actionEndDate);
String startDate = DATE_FORMAT_DATE_TIME.format(actionStartDate);
String endDate = DATE_FORMAT_DATE_TIME.format(actionEndDate);

if (event == null) {
rpc.actionOnEmptyCell(actionKey.split("-")[0], startDate, endDate);

+ 4
- 4
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/CalendarEvent.java View File

@@ -36,8 +36,8 @@ public class CalendarEvent {
private int slotIndex = -1;
private boolean format24h;

DateTimeFormat dateformat_date = DateTimeFormat.getFormat("h:mm a");
DateTimeFormat dateformat_date24 = DateTimeFormat.getFormat("H:mm");
DateTimeFormat dateformatDate = DateTimeFormat.getFormat("h:mm a");
DateTimeFormat dateformatDate24 = DateTimeFormat.getFormat("H:mm");
private boolean allDay;

/**
@@ -241,9 +241,9 @@ public class CalendarEvent {
*/
public String getTimeAsText() {
if (format24h) {
return dateformat_date24.format(startTime);
return dateformatDate24.format(startTime);
} else {
return dateformat_date.format(startTime);
return dateformatDate.format(startTime);
}
}


+ 4
- 4
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateCellDayEvent.java View File

@@ -61,7 +61,7 @@ public class DateCellDayEvent extends FocusableHTML
private int startY = -1;
private int startX = -1;
private String moveWidth;
public static final int halfHourInMilliSeconds = 1800 * 1000;
public static final int HALF_HOUR_IN_MILLI_SECONDS = 1800 * 1000;
private Date startDatetimeFrom;
private Date startDatetimeTo;
private boolean mouseMoveStarted;
@@ -396,7 +396,7 @@ public class DateCellDayEvent extends FocusableHTML
long daysMs = dayDiff * DateConstants.DAYINMILLIS;
from.setTime(startDatetimeFrom.getTime() + daysMs);
from.setTime(from.getTime()
+ ((long) halfHourInMilliSeconds * halfHourDiff));
+ ((long) HALF_HOUR_IN_MILLI_SECONDS * halfHourDiff));
to.setTime((from.getTime() + duration));

calendarEvent.setStartTime(from);
@@ -425,7 +425,7 @@ public class DateCellDayEvent extends FocusableHTML
} else if (clickTarget == topResizeBar) {
long oldStartTime = startDatetimeFrom.getTime();
long newStartTime = oldStartTime
+ ((long) halfHourInMilliSeconds * halfHourDiff);
+ ((long) HALF_HOUR_IN_MILLI_SECONDS * halfHourDiff);

if (!isTimeRangeTooSmall(newStartTime, startDatetimeTo.getTime())) {
newStartTime = startDatetimeTo.getTime() - getMinTimeRange();
@@ -445,7 +445,7 @@ public class DateCellDayEvent extends FocusableHTML
} else if (clickTarget == bottomResizeBar) {
long oldEndTime = startDatetimeTo.getTime();
long newEndTime = oldEndTime
+ ((long) halfHourInMilliSeconds * halfHourDiff);
+ ((long) HALF_HOUR_IN_MILLI_SECONDS * halfHourDiff);

if (!isTimeRangeTooSmall(startDatetimeFrom.getTime(), newEndTime)) {
newEndTime = startDatetimeFrom.getTime() + getMinTimeRange();

+ 4
- 4
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateUtil.java View File

@@ -52,9 +52,9 @@ public class DateUtil {
* @return given Date as String, for communicating to server-side
*/
public static String formatClientSideDate(Date date) {
DateTimeFormat dateformat_date = DateTimeFormat
DateTimeFormat dateformatDate = DateTimeFormat
.getFormat(DateConstants.CLIENT_DATE_FORMAT);
return dateformat_date.format(date);
return dateformatDate.format(date);
}

/**
@@ -63,8 +63,8 @@ public class DateUtil {
* @return given Date as String, for communicating to server-side
*/
public static String formatClientSideTime(Date date) {
DateTimeFormat dateformat_date = DateTimeFormat
DateTimeFormat dateformatDate = DateTimeFormat
.getFormat(DateConstants.CLIENT_TIME_FORMAT);
return dateformat_date.format(date);
return dateformatDate.format(date);
}
}

+ 2
- 2
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java View File

@@ -89,8 +89,8 @@ public class DayToolbar extends HorizontalPanel implements ClickHandler {
}

public void add(String dayName, final String date,
String localized_date_format, String extraClass) {
Label l = new Label(dayName + " " + localized_date_format);
String localizedDateFormat, String extraClass) {
Label l = new Label(dayName + " " + localizedDateFormat);
l.setStylePrimaryName("v-calendar-header-day");

if (extraClass != null) {

+ 10
- 10
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/SimpleDayCell.java View File

@@ -50,8 +50,8 @@ import com.vaadin.v7.shared.ui.calendar.DateConstants;
public class SimpleDayCell extends FocusableFlowPanel implements MouseUpHandler,
MouseDownHandler, MouseOverHandler, MouseMoveHandler {

private static int BOTTOMSPACERHEIGHT = -1;
private static int EVENTHEIGHT = -1;
private static int bottomSpacerHeight = -1;
private static int eventHeight = -1;
private static final int BORDERPADDINGSIZE = 1;

private final VCalendar calendar;
@@ -111,8 +111,8 @@ public class SimpleDayCell extends FocusableFlowPanel implements MouseUpHandler,

@Override
public void onLoad() {
BOTTOMSPACERHEIGHT = bottomspacer.getOffsetHeight();
EVENTHEIGHT = BOTTOMSPACERHEIGHT;
bottomSpacerHeight = bottomspacer.getOffsetHeight();
eventHeight = bottomSpacerHeight;
}

public void setMonthGrid(MonthGrid monthGrid) {
@@ -180,8 +180,8 @@ public class SimpleDayCell extends FocusableFlowPanel implements MouseUpHandler,
} else {
// Dynamic height by the content
DOM.removeElementAttribute(getElement(), "height");
slots = (intHeight - caption.getOffsetHeight() - BOTTOMSPACERHEIGHT)
/ EVENTHEIGHT;
slots = (intHeight - caption.getOffsetHeight() - bottomSpacerHeight)
/ eventHeight;
if (slots > 10) {
slots = 10;
}
@@ -221,11 +221,11 @@ public class SimpleDayCell extends FocusableFlowPanel implements MouseUpHandler,
}
}

int remainingSpace = intHeight - ((slots * EVENTHEIGHT)
+ BOTTOMSPACERHEIGHT + caption.getOffsetHeight());
int newHeight = remainingSpace + BOTTOMSPACERHEIGHT;
int remainingSpace = intHeight - ((slots * eventHeight)
+ bottomSpacerHeight + caption.getOffsetHeight());
int newHeight = remainingSpace + bottomSpacerHeight;
if (newHeight < 0) {
newHeight = EVENTHEIGHT;
newHeight = eventHeight;
}
bottomspacer.setHeight(newHeight + "px");


+ 3
- 3
compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/WeekGrid.java View File

@@ -540,7 +540,7 @@ public class WeekGrid extends SimplePanel {

public static class Timebar extends HTML {

private static final int[] timesFor12h = { 12, 1, 2, 3, 4, 5, 6, 7, 8,
private static final int[] TIMES_FOR_12H = { 12, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11 };

private int height;
@@ -601,7 +601,7 @@ public class WeekGrid extends SimplePanel {
for (int i = firstHour + 1; i <= amStop; i++) {
e = DOM.createDiv();
setStyleName(e, "v-calendar-time");
e.setInnerHTML("<span>" + timesFor12h[i] + "</span>"
e.setInnerHTML("<span>" + TIMES_FOR_12H[i] + "</span>"
+ " " + ampm[0]);
getElement().appendChild(e);
}
@@ -611,7 +611,7 @@ public class WeekGrid extends SimplePanel {
for (int i = pmStart; i < lastHour - 11; i++) {
e = DOM.createDiv();
setStyleName(e, "v-calendar-time");
e.setInnerHTML("<span>" + timesFor12h[i] + "</span>"
e.setInnerHTML("<span>" + TIMES_FOR_12H[i] + "</span>"
+ " " + ampm[1]);
getElement().appendChild(e);
}

+ 2
- 2
compatibility-client/src/main/java/com/vaadin/v7/client/ui/richtextarea/VRichTextToolbar.java View File

@@ -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,

+ 2
- 2
compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/ScrollbarBundle.java View File

@@ -50,7 +50,7 @@ import com.vaadin.v7.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 {
@@ -97,7 +97,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(

+ 6
- 6
compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java View File

@@ -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) {

+ 3
- 3
compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionEvent.java View File

@@ -32,7 +32,7 @@ import com.vaadin.v7.client.widgets.Grid;
@SuppressWarnings("rawtypes")
public class SelectionEvent<T> extends GwtEvent<SelectionHandler> {

private static final Type<SelectionHandler> eventType = new Type<SelectionHandler>();
private static final Type<SelectionHandler> EVENT_TYPE = new Type<SelectionHandler>();

private final Grid<T> grid;
private final List<T> added;
@@ -151,12 +151,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

+ 2
- 1
compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java View File

@@ -390,7 +390,8 @@ public class Escalator extends Widget
private boolean touching = false;
// Two movement objects for storing status and processing touches
private Movement yMov, xMov;
final double MIN_VEL = 0.6, MAX_VEL = 4, F_VEL = 1500, F_ACC = 0.7,
static final double MIN_VEL = 0.6, MAX_VEL = 4, F_VEL = 1500,
F_ACC = 0.7,
F_AXIS = 1;

// The object to deal with one direction scrolling

+ 1
- 1
compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java View File

@@ -4707,7 +4707,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

+ 4
- 4
compatibility-server/src/main/java/com/vaadin/v7/data/util/converter/DefaultConverterFactory.java View File

@@ -39,7 +39,7 @@ import com.vaadin.server.VaadinSession;
@Deprecated
public class DefaultConverterFactory implements ConverterFactory {

private static final Logger log = Logger
private static final Logger LOG = Logger
.getLogger(DefaultConverterFactory.class.getName());

@Override
@@ -48,7 +48,7 @@ public class DefaultConverterFactory implements ConverterFactory {
Converter<PRESENTATION, MODEL> converter = findConverter(
presentationType, modelType);
if (converter != null) {
log.finest(getClass().getName() + " created a "
LOG.finest(getClass().getName() + " created a "
+ converter.getClass());
return converter;
}
@@ -57,12 +57,12 @@ public class DefaultConverterFactory implements ConverterFactory {
Converter<MODEL, PRESENTATION> reverseConverter = findConverter(
modelType, presentationType);
if (reverseConverter != null) {
log.finest(getClass().getName() + " created a reverse "
LOG.finest(getClass().getName() + " created a reverse "
+ reverseConverter.getClass());
return new ReverseConverter<PRESENTATION, MODEL>(reverseConverter);
}

log.finest(getClass().getName() + " could not find a converter for "
LOG.finest(getClass().getName() + " could not find a converter for "
+ presentationType.getName() + " to " + modelType.getName()
+ " conversion");
return null;

+ 1
- 1
compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java View File

@@ -73,7 +73,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements

private TextChangeEventMode textChangeEventMode = TextChangeEventMode.LAZY;

private final int DEFAULT_TEXTCHANGE_TIMEOUT = 400;
private static final int DEFAULT_TEXTCHANGE_TIMEOUT = 400;

private int textChangeEventTimeout = DEFAULT_TEXTCHANGE_TIMEOUT;


+ 2
- 2
compatibility-server/src/main/java/com/vaadin/v7/ui/DefaultFieldFactory.java View File

@@ -38,7 +38,7 @@ import com.vaadin.v7.data.Property;
public class DefaultFieldFactory
implements FormFieldFactory, TableFieldFactory {

private static final DefaultFieldFactory instance = new DefaultFieldFactory();
private static final DefaultFieldFactory INSTANCE = new DefaultFieldFactory();

/**
* Singleton method to get an instance of DefaultFieldFactory.
@@ -46,7 +46,7 @@ public class DefaultFieldFactory
* @return an instance of DefaultFieldFactory
*/
public static DefaultFieldFactory get() {
return instance;
return INSTANCE;
}

protected DefaultFieldFactory() {

+ 36
- 38
compatibility-server/src/main/java/com/vaadin/v7/ui/Upload.java View File

@@ -282,15 +282,15 @@ public class Upload extends AbstractLegacyComponent
* the source of the file.
* @param filename
* the received file name.
* @param MIMEType
* @param mimeType
* the MIME type of the received file.
* @param length
* the length of the received file.
*/
public FinishedEvent(Upload source, String filename, String MIMEType,
public FinishedEvent(Upload source, String filename, String mimeType,
long length) {
super(source);
type = MIMEType;
type = mimeType;
this.filename = filename;
this.length = length;
}
@@ -349,13 +349,13 @@ public class Upload extends AbstractLegacyComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
* @param exception
*/
public FailedEvent(Upload source, String filename, String MIMEType,
public FailedEvent(Upload source, String filename, String mimeType,
long length, Exception reason) {
this(source, filename, MIMEType, length);
this(source, filename, mimeType, length);
this.reason = reason;
}

@@ -363,13 +363,13 @@ public class Upload extends AbstractLegacyComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
* @param exception
*/
public FailedEvent(Upload source, String filename, String MIMEType,
public FailedEvent(Upload source, String filename, String mimeType,
long length) {
super(source, filename, MIMEType, length);
super(source, filename, mimeType, length);
}

/**
@@ -393,12 +393,12 @@ public class Upload extends AbstractLegacyComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public NoOutputStreamEvent(Upload source, String filename,
String MIMEType, long length) {
super(source, filename, MIMEType, length);
String mimeType, long length) {
super(source, filename, mimeType, length);
}
}

@@ -412,14 +412,13 @@ public class Upload extends AbstractLegacyComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public NoInputStreamEvent(Upload source, String filename,
String MIMEType, long length) {
super(source, filename, MIMEType, length);
String mimeType, long length) {
super(source, filename, mimeType, length);
}

}

/**
@@ -436,14 +435,13 @@ public class Upload extends AbstractLegacyComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public SucceededEvent(Upload source, String filename, String MIMEType,
public SucceededEvent(Upload source, String filename, String mimeType,
long length) {
super(source, filename, MIMEType, length);
super(source, filename, mimeType, length);
}

}

/**
@@ -466,14 +464,14 @@ public class Upload extends AbstractLegacyComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public StartedEvent(Upload source, String filename, String MIMEType,
public StartedEvent(Upload source, String filename, String mimeType,
long contentLength) {
super(source);
this.filename = filename;
type = MIMEType;
type = mimeType;
length = contentLength;
}

@@ -862,11 +860,11 @@ public class Upload extends AbstractLegacyComponent
* Emit upload received event.
*
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
protected void fireStarted(String filename, String MIMEType) {
fireEvent(new Upload.StartedEvent(this, filename, MIMEType,
protected void fireStarted(String filename, String mimeType) {
fireEvent(new Upload.StartedEvent(this, filename, mimeType,
contentLength));
}

@@ -874,42 +872,42 @@ public class Upload extends AbstractLegacyComponent
* Emits the upload failed event.
*
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
protected void fireUploadInterrupted(String filename, String MIMEType,
protected void fireUploadInterrupted(String filename, String mimeType,
long length) {
fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length));
fireEvent(new Upload.FailedEvent(this, filename, mimeType, length));
}

protected void fireNoInputStream(String filename, String MIMEType,
protected void fireNoInputStream(String filename, String mimeType,
long length) {
fireEvent(new Upload.NoInputStreamEvent(this, filename, MIMEType,
fireEvent(new Upload.NoInputStreamEvent(this, filename, mimeType,
length));
}

protected void fireNoOutputStream(String filename, String MIMEType,
protected void fireNoOutputStream(String filename, String mimeType,
long length) {
fireEvent(new Upload.NoOutputStreamEvent(this, filename, MIMEType,
fireEvent(new Upload.NoOutputStreamEvent(this, filename, mimeType,
length));
}

protected void fireUploadInterrupted(String filename, String MIMEType,
protected void fireUploadInterrupted(String filename, String mimeType,
long length, Exception e) {
fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length, e));
fireEvent(new Upload.FailedEvent(this, filename, mimeType, length, e));
}

/**
* Emits the upload success event.
*
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*
*/
protected void fireUploadSuccess(String filename, String MIMEType,
protected void fireUploadSuccess(String filename, String mimeType,
long length) {
fireEvent(new Upload.SucceededEvent(this, filename, MIMEType, length));
fireEvent(new Upload.SucceededEvent(this, filename, mimeType, length));
}

/**

+ 6
- 6
compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerGrid.java View File

@@ -156,8 +156,8 @@ public class ColorPickerGrid extends AbstractComponent
private void sendChangedColors() {
if (!changedColors.isEmpty()) {
String[] colors = new String[changedColors.size()];
String[] XCoords = new String[changedColors.size()];
String[] YCoords = new String[changedColors.size()];
String[] xCoords = new String[changedColors.size()];
String[] yCoords = new String[changedColors.size()];
int counter = 0;
for (Point p : changedColors.keySet()) {
Color c = changedColors.get(p);
@@ -168,13 +168,13 @@ public class ColorPickerGrid extends AbstractComponent
String color = c.getCSS();

colors[counter] = color;
XCoords[counter] = String.valueOf(p.getX());
YCoords[counter] = String.valueOf(p.getY());
xCoords[counter] = String.valueOf(p.getX());
yCoords[counter] = String.valueOf(p.getY());
counter++;
}
getState().changedColor = colors;
getState().changedX = XCoords;
getState().changedY = YCoords;
getState().changedX = xCoords;
getState().changedY = yCoords;

changedColors.clear();
}

+ 8
- 8
compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerHistory.java View File

@@ -50,14 +50,14 @@ public class ColorPickerHistory extends CustomComponent
}

/** The rows. */
private static final int rows = 4;
private static final int ROWS = 4;

/** The columns. */
private static final int columns = 15;
private static final int COLUMNS = 15;

/** Temporary color history for when the component is detached. */
private ArrayBlockingQueue<Color> tempHistory = new ArrayBlockingQueue<Color>(
rows * columns);
ROWS * COLUMNS);

/** The grid. */
private final ColorPickerGrid grid;
@@ -68,7 +68,7 @@ public class ColorPickerHistory extends CustomComponent
public ColorPickerHistory() {
setPrimaryStyleName(STYLENAME);

grid = new ColorPickerGrid(rows, columns);
grid = new ColorPickerGrid(ROWS, COLUMNS);
grid.setWidth("100%");
grid.setPosition(0, 0);
grid.addColorChangeListener(this);
@@ -86,7 +86,7 @@ public class ColorPickerHistory extends CustomComponent
List<Color> tempColors = new ArrayList<Color>(tempHistory);
if (getSession().getAttribute("colorPickerHistory") == null) {
getSession().setAttribute("colorPickerHistory",
new ArrayBlockingQueue<Color>(rows * columns));
new ArrayBlockingQueue<Color>(ROWS * COLUMNS));
}
for (Color color : tempColors) {
setColor(color);
@@ -137,11 +137,11 @@ public class ColorPickerHistory extends CustomComponent
Collections.swap(colorList, colorList.indexOf(color), 0);

// Create 2d color map
Color[][] colors = new Color[rows][columns];
Color[][] colors = new Color[ROWS][COLUMNS];
Iterator<Color> iter = colorList.iterator();

for (int row = 0; row < rows; row++) {
for (int col = 0; col < columns; col++) {
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < COLUMNS; col++) {
if (iter.hasNext()) {
colors[row][col] = iter.next();
} else {

+ 4
- 4
compatibility-server/src/main/java/com/vaadin/v7/ui/components/colorpicker/ColorPickerPopup.java View File

@@ -265,7 +265,7 @@ public class ColorPickerPopup extends Window
rgbLayout.setStyleName("rgbtab");

// Add the RGB color gradient
rgbGradient = new ColorPickerGradient("rgb-gradient", RGBConverter);
rgbGradient = new ColorPickerGradient("rgb-gradient", rgbConverter);
rgbGradient.setColor(color);
rgbGradient.addColorChangeListener(this);
rgbLayout.addComponent(rgbGradient);
@@ -346,7 +346,7 @@ public class ColorPickerPopup extends Window
hsvLayout.setStyleName("hsvtab");

// Add the hsv gradient
hsvGradient = new ColorPickerGradient("hsv-gradient", HSVConverter);
hsvGradient = new ColorPickerGradient("hsv-gradient", hsvConverter);
hsvGradient.setColor(color);
hsvGradient.addColorChangeListener(this);
hsvLayout.addComponent(hsvGradient);
@@ -696,7 +696,7 @@ public class ColorPickerPopup extends Window
}

/** RGB color converter */
private Coordinates2Color RGBConverter = new Coordinates2Color() {
private Coordinates2Color rgbConverter = new Coordinates2Color() {

@Override
public Color calculate(int x, int y) {
@@ -733,7 +733,7 @@ public class ColorPickerPopup extends Window
};

/** HSV color converter */
Coordinates2Color HSVConverter = new Coordinates2Color() {
Coordinates2Color hsvConverter = new Coordinates2Color() {
@Override
public int[] calculate(Color color) {


+ 2
- 2
compatibility-server/src/main/java/com/vaadin/v7/util/SerializerHelper.java View File

@@ -107,7 +107,7 @@ public class SerializerHelper {
* List of primitive classes. Google App Engine has problems
* serializing/deserializing these (#3064).
*/
private static final Class<?>[] primitiveClasses = {
private static final Class<?>[] PRIMITIVE_CLASSES = {
byte.class, short.class, int.class, long.class, float.class,
double.class, boolean.class, char.class };

@@ -122,7 +122,7 @@ public class SerializerHelper {
*/
public static Class<?> resolveClass(String className)
throws ClassNotFoundException {
for (Class<?> c : primitiveClasses) {
for (Class<?> c : PRIMITIVE_CLASSES) {
if (className.equals(c.getName())) {
return c;
}

+ 1
- 1
compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/colorpicker/Color.java View File

@@ -39,7 +39,7 @@ public class Color implements Serializable {
private int blue;
private int alpha;

private String OUTOFRANGE = "Value must be within the range [0-255]. Was: ";
private static final String OUTOFRANGE = "Value must be within the range [0-255]. Was: ";

/**
* Creates a color that has the specified red, green, blue, and alpha values

+ 2
- 2
server/src/main/java/com/vaadin/data/BeanPropertySet.java View File

@@ -270,7 +270,7 @@ public class BeanPropertySet<T> implements PropertySet<T> {
}
}

private static final ConcurrentMap<Class<?>, BeanPropertySet<?>> instances = new ConcurrentHashMap<>();
private static final ConcurrentMap<Class<?>, BeanPropertySet<?>> INSTANCES = new ConcurrentHashMap<>();

private final Class<T> beanType;

@@ -306,7 +306,7 @@ public class BeanPropertySet<T> implements PropertySet<T> {
Objects.requireNonNull(beanType, "Bean type cannot be null");

// Cache the reflection results
return (PropertySet<T>) instances.computeIfAbsent(beanType,
return (PropertySet<T>) INSTANCES.computeIfAbsent(beanType,
BeanPropertySet::new);
}


+ 2
- 2
server/src/main/java/com/vaadin/event/dd/acceptcriteria/AcceptAll.java View File

@@ -29,13 +29,13 @@ import com.vaadin.event.dd.DragAndDropEvent;
public final class AcceptAll extends ClientSideCriterion {

private static final long serialVersionUID = 7406683402153141461L;
private static final AcceptCriterion singleton = new AcceptAll();
private static final AcceptCriterion SINGLETON = new AcceptAll();

private AcceptAll() {
}

public static AcceptCriterion get() {
return singleton;
return SINGLETON;
}

@Override

+ 2
- 2
server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIsTarget.java View File

@@ -35,7 +35,7 @@ import com.vaadin.ui.Component;
public class SourceIsTarget extends ClientSideCriterion {

private static final long serialVersionUID = -451399314705532584L;
private static final SourceIsTarget instance = new SourceIsTarget();
private static final SourceIsTarget INSTANCE = new SourceIsTarget();

private SourceIsTarget() {
}
@@ -52,7 +52,7 @@ public class SourceIsTarget extends ClientSideCriterion {
}

public static synchronized SourceIsTarget get() {
return instance;
return INSTANCE;
}

}

+ 2
- 2
server/src/main/java/com/vaadin/server/AbstractClientConnector.java View File

@@ -99,7 +99,7 @@ public abstract class AbstractClientConnector
* ShareState classes. Using WeakHashMap since entries are recalculated on
* demand.
*/
private static final Map<Class<? extends AbstractClientConnector>, Class<? extends SharedState>> stateTypeCache = Collections
private static final Map<Class<? extends AbstractClientConnector>, Class<? extends SharedState>> STATE_TYPE_CACHE = Collections
.synchronizedMap(new WeakHashMap<>());

@Override
@@ -315,7 +315,7 @@ public abstract class AbstractClientConnector
// exceptions flying around
if (stateType == null) {
// Cache because we don't need to do this once per instance
stateType = stateTypeCache.computeIfAbsent(this.getClass(),
stateType = STATE_TYPE_CACHE.computeIfAbsent(this.getClass(),
key -> findStateType());
}


+ 9
- 9
server/src/main/java/com/vaadin/server/ComponentSizeValidator.java View File

@@ -371,13 +371,13 @@ public class ComponentSizeValidator implements Serializable {
private static void showComponent(Component component, String attribute,
StringBuilder err, StringBuilder indent, boolean widthError) {

FileLocation createLoc = creationLocations.get(component);
FileLocation createLoc = CREATION_LOCATIONS.get(component);

FileLocation sizeLoc;
if (widthError) {
sizeLoc = widthLocations.get(component);
sizeLoc = WIDTH_LOCATIONS.get(component);
} else {
sizeLoc = heightLocations.get(component);
sizeLoc = HEIGHT_LOCATIONS.get(component);
}

err.append(indent);
@@ -600,9 +600,9 @@ public class ComponentSizeValidator implements Serializable {

}

private static final Map<Object, FileLocation> creationLocations = new HashMap<>();
private static final Map<Object, FileLocation> widthLocations = new HashMap<>();
private static final Map<Object, FileLocation> heightLocations = new HashMap<>();
private static final Map<Object, FileLocation> CREATION_LOCATIONS = new HashMap<>();
private static final Map<Object, FileLocation> WIDTH_LOCATIONS = new HashMap<>();
private static final Map<Object, FileLocation> HEIGHT_LOCATIONS = new HashMap<>();

public static class FileLocation implements Serializable {
public String method;
@@ -622,15 +622,15 @@ public class ComponentSizeValidator implements Serializable {
}

public static void setCreationLocation(Object object) {
setLocation(creationLocations, object);
setLocation(CREATION_LOCATIONS, object);
}

public static void setWidthLocation(Object object) {
setLocation(widthLocations, object);
setLocation(WIDTH_LOCATIONS, object);
}

public static void setHeightLocation(Object object) {
setLocation(heightLocations, object);
setLocation(HEIGHT_LOCATIONS, object);
}

private static void setLocation(Map<Object, FileLocation> map,

+ 2
- 2
server/src/main/java/com/vaadin/server/DefaultSystemMessagesProvider.java View File

@@ -25,7 +25,7 @@ package com.vaadin.server;
*/
public class DefaultSystemMessagesProvider implements SystemMessagesProvider {

private static final DefaultSystemMessagesProvider instance = new DefaultSystemMessagesProvider();
private static final DefaultSystemMessagesProvider INSTANCE = new DefaultSystemMessagesProvider();

private DefaultSystemMessagesProvider() {
// Singleton
@@ -43,7 +43,7 @@ public class DefaultSystemMessagesProvider implements SystemMessagesProvider {
* @return the default system messages provider.
*/
public static SystemMessagesProvider get() {
return instance;
return INSTANCE;
}

}

+ 2
- 2
server/src/main/java/com/vaadin/server/GlobalResourceHandler.java View File

@@ -60,7 +60,7 @@ public class GlobalResourceHandler implements RequestHandler {
private int nextLegacyId = 0;

// APP/global/[uiid]/[type]/[id]
private static final Pattern pattern = Pattern
private static final Pattern PATTERN = Pattern
.compile("^/?" + ApplicationConstants.APP_PATH + '/'
+ RESOURCE_REQUEST_PATH + "(\\d+)/(([^/]+)(/.*))");

@@ -72,7 +72,7 @@ public class GlobalResourceHandler implements RequestHandler {
return false;
}

Matcher matcher = pattern.matcher(pathInfo);
Matcher matcher = PATTERN.matcher(pathInfo);
if (!matcher.matches()) {
return false;
}

+ 17
- 17
server/src/main/java/com/vaadin/server/JsonCodec.java View File

@@ -206,19 +206,19 @@ public class JsonCodec implements Serializable {
* happens to process Vaadin requests, so it must be protected from
* corruption caused by concurrent access.
*/
private static final ConcurrentMap<Class<?>, Collection<BeanProperty>> typePropertyCache = new ConcurrentHashMap<>();
private static final ConcurrentMap<Class<?>, Collection<BeanProperty>> TYPE_PROPERTY_CACHE = new ConcurrentHashMap<>();

private static final Map<Class<?>, String> typeToTransportType = new HashMap<>();
private static final Map<Class<?>, String> TYPE_TO_TRANSPORT_TYPE = new HashMap<>();

/**
* Note! This does not contain primitives.
* <p>
*/
private static final Map<String, Class<?>> transportTypeToType = new HashMap<>();
private static final Map<String, Class<?>> TRANSPORT_TYPE_TO_TYPE = new HashMap<>();

private static final Map<Class<?>, JSONSerializer<?>> customSerializers = new HashMap<>();
private static final Map<Class<?>, JSONSerializer<?>> CUSTOM_SERIALIZERS = new HashMap<>();
static {
customSerializers.put(Date.class, new DateSerializer());
CUSTOM_SERIALIZERS.put(Date.class, new DateSerializer());
}

static {
@@ -244,14 +244,14 @@ public class JsonCodec implements Serializable {
}

private static void registerType(Class<?> type, String transportType) {
typeToTransportType.put(type, transportType);
TYPE_TO_TRANSPORT_TYPE.put(type, transportType);
if (!type.isPrimitive()) {
transportTypeToType.put(transportType, type);
TRANSPORT_TYPE_TO_TYPE.put(transportType, type);
}
}

public static boolean isInternalTransportType(String transportType) {
return transportTypeToType.containsKey(transportType);
return TRANSPORT_TYPE_TO_TYPE.containsKey(transportType);
}

public static boolean isInternalType(Type type) {
@@ -267,7 +267,7 @@ public class JsonCodec implements Serializable {
// value
return true;
}
return typeToTransportType.containsKey(getClassForType(type));
return TYPE_TO_TRANSPORT_TYPE.containsKey(getClassForType(type));
}

private static Class<?> getClassForType(Type type) {
@@ -281,7 +281,7 @@ public class JsonCodec implements Serializable {
}

private static Class<?> getType(String transportType) {
return transportTypeToType.get(transportType);
return TRANSPORT_TYPE_TO_TYPE.get(transportType);
}

public static Object decodeInternalOrCustomType(Type targetType,
@@ -329,8 +329,8 @@ public class JsonCodec implements Serializable {
Class<?> classForType = getClassForType(targetType);
return decodeEnum(classForType.asSubclass(Enum.class),
(JsonString) value);
} else if (customSerializers.containsKey(getClassForType(targetType))) {
return customSerializers.get(getClassForType(targetType))
} else if (CUSTOM_SERIALIZERS.containsKey(getClassForType(targetType))) {
return CUSTOM_SERIALIZERS.get(getClassForType(targetType))
.deserialize(targetType, value, connectorTracker);
} else {
return decodeObject(targetType, (JsonObject) value,
@@ -669,7 +669,7 @@ public class JsonCodec implements Serializable {
toReturn = Json.create(((Connector) value).getConnectorId());
} else if (value instanceof Enum) {
toReturn = Json.create(((Enum<?>) value).name());
} else if (customSerializers.containsKey(value.getClass())) {
} else if (CUSTOM_SERIALIZERS.containsKey(value.getClass())) {
toReturn = serializeJson(value, connectorTracker);
} else if (valueType instanceof GenericArrayType) {
toReturn = encodeArrayContents(
@@ -695,7 +695,7 @@ public class JsonCodec implements Serializable {

public static Collection<BeanProperty> getProperties(Class<?> type)
throws IntrospectionException {
Collection<BeanProperty> cachedProperties = typePropertyCache.get(type);
Collection<BeanProperty> cachedProperties = TYPE_PROPERTY_CACHE.get(type);
if (cachedProperties != null) {
return cachedProperties;
}
@@ -706,7 +706,7 @@ public class JsonCodec implements Serializable {

// Doesn't matter if the same calculation is done multiple times from
// different threads, so there's no need to do e.g. putIfAbsent
typePropertyCache.put(type, properties);
TYPE_PROPERTY_CACHE.put(type, properties);
return properties;
}

@@ -982,12 +982,12 @@ public class JsonCodec implements Serializable {
* of the hot part.
*/
private static String getInternalTransportType(Type valueType) {
return typeToTransportType.get(getClassForType(valueType));
return TYPE_TO_TRANSPORT_TYPE.get(getClassForType(valueType));
}

private static JsonValue serializeJson(Object value,
ConnectorTracker connectorTracker) {
JSONSerializer serializer = customSerializers.get(value.getClass());
JSONSerializer serializer = CUSTOM_SERIALIZERS.get(value.getClass());
return serializer.serialize(value, connectorTracker);
}


+ 3
- 3
server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java View File

@@ -82,7 +82,7 @@ public class LegacyCommunicationManager implements Serializable {
return session;
}

private static final ConcurrentHashMap<Class<? extends SharedState>, JsonValue> referenceDiffStates = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<Class<? extends SharedState>, JsonValue> REFERENCE_DIFF_STATES = new ConcurrentHashMap<>();

/**
* @deprecated As of 7.1. See #11411.
@@ -98,10 +98,10 @@ public class LegacyCommunicationManager implements Serializable {
if (diffState == null) {
// Use an empty state object as reference for full
// repaints
diffState = referenceDiffStates.get(stateType);
diffState = REFERENCE_DIFF_STATES.get(stateType);
if (diffState == null) {
diffState = createReferenceDiffStateState(stateType);
referenceDiffStates.put(stateType, diffState);
REFERENCE_DIFF_STATES.put(stateType, diffState);
}
}
EncodeResult encodeResult = JsonCodec.encode(state, diffState,

+ 2
- 2
server/src/main/java/com/vaadin/server/LegacyVaadinPortlet.java View File

@@ -24,7 +24,7 @@ import com.vaadin.util.ReflectTools;

public class LegacyVaadinPortlet extends VaadinPortlet {

private static final LegacyApplicationUIProvider provider = new LegacyApplicationUIProvider() {
private static final LegacyApplicationUIProvider PROVIDER = new LegacyApplicationUIProvider() {
@Override
protected LegacyApplication createApplication() {
VaadinPortlet portlet = VaadinPortlet.getCurrent();
@@ -80,7 +80,7 @@ public class LegacyVaadinPortlet extends VaadinPortlet {

private void onVaadinSessionStarted(VaadinPortletRequest request,
VaadinPortletSession session) throws PortletException {
session.addUIProvider(provider);
session.addUIProvider(PROVIDER);
}

protected boolean shouldCreateApplication(PortletRequest request) {

+ 2
- 2
server/src/main/java/com/vaadin/server/LegacyVaadinServlet.java View File

@@ -24,7 +24,7 @@ import com.vaadin.util.ReflectTools;

public class LegacyVaadinServlet extends VaadinServlet {

private static final UIProvider provider = new LegacyApplicationUIProvider() {
private static final UIProvider PROVIDER = new LegacyApplicationUIProvider() {
@Override
protected LegacyApplication createApplication() {

@@ -84,7 +84,7 @@ public class LegacyVaadinServlet extends VaadinServlet {

private void onVaadinSessionStarted(VaadinRequest request,
VaadinSession session) throws ServletException {
session.addUIProvider(provider);
session.addUIProvider(PROVIDER);
}

}

+ 5
- 5
server/src/main/java/com/vaadin/server/LocaleService.java View File

@@ -177,15 +177,15 @@ public class LocaleService implements Serializable {

localeData.dateFormat = datePattern.trim();

final boolean twelve_hour_clock = timePattern.indexOf("a") > -1;
final boolean twelveHourClock = timePattern.indexOf("a") > -1;
// TODO there are other possibilities as well, like 'h' in french
// (ignore them, too complicated)
final String hour_min_delimiter = timePattern.indexOf(".") > -1 ? "."
final String hourMinDelimiter = timePattern.indexOf(".") > -1 ? "."
: ":";

localeData.twelveHourClock = twelve_hour_clock;
localeData.hourMinuteDelimiter = hour_min_delimiter;
if (twelve_hour_clock) {
localeData.twelveHourClock = twelveHourClock;
localeData.hourMinuteDelimiter = hourMinDelimiter;
if (twelveHourClock) {
final String[] ampm = dfs.getAmPmStrings();
localeData.am = ampm[0];
localeData.pm = ampm[1];

+ 2
- 2
server/src/main/java/com/vaadin/server/ServerRpcManager.java View File

@@ -68,7 +68,7 @@ public class ServerRpcManager<T extends ServerRpc> implements Serializable {

}

private static final Map<Class<?>, Class<?>> boxedTypes = new HashMap<>();
private static final Map<Class<?>, Class<?>> BOXED_TYPES = new HashMap<>();
static {
try {
Class<?>[] boxClasses = new Class<?>[] { Boolean.class, Byte.class,
@@ -77,7 +77,7 @@ public class ServerRpcManager<T extends ServerRpc> implements Serializable {
for (Class<?> boxClass : boxClasses) {
Field typeField = boxClass.getField("TYPE");
Class<?> primitiveType = (Class<?>) typeField.get(boxClass);
boxedTypes.put(primitiveType, boxClass);
BOXED_TYPES.put(primitiveType, boxClass);
}
} catch (Exception e) {
throw new RuntimeException(e);

+ 3
- 3
server/src/main/java/com/vaadin/server/ServerRpcMethodInvocation.java View File

@@ -24,7 +24,7 @@ import com.vaadin.shared.communication.ServerRpc;

public class ServerRpcMethodInvocation extends MethodInvocation {

private static final Map<String, Method> invocationMethodCache = new ConcurrentHashMap<>(
private static final Map<String, Method> INVOCATION_METHOD_CACHE = new ConcurrentHashMap<>(
128, 0.75f, 1);

private final Method method;
@@ -67,14 +67,14 @@ public class ServerRpcMethodInvocation extends MethodInvocation {
// signature
String signature = targetType.getName() + "." + methodName + "("
+ parameterCount;
Method invocationMethod = invocationMethodCache.get(signature);
Method invocationMethod = INVOCATION_METHOD_CACHE.get(signature);

if (invocationMethod == null) {
invocationMethod = doFindInvocationMethod(targetType, methodName,
parameterCount);

if (invocationMethod != null) {
invocationMethodCache.put(signature, invocationMethod);
INVOCATION_METHOD_CACHE.put(signature, invocationMethod);
}
}


+ 3
- 3
server/src/main/java/com/vaadin/server/SizeWithUnit.java View File

@@ -32,7 +32,7 @@ import com.vaadin.shared.util.SharedUtil;
public class SizeWithUnit implements Serializable {
private final float size;
private final Unit unit;
private static final Pattern sizePattern = Pattern
private static final Pattern SIZE_PATTERN = Pattern
.compile(SharedUtil.SIZE_PATTERN);

/**
@@ -90,7 +90,7 @@ public class SizeWithUnit implements Serializable {
}
float size = 0;
Unit unit = null;
Matcher matcher = sizePattern.matcher(s);
Matcher matcher = SIZE_PATTERN.matcher(s);
if (matcher.find()) {
size = Float.parseFloat(matcher.group(1));
if (size < 0) {
@@ -107,7 +107,7 @@ public class SizeWithUnit implements Serializable {
}
} else {
throw new IllegalArgumentException("Invalid size argument: \"" + s
+ "\" (should match " + sizePattern.pattern() + ")");
+ "\" (should match " + SIZE_PATTERN.pattern() + ")");
}
return new SizeWithUnit(size, unit);
}

+ 8
- 8
server/src/main/java/com/vaadin/server/StreamResource.java View File

@@ -41,7 +41,7 @@ public class StreamResource implements ConnectorResource {
/**
* Explicit mime-type.
*/
private String MIMEType = null;
private String mimeType = null;

/**
* Filename.
@@ -76,8 +76,8 @@ public class StreamResource implements ConnectorResource {
*/
@Override
public String getMIMEType() {
if (MIMEType != null) {
return MIMEType;
if (mimeType != null) {
return mimeType;
}
return FileTypeResolver.getMIMEType(filename);
}
@@ -85,11 +85,11 @@ public class StreamResource implements ConnectorResource {
/**
* Sets the mime type of the resource.
*
* @param MIMEType
* @param mimeType
* the MIME type to be set.
*/
public void setMIMEType(String MIMEType) {
this.MIMEType = MIMEType;
public void setMIMEType(String mimeType) {
this.mimeType = mimeType;
}

/**
@@ -223,7 +223,7 @@ public class StreamResource implements ConnectorResource {
} else if (obj instanceof StreamResource) {
StreamResource that = (StreamResource) obj;
return SharedUtil.equals(getStreamSource(), that.getStreamSource())
&& SharedUtil.equals(MIMEType, that.MIMEType)
&& SharedUtil.equals(mimeType, that.mimeType)
&& SharedUtil.equals(getFilename(), that.getFilename())
&& getBufferSize() == that.getBufferSize()
&& getCacheTime() == that.getCacheTime();
@@ -234,7 +234,7 @@ public class StreamResource implements ConnectorResource {

@Override
public int hashCode() {
return Arrays.hashCode(new Object[] { getStreamSource(), MIMEType,
return Arrays.hashCode(new Object[] { getStreamSource(), mimeType,
getFilename(), getBufferSize(), getCacheTime() });
}


+ 14
- 14
server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java View File

@@ -92,15 +92,15 @@ public class ClassPathExplorer {
* entries that could include widgets/widgetsets are listed (primarily
* directories, Vaadin JARs and add-on JARs).
*/
private static final List<String> rawClasspathEntries = getRawClasspathEntries();
private static final List<String> RAW_CLASSPATH_ENTRIES = getRawClasspathEntries();

/**
* Map from identifiers (either a package name preceded by the path and a
* slash, or a URL for a JAR file) to the corresponding URLs. This is
* constructed from the class path.
*/
private static final Map<String, URL> classpathLocations = getClasspathLocations(
rawClasspathEntries);
private static final Map<String, URL> CLASSPATH_LOCATIONS = getClasspathLocations(
RAW_CLASSPATH_ENTRIES);

private static boolean debug = false;

@@ -138,7 +138,7 @@ public class ClassPathExplorer {
long start = System.currentTimeMillis();
Map<String, URL> widgetsets = new HashMap<>();
Map<String, URL> themes = new HashMap<>();
Set<String> keySet = classpathLocations.keySet();
Set<String> keySet = CLASSPATH_LOCATIONS.keySet();
for (String location : keySet) {
searchForWidgetSetsAndAddonStyles(location, widgetsets, themes);
}
@@ -179,16 +179,16 @@ public class ClassPathExplorer {
* "Vaadin-Widgetsets" attribute in its manifest are added to widgetsets.
*
* @param locationString
* an entry in {@link #classpathLocations}
* an entry in {@link #CLASSPATH_LOCATIONS}
* @param widgetsets
* a map from widgetset name (including package, with dots as
* separators) to a URL (see {@link #classpathLocations}) - new
* separators) to a URL (see {@link #CLASSPATH_LOCATIONS}) - new
* entries are added to this map
*/
private static void searchForWidgetSetsAndAddonStyles(String locationString,
Map<String, URL> widgetsets, Map<String, URL> addonStyles) {

URL location = classpathLocations.get(locationString);
URL location = CLASSPATH_LOCATIONS.get(locationString);
File directory = new File(location.getFile());

if (directory.exists() && !directory.isHidden()) {
@@ -329,12 +329,12 @@ public class ClassPathExplorer {
* Determine every URL location defined by the current classpath, and it's
* associated package name.
*
* See {@link #classpathLocations} for information on output format.
* See {@link #CLASSPATH_LOCATIONS} for information on output format.
*
* @param rawClasspathEntries
* raw class path entries as split from the Java class path
* string
* @return map of classpath locations, see {@link #classpathLocations}
* @return map of classpath locations, see {@link #CLASSPATH_LOCATIONS}
*/
private static final Map<String, URL> getClasspathLocations(
List<String> rawClasspathEntries) {
@@ -419,7 +419,7 @@ public class ClassPathExplorer {

/**
* Recursively add subdirectories and jar files to locations - see
* {@link #classpathLocations}.
* {@link #CLASSPATH_LOCATIONS}.
*
* @param name
* @param file
@@ -465,7 +465,7 @@ public class ClassPathExplorer {
}

/**
* Add a jar file to locations - see {@link #classpathLocations}.
* Add a jar file to locations - see {@link #CLASSPATH_LOCATIONS}.
*
* @param file
* @param locations
@@ -522,14 +522,14 @@ public class ClassPathExplorer {
if (debug) {
debug("classpathLocations values:");
List<String> locations = new ArrayList<>(
classpathLocations.keySet());
CLASSPATH_LOCATIONS.keySet());
for (String location : locations) {
debug(String.valueOf(classpathLocations.get(location)));
debug(String.valueOf(CLASSPATH_LOCATIONS.get(location)));
}
}

URL firstDirectory = null;
for (String entry : rawClasspathEntries) {
for (String entry : RAW_CLASSPATH_ENTRIES) {

File directory = new File(entry);
if (directory.exists() && !directory.isHidden()

+ 2
- 2
server/src/main/java/com/vaadin/ui/AbstractComponent.java View File

@@ -1251,7 +1251,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
* implementation
*/
protected Collection<String> getCustomAttributes() {
List<String> l = new ArrayList<>(Arrays.asList(customAttributes));
List<String> l = new ArrayList<>(Arrays.asList(CUSTOM_ATTRIBUTES));
if (this instanceof Focusable) {
l.add("tab-index");
l.add("tabindex");
@@ -1259,7 +1259,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
return l;
}

private static final String[] customAttributes = { "width", "height",
private static final String[] CUSTOM_ATTRIBUTES = { "width", "height",
"debug-id", "error", "width-auto", "height-auto", "width-full",
"height-full", "size-auto", "size-full", "immediate", "locale",
"read-only", "_id" };

+ 33
- 35
server/src/main/java/com/vaadin/ui/Upload.java View File

@@ -280,15 +280,15 @@ public class Upload extends AbstractComponent
* the source of the file.
* @param filename
* the received file name.
* @param MIMEType
* @param mimeType
* the MIME type of the received file.
* @param length
* the length of the received file.
*/
public FinishedEvent(Upload source, String filename, String MIMEType,
public FinishedEvent(Upload source, String filename, String mimeType,
long length) {
super(source);
type = MIMEType;
type = mimeType;
this.filename = filename;
this.length = length;
}
@@ -346,13 +346,13 @@ public class Upload extends AbstractComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
* @param reason
*/
public FailedEvent(Upload source, String filename, String MIMEType,
public FailedEvent(Upload source, String filename, String mimeType,
long length, Exception reason) {
this(source, filename, MIMEType, length);
this(source, filename, mimeType, length);
this.reason = reason;
}

@@ -360,12 +360,12 @@ public class Upload extends AbstractComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public FailedEvent(Upload source, String filename, String MIMEType,
public FailedEvent(Upload source, String filename, String mimeType,
long length) {
super(source, filename, MIMEType, length);
super(source, filename, mimeType, length);
}

/**
@@ -388,12 +388,12 @@ public class Upload extends AbstractComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public NoOutputStreamEvent(Upload source, String filename,
String MIMEType, long length) {
super(source, filename, MIMEType, length);
String mimeType, long length) {
super(source, filename, mimeType, length);
}
}

@@ -406,14 +406,13 @@ public class Upload extends AbstractComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public NoInputStreamEvent(Upload source, String filename,
String MIMEType, long length) {
super(source, filename, MIMEType, length);
String mimeType, long length) {
super(source, filename, mimeType, length);
}

}

/**
@@ -429,14 +428,13 @@ public class Upload extends AbstractComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
public SucceededEvent(Upload source, String filename, String MIMEType,
public SucceededEvent(Upload source, String filename, String mimeType,
long length) {
super(source, filename, MIMEType, length);
super(source, filename, mimeType, length);
}

}

/**
@@ -458,14 +456,14 @@ public class Upload extends AbstractComponent
*
* @param source
* @param filename
* @param MIMEType
* @param mimeType
* @param contentLength
*/
public StartedEvent(Upload source, String filename, String MIMEType,
public StartedEvent(Upload source, String filename, String mimeType,
long contentLength) {
super(source);
this.filename = filename;
type = MIMEType;
type = mimeType;
length = contentLength;
}

@@ -783,10 +781,10 @@ public class Upload extends AbstractComponent
* Emit upload received event.
*
* @param filename
* @param MIMEType
* @param mimeType
*/
protected void fireStarted(String filename, String MIMEType) {
fireEvent(new Upload.StartedEvent(this, filename, MIMEType,
protected void fireStarted(String filename, String mimeType) {
fireEvent(new Upload.StartedEvent(this, filename, mimeType,
contentLength));
}

@@ -794,29 +792,29 @@ public class Upload extends AbstractComponent
* Emits the upload failed event.
*
* @param filename
* @param MIMEType
* @param mimeType
* @param length
*/
protected void fireUploadInterrupted(String filename, String MIMEType,
protected void fireUploadInterrupted(String filename, String mimeType,
long length) {
fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length));
fireEvent(new Upload.FailedEvent(this, filename, mimeType, length));
}

protected void fireNoInputStream(String filename, String MIMEType,
protected void fireNoInputStream(String filename, String mimeType,
long length) {
fireEvent(new Upload.NoInputStreamEvent(this, filename, MIMEType,
fireEvent(new Upload.NoInputStreamEvent(this, filename, mimeType,
length));
}

protected void fireNoOutputStream(String filename, String MIMEType,
protected void fireNoOutputStream(String filename, String mimeType,
long length) {
fireEvent(new Upload.NoOutputStreamEvent(this, filename, MIMEType,
fireEvent(new Upload.NoOutputStreamEvent(this, filename, mimeType,
length));
}

protected void fireUploadInterrupted(String filename, String MIMEType,
protected void fireUploadInterrupted(String filename, String mimeType,
long length, Exception e) {
fireEvent(new Upload.FailedEvent(this, filename, MIMEType, length, e));
fireEvent(new Upload.FailedEvent(this, filename, mimeType, length, e));
}

/**

+ 6
- 6
server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java View File

@@ -59,7 +59,7 @@ public class DesignAttributeHandler implements Serializable {
return Logger.getLogger(DesignAttributeHandler.class.getName());
}

private static final Map<Class<?>, AttributeCacheEntry> cache = new ConcurrentHashMap<>();
private static final Map<Class<?>, AttributeCacheEntry> CACHE = new ConcurrentHashMap<>();

// translates string <-> object
private static final DesignFormatter FORMATTER = new DesignFormatter();
@@ -145,7 +145,7 @@ public class DesignAttributeHandler implements Serializable {
*/
public static Collection<String> getSupportedAttributes(Class<?> clazz) {
resolveSupportedAttributes(clazz);
return cache.get(clazz).getAttributes();
return CACHE.get(clazz).getAttributes();
}

/**
@@ -160,7 +160,7 @@ public class DesignAttributeHandler implements Serializable {
if (clazz == null) {
throw new IllegalArgumentException("The clazz can not be null");
}
if (cache.containsKey(clazz)) {
if (CACHE.containsKey(clazz)) {
// NO-OP
return;
}
@@ -184,7 +184,7 @@ public class DesignAttributeHandler implements Serializable {
entry.addAttribute(attribute, getter, setter);
}
}
cache.put(clazz, entry);
CACHE.put(clazz, entry);
}

/**
@@ -413,7 +413,7 @@ public class DesignAttributeHandler implements Serializable {
private static Method findSetterForAttribute(Class<?> clazz,
String attribute) {
resolveSupportedAttributes(clazz);
return cache.get(clazz).getSetter(attribute);
return CACHE.get(clazz).getSetter(attribute);
}

/**
@@ -429,7 +429,7 @@ public class DesignAttributeHandler implements Serializable {
private static Method findGetterForAttribute(Class<?> clazz,
String attribute) {
resolveSupportedAttributes(clazz);
return cache.get(clazz).getGetter(attribute);
return CACHE.get(clazz).getGetter(attribute);
}

/**

+ 7
- 7
server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java View File

@@ -185,22 +185,22 @@ public class DesignResourceConverter implements Converter<String, Resource> {
return ((ExternalResource) value).getURL();
}

private static final Map<Class<? extends Resource>, ResourceConverterByProtocol> typeToConverter = new HashMap<>();
private static final Map<Class<? extends Resource>, ResourceConverterByProtocol> TYPE_TO_CONVERTER = new HashMap<>();

static {
typeToConverter.put(ExternalResource.class, HTTP);
TYPE_TO_CONVERTER.put(ExternalResource.class, HTTP);
// ^ any of non-specialized would actually work
typeToConverter.put(ThemeResource.class, THEME);
typeToConverter.put(FontIcon.class, FONTICON);
typeToConverter.put(FileResource.class, FILE);
TYPE_TO_CONVERTER.put(ThemeResource.class, THEME);
TYPE_TO_CONVERTER.put(FontIcon.class, FONTICON);
TYPE_TO_CONVERTER.put(FileResource.class, FILE);

}

public static ResourceConverterByProtocol byType(
Class<? extends Resource> resourceType) {
for (Class<?> type : typeToConverter.keySet()) {
for (Class<?> type : TYPE_TO_CONVERTER.keySet()) {
if (type.isAssignableFrom(resourceType)) {
return typeToConverter.get(type);
return TYPE_TO_CONVERTER.get(type);
}
}
return null;

+ 9
- 9
server/src/main/java/com/vaadin/util/CurrentInstance.java View File

@@ -58,7 +58,7 @@ public class CurrentInstance implements Serializable {

private final WeakReference<Object> instance;

private static final ThreadLocal<Map<Class<?>, CurrentInstance>> instances = new ThreadLocal<>();
private static final ThreadLocal<Map<Class<?>, CurrentInstance>> INSTANCES = new ThreadLocal<>();

private CurrentInstance(Object instance) {
this.instance = new WeakReference<>(instance);
@@ -73,7 +73,7 @@ public class CurrentInstance implements Serializable {
* if there is no current instance.
*/
public static <T> T get(Class<T> type) {
Map<Class<?>, CurrentInstance> map = instances.get();
Map<Class<?>, CurrentInstance> map = INSTANCES.get();
if (map == null) {
return null;
}
@@ -97,7 +97,7 @@ public class CurrentInstance implements Serializable {
removeStaleInstances(map);

if (map.isEmpty()) {
instances.remove();
INSTANCES.remove();
}

return null;
@@ -135,14 +135,14 @@ public class CurrentInstance implements Serializable {
* the actual instance
*/
public static <T> CurrentInstance set(Class<T> type, T instance) {
Map<Class<?>, CurrentInstance> map = instances.get();
Map<Class<?>, CurrentInstance> map = INSTANCES.get();
CurrentInstance previousInstance = null;
if (instance == null) {
// remove the instance
if (map != null) {
previousInstance = map.remove(type);
if (map.isEmpty()) {
instances.remove();
INSTANCES.remove();
map = null;
}
}
@@ -150,7 +150,7 @@ public class CurrentInstance implements Serializable {
assert type.isInstance(instance) : "Invald instance type";
if (map == null) {
map = new HashMap<>();
instances.set(map);
INSTANCES.set(map);
}

previousInstance = map.put(type, new CurrentInstance(instance));
@@ -165,7 +165,7 @@ public class CurrentInstance implements Serializable {
* Clears all current instances.
*/
public static void clearAll() {
instances.remove();
INSTANCES.remove();
}

/**
@@ -220,7 +220,7 @@ public class CurrentInstance implements Serializable {
* @return a map containing the current instances
*/
public static Map<Class<?>, CurrentInstance> getInstances() {
Map<Class<?>, CurrentInstance> map = instances.get();
Map<Class<?>, CurrentInstance> map = INSTANCES.get();
if (map == null) {
return Collections.emptyMap();
} else {
@@ -237,7 +237,7 @@ public class CurrentInstance implements Serializable {
if (removeStale) {
removeStaleInstances(map);
if (map.isEmpty()) {
instances.remove();
INSTANCES.remove();
}
}
return copy;

+ 8
- 8
server/src/main/java/com/vaadin/util/FileTypeResolver.java View File

@@ -54,7 +54,7 @@ public class FileTypeResolver implements Serializable {
/**
* Initial file extension to mime-type mapping.
*/
private static final String initialExtToMIMEMap = "application/cu-seeme csm cu,"
private static final String INITIAL_EXT_TO_MIME_MAP = "application/cu-seeme csm cu,"
+ "application/dsptype tsp,"
+ "application/futuresplash spl,"
+ "application/mac-binhex40 hqx,"
@@ -221,7 +221,7 @@ public class FileTypeResolver implements Serializable {
static {

// Initialize extension to MIME map
final StringTokenizer lines = new StringTokenizer(initialExtToMIMEMap,
final StringTokenizer lines = new StringTokenizer(INITIAL_EXT_TO_MIME_MAP,
",");
while (lines.hasMoreTokens()) {
final String line = lines.nextToken();
@@ -356,24 +356,24 @@ public class FileTypeResolver implements Serializable {
* @param extension
* the filename extension to be associated with
* <code>MIMEType</code>.
* @param MIMEType
* @param mimeType
* the new mime-type for <code>extension</code>.
*/
public static void addExtension(String extension, String MIMEType) {
EXT_TO_MIME_MAP.put(extension.toLowerCase(Locale.ROOT), MIMEType);
public static void addExtension(String extension, String mimeType) {
EXT_TO_MIME_MAP.put(extension.toLowerCase(Locale.ROOT), mimeType);
}

/**
* Adds a icon for the given mime-type. If the mime-type also has a
* corresponding icon, it is replaced with the new icon.
*
* @param MIMEType
* @param mimeType
* the mime-type whose icon is to be changed.
* @param icon
* the new icon to be associated with <code>MIMEType</code>.
*/
public static void addIcon(String MIMEType, Resource icon) {
MIME_TO_ICON_MAP.put(MIMEType, icon);
public static void addIcon(String mimeType, Resource icon) {
MIME_TO_ICON_MAP.put(mimeType, icon);
}

/**

+ 3
- 3
server/src/main/java/com/vaadin/util/TimeZoneUtil.java View File

@@ -104,7 +104,7 @@ public final class TimeZoneUtil implements Serializable {
}
info.id = zoneId.getId();
info.transitions = transitionsList.stream().mapToLong(l -> l).toArray();
info.std_offset = (int) Duration.ofMillis(timeZone.getRawOffset())
info.stdOffset = (int) Duration.ofMillis(timeZone.getRawOffset())
.toMinutes();
info.names = new String[] {
timeZone.getDisplayName(false, TimeZone.SHORT, locale),
@@ -119,7 +119,7 @@ public final class TimeZoneUtil implements Serializable {
JreJsonFactory factory = new JreJsonFactory();
JsonObject object = factory.createObject();
object.put("id", info.id);
object.put("std_offset", info.std_offset);
object.put("std_offset", info.stdOffset);
object.put("names", getArray(factory, info.names));
object.put("transitions", getArray(factory, info.transitions));
return JsonUtil.stringify(object);
@@ -143,7 +143,7 @@ public final class TimeZoneUtil implements Serializable {

private static class TimeZoneInfo implements Serializable {
String id;
int std_offset;
int stdOffset;
String[] names;
long[] transitions;
}

+ 1
- 1
server/src/test/java/com/vaadin/data/BeanPropertySetTest.java View File

@@ -66,7 +66,7 @@ public class BeanPropertySetTest {
// Simulate deserializing into a different JVM by clearing the instance
// map
Field instancesField = BeanPropertySet.class
.getDeclaredField("instances");
.getDeclaredField("INSTANCES");
instancesField.setAccessible(true);
Map<?, ?> instances = (Map<?, ?>) instancesField.get(null);
instances.clear();

+ 1
- 1
server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java View File

@@ -88,7 +88,7 @@ public class AbstractClientConnectorTest {
NoSuchFieldException, SecurityException, InterruptedException,
ClassNotFoundException {
Field stateTypeCacheField = AbstractClientConnector.class
.getDeclaredField("stateTypeCache");
.getDeclaredField("STATE_TYPE_CACHE");
stateTypeCacheField.setAccessible(true);
Map<Class<?>, ?> stateTypeCache = (Map<Class<?>, ?>) stateTypeCacheField
.get(null);

+ 1
- 1
server/src/test/java/com/vaadin/util/CurrentInstanceTest.java View File

@@ -77,7 +77,7 @@ public class CurrentInstanceTest {
private ThreadLocal<Map<Class<?>, CurrentInstance>> getInternalCurrentInstanceVariable()
throws SecurityException, NoSuchFieldException,
IllegalAccessException {
Field f = CurrentInstance.class.getDeclaredField("instances");
Field f = CurrentInstance.class.getDeclaredField("INSTANCES");
f.setAccessible(true);
return (ThreadLocal<Map<Class<?>, CurrentInstance>>) f.get(null);
}

+ 5
- 5
shared/src/main/java/com/vaadin/shared/communication/URLReference.java View File

@@ -19,7 +19,7 @@ import java.io.Serializable;

public class URLReference implements Serializable {

private String URL;
private String url;

/**
* Returns the URL that this object refers to.
@@ -29,15 +29,15 @@ public class URLReference implements Serializable {
* @return The URL for this reference or null if unknown.
*/
public String getURL() {
return URL;
return url;
}

/**
* Sets the URL that this object refers to.
*
* @param URL
* @param url
*/
public void setURL(String URL) {
this.URL = URL;
public void setURL(String url) {
this.url = url;
}
}

+ 1
- 1
shared/src/main/java/com/vaadin/shared/ui/colorpicker/Color.java View File

@@ -38,7 +38,7 @@ public class Color implements Serializable {
private int blue;
private int alpha;

private String OUTOFRANGE = "Value must be within the range [0-255]. Was: ";
private static final String OUTOFRANGE = "Value must be within the range [0-255]. Was: ";

/**
* Creates a color that has the specified red, green, blue, and alpha values

+ 6
- 6
testbench-api/src/main/java/com/vaadin/testbench/elements/AbstractComponentElement.java View File

@@ -25,6 +25,7 @@ import com.vaadin.testbench.elementsbase.ServerClass;

@ServerClass("com.vaadin.ui.AbstractComponent")
public class AbstractComponentElement extends AbstractElement {

/**
* Returns the caption of the Component element.
*
@@ -32,16 +33,16 @@ public class AbstractComponentElement extends AbstractElement {
* @return component caption
*/
public String getCaption() {
final String GWT_ID_ATTRIBUTE = "aria-labelledby";
final String gwtIdAttribute = "aria-labelledby";
WebElement captElem = null;
String captionId = null;
captionId = getAttribute(GWT_ID_ATTRIBUTE);
captionId = getAttribute(gwtIdAttribute);
// IE8 getAttribute returns empty string instead of null
// when there is no attribute with specified name
if (captionId == null || captionId.isEmpty()) {
WebElement elem = findElement(
By.xpath(".//*[@" + GWT_ID_ATTRIBUTE + "]"));
captionId = elem.getAttribute(GWT_ID_ATTRIBUTE);
By.xpath(".//*[@" + gwtIdAttribute + "]"));
captionId = elem.getAttribute(gwtIdAttribute);
}
// element ids are unique, we can search the whole page
captElem = getDriver().findElement(By.id(captionId));
@@ -53,12 +54,11 @@ public class AbstractComponentElement extends AbstractElement {
}

public boolean isReadOnly() {
final String READONLY_CSS_CLASS = "v-readonly";
String readonlyClass = getAttribute("class");
// looking for READONLY_CSS_CLASS string
String[] cssSelectors = readonlyClass.split("\\s");
for (String selector : cssSelectors) {
if (selector.equals(READONLY_CSS_CLASS)) {
if (selector.equals("v-readonly")) {
return true;
}
}

Loading…
Cancel
Save