diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java b/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java index 345eebc8aa..dcec10f86f 100644 --- a/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java +++ b/client/src/com/vaadin/terminal/gwt/client/ui/table/VScrollTable.java @@ -5256,6 +5256,27 @@ public class VScrollTable extends FlowPanel implements HasWidgets, return false; } + /** + * Checks if the row represented by the row key has been selected + * + * @param key + * The generated row key + */ + private boolean rowKeyIsSelected(int rowKey) { + // Check single selections + if (selectedRowKeys.contains("" + rowKey)) { + return true; + } + + // Check range selections + for (SelectionRange r : selectedRowRanges) { + if (r.inRange(getRenderedRowByKey("" + rowKey))) { + return true; + } + } + return false; + } + protected void startRowDrag(Event event, final int type, Element targetTdOrTr) { VTransferable transferable = new VTransferable(); @@ -5274,18 +5295,37 @@ public class VScrollTable extends FlowPanel implements HasWidgets, VDragEvent ev = VDragAndDropManager.get().startDrag( transferable, event, true); if (dragmode == DRAGMODE_MULTIROW && isMultiSelectModeAny() - && selectedRowKeys.contains("" + rowKey)) { - ev.createDragImage( - (Element) scrollBody.tBodyElement.cast(), true); + && rowKeyIsSelected(rowKey)) { + + // Create a drag image of ALL rows (ie6,7 has a different + // DOM structure) + if(BrowserInfo.get().isIE6() || BrowserInfo.get().isIE7()){ + ev.createDragImage(scrollBody.getElement(), true); + } else { + ev.createDragImage( + (Element) scrollBody.tBodyElement.cast(), true); + } + + // Hide rows which are not selected Element dragImage = ev.getDragImage(); int i = 0; for (Iterator<Widget> iterator = scrollBody.iterator(); iterator .hasNext();) { VScrollTableRow next = (VScrollTableRow) iterator .next(); - Element child = (Element) dragImage.getChild(i++); - if (!selectedRowKeys.contains("" + next.rowKey)) { - child.getStyle().setVisibility(Visibility.HIDDEN); + + Element child; + if(BrowserInfo.get().isIE6() || BrowserInfo.get().isIE7()){ + child = (Element) dragImage.getChild(1) + .getChild(0) + .getChild(i++); + } else { + child = (Element) dragImage.getChild(i++); + } + + if (!rowKeyIsSelected(next.rowKey)) { + child.getStyle().setVisibility( + Visibility.HIDDEN); } } } else { |