diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-26 13:26:20 +0200 |
---|---|---|
committer | Pekka Maanpää <pekkamaa@vaadin.com> | 2017-10-26 14:26:20 +0300 |
commit | 10bd7544fd22dccd7e8e32cb236eb50f102892d3 (patch) | |
tree | d0e6f2241dc2b612a0deeceeb30399e88e47ed6a /compatibility-client/src | |
parent | 7c8f440781835dbcf72bfbc47ab8be2f669a40e4 (diff) | |
download | vaadin-framework-10bd7544fd22dccd7e8e32cb236eb50f102892d3.tar.gz vaadin-framework-10bd7544fd22dccd7e8e32cb236eb50f102892d3.zip |
Improve naming of fields and variables (#10242)
* Variable names to conform to naming convention.
* Use static constants where it makes sense
Diffstat (limited to 'compatibility-client/src')
19 files changed, 88 insertions, 87 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendar.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendar.java index 7a3d560b30..2e07216e5f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendar.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendar.java @@ -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) { diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java index dca367ee22..e8c889a9c0 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VPopupCalendar.java @@ -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( diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java index 16817fd82d..54b2417e46 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java @@ -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() { diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VSlider.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VSlider.java index 5cd956c9f9..d252b55330 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VSlider.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VSlider.java @@ -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; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java index c9204478b4..bb2453c881 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java @@ -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( diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java index 043b210197..fb3ff93503 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java @@ -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 diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/VCalendarAction.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/VCalendarAction.java index 1ca09f7806..4eed40620e 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/VCalendarAction.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/VCalendarAction.java @@ -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); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/CalendarEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/CalendarEvent.java index bc08421d4c..7185e0bf1f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/CalendarEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/CalendarEvent.java @@ -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); } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateCellDayEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateCellDayEvent.java index 5855e25a2a..f47cc29397 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateCellDayEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateCellDayEvent.java @@ -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(); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateUtil.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateUtil.java index 1d06406e5a..7558088b46 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateUtil.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DateUtil.java @@ -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); } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java index b7e152c010..10216ba94f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java @@ -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) { diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/SimpleDayCell.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/SimpleDayCell.java index 470ce2f1c6..bd73edab07 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/SimpleDayCell.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/SimpleDayCell.java @@ -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"); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/WeekGrid.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/WeekGrid.java index b75bcae7c4..fd1dfd45a3 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/WeekGrid.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/WeekGrid.java @@ -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); } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/richtextarea/VRichTextToolbar.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/richtextarea/VRichTextToolbar.java index 8f52f281f9..b03f71b2e3 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/richtextarea/VRichTextToolbar.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/richtextarea/VRichTextToolbar.java @@ -201,7 +201,7 @@ public class VRichTextToolbar extends Composite { fonts.setSelectedIndex(0); } else if (sender == fontSizes) { basic.setFontSize( - fontSizesConstants[fontSizes.getSelectedIndex() - 1]); + FONT_SIZES_CONSTANTS[fontSizes.getSelectedIndex() - 1]); fontSizes.setSelectedIndex(0); } } @@ -275,7 +275,7 @@ public class VRichTextToolbar extends Composite { } } - private static final RichTextArea.FontSize[] fontSizesConstants = { + private static final RichTextArea.FontSize[] FONT_SIZES_CONSTANTS = { RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL, RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE, diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/ScrollbarBundle.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/ScrollbarBundle.java index 4ffad154e9..d8f86616ac 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/ScrollbarBundle.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/escalator/ScrollbarBundle.java @@ -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( diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java index 22bc9e7508..1ba971753e 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java @@ -144,17 +144,17 @@ public class ListSorter<T> { Grid.Column column = o.getColumn(); Comparator cmp = ListSorter.this.comparators.get(column); int result = 0; - Object value_a = column.getValue(a); - Object value_b = column.getValue(b); + Object valueA = column.getValue(a); + Object valueB = column.getValue(b); if (cmp != null) { - result = cmp.compare(value_a, value_b); + result = cmp.compare(valueA, valueB); } else { - if (!(value_a instanceof Comparable)) { + if (!(valueA instanceof Comparable)) { throw new IllegalStateException("Column " + column + " has no assigned comparator and value " - + value_a + " isn't naturally comparable"); + + valueA + " isn't naturally comparable"); } - result = ((Comparable) value_a).compareTo(value_b); + result = ((Comparable) valueA).compareTo(valueB); } if (result != 0) { diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionEvent.java index 94fb851df9..35fb230cff 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionEvent.java @@ -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 diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java index 64e9e0656b..ae98ffe782 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java @@ -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 diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java index 980745eac9..a18cd15b28 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java @@ -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 |