diff options
author | Artur Signell <artur@vaadin.com> | 2015-06-18 21:59:51 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-06-26 10:45:24 +0000 |
commit | f7a852e3df45437568e54cff592aae50ae9a06ce (patch) | |
tree | d3dcc281693c73959b9a3538a4c992562d3c4f44 /server/src/com/vaadin/ui/Grid.java | |
parent | 7355f1a26277d7644cfc974f4c4d8b7bc898c366 (diff) | |
download | vaadin-framework-f7a852e3df45437568e54cff592aae50ae9a06ce.tar.gz vaadin-framework-f7a852e3df45437568e54cff592aae50ae9a06ce.zip |
Properly toggle editor state when calling editId() on the server (#18287)
Ensure isEditorActive() returns false if editItem(...) has been called but the
editor has not yet been opened, as it should according to javadoc
isRendered() requires that the editor fields are marked as dirty when they are
made visible on the client (isEditorActive() changes state)
Change-Id: I7fbe1cb484cf83974ffa6ca50a6c642fbf7e8378
Diffstat (limited to 'server/src/com/vaadin/ui/Grid.java')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index 88a3195857..e5eebff879 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -3533,6 +3533,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, private final Footer footer = new Footer(this); private Object editedItemId = null; + private boolean editorActive = false; private FieldGroup editorFieldGroup = new CustomFieldGroup(); private CellStyleGenerator cellStyleGenerator; @@ -5691,7 +5692,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, * @return true iff the editor is open */ public boolean isEditorActive() { - return editedItemId != null; + return editorActive; } private void checkColumnExists(Object propertyId) { @@ -5765,6 +5766,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, .getPropertyId()); } + editorActive = true; // Must ensure that all fields, recursively, are sent to the client // This is needed because the fields are hidden using isRendered for (Field<?> f : getEditorFields()) { @@ -5816,6 +5818,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, protected void doCancelEditor() { editedItemId = null; + editorActive = false; editorFieldGroup.discard(); editorFieldGroup.setItemDataSource(null); } @@ -5833,6 +5836,7 @@ public class Grid extends AbstractComponent implements SelectionNotifier, } editedItemId = null; + editorActive = false; editorFieldGroup = new CustomFieldGroup(); } |