From fb4248119d77a6865a42ffdf0d80f10d683769a5 Mon Sep 17 00:00:00 2001 From: Pekka Hyvönen Date: Fri, 7 Oct 2016 16:06:01 +0300 Subject: Remove AbstractComponent.immediate All components are now in immediate mode by default. V7 compatibility components will use AbstractLegacyComponent that has immediate. V7 ColorPickerPopup will not have setImmediate, since it extends V8 Window, which is not in V7 compatibility packages. Removed OutOfSync and ResynchronizeAfterAsyncRemoval Tests, since those tested UI in not immediate mode, which is invalid now. Removed WindowResizeListener, LazyWindowResize, test UIs, since both used immediate and there were no test run for either. Change-Id: Ie1c8cfa4c48461db944ff9b13efe8473c5a3298f --- .../client/communication/ServerRpcQueue.java | 6 ----- .../com/vaadin/client/ui/VAbstractSplitPanel.java | 26 ++++++++----------- .../main/java/com/vaadin/client/ui/VCheckBox.java | 10 +++----- .../main/java/com/vaadin/client/ui/VDateField.java | 11 -------- .../com/vaadin/client/ui/VDateFieldCalendar.java | 4 +-- .../main/java/com/vaadin/client/ui/VSlider.java | 29 +++++++++------------- .../java/com/vaadin/client/ui/VTextualDate.java | 6 ++--- client/src/main/java/com/vaadin/client/ui/VUI.java | 3 --- .../main/java/com/vaadin/client/ui/VWindow.java | 7 ++---- .../client/ui/checkbox/CheckBoxConnector.java | 5 +--- .../ui/datefield/AbstractDateFieldConnector.java | 1 - .../client/ui/datefield/DateFieldConnector.java | 4 +-- .../vaadin/client/ui/slider/SliderConnector.java | 1 - .../ui/splitpanel/AbstractSplitPanelConnector.java | 2 -- .../java/com/vaadin/client/ui/ui/UIConnector.java | 5 +--- .../vaadin/client/ui/window/WindowConnector.java | 4 +-- 16 files changed, 36 insertions(+), 88 deletions(-) (limited to 'client/src') diff --git a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java index ce07fc0baf..250d9c53fa 100644 --- a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java +++ b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java @@ -103,12 +103,6 @@ public class ServerRpcQueue { * * @param invocation * RPC method invocation - * @param delayed - * false to trigger sending within a short time - * window (possibly combining subsequent calls to a single - * request), true to let the framework delay sending - * of RPC calls and variable changes until the next non-delayed - * change * @param lastOnly * true to remove all previously delayed invocations * of the same method that were also enqueued with lastonly set diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java index 837b185f35..5f75869ba4 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractSplitPanel.java @@ -96,9 +96,6 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { /** For internal use only. May be removed or replaced in the future. */ public ApplicationConnection client; - /** For internal use only. May be removed or replaced in the future. */ - public boolean immediate; - /** * The current position of the split handle in either percentages or pixels *

@@ -406,8 +403,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { int pixelPosition = DOM.getElementPropertyInt(splitter, "offsetTop"); // reposition splitter in case it is out of box - if ((pixelPosition > 0 && pixelPosition + getSplitterSize() > wholeSize) - || (positionReversed && pixelPosition < 0)) { + if (pixelPosition > 0 && pixelPosition + getSplitterSize() > wholeSize + || positionReversed && pixelPosition < 0) { pixelPosition = wholeSize - getSplitterSize(); if (pixelPosition < 0) { pixelPosition = 0; @@ -418,8 +415,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { } firstContainer.getStyle().setHeight(pixelPosition, Unit.PX); - int secondContainerHeight = (wholeSize - pixelPosition - - getSplitterSize()); + int secondContainerHeight = wholeSize - pixelPosition + - getSplitterSize(); if (secondContainerHeight < 0) { secondContainerHeight = 0; } @@ -456,8 +453,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { int pixelPosition = DOM.getElementPropertyInt(splitter, "offsetLeft"); // reposition splitter in case it is out of box - if ((pixelPosition > 0 && pixelPosition + getSplitterSize() > wholeSize) - || (positionReversed && pixelPosition < 0)) { + if (pixelPosition > 0 && pixelPosition + getSplitterSize() > wholeSize + || positionReversed && pixelPosition < 0) { pixelPosition = wholeSize - getSplitterSize(); if (pixelPosition < 0) { pixelPosition = 0; @@ -468,8 +465,8 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { } firstContainer.getStyle().setWidth(pixelPosition, Unit.PX); - int secondContainerWidth = (wholeSize - pixelPosition - - getSplitterSize()); + int secondContainerWidth = wholeSize - pixelPosition + - getSplitterSize(); if (secondContainerWidth < 0) { secondContainerWidth = 0; } @@ -667,7 +664,7 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { } else { // Reversed position if (positionReversed) { - position = (getOffsetWidth() - newX - getSplitterSize()) + "px"; + position = getOffsetWidth() - newX - getSplitterSize() + "px"; } else { position = newX + "px"; } @@ -700,8 +697,7 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { } else { // Reversed position if (positionReversed) { - position = (getOffsetHeight() - newY - getSplitterSize()) - + "px"; + position = getOffsetHeight() - newY - getSplitterSize() + "px"; } else { position = newY + "px"; } @@ -789,7 +785,7 @@ public abstract class VAbstractSplitPanel extends ComplexPanel { * @return true if the browser requires a dragging curtain */ private boolean isDraggingCurtainRequired() { - return (BrowserInfo.get().isGecko() || BrowserInfo.get().isWebkit()); + return BrowserInfo.get().isGecko() || BrowserInfo.get().isWebkit(); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/VCheckBox.java b/client/src/main/java/com/vaadin/client/ui/VCheckBox.java index 7f066e2a93..02dcfd7271 100644 --- a/client/src/main/java/com/vaadin/client/ui/VCheckBox.java +++ b/client/src/main/java/com/vaadin/client/ui/VCheckBox.java @@ -37,9 +37,6 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox /** For internal use only. May be removed or replaced in the future. */ public String id; - /** For internal use only. May be removed or replaced in the future. */ - public boolean immediate; - /** For internal use only. May be removed or replaced in the future. */ public ApplicationConnection client; @@ -54,8 +51,7 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox Element el = DOM.getFirstChild(getElement()); while (el != null) { - DOM.sinkEvents(el, - (DOM.getEventsSunk(el) | VTooltip.TOOLTIP_EVENTS)); + DOM.sinkEvents(el, DOM.getEventsSunk(el) | VTooltip.TOOLTIP_EVENTS); el = DOM.getNextSibling(el); } @@ -73,8 +69,8 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox @Override public void onBrowserEvent(Event event) { - if (icon != null && (event.getTypeInt() == Event.ONCLICK) - && (DOM.eventGetTarget(event) == icon.getElement())) { + if (icon != null && event.getTypeInt() == Event.ONCLICK + && DOM.eventGetTarget(event) == icon.getElement()) { // Click on icon should do nothing if widget is disabled if (isEnabled()) { setValue(!getValue()); diff --git a/client/src/main/java/com/vaadin/client/ui/VDateField.java b/client/src/main/java/com/vaadin/client/ui/VDateField.java index ef7a131a77..2f8c72081e 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDateField.java +++ b/client/src/main/java/com/vaadin/client/ui/VDateField.java @@ -34,9 +34,6 @@ public class VDateField extends FlowPanel implements Field, HasEnabled { /** For internal use only. May be removed or replaced in the future. */ public ApplicationConnection client; - /** For internal use only. May be removed or replaced in the future. */ - public boolean immediate; - /** For internal use only. May be removed or replaced in the future. */ public static String resolutionToString(Resolution res) { if (res == Resolution.DAY) { @@ -113,14 +110,6 @@ public class VDateField extends FlowPanel implements Field, HasEnabled { this.date = date; } - public boolean isImmediate() { - return immediate; - } - - public void setImmediate(boolean immediate) { - this.immediate = immediate; - } - public boolean isReadonly() { return readonly; } diff --git a/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java b/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java index d09de9a771..18d896e487 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java +++ b/client/src/main/java/com/vaadin/client/ui/VDateFieldCalendar.java @@ -86,9 +86,7 @@ public class VDateFieldCalendar extends VDateField { false); } } - if (isImmediate()) { - getClient().sendPendingVariableChanges(); - } + getClient().sendPendingVariableChanges(); } } diff --git a/client/src/main/java/com/vaadin/client/ui/VSlider.java b/client/src/main/java/com/vaadin/client/ui/VSlider.java index 920ffec832..bc0f539657 100644 --- a/client/src/main/java/com/vaadin/client/ui/VSlider.java +++ b/client/src/main/java/com/vaadin/client/ui/VSlider.java @@ -52,7 +52,6 @@ public class VSlider extends SimpleFocusablePanel protected String id; - protected boolean immediate; protected boolean disabled; protected boolean readonly; @@ -214,7 +213,7 @@ public class VSlider extends SimpleFocusablePanel @Override public void execute() { final Element p = getElement(); - if (p.getPropertyInt(domProperty) > (MIN_SIZE + 5) + if (p.getPropertyInt(domProperty) > MIN_SIZE + 5 || propertyNotNullOrEmpty(styleAttribute, p)) { if (isVertical()) { setHeight(); @@ -283,10 +282,10 @@ public class VSlider extends SimpleFocusablePanel increaseValue(true); } else if (DOM.eventGetType(event) == Event.MOUSEEVENTS) { processBaseEvent(event); - } else if ((BrowserInfo.get().isGecko() - && DOM.eventGetType(event) == Event.ONKEYPRESS) - || (!BrowserInfo.get().isGecko() - && DOM.eventGetType(event) == Event.ONKEYDOWN)) { + } else if (BrowserInfo.get().isGecko() + && DOM.eventGetType(event) == Event.ONKEYPRESS + || !BrowserInfo.get().isGecko() + && DOM.eventGetType(event) == Event.ONKEYDOWN) { if (handleNavigation(event.getKeyCode(), event.getCtrlKey(), event.getShiftKey())) { @@ -406,10 +405,10 @@ public class VSlider extends SimpleFocusablePanel } if (isVertical()) { - v = ((baseSize - (coord - baseOffset)) - / (double) (baseSize - handleSize)) * (max - min) + min; + v = (baseSize - (coord - baseOffset)) + / (double) (baseSize - handleSize) * (max - min) + min; } else { - v = ((coord - baseOffset) / (double) (baseSize - handleSize)) + v = (coord - baseOffset) / (double) (baseSize - handleSize) * (max - min) + min; } @@ -475,8 +474,8 @@ public class VSlider extends SimpleFocusablePanel return false; } - if ((keycode == getNavigationUpKey() && isVertical()) - || (keycode == getNavigationRightKey() && !isVertical())) { + if (keycode == getNavigationUpKey() && isVertical() + || keycode == getNavigationRightKey() && !isVertical()) { if (shift) { for (int a = 0; a < acceleration; a++) { increaseValue(false); @@ -487,7 +486,7 @@ public class VSlider extends SimpleFocusablePanel } return true; } else if (keycode == getNavigationDownKey() && isVertical() - || (keycode == getNavigationLeftKey() && !isVertical())) { + || keycode == getNavigationLeftKey() && !isVertical()) { if (shift) { for (int a = 0; a < acceleration; a++) { decreaseValue(false); @@ -554,10 +553,6 @@ public class VSlider extends SimpleFocusablePanel this.id = id; } - public void setImmediate(boolean immediate) { - this.immediate = immediate; - } - public void setDisabled(boolean disabled) { this.disabled = disabled; } @@ -614,7 +609,7 @@ public class VSlider extends SimpleFocusablePanel : "offsetWidth"; final int handleSize = handle.getPropertyInt(domProperty); final int baseSize = base.getPropertyInt(domProperty) - - (2 * BASE_BORDER_WIDTH); + - 2 * BASE_BORDER_WIDTH; final int range = baseSize - handleSize; double v = value.doubleValue(); diff --git a/client/src/main/java/com/vaadin/client/ui/VTextualDate.java b/client/src/main/java/com/vaadin/client/ui/VTextualDate.java index 9577698194..7b83a5622d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VTextualDate.java +++ b/client/src/main/java/com/vaadin/client/ui/VTextualDate.java @@ -258,16 +258,16 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, Date currentDate = getDate(); getClient().updateVariable(getId(), "year", currentDate != null ? currentDate.getYear() + 1900 : -1, - currentResolution == Resolution.YEAR && immediate); + currentResolution == Resolution.YEAR); if (currentResolution.compareTo(Resolution.MONTH) <= 0) { getClient().updateVariable(getId(), "month", currentDate != null ? currentDate.getMonth() + 1 : -1, - currentResolution == Resolution.MONTH && immediate); + currentResolution == Resolution.MONTH); } if (currentResolution.compareTo(Resolution.DAY) <= 0) { getClient().updateVariable(getId(), "day", currentDate != null ? currentDate.getDate() : -1, - currentResolution == Resolution.DAY && immediate); + currentResolution == Resolution.DAY); } } diff --git a/client/src/main/java/com/vaadin/client/ui/VUI.java b/client/src/main/java/com/vaadin/client/ui/VUI.java index 585631a6b6..ad4077d396 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUI.java +++ b/client/src/main/java/com/vaadin/client/ui/VUI.java @@ -96,9 +96,6 @@ public class VUI extends SimplePanel implements ResizeHandler, /** stored height of parent for embedded application auto-resize */ private int parentHeight; - /** For internal use only. May be removed or replaced in the future. */ - public boolean immediate; - /** For internal use only. May be removed or replaced in the future. */ public boolean resizeLazy = false; diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java index e9767a6bac..8f1292ca1d 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -188,9 +188,6 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, */ public boolean centered = false; - /** For internal use only. May be removed or replaced in the future. */ - public boolean immediate; - private Element wrapper; /** For internal use only. May be removed or replaced in the future. */ @@ -548,7 +545,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, private static void focusTopmostModalWindow() { VWindow topmost = getTopmostWindow(); - if ((topmost != null) && (topmost.vaadinModality)) { + if (topmost != null && topmost.vaadinModality) { topmost.focus(); } } @@ -1109,7 +1106,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, if (updateVariables) { // sending width back always as pixels, no need for unit client.updateVariable(id, "width", w, false); - client.updateVariable(id, "height", h, immediate); + client.updateVariable(id, "height", h, true); } if (updateVariables || !resizeLazy) { diff --git a/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index 3c36ffd4fe..cf39e5ee21 100644 --- a/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -109,7 +109,6 @@ public class CheckBoxConnector extends AbstractFieldConnector VCaption.setCaptionText(getWidget(), getState()); getWidget().setValue(getState().checked); - getWidget().immediate = getState().immediate; } @Override @@ -140,9 +139,7 @@ public class CheckBoxConnector extends AbstractFieldConnector getWidget().getElement()); getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked, details); - if (getState().immediate) { - getConnection().sendPendingVariableChanges(); - } + getConnection().sendPendingVariableChanges(); } } diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java index 9d9bdb4d7a..5e0fe7cc2e 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java @@ -38,7 +38,6 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector // Save details getWidget().client = client; getWidget().paintableId = uidl.getId(); - getWidget().immediate = getState().immediate; getWidget().setReadonly(isReadOnly()); getWidget().setEnabled(isEnabled()); diff --git a/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java index c5972c9f61..7161283176 100644 --- a/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/datefield/DateFieldConnector.java @@ -56,9 +56,7 @@ public class DateFieldConnector extends TextualDateConnector { * a day/enter/clicking outside of popup) then the new value is * communicated to the server. */ - if (getWidget().isImmediate()) { - getConnection().getServerRpcQueue().flush(); - } + getConnection().getServerRpcQueue().flush(); } }); } diff --git a/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java b/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java index 7988847995..a77870ec2f 100644 --- a/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/slider/SliderConnector.java @@ -81,7 +81,6 @@ public class SliderConnector extends AbstractFieldConnector super.onStateChanged(stateChangeEvent); getWidget().setId(getConnectorId()); - getWidget().setImmediate(getState().immediate); getWidget().setDisabled(!isEnabled()); getWidget().setReadOnly(isReadOnly()); getWidget().setOrientation(getState().orientation); diff --git a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java index ec6b86880b..86cf5adf98 100644 --- a/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -124,8 +124,6 @@ public abstract class AbstractSplitPanelConnector extends public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); - getWidget().immediate = getState().immediate; - getWidget().setEnabled(isEnabled()); clickEventHandler.handleEventHandlerRegistration(); diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java index 26f99bfb94..3770c28446 100644 --- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java @@ -175,9 +175,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector getRpcProxy(UIServerRpc.class).resize(event.getHeight(), event.getWidth(), Window.getClientWidth(), Window.getClientHeight()); - if (getState().immediate || getPageState().hasResizeListeners) { - getConnection().getServerRpcQueue().flush(); - } + getConnection().getServerRpcQueue().flush(); } }); getWidget().addScrollHandler(new ScrollHandler() { @@ -211,7 +209,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector boolean firstPaint = getWidget().connection == null; getWidget().connection = client; - getWidget().immediate = getState().immediate; getWidget().resizeLazy = uidl.hasAttribute(UIConstants.RESIZE_LAZY); // this also implicitly removes old styles String styles = ""; diff --git a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java index 7d9094e583..eed89f090c 100644 --- a/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java @@ -218,7 +218,7 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector } ComponentConnector content = getContent(); - boolean hasContent = (content != null); + boolean hasContent = content != null; Element contentElement = window.contentPanel.getElement(); Style contentStyle = window.contents.getStyle(); @@ -388,8 +388,6 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector clickEventHandler.handleEventHandlerRegistration(); - window.immediate = state.immediate; - window.setClosable(!isReadOnly()); // initialize position from state updateWindowPosition(); -- cgit v1.2.3