diff options
author | Artur Signell <artur@vaadin.com> | 2016-09-12 22:29:25 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-09-13 08:36:23 +0000 |
commit | 29cdc9873442b8051066810e866bcc2b3f010a59 (patch) | |
tree | 068614020e234826e1ee68abdbe40ea70c9fa324 /client/src | |
parent | 8b91ebd61bf72d4f1fb2925cea073de297da94fa (diff) | |
download | vaadin-framework-29cdc9873442b8051066810e866bcc2b3f010a59.tar.gz vaadin-framework-29cdc9873442b8051066810e866bcc2b3f010a59.zip |
Add context event support to new Grid
Change-Id: I21c5bb95feb3dbab1b543943adc0584aa8eec87b
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java index e2d2172166..58a5ea8262 100644 --- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Optional; import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.EventTarget; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.shared.HandlerRegistration; import com.vaadin.client.ComponentConnector; @@ -32,10 +33,12 @@ import com.vaadin.client.DeferredWorker; import com.vaadin.client.HasComponentsConnector; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.TooltipInfo; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.connectors.AbstractListingConnector; import com.vaadin.client.data.DataSource; import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.widget.grid.CellReference; +import com.vaadin.client.widget.grid.EventCellReference; import com.vaadin.client.widget.grid.events.BodyClickHandler; import com.vaadin.client.widget.grid.events.BodyDoubleClickHandler; import com.vaadin.client.widget.grid.events.GridClickEvent; @@ -46,12 +49,14 @@ import com.vaadin.client.widget.grid.sort.SortEvent; import com.vaadin.client.widget.grid.sort.SortOrder; import com.vaadin.client.widgets.Grid; import com.vaadin.client.widgets.Grid.Column; +import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.data.DataCommunicatorConstants; import com.vaadin.shared.data.selection.SelectionModel; import com.vaadin.shared.data.selection.SelectionServerRpc; import com.vaadin.shared.data.sort.SortDirection; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.grid.GridConstants; +import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.shared.ui.grid.GridServerRpc; import com.vaadin.shared.ui.grid.GridState; @@ -269,7 +274,6 @@ public class GridConnector sortDirections.toArray(new SortDirection[0]), event.isUserOriginated()); } - /* HasComponentsConnector */ @Override @@ -350,4 +354,24 @@ public class GridConnector return null; } } + + @Override + protected void sendContextClickEvent(MouseEventDetails details, + EventTarget eventTarget) { + + EventCellReference<JsonObject> eventCell = getWidget().getEventCell(); + + Section section = eventCell.getSection(); + String rowKey = null; + if (eventCell.isBody() && eventCell.getRow() != null) { + rowKey = getRowKey(eventCell.getRow()); + } + + String columnId = getColumnId(eventCell.getColumn()); + + getRpcProxy(GridServerRpc.class).contextClick(eventCell.getRowIndex(), + rowKey, columnId, section, details); + + WidgetUtil.clearTextSelection(); + } } |