diff options
author | Henri Sara <hesara@vaadin.com> | 2015-11-10 14:42:41 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-08 09:46:21 +0000 |
commit | 96479f6e6a15c63627414dd1befdb6ddc4731326 (patch) | |
tree | e029c7cdafd031d5ba6ce594820e6023be2e8547 /client | |
parent | db95805c02bb0af8e8c5c4a93ddd17d8422dd088 (diff) | |
download | vaadin-framework-96479f6e6a15c63627414dd1befdb6ddc4731326.tar.gz vaadin-framework-96479f6e6a15c63627414dd1befdb6ddc4731326.zip |
Move combo popup opener clicked flag to connector (#19929)
The flag is only used by the connector to temporarily block
certain operations.
Change-Id: I30a2ffe15768a483b7823dcee450b9cfe93888a4
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VFilterSelect.java | 34 | ||||
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java | 34 |
2 files changed, 31 insertions, 37 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java index 21fcfb7da6..c3683a4bb7 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java @@ -1467,10 +1467,10 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, public String selectedOptionKey; /** For internal use only. May be removed or replaced in the future. */ - public boolean waitingForFilteringResponse = false; + private boolean waitingForFilteringResponse = false; /** For internal use only. May be removed or replaced in the future. */ - public boolean updateSelectionWhenReponseIsReceived = false; + private boolean updateSelectionWhenReponseIsReceived = false; /** For internal use only. May be removed or replaced in the future. */ public boolean initDone = false; @@ -1517,15 +1517,6 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, /** For internal use only. May be removed or replaced in the future. */ public boolean prompting = false; - /** - * Set true when popupopened has been clicked. Cleared on each UIDL-update. - * This handles the special case where are not filtering yet and the - * selected value has changed on the server-side. See #2119 - * <p> - * For internal use only. May be removed or replaced in the future. - */ - public boolean popupOpenerClicked; - /** For internal use only. May be removed or replaced in the future. */ public int suggestionPopupMinWidth = 0; @@ -2215,7 +2206,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, boolean immediate = focused || !connector.hasEventListener(EventId.FOCUS); filterOptions(-1, "", immediate); - setPopupOpenerClicked(true); + connector.popupOpenerClicked(); lastFilter = ""; } DOM.eventPreventDefault(DOM.eventGetCurrentEvent()); @@ -2632,23 +2623,4 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, this.updateSelectionWhenReponseIsReceived = updateSelectionWhenReponseIsReceived; } - /** - * For internal use only - this method will be removed in the future. - * - * @return true if the user has requested opening the popup - */ - public boolean isPopupOpenerClicked() { - return popupOpenerClicked; - } - - /** - * For internal use only - this method will be removed in the future. - * - * @param popupOpenerClicked - * true if the user has requested opening the popup - */ - public void setPopupOpenerClicked(boolean popupOpenerClicked) { - this.popupOpenerClicked = popupOpenerClicked; - } - } diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index f5c29bf7b8..668ae8f4bb 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -56,6 +56,15 @@ public class ComboBoxConnector extends AbstractFieldConnector implements private Runnable pageChangeCallback; + /** + * Set true when popupopened has been clicked. Cleared on each UIDL-update. + * This handles the special case where are not filtering yet and the + * selected value has changed on the server-side. See #2119 + * <p> + * For internal use only. May be removed or replaced in the future. + */ + private boolean popupOpenerClicked; + @Override protected void init() { super.init(); @@ -227,7 +236,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements getWidget().setWaitingForFilteringResponse(false); - if (!getWidget().isPopupOpenerClicked()) { + if (!popupOpenerClicked) { navigateItemAfterPageChange(); } @@ -240,7 +249,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements // Calculate minimum textarea width getWidget().updateSuggestionPopupMinWidth(); - getWidget().setPopupOpenerClicked(false); + popupOpenerClicked = false; /* * if this is our first time we need to recalculate the root width. @@ -293,7 +302,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements continue; } if (!getWidget().isWaitingForFilteringResponse() - || getWidget().isPopupOpenerClicked()) { + || popupOpenerClicked) { if (!suggestionKey.equals(getWidget().selectedOptionKey) || suggestion.getReplacementString().equals( getWidget().tb.getText()) @@ -322,8 +331,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements } private void resetSelection() { - if (!getWidget().isWaitingForFilteringResponse() - || getWidget().isPopupOpenerClicked()) { + if (!getWidget().isWaitingForFilteringResponse() || popupOpenerClicked) { // select nulled if (!getWidget().focused) { /* @@ -343,7 +351,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements || (getWidget().allowNewItem && !getWidget().tb.getValue().isEmpty())) { - boolean openedPopupWithNonScrollingMode = (getWidget().popupOpenerClicked + boolean openedPopupWithNonScrollingMode = (popupOpenerClicked && getWidget().getSelectedCaption() != null); if (!openedPopupWithNonScrollingMode) { getWidget().tb.setValue(""); @@ -513,4 +521,18 @@ public class ComboBoxConnector extends AbstractFieldConnector implements pageChangeCallback = null; } + /** + * Record that the popup opener has been clicked and the popup should be + * opened on the next request. + * + * This handles the special case where are not filtering yet and the + * selected value has changed on the server-side. See #2119. The flag is + * cleared on each UIDL reply. + * + * @since + */ + public void popupOpenerClicked() { + popupOpenerClicked = true; + } + } |