diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-02-22 11:35:19 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-02-22 11:35:19 +0200 |
commit | ca1bfa7511e35fad802271604158afd7be6531d0 (patch) | |
tree | f0c68b320cff5051a4a8dc4d5827f55276b1d73c /compatibility-client/src | |
parent | e76d2e8953e8bfb80018019dc5497e7760313403 (diff) | |
download | vaadin-framework-ca1bfa7511e35fad802271604158afd7be6531d0.tar.gz vaadin-framework-ca1bfa7511e35fad802271604158afd7be6531d0.zip |
Pick changes from 7.7.7 (#8577)
* Fix java packaging order (#106)
Closes vaadin/archetypes#113
* Use proper UTF-8 encoding for Content-Disposition filenames (#19527) (#6607)
* Enable changing the backing bean for BeanItem (#4302) (#77)
When storing a bean to the database, you typically get a new and updated
bean instance back. By allowing to change the bean instance, we make it
possible to just update the single BeanItem instance which can be used
in many places.
* Make AtmospherePushConnection methods public (#7973)
There is no sensible way to use a custom version of APC, so protected
access does not help in any way to access the underlying resource and/or
connected UI.
* Use correct indexes in multiselect checkboxes after removing rows (#8072)
Fixes #8011
* Fix removal of hidden Grid columns (#8071)
Fixes #8018
* Call error handler for exceptions in UI.init() (#8055)
Fixes #4995
* Render font icon correctly on the 'more' menu item (#8126)
* Render font icon correctly on the 'more' menu item
Fixes #8125
* Reopen Grid details on attach, fixes #8015 (#8074)
Fixes #8015
* Fix broken Grid tests after picking changes from 7.7.7
Removed duplicate setDetailsVisible calls from onDetach
* Correctly detach components in merged cells when a static row is removed (#8142)
Fixes #8140
Diffstat (limited to 'compatibility-client/src')
3 files changed, 44 insertions, 23 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/MultiSelectionRenderer.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/MultiSelectionRenderer.java index 678d37369f..a7c974aead 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/MultiSelectionRenderer.java @@ -26,6 +26,7 @@ import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.TableElement; +import com.google.gwt.dom.client.TableRowElement; import com.google.gwt.dom.client.TableSectionElement; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -45,6 +46,7 @@ import com.vaadin.v7.client.widget.grid.RendererCellReference; import com.vaadin.v7.client.widget.grid.events.GridEnabledEvent; import com.vaadin.v7.client.widget.grid.events.GridEnabledHandler; import com.vaadin.v7.client.widget.grid.selection.SelectionModel.Multi.Batched; +import com.vaadin.v7.client.widgets.Escalator.AbstractRowContainer; import com.vaadin.v7.client.widgets.Grid; /** @@ -319,7 +321,7 @@ public class MultiSelectionRenderer<T> int constrainedPageY = Math.max(bodyAbsoluteTop, Math.min(bodyAbsoluteBottom, pageY)); - int logicalRow = getLogicalRowIndex(WidgetUtil + int logicalRow = getLogicalRowIndex(grid, WidgetUtil .getElementFromPoint(initialPageX, constrainedPageY)); int incrementOrDecrement = (logicalRow > lastModifiedLogicalRow) ? 1 @@ -586,8 +588,6 @@ public class MultiSelectionRenderer<T> } } - private static final String LOGICAL_ROW_PROPERTY_INT = "vEscalatorLogicalRow"; - private final Grid<T> grid; private HandlerRegistration nativePreviewHandlerRegistration; @@ -633,8 +633,6 @@ public class MultiSelectionRenderer<T> CheckBox checkBox) { checkBox.setValue(data, false); checkBox.setEnabled(grid.isEnabled() && !grid.isEditorActive()); - checkBox.getElement().setPropertyInt(LOGICAL_ROW_PROPERTY_INT, - cell.getRowIndex()); } @Override @@ -668,7 +666,7 @@ public class MultiSelectionRenderer<T> private void startDragSelect(NativeEvent event, final Element target) { injectNativeHandler(); - int logicalRowIndex = getLogicalRowIndex(target); + int logicalRowIndex = getLogicalRowIndex(grid, target); autoScrollHandler.start(logicalRowIndex); event.preventDefault(); event.stopPropagation(); @@ -687,7 +685,7 @@ public class MultiSelectionRenderer<T> } } - private int getLogicalRowIndex(final Element target) { + private int getLogicalRowIndex(Grid<T> grid, final Element target) { if (target == null) { return -1; } @@ -707,7 +705,8 @@ public class MultiSelectionRenderer<T> final Element checkbox = td.getFirstChildElement(); assert checkbox != null : "Checkbox has disappeared"; - return checkbox.getPropertyInt(LOGICAL_ROW_PROPERTY_INT); + return ((AbstractRowContainer) grid.getEscalator().getBody()) + .getLogicalRowIndex((TableRowElement) tr); } tr = tr.getNextSiblingElement(); } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java index f343d45f6f..cb2786a4cf 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java @@ -673,13 +673,13 @@ public class Escalator extends Widget /*-{ var vScroll = esc.@com.vaadin.v7.client.widgets.Escalator::verticalScrollbar; var vScrollElem = vScroll.@com.vaadin.v7.client.widget.escalator.ScrollbarBundle::getElement()(); - + var hScroll = esc.@com.vaadin.v7.client.widgets.Escalator::horizontalScrollbar; var hScrollElem = hScroll.@com.vaadin.v7.client.widget.escalator.ScrollbarBundle::getElement()(); - + return $entry(function(e) { var target = e.target; - + // in case the scroll event was native (i.e. scrollbars were dragged, or // the scrollTop/Left was manually modified), the bundles have old cache // values. We need to make sure that the caches are kept up to date. @@ -700,29 +700,29 @@ public class Escalator extends Widget return $entry(function(e) { var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; - + // Delta mode 0 is in pixels; we don't need to do anything... - + // A delta mode of 1 means we're scrolling by lines instead of pixels // We need to scale the number of lines by the default line height if(e.deltaMode === 1) { var brc = esc.@com.vaadin.v7.client.widgets.Escalator::body; deltaY *= brc.@com.vaadin.v7.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()(); } - + // Other delta modes aren't supported if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) { var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\""; - + // Print warning message esc.@com.vaadin.v7.client.widgets.Escalator::logWarning(*)(msg); } - + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.v7.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); }); }-*/; @@ -1044,7 +1044,7 @@ public class Escalator extends Widget } } - protected abstract class AbstractRowContainer implements RowContainer { + public abstract class AbstractRowContainer implements RowContainer { private EscalatorUpdater updater = EscalatorUpdater.NULL; private int rows; @@ -2070,7 +2070,14 @@ public class Escalator extends Widget */ protected abstract double getHeightOfSection(); - protected int getLogicalRowIndex(final TableRowElement tr) { + /** + * Gets the logical row index for the given table row element. + * + * @param tr + * the table row element inside this container + * @return the logical index of the given element + */ + public int getLogicalRowIndex(final TableRowElement tr) { return tr.getSectionRowIndex(); }; @@ -3379,7 +3386,7 @@ public class Escalator extends Widget } @Override - protected int getLogicalRowIndex(final TableRowElement tr) { + public int getLogicalRowIndex(final TableRowElement tr) { assert tr .getParentNode() == root : "The given element isn't a row element in the body"; int internalIndex = visualRowOrder.indexOf(tr); diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java index e59fc2213f..5e48188128 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java @@ -4128,6 +4128,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, private GridSpacerUpdater gridSpacerUpdater = new GridSpacerUpdater(); /** A set keeping track of the indices of all currently open details */ private Set<Integer> visibleDetails = new HashSet<>(); + /** A set of indices of details to reopen after detach and on attach */ + private final Set<Integer> reattachVisibleDetails = new HashSet<>(); private boolean columnReorderingAllowed; @@ -6451,8 +6453,14 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, int columnIndex = columns.indexOf(column); // Remove from column configuration - escalator.getColumnConfiguration() - .removeColumns(getVisibleColumns().indexOf(column), 1); + int visibleColumnIndex = getVisibleColumns().indexOf(column); + if (visibleColumnIndex < 0) { + assert column.isHidden(); + // Hidden columns are not included in Escalator + } else { + getEscalator().getColumnConfiguration() + .removeColumns(visibleColumnIndex, 1); + } updateFrozenColumns(); @@ -6831,7 +6839,12 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, return editor; } - protected Escalator getEscalator() { + /** + * Gets the {@link Escalator} used by this Grid instnace. + * + * @return the escalator instance, never <code>null</code> + */ + public Escalator getEscalator() { return escalator; } @@ -8766,6 +8779,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, @Override protected void onDetach() { Set<Integer> details = new HashSet<>(visibleDetails); + reattachVisibleDetails.clear(); + reattachVisibleDetails.addAll(details); for (int row : details) { setDetailsVisible(row, false); } |