From 59624acfcf91ec6e82e966942d438707be6ca26c Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Wed, 17 Sep 2014 19:22:37 +0300 Subject: Implement Vaadin-specific editor row commit/discard handling (#13334) Change-Id: Iaaf5e4461adb1d4fd9b8f042c6001b8408d1a0e4 --- .../com/vaadin/shared/ui/grid/EditorRowClientRpc.java | 14 ++++++++++++++ .../com/vaadin/shared/ui/grid/EditorRowServerRpc.java | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'shared') diff --git a/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java b/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java index 1c99a5035d..d6822cfccc 100644 --- a/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java +++ b/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java @@ -33,6 +33,14 @@ public interface EditorRowClientRpc extends ClientRpc { */ void bind(int rowIndex); + /** + * Tells the client to discard unsaved changes in the editor row. + * + * @param rowIndex + * the index of the edited row + */ + void discard(int rowIndex); + /** * Tells the client to cancel editing and hide the editor row. * @@ -46,4 +54,10 @@ public interface EditorRowClientRpc extends ClientRpc { * by the client. */ void confirmBind(); + + /** + * Confirms a pending {@link EditorRowServerRpc#commit(int) commit request} + * sent by the client. + */ + void confirmCommit(); } diff --git a/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java index 45705ca924..25bafe2da1 100644 --- a/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java +++ b/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java @@ -36,6 +36,25 @@ public interface EditorRowServerRpc extends ServerRpc { */ void bind(int rowIndex); + /** + * Asks the server to commit unsaved changes in the editor row to the data + * source. When a commit request is sent, it must be acknowledged with a + * {@link EditorRowClientRpc#confirmCommit() confirm call}. + * + * @param rowIndex + * the index of the edited row + */ + void commit(int rowIndex); + + /** + * Asks the server to replace any unsaved changes with values from the data + * source. + * + * @param rowIndex + * the index of the edited row + */ + void discard(int rowIndex); + /** * Tells the server to cancel editing. When sending a cancel request, the * client does not need to wait for confirmation by the server before hiding -- cgit v1.2.3