diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-11-07 12:47:09 +0100 |
---|---|---|
committer | Pekka Maanpää <pekkamaa@vaadin.com> | 2017-11-07 13:47:09 +0200 |
commit | 838ad0727aab9cf2b42a8a40235b6bd1655a286d (patch) | |
tree | b8b13b4ce1046a11eeed59ef81f5a48203b11346 | |
parent | 0a3a6c0293ed3dc45740fac30738e81b920c084d (diff) | |
download | vaadin-framework-838ad0727aab9cf2b42a8a40235b6bd1655a286d.tar.gz vaadin-framework-838ad0727aab9cf2b42a8a40235b6bd1655a286d.zip |
Remove deprecated usage of ApplicationConnection.hasEventListeners() (#10248)
From VDateField and VWindow
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<R extends Enum<R>> } 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<R extends Enum<R>> 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<R> connector; private R currentResolution; @@ -200,7 +201,7 @@ public abstract class VDateField<R extends Enum<R>> 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; @@ -131,6 +132,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, 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; /** For internal use only. May be removed or replaced in the future. */ @@ -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<R extends Enum<R>> // 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()); |