diff options
author | Henrik Paul <henrik@vaadin.com> | 2015-03-31 14:44:23 +0300 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2015-03-31 14:44:23 +0300 |
commit | 844b2c6c41d57d4db1238eb6096f225c9fdb8314 (patch) | |
tree | ffdd57cd35da2df500fbfae5981de381439d1f5c /client | |
parent | 2080f86e03552c56d52f488e4dcd72282cd64f62 (diff) | |
parent | 3ab82ace45827365e87f9540fad3dffaed0679b5 (diff) | |
download | vaadin-framework-844b2c6c41d57d4db1238eb6096f225c9fdb8314.tar.gz vaadin-framework-844b2c6c41d57d4db1238eb6096f225c9fdb8314.zip |
Merge remote-tracking branch 'origin/master' into grid-7.5
Change-Id: Ife8c6d2a5f6c134a6e28e862f524b6e687199cc8
Diffstat (limited to 'client')
11 files changed, 227 insertions, 136 deletions
diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index 5ca79cb121..3bc75a9a9b 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -411,6 +411,11 @@ public class BrowserInfo { if (isIOS() && isWebkit() && getOperatingSystemMajorVersion() >= 6) { return false; } + + if (isIE()) { + return false; + } + return true; } diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index 787da9bc6f..e544c91d0f 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -43,7 +43,7 @@ import elemental.json.JsonObject; /** * The default {@link PushConnection} implementation that uses Atmosphere for * handling the communication channel. - * + * * @author Vaadin Ltd * @since 7.1 */ @@ -135,8 +135,6 @@ public class AtmospherePushConnection implements PushConnection { */ private Command pendingDisconnectCommand; - private String pushPath; - public AtmospherePushConnection() { } @@ -183,9 +181,6 @@ public class AtmospherePushConnection implements PushConnection { pushConfiguration.parameters.get(param)); } - pushPath = pushConfiguration.pushPath; - assert pushPath != null; - runWhenAtmosphereLoaded(new Command() { @Override public void execute() { @@ -202,7 +197,7 @@ public class AtmospherePushConnection implements PushConnection { private void connect() { String baseUrl = connection .translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX - + pushPath + '/'); + + ApplicationConstants.PUSH_PATH + '/'); String extraParams = UIConstants.UI_ID_PARAMETER + "=" + connection.getConfiguration().getUIId(); @@ -277,9 +272,9 @@ public class AtmospherePushConnection implements PushConnection { /** * Called whenever a server push connection is established (or * re-established). - * + * * @param response - * + * * @since 7.2 */ protected void onConnect(AtmosphereResponse response) { @@ -360,7 +355,7 @@ public class AtmospherePushConnection implements PushConnection { /** * Called if the push connection fails. Atmosphere will automatically retry * the connection until successful. - * + * */ protected void onError(AtmosphereResponse response) { state = State.DISCONNECTED; diff --git a/client/src/com/vaadin/client/connectors/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java index d17f378611..0e2ee0046b 100644 --- a/client/src/com/vaadin/client/connectors/GridConnector.java +++ b/client/src/com/vaadin/client/connectors/GridConnector.java @@ -176,6 +176,18 @@ public class GridConnector extends AbstractHasComponentsConnector implements this.id = id; } + /** + * Sets a new renderer for this column object + * + * @param rendererConnector + * a renderer connector object + */ + public void setRenderer( + AbstractRendererConnector<Object> rendererConnector) { + setRenderer(rendererConnector.getRenderer()); + this.rendererConnector = rendererConnector; + } + @Override public Object getValue(final JsonObject obj) { final JsonObject rowData = obj.getObject(GridState.JSONKEY_DATA); @@ -189,16 +201,6 @@ public class GridConnector extends AbstractHasComponentsConnector implements return null; } - /* - * Only used to check that the renderer connector will not change during - * the column lifetime. - * - * TODO remove once support for changing renderers is implemented - */ - private AbstractRendererConnector<Object> getRendererConnector() { - return rendererConnector; - } - private AbstractFieldConnector getEditorConnector() { return editorConnector; } @@ -1137,11 +1139,6 @@ public class GridConnector extends AbstractHasComponentsConnector implements columnsUpdatedFromState = true; updateColumnFromState(column, columnState); columnsUpdatedFromState = false; - - if (columnState.rendererConnector != column.getRendererConnector()) { - throw new UnsupportedOperationException( - "Changing column renderer after initialization is currently unsupported"); - } } /** @@ -1185,6 +1182,7 @@ public class GridConnector extends AbstractHasComponentsConnector implements * @param state * The state to get the data from */ + @SuppressWarnings("unchecked") private static void updateColumnFromState(CustomGridColumn column, GridColumnState state) { column.setWidth(state.width); @@ -1192,6 +1190,9 @@ public class GridConnector extends AbstractHasComponentsConnector implements column.setMaximumWidth(state.maxWidth); column.setExpandRatio(state.expandRatio); + assert state.rendererConnector instanceof AbstractRendererConnector : "GridColumnState.rendererConnector is invalid (not subclass of AbstractRendererConnector)"; + column.setRenderer((AbstractRendererConnector<Object>) state.rendererConnector); + column.setSortable(state.sortable); column.setHidden(state.hidden); diff --git a/client/src/com/vaadin/client/ui/FocusableScrollPanel.java b/client/src/com/vaadin/client/ui/FocusableScrollPanel.java index 475c8f8074..9dd9c17675 100644 --- a/client/src/com/vaadin/client/ui/FocusableScrollPanel.java +++ b/client/src/com/vaadin/client/ui/FocusableScrollPanel.java @@ -48,9 +48,11 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements Style style = getElement().getStyle(); style.setProperty("zoom", "1"); style.setPosition(Position.RELATIVE); + browserInfo = BrowserInfo.get(); } private DivElement focusElement; + private BrowserInfo browserInfo; public FocusableScrollPanel(boolean useFakeFocusElement) { this(); @@ -72,6 +74,12 @@ public class FocusableScrollPanel extends SimpleFocusablePanel implements style.setPosition(Position.FIXED); style.setTop(0, Unit.PX); style.setLeft(0, Unit.PX); + if (browserInfo.isIE()) { + // for #15294: artificially hide little bit more the + // focusElement, otherwise IE will make the window to scroll + // into it when focused + style.setLeft(-999, Unit.PX); + } getElement().appendChild(focusElement); /* Sink from focusElemet too as focusa and blur don't bubble */ DOM.sinkEvents(focusElement, Event.FOCUSEVENTS); diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java index 06eaecaf70..fc328dd56a 100644 --- a/client/src/com/vaadin/client/ui/VAccordion.java +++ b/client/src/com/vaadin/client/ui/VAccordion.java @@ -29,8 +29,8 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.ComplexPanel; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ComponentConnector; -import com.vaadin.client.WidgetUtil; import com.vaadin.client.VCaption; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ui.accordion.AccordionState; @@ -417,6 +417,9 @@ public class VAccordion extends VTabsheetBase { public void removeTab(int index) { StackItem item = getStackItem(index); remove(item); + if (selectedItemIndex == index) { + selectedItemIndex = -1; + } touchScrollHandler.removeElement(item.getContainerElement()); } diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 12de2724fc..13561dcd0f 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -2774,7 +2774,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private boolean sortable = false; private final String cid; + private boolean dragging; + private Integer currentDragX = null; // is used to resolve #14796 private int dragStartX; private int colIndex; @@ -3146,6 +3148,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, event.stopPropagation(); } dragging = true; + currentDragX = WidgetUtil.getTouchOrMouseClientX(event); moved = false; colIndex = getColIndexByKey(cid); DOM.setCapture(getElement()); @@ -3160,6 +3163,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets, if (columnReordering && WidgetUtil.isTouchEventOrLeftMouseButton(event)) { dragging = false; + currentDragX = null; DOM.releaseCapture(getElement()); if (WidgetUtil.isTouchEvent(event)) { @@ -3227,47 +3231,57 @@ public class VScrollTable extends FlowPanel implements HasWidgets, break; case Event.ONTOUCHMOVE: case Event.ONMOUSEMOVE: - if (dragging && WidgetUtil.isTouchEventOrLeftMouseButton(event)) { - if (event.getTypeInt() == Event.ONTOUCHMOVE) { - /* - * prevent using this event in e.g. scrolling - */ - event.stopPropagation(); - } - if (!moved) { - createFloatingCopy(); - moved = true; - } + // only start the drag if the mouse / touch has moved a minimum + // distance in x-axis (the same idea as in #13381) + int currentX = WidgetUtil.getTouchOrMouseClientX(event); - final int clientX = WidgetUtil - .getTouchOrMouseClientX(event); - final int x = clientX + tHead.hTableWrapper.getScrollLeft(); - int slotX = headerX; - closestSlot = colIndex; - int closestDistance = -1; - int start = 0; - if (showRowHeaders) { - start++; - } - final int visibleCellCount = tHead.getVisibleCellCount(); - for (int i = start; i <= visibleCellCount; i++) { - if (i > 0) { - final String colKey = getColKeyByIndex(i - 1); - // getColWidth only returns the internal width - // without padding, not the offset width of the - // whole td (#10890) - slotX += getColWidth(colKey) - + scrollBody.getCellExtraWidth(); + if (currentDragX == null + || Math.abs(currentDragX - currentX) > VDragAndDropManager.MINIMUM_DISTANCE_TO_START_DRAG) { + if (dragging + && WidgetUtil.isTouchEventOrLeftMouseButton(event)) { + if (event.getTypeInt() == Event.ONTOUCHMOVE) { + /* + * prevent using this event in e.g. scrolling + */ + event.stopPropagation(); } - final int dist = Math.abs(x - slotX); - if (closestDistance == -1 || dist < closestDistance) { - closestDistance = dist; - closestSlot = i; + if (!moved) { + createFloatingCopy(); + moved = true; } - } - tHead.focusSlot(closestSlot); - updateFloatingCopysPosition(clientX, -1); + final int clientX = WidgetUtil + .getTouchOrMouseClientX(event); + final int x = clientX + + tHead.hTableWrapper.getScrollLeft(); + int slotX = headerX; + closestSlot = colIndex; + int closestDistance = -1; + int start = 0; + if (showRowHeaders) { + start++; + } + final int visibleCellCount = tHead + .getVisibleCellCount(); + for (int i = start; i <= visibleCellCount; i++) { + if (i > 0) { + final String colKey = getColKeyByIndex(i - 1); + // getColWidth only returns the internal width + // without padding, not the offset width of the + // whole td (#10890) + slotX += getColWidth(colKey) + + scrollBody.getCellExtraWidth(); + } + final int dist = Math.abs(x - slotX); + if (closestDistance == -1 || dist < closestDistance) { + closestDistance = dist; + closestSlot = i; + } + } + tHead.focusSlot(closestSlot); + + updateFloatingCopysPosition(clientX, -1); + } } break; default: diff --git a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index 80979587b9..cde1f1af0f 100644 --- a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -77,22 +77,24 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements // (even though both can never be given at the same time) templateContents = getConnection().getResource( "layouts/" + templateName + ".html"); - if (templateContents == null) { - // Template missing -> show debug notice and render components - // in order. - getWidget() - .getElement() - .setInnerHTML( - "<em>Layout file layouts/" - + templateName - + ".html is missing. Components will be drawn for debug purposes.</em>"); - } } if (templateContents != null) { // Template ok -> initialize. getWidget().initializeHTML(templateContents, getConnection().getThemeUri()); + } else { + // Template missing -> show debug notice and render components in + // order. + String warning = templateName != null ? "Layout file layouts/" + + templateName + ".html is missing." + : "Layout file not specified."; + getWidget() + .getElement() + .setInnerHTML( + "<em>" + + warning + + " Components will be drawn for debug purposes.</em>"); } templateUpdated = true; } diff --git a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java index 844f4c1b9c..47f8eb1b66 100644 --- a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -38,9 +38,9 @@ import com.vaadin.client.ComponentConnector; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.Profiler; import com.vaadin.client.UIDL; -import com.vaadin.client.WidgetUtil; import com.vaadin.client.VConsole; import com.vaadin.client.ValueMap; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.VOverlay; import com.vaadin.shared.ApplicationConstants; import com.vaadin.shared.MouseEventDetails; @@ -240,6 +240,12 @@ public class VDragAndDropManager { } + /* + * #13381, #14796. The drag only actually starts when the mouse move or + * touch move event is more than 3 pixel away. + */ + public static final int MINIMUM_DISTANCE_TO_START_DRAG = 3; + private static VDragAndDropManager instance; private HandlerRegistration handlerRegistration; private VDragEvent currentDrag; @@ -425,25 +431,16 @@ public class VDragAndDropManager { int currentY = WidgetUtil .getTouchOrMouseClientY(event .getNativeEvent()); - if (Math.abs(startX - currentX) > 3 - || Math.abs(startY - currentY) > 3) { - if (deferredStartRegistration != null) { - deferredStartRegistration - .removeHandler(); - deferredStartRegistration = null; - } + if (Math.abs(startX - currentX) > MINIMUM_DISTANCE_TO_START_DRAG + || Math.abs(startY - currentY) > MINIMUM_DISTANCE_TO_START_DRAG) { + ensureDeferredRegistrationCleanup(); currentDrag.setCurrentGwtEvent(event .getNativeEvent()); startDrag.execute(); } break; default: - // on any other events, clean up the - // deferred drag start - if (deferredStartRegistration != null) { - deferredStartRegistration.removeHandler(); - deferredStartRegistration = null; - } + ensureDeferredRegistrationCleanup(); currentDrag = null; clearDragElement(); break; @@ -534,10 +531,10 @@ public class VDragAndDropManager { } private void endDrag(boolean doDrop) { - if (handlerRegistration != null) { - handlerRegistration.removeHandler(); - handlerRegistration = null; - } + + ensureDeferredRegistrationCleanup(); + ensureHandlerRegistrationCleanup(); + boolean sendTransferableToServer = false; if (currentDropHandler != null) { if (doDrop) { @@ -595,6 +592,20 @@ public class VDragAndDropManager { } + private void ensureHandlerRegistrationCleanup() { + if (handlerRegistration != null) { + handlerRegistration.removeHandler(); + handlerRegistration = null; + } + } + + private void ensureDeferredRegistrationCleanup() { + if (deferredStartRegistration != null) { + deferredStartRegistration.removeHandler(); + deferredStartRegistration = null; + } + } + private void removeActiveDragSourceStyleName(ComponentConnector dragSource) { dragSource.getWidget().removeStyleName(ACTIVE_DRAG_SOURCE_STYLENAME); } diff --git a/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java b/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java index 5024c8bffa..ddbf690970 100644 --- a/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java @@ -569,6 +569,7 @@ public class MultiSelectionRenderer<T> extends ComplexRenderer<Boolean> { InputElement checkbox = InputElement.as(cell.getElement() .getFirstChildElement()); checkbox.setChecked(data.booleanValue()); + checkbox.setDisabled(grid.isEditorActive()); checkbox.setPropertyInt(LOGICAL_ROW_PROPERTY_INT, cell.getRowIndex()); } diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java index 6d9b8ee70a..88ed9295e4 100644 --- a/client/src/com/vaadin/client/widgets/Escalator.java +++ b/client/src/com/vaadin/client/widgets/Escalator.java @@ -2031,9 +2031,8 @@ public class Escalator extends Widget implements RequiresResize, return new Cell(domRowIndex, domColumnIndex, cellElement); } - double getMaxCellWidth(int colIndex) throws IllegalArgumentException { - double maxCellWidth = -1; - + void createAutoSizeElements(int colIndex, + Collection<TableCellElement> elements) { assert isAttached() : "Can't measure max width of cell, since Escalator is not attached to the DOM."; NodeList<TableRowElement> rows = root.getRows(); @@ -2062,24 +2061,9 @@ public class Escalator extends Widget implements RequiresResize, cellClone.getStyle().clearWidth(); rowElement.insertBefore(cellClone, cellOriginal); - double requiredWidth = WidgetUtil - .getRequiredWidthBoundingClientRectDouble(cellClone); - - if (BrowserInfo.get().isIE()) { - /* - * IE browsers have some issues with subpixels. Occasionally - * content is overflown even if not necessary. Increase the - * counted required size by 0.01 just to be on the safe - * side. - */ - requiredWidth += 0.01; - } - maxCellWidth = Math.max(requiredWidth, maxCellWidth); - cellClone.removeFromParent(); + elements.add(cellClone); } - - return maxCellWidth; } private boolean cellIsPartOfSpan(TableCellElement cell) { @@ -3906,7 +3890,8 @@ public class Escalator extends Widget implements RequiresResize, if (px < 0) { if (isAttached()) { - calculateWidth(); + autosizeColumns(Collections.singletonList(columns + .indexOf(this))); } else { /* * the column's width is calculated at Escalator.onLoad @@ -3960,10 +3945,6 @@ public class Escalator extends Widget implements RequiresResize, } return false; } - - private void calculateWidth() { - calculatedWidth = getMaxCellWidth(columns.indexOf(this)); - } } private final List<Column> columns = new ArrayList<Column>(); @@ -4268,6 +4249,7 @@ public class Escalator extends Widget implements RequiresResize, return; } + List<Integer> autosizeColumns = new ArrayList<Integer>(); for (Entry<Integer, Double> entry : indexWidthMap.entrySet()) { int index = entry.getKey().intValue(); double width = entry.getValue().doubleValue(); @@ -4277,10 +4259,15 @@ public class Escalator extends Widget implements RequiresResize, } checkValidColumnIndex(index); - columns.get(index).setWidth(width); - + if (width >= 0) { + columns.get(index).setWidth(width); + } else { + autosizeColumns.add(index); + } } + autosizeColumns(autosizeColumns); + widthsArray = null; header.reapplyColumnWidths(); body.reapplyColumnWidths(); @@ -4291,6 +4278,64 @@ public class Escalator extends Widget implements RequiresResize, recalculateElementSizes(); } + private void autosizeColumns(List<Integer> columns) { + if (columns.isEmpty()) { + return; + } + + // Must process columns in index order + Collections.sort(columns); + + Map<Integer, List<TableCellElement>> autoSizeElements = new HashMap<Integer, List<TableCellElement>>(); + try { + // Set up the entire DOM at once + for (int i = columns.size() - 1; i >= 0; i--) { + // Iterate backwards to not mess with the indexing + Integer colIndex = columns.get(i); + + ArrayList<TableCellElement> elements = new ArrayList<TableCellElement>(); + autoSizeElements.put(colIndex, elements); + + header.createAutoSizeElements(colIndex, elements); + body.createAutoSizeElements(colIndex, elements); + footer.createAutoSizeElements(colIndex, elements); + } + + // Extract all measurements & update values + for (Integer colIndex : columns) { + double maxWidth = Double.NEGATIVE_INFINITY; + List<TableCellElement> elements = autoSizeElements + .get(colIndex); + for (TableCellElement element : elements) { + + double cellWidth = WidgetUtil + .getRequiredWidthBoundingClientRectDouble(element); + + maxWidth = Math.max(maxWidth, cellWidth); + } + assert maxWidth >= 0 : "Got a negative max width for a column, which should be impossible."; + + if (BrowserInfo.get().isIE()) { + /* + * IE browsers have some issues with subpixels. + * Occasionally content is overflown even if not + * necessary. Increase the counted required size by 0.01 + * just to be on the safe side. + */ + maxWidth += 0.01; + } + + this.columns.get(colIndex).calculatedWidth = maxWidth; + } + } finally { + for (List<TableCellElement> list : autoSizeElements.values()) { + for (TableCellElement element : list) { + element.removeFromParent(); + } + } + } + } + private void checkValidColumnIndex(int index) throws IllegalArgumentException { if (!Range.withLength(0, getColumnCount()).contains(index)) { @@ -4310,18 +4355,6 @@ public class Escalator extends Widget implements RequiresResize, return columns.get(index).getCalculatedWidth(); } - private double getMaxCellWidth(int colIndex) - throws IllegalArgumentException { - double headerWidth = header.getMaxCellWidth(colIndex); - double bodyWidth = body.getMaxCellWidth(colIndex); - double footerWidth = footer.getMaxCellWidth(colIndex); - - double maxWidth = Math.max(headerWidth, - Math.max(bodyWidth, footerWidth)); - assert maxWidth >= 0 : "Got a negative max width for a column, which should be impossible."; - return maxWidth; - } - /** * Calculates the width of the columns in a given range. * diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index dad6f0fcfc..20b8844623 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -1190,6 +1190,7 @@ public class Grid<T> extends ResizeComposite implements + "Grid editor"); grid.getEscalator().setScrollLocked(Direction.VERTICAL, false); + updateSelectionCheckboxesAsNeeded(true); } } }; @@ -1289,6 +1290,16 @@ public class Grid<T> extends ResizeComposite implements null); handler.cancel(request); state = State.INACTIVE; + updateSelectionCheckboxesAsNeeded(true); + } + + private void updateSelectionCheckboxesAsNeeded(boolean isEnabled) { + if (grid.getSelectionModel() instanceof Multi) { + grid.refreshBody(); + CheckBox checkBox = (CheckBox) grid.getDefaultHeaderRow() + .getCell(grid.selectionColumn).getWidget(); + checkBox.setEnabled(isEnabled); + } } /** @@ -1315,6 +1326,7 @@ public class Grid<T> extends ResizeComposite implements EditorRequest<T> request = new EditorRequestImpl<T>(grid, rowIndex, saveRequestCallback); handler.save(request); + updateSelectionCheckboxesAsNeeded(true); } /** @@ -1379,6 +1391,7 @@ public class Grid<T> extends ResizeComposite implements rowIndex, bindRequestCallback); handler.bind(request); grid.getEscalator().setScrollLocked(Direction.VERTICAL, true); + updateSelectionCheckboxesAsNeeded(false); } } @@ -2577,7 +2590,7 @@ public class Grid<T> extends ResizeComposite implements final double widthFixed = Math.max(widthAsIs, column.getMinimumWidth()); defaultExpandRatios = defaultExpandRatios - && column.getExpandRatio() == -1; + && (column.getExpandRatio() == -1 || column == selectionColumn); if (isFixedWidth) { columnSizes.put(visibleColumns.indexOf(column), widthFixed); @@ -2595,7 +2608,8 @@ public class Grid<T> extends ResizeComposite implements .getExpandRatio()); final double newWidth = column.getWidthActual(); final double maxWidth = getMaxWidth(column); - boolean shouldExpand = newWidth < maxWidth && expandRatio > 0; + boolean shouldExpand = newWidth < maxWidth && expandRatio > 0 + && column != selectionColumn; if (shouldExpand) { totalRatios += expandRatio; columnsToExpand.add(column); @@ -3923,12 +3937,14 @@ public class Grid<T> extends ResizeComposite implements if (renderer == null) { throw new IllegalArgumentException("Renderer cannot be null."); } - bodyRenderer = renderer; - if (grid != null) { - grid.refreshBody(); - } + if (renderer != bodyRenderer) { + bodyRenderer = renderer; + if (grid != null) { + grid.refreshBody(); + } + } return this; } @@ -5635,7 +5651,6 @@ public class Grid<T> extends ResizeComposite implements escalator.getColumnConfiguration() .setFrozenColumnCount(numberOfColumns); - } /** @@ -6975,6 +6990,9 @@ public class Grid<T> extends ResizeComposite implements // Do ComplexRenderer.init and render new content conf.insertColumns(0, visibleColumns.size()); + // Number of frozen columns should be kept same #16901 + updateFrozenColumns(); + // Update column widths. for (Column<?, T> column : columns) { column.reapplyWidth(); |