import com.vaadin.event.selection.SelectionListener;
import com.vaadin.server.ErrorMessage;
import com.vaadin.server.Resource;
+import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.Registration;
import com.vaadin.shared.ui.ContentMode;
import com.vaadin.shared.ui.grid.HeightMode;
public static class ItemClick<T> extends ConnectorEvent {
private final T item;
+ private final MouseEventDetails mouseEventDetails;
/**
* Constructs a new item click.
* the tree component
* @param item
* the clicked item
+ * @param mouseEventDetails
+ * information about the original mouse event (mouse button
+ * clicked, coordinates if available etc.)
*/
- protected ItemClick(Tree<T> source, T item) {
+ protected ItemClick(Tree<T> source, T item,
+ MouseEventDetails mouseEventDetails) {
super(source);
this.item = item;
+ this.mouseEventDetails = mouseEventDetails;
}
/**
public Tree<T> getSource() {
return (Tree<T>) super.getSource();
}
+
+ /**
+ * Returns the mouse event details.
+ *
+ * @return the mouse event details
+ */
+ public MouseEventDetails getMouseEventDetails() {
+ return mouseEventDetails;
+ }
}
/**
e.isUserOriginated()));
treeGrid.addCollapseListener(e -> fireCollapseEvent(
e.getCollapsedItem(), e.isUserOriginated()));
- treeGrid.addItemClickListener(
- e -> fireEvent(new ItemClick<>(this, e.getItem())));
+ treeGrid.addItemClickListener(e -> fireEvent(
+ new ItemClick<>(this, e.getItem(), e.getMouseEventDetails())));
}
/**