aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/EditorCancelEvent.java16
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java4
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/EditorSaveEvent.java16
3 files changed, 32 insertions, 4 deletions
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/EditorCancelEvent.java b/server/src/main/java/com/vaadin/ui/components/grid/EditorCancelEvent.java
index b2af155977..a698687900 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/EditorCancelEvent.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/EditorCancelEvent.java
@@ -33,14 +33,19 @@ import com.vaadin.ui.Grid;
*/
public class EditorCancelEvent<T> extends EventObject {
+ private T bean;
+
/**
* Constructor for a editor cancel event.
*
* @param editor
* the source of the event
+ * @param bean
+ * the bean being edited
*/
- public EditorCancelEvent(Editor<T> editor) {
+ public EditorCancelEvent(Editor<T> editor, T bean) {
super(editor);
+ this.bean = bean;
}
@SuppressWarnings("unchecked")
@@ -57,4 +62,13 @@ public class EditorCancelEvent<T> extends EventObject {
public Grid<T> getGrid() {
return getSource().getGrid();
}
+
+ /**
+ * Gets the bean being edited.
+ *
+ * @return the bean being edited
+ */
+ public T getBean() {
+ return bean;
+ }
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
index b771696aa2..dad45f0fbb 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
@@ -246,7 +246,7 @@ public class EditorImpl<T> extends AbstractGridExtension<T>
binder.validate();
if (binder.writeBeanIfValid(edited)) {
refresh(edited);
- eventRouter.fireEvent(new EditorSaveEvent<>(this));
+ eventRouter.fireEvent(new EditorSaveEvent<>(this, edited));
return true;
}
}
@@ -267,7 +267,7 @@ public class EditorImpl<T> extends AbstractGridExtension<T>
private void doCancel(boolean afterBeingSaved) {
doClose();
if (!afterBeingSaved) {
- eventRouter.fireEvent(new EditorCancelEvent<>(this));
+ eventRouter.fireEvent(new EditorCancelEvent<>(this, edited));
}
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/EditorSaveEvent.java b/server/src/main/java/com/vaadin/ui/components/grid/EditorSaveEvent.java
index e3d29f38a2..44a58a900f 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/EditorSaveEvent.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/EditorSaveEvent.java
@@ -33,14 +33,19 @@ import com.vaadin.ui.Grid;
*/
public class EditorSaveEvent<T> extends EventObject {
+ private T bean;
+
/**
* Constructor for a editor save event.
*
* @param editor
* the source of the event
+ * @param bean
+ * the bean being edited
*/
- public EditorSaveEvent(Editor<T> editor) {
+ public EditorSaveEvent(Editor<T> editor, T bean) {
super(editor);
+ this.bean = bean;
}
@SuppressWarnings("unchecked")
@@ -57,4 +62,13 @@ public class EditorSaveEvent<T> extends EventObject {
public Grid<T> getGrid() {
return getSource().getGrid();
}
+
+ /**
+ * Gets the bean being edited.
+ *
+ * @return the bean being edited
+ */
+ public T getBean() {
+ return bean;
+ }
}