diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-09-22 12:23:12 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-09-22 13:23:12 +0300 |
commit | 60ff3d6c3428b2e353ecc0df90296cecc3e840e0 (patch) | |
tree | a88cd5b672417440f57ec786b3c2c3c2bdac6adb /client | |
parent | 23718371f820fb3babca2c57072a62137aa2c01d (diff) | |
download | vaadin-framework-60ff3d6c3428b2e353ecc0df90296cecc3e840e0.tar.gz vaadin-framework-60ff3d6c3428b2e353ecc0df90296cecc3e840e0.zip |
Format curly brackets correctly for checkstyle (#10066)
Diffstat (limited to 'client')
7 files changed, 43 insertions, 104 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java index 8fce2651ab..f503c4689a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractCalendarPanel.java @@ -1260,24 +1260,16 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> // Ctrl and Shift selection not supported if (ctrl || shift) { return false; - } - - else if (keycode == getPreviousKey()) { + } else if (keycode == getPreviousKey()) { focusNextYear(10); // Add 10 years return true; - } - - else if (keycode == getForwardKey()) { + } else if (keycode == getForwardKey()) { focusNextYear(1); // Add 1 year return true; - } - - else if (keycode == getNextKey()) { + } else if (keycode == getNextKey()) { focusPreviousYear(10); // Subtract 10 years return true; - } - - else if (keycode == getBackwardKey()) { + } else if (keycode == getBackwardKey()) { focusPreviousYear(1); // Subtract 1 year return true; @@ -1479,21 +1471,13 @@ public abstract class VAbstractCalendarPanel<R extends Enum<R>> boolean shift) { if (!isEnabled() || isReadonly()) { return false; - } - - else if (isYear(getResolution())) { + } else if (isYear(getResolution())) { return handleNavigationYearMode(keycode, ctrl, shift); - } - - else if (isMonth(getResolution())) { + } else if (isMonth(getResolution())) { return handleNavigationMonthMode(keycode, ctrl, shift); - } - - else if (isDay(getResolution())) { + } else if (isDay(getResolution())) { return handleNavigationDayMode(keycode, ctrl, shift); - } - - else { + } else { return handleNavigationDayMode(keycode, ctrl, shift); } diff --git a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 7ec6e5fd10..5ab5f5fcda 100644 --- a/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -541,14 +541,10 @@ public abstract class AbstractOrderedLayoutConnector if (isVertical) { // Doesn't need height fix for vertical layouts return false; - } - - else if (!isUndefinedHeight()) { + } else if (!isUndefinedHeight()) { // Fix not needed unless the height is undefined return false; - } - - else if (!hasChildrenWithRelativeHeight + } else if (!hasChildrenWithRelativeHeight && !hasChildrenWithMiddleAlignment) { // Already works if there are no relative heights or middle aligned // children diff --git a/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java b/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java index 826105d623..6ff77a2c88 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/AutoScroller.java @@ -294,14 +294,10 @@ public class AutoScroller { if (pointerPageCordinate < startBound) { final double distance = pointerPageCordinate - startBound; ratio = Math.max(-1, distance / gradientArea); - } - - else if (pointerPageCordinate > endBound) { + } else if (pointerPageCordinate > endBound) { final double distance = pointerPageCordinate - endBound; ratio = Math.min(1, distance / gradientArea); - } - - else { + } else { ratio = 0; } @@ -358,13 +354,11 @@ public class AutoScroller { if (startBound == -1) { startBound = Math.min(finalStartBound, pageCordinate); endBound = Math.max(finalEndBound, pageCordinate); - } - - /* - * Subsequent runs make sure that the scroll area grows (but doesn't - * shrink) with the finger, but no further than the final bound. - */ - else { + } else { + /* + * Subsequent runs make sure that the scroll area grows (but doesn't + * shrink) with the finger, but no further than the final bound. + */ int oldTopBound = startBound; if (startBound < finalStartBound) { startBound = Math.max(startBound, diff --git a/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java b/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java index b7059c035f..75c80a4082 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java @@ -145,9 +145,7 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { editRow(event, cell.getRowIndex(), cell.getColumnIndexDOM()); return true; - } - - else if (e.getTypeInt() == Event.ONKEYDOWN) { + } else if (e.getTypeInt() == Event.ONKEYDOWN) { int rowDelta = 0; int colDelta = 0; diff --git a/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java b/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java index 8ccd4373c2..ba27d96afa 100644 --- a/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/client/src/main/java/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java @@ -380,14 +380,10 @@ public class MultiSelectionRenderer<T> if (pointerPageY < topBound) { final double distance = pointerPageY - topBound; ratio = Math.max(-1, distance / gradientArea); - } - - else if (pointerPageY > bottomBound) { + } else if (pointerPageY > bottomBound) { final double distance = pointerPageY - bottomBound; ratio = Math.min(1, distance / gradientArea); - } - - else { + } else { ratio = 0; } @@ -447,13 +443,11 @@ public class MultiSelectionRenderer<T> if (topBound == -1) { topBound = Math.min(finalTopBound, pageY); bottomBound = Math.max(finalBottomBound, pageY); - } - - /* - * Subsequent runs make sure that the scroll area grows (but doesn't - * shrink) with the finger, but no further than the final bound. - */ - else { + } else { + /* + * Subsequent runs make sure that the scroll area grows (but doesn't + * shrink) with the finger, but no further than the final bound. + */ int oldTopBound = topBound; if (topBound < finalTopBound) { topBound = Math.max(topBound, diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index bfff4ad6ae..ee432e0892 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -2581,9 +2581,7 @@ public class Escalator extends Widget setTopRowLogicalIndex(logicalRowIndex); rowsWereMoved = true; - } - - else if (viewportOffset + nextRowBottomOffset <= 0) { + } else if (viewportOffset + nextRowBottomOffset <= 0) { /* * the viewport has been scrolled more than the topmost visual * row. @@ -2756,14 +2754,10 @@ public class Escalator extends Widget final double yDelta = numberOfRows * getDefaultRowHeight(); moveViewportAndContent(yDelta); updateTopRowLogicalIndex(numberOfRows); - } - - else if (addedRowsBelowCurrentViewport) { + } else if (addedRowsBelowCurrentViewport) { // NOOP, we already recalculated scrollbars. - } - - else { // some rows were added inside the current viewport - + } else { + // some rows were added inside the current viewport final int unupdatedLogicalStart = index + addedRows.size(); final int visualOffset = getLogicalRowIndex( visualRowOrder.getFirst()); @@ -2774,7 +2768,7 @@ public class Escalator extends Widget * * If more rows were added than the new escalator rows can * account for, we need to start to spin the escalator to update - * the remaining rows aswell. + * the remaining rows as well. */ final int rowsStillNeeded = numberOfRows - addedRows.size(); @@ -3181,9 +3175,7 @@ public class Escalator extends Widget fireRowVisibilityChangeEvent(); return; - } - - else { + } else { // No escalator rows need to be removed. /* @@ -3215,9 +3207,7 @@ public class Escalator extends Widget */ paintRemoveRowsAtMiddle(removedLogicalInside, removedVisualInside, 0); - } - - else if (removedVisualInside.contains(0) + } else if (removedVisualInside.contains(0) && numberOfRows >= visualRowOrder.size()) { /* * We're removing so many rows that the viewport is @@ -3257,9 +3247,7 @@ public class Escalator extends Widget * TODO [[optimize]]: This might lead to a double body * refresh. Needs investigation. */ - } - - else if (contentBottom + } else if (contentBottom + (numberOfRows * getDefaultRowHeight()) - viewportBottom < getDefaultRowHeight()) { /* @@ -3277,9 +3265,7 @@ public class Escalator extends Widget removedVisualInside); updateTopRowLogicalIndex( -removedLogicalInside.length()); - } - - else { + } else { /* * We're in a combination, where we need to both scroll * up AND show new rows at the bottom. @@ -3715,9 +3701,7 @@ public class Escalator extends Widget setScrollTop(oldScrollTop); scroller.onScroll(); } - } - - else if (neededEscalatorRowsDiff < 0) { + } else if (neededEscalatorRowsDiff < 0) { // needs less final ListIterator<TableRowElement> iter = visualRowOrder @@ -5174,9 +5158,7 @@ public class Escalator extends Widget continue; } else if (topIsBelowRange) { return heights; - } - - else if (topIsAboveRange && bottomIsInRange) { + } else if (topIsAboveRange && bottomIsInRange) { switch (topInclusion) { case PARTIAL: heights += bottom - rangeTop; @@ -5187,9 +5169,7 @@ public class Escalator extends Widget default: break; } - } - - else if (topIsAboveRange && bottomIsBelowRange) { + } else if (topIsAboveRange && bottomIsBelowRange) { /* * Here we arbitrarily decide that the top inclusion will @@ -5210,9 +5190,7 @@ public class Escalator extends Widget } else if (topIsInRange && bottomIsInRange) { heights += height; - } - - else if (topIsInRange && bottomIsBelowRange) { + } else if (topIsInRange && bottomIsBelowRange) { switch (bottomInclusion) { case PARTIAL: heights += rangeBottom - top; @@ -5225,9 +5203,7 @@ public class Escalator extends Widget } return heights; - } - - else { + } else { assert false : "Unnaccounted-for situation"; } } diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 9b04100d48..8d65052aa2 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -4356,10 +4356,9 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, && rightBoundaryForDrag < dropMarkerLeft && dropMarkerLeft <= escalator.getInnerWidth()) { dropMarkerLeft = rightBoundaryForDrag - dropMarkerWidthOffset; - } - - // Check if the drop marker shouldn't be shown at all - else if (dropMarkerLeft < frozenColumnsWidth + } else if ( + // Check if the drop marker shouldn't be shown at all + dropMarkerLeft < frozenColumnsWidth || dropMarkerLeft > Math.min(rightBoundaryForDrag, escalator.getInnerWidth()) || dropMarkerLeft < 0) { @@ -4641,9 +4640,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, rightBound = cellColumnRightIndex; } cellColumnIndex = cellColumnRightIndex - 1; - } - - else { + } else { // can't drop inside a spanned cell, or this is the // dragged cell while (colspan > 1) { |