From 838ad0727aab9cf2b42a8a40235b6bd1655a286d Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Tue, 7 Nov 2017 12:47:09 +0100 Subject: Remove deprecated usage of ApplicationConnection.hasEventListeners() (#10248) From VDateField and VWindow --- .../src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java | 3 +-- client/src/main/java/com/vaadin/client/ui/VDateField.java | 7 ++++--- client/src/main/java/com/vaadin/client/ui/VWindow.java | 8 ++++++-- .../vaadin/client/ui/datefield/AbstractDateFieldConnector.java | 2 +- .../main/java/com/vaadin/client/ui/window/WindowConnector.java | 1 + 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java index 6525180903..340e4faf6a 100644 --- a/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java +++ b/client/src/main/java/com/vaadin/client/ui/VAbstractTextualDate.java @@ -402,8 +402,7 @@ public abstract class VAbstractTextualDate> } else { text.removeStyleName(styleName); } - if (getClient() != null && getClient() - .hasEventListeners(VAbstractTextualDate.this, eventId)) { + if (getClient() != null && connector.hasEventListener(eventId)) { // may excessively send events if if focus went to another // sub-component if (EventId.FOCUS.equals(eventId)) { 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 be56fd99ee..3bfa8e9649 100644 --- a/client/src/main/java/com/vaadin/client/ui/VDateField.java +++ b/client/src/main/java/com/vaadin/client/ui/VDateField.java @@ -27,6 +27,7 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HasEnabled; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.DateTimeService; +import com.vaadin.client.ui.datefield.AbstractDateFieldConnector; import com.vaadin.shared.ui.datefield.AbstractDateFieldServerRpc; /** @@ -43,10 +44,10 @@ public abstract class VDateField> extends FlowPanel public static final String CLASSNAME = "v-datefield"; /** For internal use only. May be removed or replaced in the future. */ - public String paintableId; + public ApplicationConnection client; /** For internal use only. May be removed or replaced in the future. */ - public ApplicationConnection client; + public AbstractDateFieldConnector connector; private R currentResolution; @@ -200,7 +201,7 @@ public abstract class VDateField> extends FlowPanel } public String getId() { - return paintableId; + return connector.getConnectorId(); } public ApplicationConnection getClient() { 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 e53997ec17..02d3ce63cd 100644 --- a/client/src/main/java/com/vaadin/client/ui/VWindow.java +++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java @@ -59,6 +59,7 @@ import com.vaadin.client.WidgetUtil; import com.vaadin.client.debug.internal.VDebugWindow; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.aria.AriaHelper; +import com.vaadin.client.ui.window.WindowConnector; import com.vaadin.client.ui.window.WindowMoveEvent; import com.vaadin.client.ui.window.WindowMoveHandler; import com.vaadin.client.ui.window.WindowOrderEvent; @@ -130,6 +131,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, /** 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 WindowConnector connector; + /** For internal use only. May be removed or replaced in the future. */ public String id; @@ -1351,14 +1355,14 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, @Override public void onBlur(BlurEvent event) { - if (client.hasEventListeners(this, EventId.BLUR)) { + if (connector.hasEventListener(EventId.BLUR)) { client.updateVariable(id, EventId.BLUR, "", true); } } @Override public void onFocus(FocusEvent event) { - if (client.hasEventListeners(this, EventId.FOCUS)) { + if (connector.hasEventListener(EventId.FOCUS)) { client.updateVariable(id, EventId.FOCUS, "", true); } } 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 fb060ad326..b31447fcac 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 @@ -96,7 +96,7 @@ public abstract class AbstractDateFieldConnector> // Save details widget.client = getConnection(); - widget.paintableId = getConnectorId(); + widget.connector = this; widget.setReadonly(isReadOnly()); widget.setEnabled(isEnabled()); 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 fb1bba4182..1de571592a 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 @@ -105,6 +105,7 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector VWindow window = getWidget(); window.id = getConnectorId(); window.client = getConnection(); + window.connector = this; getLayoutManager().registerDependency(this, window.contentPanel.getElement()); -- cgit v1.2.3