From fcb564daacec11992703e4821ae784c0d3b305dd Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Wed, 10 Sep 2014 15:21:09 +0300 Subject: Implement Vaadin-specific editor row bind/cancel handling (#13334) Change-Id: I9a6326a065b3ca159dd1b4237de1dbf8fa8e10ff --- .../vaadin/shared/ui/grid/EditorRowClientRpc.java | 49 ++++++++++++++++++++++ .../vaadin/shared/ui/grid/EditorRowServerRpc.java | 48 +++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java create mode 100644 shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java (limited to 'shared/src') diff --git a/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java b/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java new file mode 100644 index 0000000000..1c99a5035d --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/grid/EditorRowClientRpc.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.grid; + +import com.vaadin.shared.communication.ClientRpc; + +/** + * An RPC interface for the grid editor row server-to-client communications. + * + * @since + * @author Vaadin Ltd + */ +public interface EditorRowClientRpc extends ClientRpc { + + /** + * Tells the client to open the editor row and bind data to it. + * + * @param rowIndex + * the index of the edited row + */ + void bind(int rowIndex); + + /** + * Tells the client to cancel editing and hide the editor row. + * + * @param rowIndex + * the index of the edited row + */ + void cancel(int rowIndex); + + /** + * Confirms a pending {@link EditorRowServerRpc#bind(int) bind request} sent + * by the client. + */ + void confirmBind(); +} diff --git a/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java new file mode 100644 index 0000000000..45705ca924 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/grid/EditorRowServerRpc.java @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.ui.grid; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * An RPC interface for the grid editor row client-to-server communications. + * + * @since + * @author Vaadin Ltd + */ +public interface EditorRowServerRpc extends ServerRpc { + + /** + * Asks the server to open the editor row and bind data to it. When a bind + * request is sent, it must be acknowledged with a + * {@link EditorRowClientRpc#confirmBind() confirm call} before the client + * can open the editor. + * + * @param rowIndex + * the index of the edited row + */ + void bind(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 + * the editor row. + * + * @param rowIndex + * the index of the edited row + */ + void cancel(int rowIndex); +} -- cgit v1.2.3