diff options
author | Henri Sara <hesara@vaadin.com> | 2015-08-19 11:54:59 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2015-08-19 11:54:59 +0300 |
commit | 123c9fbc74d52c66f59bb825414ad3260aaea975 (patch) | |
tree | 8deda9347560f9324d36a5513d4a6fc555d0f13d /server/src/com/vaadin/ui/Grid.java | |
parent | 7a3e03b5acd416141e1a95eae32c3808a8e5addd (diff) | |
parent | e7fda93b300b11d9507f25917306e1f3d57cb27c (diff) | |
download | vaadin-framework-123c9fbc74d52c66f59bb825414ad3260aaea975.tar.gz vaadin-framework-123c9fbc74d52c66f59bb825414ad3260aaea975.zip |
Merge branch 'master-before-18503' into grid-unbuffered-editor
Conflicts:
server/src/com/vaadin/data/RpcDataProviderExtension.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
Change-Id: I9e7907c9caf839fd043444db0505f9853f020a6a
Diffstat (limited to 'server/src/com/vaadin/ui/Grid.java')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index bee424e98f..c7ad9632fa 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -1167,6 +1167,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, private int selectionLimit = DEFAULT_MAX_SELECTIONS; + private boolean allSelected; + @Override public boolean select(final Object... itemIds) throws IllegalArgumentException { @@ -1212,6 +1214,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } fireSelectionEvent(oldSelection, selection); } + + updateAllSelectedState(); + return selectionWillChange; } @@ -1277,6 +1282,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, selection.removeAll(itemIds); fireSelectionEvent(oldSelection, selection); } + + updateAllSelectedState(); + return hasCommonElements; } @@ -1357,6 +1365,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, fireSelectionEvent(oldSelection, selection); } + updateAllSelectedState(); + return changed; } @@ -1370,6 +1380,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, "Vararg array of itemIds may not be null"); } } + + private void updateAllSelectedState() { + if (allSelected != selection.size() >= selectionLimit) { + allSelected = selection.size() >= selectionLimit; + grid.getRpcProxy(GridClientRpc.class).setSelectAll(allSelected); + } + } } /** @@ -3648,10 +3665,21 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, safeConverter.getPresentationType(), locale); } - JsonValue encodedValue = renderer.encode(presentationValue); + JsonValue encodedValue; + try { + encodedValue = renderer.encode(presentationValue); + } catch (Exception e) { + getLogger().log(Level.SEVERE, "Unable to encode data", e); + encodedValue = renderer.encode(null); + } return encodedValue; } + + private static Logger getLogger() { + return Logger.getLogger(AbstractRenderer.class.getName()); + } + } /** |