diff options
author | Artur Signell <artur@vaadin.com> | 2016-01-17 16:56:33 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-01-22 09:34:34 +0000 |
commit | 610736d9f373d4b37fd39ff8f90aabd13eab7926 (patch) | |
tree | f185b3c0e3b4fdfea95af8d6dbd54cecd453b4f5 /client | |
parent | 1099c1eddd3477b50bcd3e5bab585109db25d5ca (diff) | |
download | vaadin-framework-610736d9f373d4b37fd39ff8f90aabd13eab7926.tar.gz vaadin-framework-610736d9f373d4b37fd39ff8f90aabd13eab7926.zip |
Make Checkbox label send context click events also (#19456)
Change-Id: Ic23a84357e1d0d333905ce6b3931c41ee90148f6
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index 8cfcf7feb1..0dc9810c51 100644 --- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -23,11 +23,13 @@ import com.google.gwt.user.client.Event; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.VCaption; import com.vaadin.client.VTooltip; +import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.ConnectorFocusAndBlurHandler; import com.vaadin.client.ui.Icon; import com.vaadin.client.ui.VCheckBox; +import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc; @@ -137,4 +139,17 @@ public class CheckBoxConnector extends AbstractFieldConnector implements } } } + + private boolean contextEventSunk = false; + + @OnStateChange("registeredEventListeners") + void sinkContextClickEvent() { + if (!contextEventSunk && hasEventListener(EventId.CONTEXT_CLICK)) { + // CheckBox.sinkEvents works differently than all other widgets: + // "Unlike other widgets the CheckBox sinks on its inputElement, not + // its wrapper" + DOM.sinkEvents(getWidget().getElement(), Event.ONCONTEXTMENU); + contextEventSunk = true; + } + } } |