diff options
author | Automerge <automerge@vaadin.com> | 2012-03-26 13:21:55 +0000 |
---|---|---|
committer | Automerge <automerge@vaadin.com> | 2012-03-26 13:21:55 +0000 |
commit | 381c3eb5d4ebce92bceddd06e2a9ed81b40789c4 (patch) | |
tree | bd02700a2d3b6bd116f9f52d7063295376df3972 /src/com | |
parent | 82cc52702065587c46a7a0b6b08a35b2abe9f51b (diff) | |
download | vaadin-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.java | 36 |
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); } } |