summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAutomerge <automerge@vaadin.com>2012-03-26 13:21:55 +0000
committerAutomerge <automerge@vaadin.com>2012-03-26 13:21:55 +0000
commit381c3eb5d4ebce92bceddd06e2a9ed81b40789c4 (patch)
treebd02700a2d3b6bd116f9f52d7063295376df3972 /src/com
parent82cc52702065587c46a7a0b6b08a35b2abe9f51b (diff)
downloadvaadin-framework-381c3eb5d4ebce92bceddd06e2a9ed81b40789c4.tar.gz
vaadin-framework-381c3eb5d4ebce92bceddd06e2a9ed81b40789c4.zip
[merge from 6.7] #8526 Added comments
svn changeset:23323/svn branch:6.8
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 9e3b39f6b5..43908d474a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -838,6 +838,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
rendering = true;
+ // On the first rendering, add a handler to clear saved context menu
+ // details when the menu closes. See #8526.
if (this.client == null) {
client.getContextMenu().addCloseHandler(
new CloseHandler<PopupPanel>() {
@@ -846,7 +848,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
});
}
-
+ // If a row has an open context menu, it will be closed as the row is
+ // detached. Retain a reference here so we can restore the menu if
+ // required.
ContextMenuDetails savedContextMenu = contextMenu;
if (uidl.hasAttribute(ATTRIBUTE_PAGEBUFFER_FIRST)) {
@@ -985,6 +989,21 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
}
+ // If a row had an open context menu before the update, and after the
+ // update there's a row with the same key as that row, restore the
+ // context menu. See #8526.
+ if (enabled && savedContextMenu != null) {
+ for (Widget w : scrollBody.renderedRows) {
+ VScrollTableRow row = (VScrollTableRow) w;
+ if (row.isVisible()
+ && row.getKey().equals(savedContextMenu.rowKey)) {
+ contextMenu = savedContextMenu;
+ client.getContextMenu().showAt(row, savedContextMenu.left,
+ savedContextMenu.top);
+ }
+ }
+ }
+
if (!isSelectable()) {
scrollBody.addStyleName(CLASSNAME + "-body-noselection");
} else {
@@ -1040,17 +1059,6 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
rendering = false;
headerChangedDuringUpdate = false;
-
- if (savedContextMenu != null) {
- for (Widget w : scrollBody.renderedRows) {
- VScrollTableRow row = (VScrollTableRow) w;
- if (row.getKey().equals(savedContextMenu.rowKey)) {
- contextMenu = savedContextMenu;
- client.getContextMenu().showAt(row, savedContextMenu.left,
- savedContextMenu.top);
- }
- }
- }
}
private void initializeRows(UIDL uidl, UIDL rowData) {
@@ -5411,8 +5419,8 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
int top = Util.getTouchOrMouseClientY(event);
top += Window.getScrollTop();
left += Window.getScrollLeft();
- contextMenu = new ContextMenuDetails(this.getKey(),
- left, top);
+ contextMenu = new ContextMenuDetails(this.getKey(), left,
+ top);
client.getContextMenu().showAt(this, left, top);
}
}