summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2015-03-24 15:11:23 +0200
committerVaadin Code Review <review@vaadin.com>2015-03-25 14:03:22 +0000
commit6a7437cc96da860e50297e064abe7aef387c9e2c (patch)
tree5031b0eccb298de0dbf7d27cb264fdea5f64ada1 /client
parentff5f4e29731e534a85c5c22fab292eea0476237b (diff)
downloadvaadin-framework-6a7437cc96da860e50297e064abe7aef387c9e2c.tar.gz
vaadin-framework-6a7437cc96da860e50297e064abe7aef387c9e2c.zip
Fixes edge case in null details generation for Grid (#17274)
Change-Id: I1bf4c2f0600baea8b925bd31dcd42c1e901a7c8b
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/connectors/GridConnector.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/client/src/com/vaadin/client/connectors/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java
index 7c568e02e5..51e986933c 100644
--- a/client/src/com/vaadin/client/connectors/GridConnector.java
+++ b/client/src/com/vaadin/client/connectors/GridConnector.java
@@ -19,6 +19,7 @@ package com.vaadin.client.connectors;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -677,8 +678,13 @@ public class GridConnector extends AbstractHasComponentsConnector implements
customDetailsGenerator
.setDetailsConnectorChanges(connectorChanges);
+ List<DetailsConnectorChange> removedFirst = new ArrayList<DetailsConnectorChange>(
+ connectorChanges);
+ Collections.sort(removedFirst,
+ DetailsConnectorChange.REMOVED_FIRST_COMPARATOR);
+
// refresh moved/added details rows
- for (DetailsConnectorChange change : connectorChanges) {
+ for (DetailsConnectorChange change : removedFirst) {
Integer oldIndex = change.getOldIndex();
Integer newIndex = change.getNewIndex();
@@ -689,13 +695,23 @@ public class GridConnector extends AbstractHasComponentsConnector implements
+ "invalid new index: " + newIndex
+ " (connector: " + change.getConnector() + ")";
- Integer index = newIndex;
- if (index == null) {
- index = oldIndex;
+ if (oldIndex != null) {
+ /* Close the old/removed index */
+ getWidget().setDetailsVisible(oldIndex, false);
+
+ if (change.isShouldStillBeVisible()) {
+ getWidget().setDetailsVisible(oldIndex, true);
+ }
}
- getWidget().setDetailsVisible(index, false);
- getWidget().setDetailsVisible(index, true);
+ if (newIndex != null) {
+ /*
+ * Since the component was lazy loaded, we need to
+ * refresh the details by toggling it.
+ */
+ getWidget().setDetailsVisible(newIndex, false);
+ getWidget().setDetailsVisible(newIndex, true);
+ }
}
detailsConnectorFetcher.responseReceived(fetchId);
}