summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/com/vaadin/ui/Tree.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Tree.java b/server/src/main/java/com/vaadin/ui/Tree.java
index cd53d1bc08..6ae86efe37 100644
--- a/server/src/main/java/com/vaadin/ui/Tree.java
+++ b/server/src/main/java/com/vaadin/ui/Tree.java
@@ -40,6 +40,7 @@ import com.vaadin.event.SerializableEventListener;
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;
@@ -101,6 +102,7 @@ public class Tree<T> extends Composite
public static class ItemClick<T> extends ConnectorEvent {
private final T item;
+ private final MouseEventDetails mouseEventDetails;
/**
* Constructs a new item click.
@@ -109,10 +111,15 @@ public class Tree<T> extends Composite
* 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;
}
/**
@@ -129,6 +136,15 @@ public class Tree<T> extends Composite
public Tree<T> getSource() {
return (Tree<T>) super.getSource();
}
+
+ /**
+ * Returns the mouse event details.
+ *
+ * @return the mouse event details
+ */
+ public MouseEventDetails getMouseEventDetails() {
+ return mouseEventDetails;
+ }
}
/**
@@ -244,8 +260,8 @@ public class Tree<T> extends Composite
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())));
}
/**