summaryrefslogtreecommitdiffstats
path: root/shared/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-11-17 17:05:28 +0200
committerVaadin Code Review <review@vaadin.com>2016-11-25 13:13:00 +0000
commitd37b2d430eca6b0eeacb48626c0bbfb33d1502de (patch)
treea73527e2b0eef2e902572908c1c6a22d44a2ab27 /shared/src
parentd63c1f9014e0a49e5250edd41bd5c7542901c267 (diff)
downloadvaadin-framework-d37b2d430eca6b0eeacb48626c0bbfb33d1502de.tar.gz
vaadin-framework-d37b2d430eca6b0eeacb48626c0bbfb33d1502de.zip
Reintroduce Grid Editor using Binder
This patch restores the bean type to BinderValidationStatusHandler Change-Id: I9ace77a492c4823c15591fb1426e9bd216895fb0
Diffstat (limited to 'shared/src')
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java2
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java64
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java52
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorState.java49
4 files changed, 167 insertions, 0 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java
index 8296dd8660..c2f4f6a07e 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java
@@ -23,6 +23,7 @@ public class ColumnState extends SharedState {
public String caption;
public String id;
public boolean sortable;
+ public boolean editable = false;
/** The caption for the column hiding toggle. */
public String hidingToggleCaption;
@@ -58,4 +59,5 @@ public class ColumnState extends SharedState {
public boolean resizable = true;
public Connector renderer;
+
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java
new file mode 100644
index 0000000000..04cdac431b
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorClientRpc.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2000-2016 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.editor;
+
+import java.util.List;
+
+import com.vaadin.shared.communication.ClientRpc;
+
+/**
+ * An RPC interface for the grid editor server-to-client communications.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface EditorClientRpc extends ClientRpc {
+
+ /**
+ * Tells the client to cancel editing and hide the editor.
+ */
+ void cancel();
+
+ /**
+ * Confirms a pending {@link EditorServerRpc#bind(String) bind request} sent
+ * by the client.
+ *
+ * @param bindSucceeded
+ * {@code true} if and only if the bind action was successful
+ */
+ void confirmBind(boolean bindSucceeded);
+
+ /**
+ * Confirms a pending {@link EditorServerRpc#save() save request} sent by
+ * the client.
+ *
+ * @param saveSucceeded
+ * {@code true} if and only if the save action was successful
+ */
+ void confirmSave(boolean saveSucceeded);
+
+ /**
+ * Sets the displayed error messages for editor.
+ *
+ * @param errorMessage
+ * the error message to show the user; {@code} null to clear
+ * @param errorColumnsIds
+ * a list of column ids that should get error markers; empty list
+ * to clear
+ *
+ */
+ void setErrorMessage(String errorMessage, List<String> errorColumnsIds);
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java
new file mode 100644
index 0000000000..47f6d365cc
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorServerRpc.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2016 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.editor;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * An RPC interface for the grid editor client-to-server communications.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface EditorServerRpc extends ServerRpc {
+
+ /**
+ * Asks the server to open the editor and bind data to it. When a bind
+ * request is sent, it must be acknowledged with a
+ * {@link EditorClientRpc#confirmBind() confirm call} before the client can
+ * open the editor.
+ *
+ * @param key
+ * the identifier key for edited item
+ */
+ void bind(String key);
+
+ /**
+ * Asks the server to save unsaved changes in the editor to the bean. When a
+ * save request is sent, it must be acknowledged with a
+ * {@link EditorClientRpc#confirmSave() confirm call}.
+ */
+ void save();
+
+ /**
+ * 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.
+ */
+ void cancel();
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorState.java
new file mode 100644
index 0000000000..1cae17e135
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/editor/EditorState.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2016 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.editor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.vaadin.shared.communication.SharedState;
+import com.vaadin.shared.ui.grid.GridConstants;
+
+/**
+ * State object for Editor in Grid.
+ *
+ * @author Vaadin Ltd
+ * @since
+ */
+public class EditorState extends SharedState {
+
+ {
+ // Disable editor by default.
+ enabled = false;
+ }
+
+ /** Map from Column id to Component connector id. */
+ public Map<String, String> columnFields = new HashMap<>();
+
+ /** Buffer mode state. */
+ public boolean buffered = true;
+
+ /** The caption for the save button in the editor. */
+ public String saveCaption = GridConstants.DEFAULT_SAVE_CAPTION;
+
+ /** The caption for the cancel button in the editor. */
+ public String cancelCaption = GridConstants.DEFAULT_CANCEL_CAPTION;
+
+}