Browse Source

Fix issues from API review for 8.2 (#10342)

* Rename HierarchicalDataCommunicator#getMapper to getHierarchyMapper

* Make rpc field in Notification private

* Change DropIndexCalculator.ALWAYS_DROP_TO_END to a generic static method

* Move EditorImpl#editRow documentation to the interface level

* Correct GridDragEndEvent, GridDragStartEvent constructor javadocs

* Revert SharedState.registeredEventListeners to a Set

* Rename GridDropTarget dropAllowedOnSortedGridRows

* Rename ColumnState.contentMode to tooltipContentMode
tags/8.3.0.alpha1
Aleksi Hietanen 6 years ago
parent
commit
f805482c60
No account linked to committer's email address
23 changed files with 97 additions and 114 deletions
  1. 0
    1
      all/src/main/templates/release-notes.html
  2. 9
    9
      client/src/main/java/com/vaadin/client/connectors/grid/ColumnConnector.java
  3. 1
    1
      client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java
  4. 3
    3
      client/src/main/java/com/vaadin/client/ui/AbstractConnector.java
  5. 3
    3
      server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java
  6. 3
    3
      server/src/main/java/com/vaadin/event/EventRouter.java
  7. 3
    3
      server/src/main/java/com/vaadin/ui/Grid.java
  8. 8
    8
      server/src/main/java/com/vaadin/ui/Notification.java
  9. 7
    4
      server/src/main/java/com/vaadin/ui/components/grid/DropIndexCalculator.java
  10. 13
    3
      server/src/main/java/com/vaadin/ui/components/grid/Editor.java
  11. 0
    16
      server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
  12. 1
    1
      server/src/main/java/com/vaadin/ui/components/grid/GridDragEndEvent.java
  13. 1
    1
      server/src/main/java/com/vaadin/ui/components/grid/GridDragStartEvent.java
  14. 9
    9
      server/src/main/java/com/vaadin/ui/components/grid/GridDropTarget.java
  15. 1
    1
      server/src/main/java/com/vaadin/ui/components/grid/GridRowDragger.java
  16. 13
    13
      server/src/test/java/com/vaadin/tests/components/grid/GridDropTargetTest.java
  17. 3
    3
      server/src/test/java/com/vaadin/tests/server/component/grid/GridRowDraggerOneGridTest.java
  18. 3
    3
      server/src/test/java/com/vaadin/tests/server/component/grid/GridRowDraggerTwoGridsTest.java
  19. 3
    5
      shared/src/main/java/com/vaadin/shared/communication/SharedState.java
  20. 9
    20
      shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java
  21. 1
    1
      shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java
  22. 2
    2
      uitest/src/main/java/com/vaadin/tests/components/grid/AbstractGridDnD.java
  23. 1
    1
      uitest/src/main/java/com/vaadin/tests/components/grid/GridRowDraggerTwoGrids.java

+ 0
- 1
all/src/main/templates/release-notes.html View File

@@ -121,7 +121,6 @@
<li>Error indicators are now <tt>&lt;span class="v-errorindicator"&gt;&lt;/span&gt;</tt> elements.</li>
<li><tt>Embedded</tt> is not a <tt>LegacyComponent</tt> anymore.</li>
<li><tt>Notification</tt> method <tt>show</tt> returns <tt>Notification</tt>, instead of <tt>void</tt>.</li>
<li><tt>SharedState</tt> field <tt>registeredEventListeners</tt> is a <tt>Map</tt> instead of <tt>Set</tt>.</li>
<li>The client side <tt>SelectionModel</tt> interface has a new method <tt>isMultiSelectionAllowed</tt>.</li>
<li><tt>AbstractDateField</tt> is not a <tt>LegacyComponent</tt> anymore.</li>
<li><tt>AbstractDateField</tt>.<tt>formatDate</tt> is now abstract.</li>

+ 9
- 9
client/src/main/java/com/vaadin/client/connectors/grid/ColumnConnector.java View File

@@ -42,7 +42,7 @@ public class ColumnConnector extends AbstractExtensionConnector {
extends Column<Object, JsonObject> {

private final String connectorId;
private ContentMode contentMode;
private ContentMode tooltipContentMode;

CustomColumn(String connectorId) {
this.connectorId = connectorId;
@@ -64,20 +64,20 @@ public class ColumnConnector extends AbstractExtensionConnector {
*
* @since 8.2
*/
public ContentMode getContentMode() {
return contentMode;
public ContentMode getTooltipContentMode() {
return tooltipContentMode;
}

/**
* Sets the content mode for tooltips in this column.
*
* @param contentMode
* @param tooltipContentMode
* the content mode for tooltips
*
* @since 8.2
*/
public void setContentMode(ContentMode contentMode) {
this.contentMode = contentMode;
public void setTooltipContentMode(ContentMode tooltipContentMode) {
this.tooltipContentMode = tooltipContentMode;
}
}

@@ -189,9 +189,9 @@ public class ColumnConnector extends AbstractExtensionConnector {
column.setEditable(getState().editable);
}

@OnStateChange("contentMode")
void updateContentMode() {
column.setContentMode(getState().contentMode);
@OnStateChange("tooltipContentMode")
void updateTooltipContentMode() {
column.setTooltipContentMode(getState().tooltipContentMode);
}

@Override

+ 1
- 1
client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java View File

@@ -634,7 +634,7 @@ public class GridConnector extends AbstractListingConnector
if (cellDescriptions != null
&& cellDescriptions.hasKey(id)) {
return new TooltipInfo(cellDescriptions.getString(id),
((CustomColumn) column).getContentMode());
((CustomColumn) column).getTooltipContentMode());
} else if (row.hasKey(GridState.JSONKEY_ROWDESCRIPTION)) {
return new TooltipInfo(
row.getString(GridState.JSONKEY_ROWDESCRIPTION),

+ 3
- 3
client/src/main/java/com/vaadin/client/ui/AbstractConnector.java View File

@@ -20,7 +20,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;

import com.google.gwt.core.client.JsArrayString;
@@ -490,8 +490,8 @@ public abstract class AbstractConnector
*/
@Override
public boolean hasEventListener(String eventIdentifier) {
Map<String, Integer> reg = getState().registeredEventListeners;
return reg != null && reg.containsKey(eventIdentifier);
Set<String> reg = getState().registeredEventListeners;
return reg != null && reg.contains(eventIdentifier);
}

/**

+ 3
- 3
server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java View File

@@ -323,11 +323,11 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> {
}

/**
* Returns active {@code HierarchyMapper}
* Returns the {@code HierarchyMapper} used by this data communicator.
*
* @return the mapper
* @return the hierarchy mapper used by this data communicator
*/
protected HierarchyMapper<T, ?> getMapper() {
protected HierarchyMapper<T, ?> getHierarchyMapper() {
return mapper;
}
}

+ 3
- 3
server/src/main/java/com/vaadin/event/EventRouter.java View File

@@ -120,9 +120,10 @@ public class EventRouter implements MethodEventSource {
.addRegisteredEventListener(state, eventIdentifier);

return () -> {
registration.remove();

listenerList.remove(listenerMethod);
if (!hasListeners(eventType)) {
registration.remove();
}
};
}

@@ -313,5 +314,4 @@ public class EventRouter implements MethodEventSource {
}
return listeners;
}

}

+ 3
- 3
server/src/main/java/com/vaadin/ui/Grid.java View File

@@ -1414,7 +1414,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
* @param cellDescriptionGenerator
* the cell description generator to set, or {@code null} to
* remove a previously set generator
* @param contentMode
* @param tooltipContentMode
* the content mode for tooltips
* @return this column
*
@@ -1422,9 +1422,9 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
*/
public Column<T, V> setDescriptionGenerator(
DescriptionGenerator<T> cellDescriptionGenerator,
ContentMode contentMode) {
ContentMode tooltipContentMode) {
this.descriptionGenerator = cellDescriptionGenerator;
getState().contentMode = contentMode;
getState().tooltipContentMode = tooltipContentMode;
getGrid().getDataCommunicator().reset();
return this;
}

+ 8
- 8
server/src/main/java/com/vaadin/ui/Notification.java View File

@@ -69,14 +69,6 @@ import com.vaadin.shared.ui.notification.NotificationState;
*/
public class Notification extends AbstractExtension {

/**
* The server RPC.
*
* @since 8.2
*/
protected NotificationServerRpc rpc = () -> fireEvent(
new CloseEvent(Notification.this));

public enum Type {
HUMANIZED_MESSAGE("humanized"), WARNING_MESSAGE(
"warning"), ERROR_MESSAGE("error"), TRAY_NOTIFICATION("tray"),
@@ -128,6 +120,14 @@ public class Notification extends AbstractExtension {
public static final int DELAY_FOREVER = -1;
public static final int DELAY_NONE = 0;

/**
* The server RPC.
*
* @since 8.2
*/
private NotificationServerRpc rpc = () -> fireEvent(
new CloseEvent(Notification.this));

/**
* Creates a "humanized" notification message.
*

+ 7
- 4
server/src/main/java/com/vaadin/ui/components/grid/DropIndexCalculator.java View File

@@ -31,11 +31,14 @@ import java.io.Serializable;
public interface DropIndexCalculator<T> extends Serializable {

/**
* Calculator for always dropping items to the end of the target grid,
* regardless of drop position.
* Returns a calculator for always dropping items to the end of the target
* grid, regardless of drop position.
*
* @return the created drop index calculator
*/
@SuppressWarnings("rawtypes")
static DropIndexCalculator ALWAYS_DROP_TO_END = (event -> Integer.MAX_VALUE);
static <T> DropIndexCalculator<T> alwaysDropToEnd() {
return (GridDropEvent<T> event) -> Integer.MAX_VALUE;
}

/**
* Called when Items are dropped onto a target grid.

+ 13
- 3
server/src/main/java/com/vaadin/ui/components/grid/Editor.java View File

@@ -104,12 +104,22 @@ public interface Editor<T> extends Serializable {
public void cancel();

/**
* Edits the selected row
* Opens the editor interface for the provided row. Scrolls the Grid to
* bring the row to view if it is not already visible.
*
* @param rowNumber
* the row to edit
* Note that any cell content rendered by a WidgetRenderer will not be
* visible in the editor row.
*
* @see #setEnabled(boolean)
* @since 8.2
*
* @param rowNumber
* the row number of the edited item
* @throws IllegalStateException
* if the editor is not enabled or already editing a different
* item in buffered mode
* @throws IllegalArgumentException
* if the {@code rowNumber} is not in the backing data provider
*/
public void editRow(int rowNumber);


+ 0
- 16
server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java View File

@@ -267,22 +267,6 @@ public class EditorImpl<T> extends AbstractGridExtension<T>
rpc.cancel();
}

/**
* Opens the editor interface for the provided row. Scrolls the Grid to
* bring the row to view if it is not already visible.
*
* Note that any cell content rendered by a WidgetRenderer will not be
* visible in the editor row.
*
* @param rowNumber
* the row number of the edited item
* @throws IllegalStateException
* if the editor is not enabled or already editing a different item
* in buffered mode
* @throws IllegalArgumentException
* if the {@code rowNumber} is not in the backing data provider
* @see #setEnabled(boolean)
*/
@Override
public void editRow(int rowNumber)
throws IllegalStateException, IllegalArgumentException {

+ 1
- 1
server/src/main/java/com/vaadin/ui/components/grid/GridDragEndEvent.java View File

@@ -43,7 +43,7 @@ public class GridDragEndEvent<T> extends DragEndEvent<Grid<T>> {
* @param dropEffect
* Drop effect from {@code DataTransfer.dropEffect} object.
* @param draggedItems
* Set of items having been dragged.
* List of items having been dragged.
*/
public GridDragEndEvent(Grid<T> source, DropEffect dropEffect,
List<T> draggedItems) {

+ 1
- 1
server/src/main/java/com/vaadin/ui/components/grid/GridDragStartEvent.java View File

@@ -43,7 +43,7 @@ public class GridDragStartEvent<T> extends DragStartEvent<Grid<T>> {
* @param effectAllowed
* Allowed effect from {@code DataTransfer.effectAllowed} object.
* @param draggedItems
* Set of items being dragged.
* List of items being dragged.
*/
public GridDragStartEvent(Grid<T> source, EffectAllowed effectAllowed,
List<T> draggedItems) {

+ 9
- 9
server/src/main/java/com/vaadin/ui/components/grid/GridDropTarget.java View File

@@ -41,7 +41,7 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {

private Registration sortListenerRegistration;
private DropMode cachedDropMode;
private boolean dropAllowedOnSortedGridRows = true;
private boolean dropAllowedOnRowsWhenSorted = true;

/**
* Extends a Grid and makes it's rows drop targets for HTML5 drag and drop.
@@ -88,18 +88,18 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
* in this case.
* <p>
* <em>NOTE: {@link DropMode#ON_GRID} is used automatically when the grid
* has been sorted and {@link #setDropAllowedOnSortedGridRows(boolean)} is
* has been sorted and {@link #setDropAllowedOnRowsWhenSorted(boolean)} is
* {@code false} - since the drop location would not necessarily match the
* correct row because of the sorting. During the sorting, any calls to this
* method don't have any effect until the sorting has been removed, or
* {@link #setDropAllowedOnSortedGridRows(boolean)} is set back to
* {@link #setDropAllowedOnRowsWhenSorted(boolean)} is set back to
* {@code true}.</em>
*
* @param dropMode
* Drop mode that describes the allowed drop locations within the
* Grid's row.
* @see GridDropEvent#getDropLocation()
* @see #setDropAllowedOnSortedGridRows(boolean)
* @see #setDropAllowedOnRowsWhenSorted(boolean)
*/
public void setDropMode(DropMode dropMode) {
if (dropMode == null) {
@@ -147,10 +147,10 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
* drops on sorted grid rows
* @since 8.2
*/
public void setDropAllowedOnSortedGridRows(
public void setDropAllowedOnRowsWhenSorted(
boolean dropAllowedOnSortedGridRows) {
if (this.dropAllowedOnSortedGridRows != dropAllowedOnSortedGridRows) {
this.dropAllowedOnSortedGridRows = dropAllowedOnSortedGridRows;
if (this.dropAllowedOnRowsWhenSorted != dropAllowedOnSortedGridRows) {
this.dropAllowedOnRowsWhenSorted = dropAllowedOnSortedGridRows;

if (!dropAllowedOnSortedGridRows) {

@@ -194,8 +194,8 @@ public class GridDropTarget<T> extends DropTargetExtension<Grid<T>> {
* the grid
* @since 8.2
*/
public boolean isDropAllowedOnSortedGridRows() {
return dropAllowedOnSortedGridRows;
public boolean isDropAllowedOnRowsWhenSorted() {
return dropAllowedOnRowsWhenSorted;
}

/**

+ 1
- 1
server/src/main/java/com/vaadin/ui/components/grid/GridRowDragger.java View File

@@ -190,7 +190,7 @@ public class GridRowDragger<T> implements Serializable {
gridDragSource = new GridDragSource<>(source);

gridDropTarget = new GridDropTarget<>(target, dropMode);
gridDropTarget.setDropAllowedOnSortedGridRows(false);
gridDropTarget.setDropAllowedOnRowsWhenSorted(false);

gridDragSource.addGridDragStartListener(event -> {
draggedItems = event.getDraggedItems();

+ 13
- 13
server/src/test/java/com/vaadin/tests/components/grid/GridDropTargetTest.java View File

@@ -24,14 +24,14 @@ public class GridDropTargetTest {
@Test
public void dropAllowedOnSortedGridRows_defaultValue_isTrue() {
Assert.assertTrue("Default drop allowed should be backwards compatible",
target.isDropAllowedOnSortedGridRows());
target.isDropAllowedOnRowsWhenSorted());
}

@Test
public void dropAllowedOnSortedGridRows_notAllowed_changesDropModeWhenSorted() {
Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(false);
target.setDropAllowedOnRowsWhenSorted(false);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

@@ -64,11 +64,11 @@ public class GridDropTargetTest {

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(false);
target.setDropAllowedOnRowsWhenSorted(false);

Assert.assertEquals(DropMode.ON_GRID, target.getDropMode());

target.setDropAllowedOnSortedGridRows(true);
target.setDropAllowedOnRowsWhenSorted(true);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());
}
@@ -77,7 +77,7 @@ public class GridDropTargetTest {
public void dropAllowedOnSortedGridRows_notAllowedBackToAllowed_changesBackToUserDefinedMode() {
Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(false);
target.setDropAllowedOnRowsWhenSorted(false);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

@@ -85,7 +85,7 @@ public class GridDropTargetTest {

Assert.assertEquals(DropMode.ON_GRID, target.getDropMode());

target.setDropAllowedOnSortedGridRows(true);
target.setDropAllowedOnRowsWhenSorted(true);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

@@ -98,19 +98,19 @@ public class GridDropTargetTest {
public void dropAllowedOnSortedGridRows_swappingAllowedDropOnSortedOffAndOn() {
Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(false);
target.setDropAllowedOnRowsWhenSorted(false);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(false);
target.setDropAllowedOnRowsWhenSorted(false);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(true);
target.setDropAllowedOnRowsWhenSorted(true);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(true);
target.setDropAllowedOnRowsWhenSorted(true);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());
}
@@ -119,7 +119,7 @@ public class GridDropTargetTest {
public void dropAllowedOnSortedGridRows_changingDropModeWhileSorted_replacesPreviouslyCachedButDoesntOverride() {
Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

target.setDropAllowedOnSortedGridRows(false);
target.setDropAllowedOnRowsWhenSorted(false);

Assert.assertEquals(DropMode.BETWEEN, target.getDropMode());

@@ -131,7 +131,7 @@ public class GridDropTargetTest {

Assert.assertEquals(DropMode.ON_GRID, target.getDropMode());
Assert.assertFalse("Changing drop mode should not have any effect here",
target.isDropAllowedOnSortedGridRows());
target.isDropAllowedOnRowsWhenSorted());

grid.clearSortOrder();

@@ -145,7 +145,7 @@ public class GridDropTargetTest {

Assert.assertEquals(DropMode.ON_GRID, target.getDropMode());

target.setDropAllowedOnSortedGridRows(true);
target.setDropAllowedOnRowsWhenSorted(true);

Assert.assertEquals(DropMode.ON_TOP_OR_BETWEEN, target.getDropMode());
}

+ 3
- 3
server/src/test/java/com/vaadin/tests/server/component/grid/GridRowDraggerOneGridTest.java View File

@@ -15,8 +15,8 @@ import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.shared.ui.grid.DropLocation;
import com.vaadin.ui.Grid;
import com.vaadin.ui.components.grid.DropIndexCalculator;
import com.vaadin.ui.components.grid.GridRowDragger;
import com.vaadin.ui.components.grid.GridDropEvent;
import com.vaadin.ui.components.grid.GridRowDragger;
import com.vaadin.ui.components.grid.SourceDataProviderUpdater;

public class GridRowDraggerOneGridTest {
@@ -143,7 +143,7 @@ public class GridRowDraggerOneGridTest {
public void alwaysDropToEndCalculator() {
source.setItems("0", "1", "2");

dragger.setDropIndexCalculator(DropIndexCalculator.ALWAYS_DROP_TO_END);
dragger.setDropIndexCalculator(DropIndexCalculator.alwaysDropToEnd());

drop("1", DropLocation.ABOVE, "0");

@@ -208,7 +208,7 @@ public class GridRowDraggerOneGridTest {
public void dropOnSortedGrid_byDefault_dropsToTheEnd() {
Assert.assertFalse(
"Default drops on sorted grid rows should not be allowed",
dragger.getGridDropTarget().isDropAllowedOnSortedGridRows());
dragger.getGridDropTarget().isDropAllowedOnRowsWhenSorted());

source.setItems("0", "1", "2", "3", "4");


+ 3
- 3
server/src/test/java/com/vaadin/tests/server/component/grid/GridRowDraggerTwoGridsTest.java View File

@@ -15,8 +15,8 @@ import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.shared.ui.grid.DropLocation;
import com.vaadin.ui.Grid;
import com.vaadin.ui.components.grid.DropIndexCalculator;
import com.vaadin.ui.components.grid.GridRowDragger;
import com.vaadin.ui.components.grid.GridDropEvent;
import com.vaadin.ui.components.grid.GridRowDragger;
import com.vaadin.ui.components.grid.SourceDataProviderUpdater;

public class GridRowDraggerTwoGridsTest {
@@ -186,7 +186,7 @@ public class GridRowDraggerTwoGridsTest {
source.setItems("0");
target.setItems("1", "2");

dragger.setDropIndexCalculator(DropIndexCalculator.ALWAYS_DROP_TO_END);
dragger.setDropIndexCalculator(DropIndexCalculator.alwaysDropToEnd());

drop("1", DropLocation.ABOVE, "0");

@@ -255,7 +255,7 @@ public class GridRowDraggerTwoGridsTest {
public void dropOnSortedGrid_byDefault_dropsToTheEnd() {
Assert.assertFalse(
"Default drops on sorted grid rows should not be allowed",
dragger.getGridDropTarget().isDropAllowedOnSortedGridRows());
dragger.getGridDropTarget().isDropAllowedOnRowsWhenSorted());

source.setItems("0", "1", "2");
target.setItems("4", "5");

+ 3
- 5
shared/src/main/java/com/vaadin/shared/communication/SharedState.java View File

@@ -19,6 +19,7 @@ package com.vaadin.shared.communication;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import com.vaadin.shared.Connector;
import com.vaadin.shared.annotations.NoLayout;
@@ -63,12 +64,9 @@ public class SharedState implements Serializable {
public boolean enabled = true;

/**
* A Map of event identifiers with registered listeners, {@code key} is
* event identifier, {@code value} is the listeners count.
*
* @since 8.2
* A set of event identifiers with registered listeners.
*/
@NoLayout
public Map<String, Integer> registeredEventListeners;
public Set<String> registeredEventListeners;

}

+ 9
- 20
shared/src/main/java/com/vaadin/shared/ui/ComponentStateUtil.java View File

@@ -16,7 +16,7 @@
package com.vaadin.shared.ui;

import java.io.Serializable;
import java.util.HashMap;
import java.util.HashSet;

import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Registration;
@@ -67,19 +67,12 @@ public final class ComponentStateUtil implements Serializable {
@Deprecated
public static final void removeRegisteredEventListener(SharedState state,
String eventIdentifier) {
if (state.registeredEventListeners != null) {
Integer count = state.registeredEventListeners.get(eventIdentifier);
if (count != null) {
if (count > 1) {
state.registeredEventListeners.put(eventIdentifier,
count - 1);
} else {
state.registeredEventListeners.remove(eventIdentifier);
if (state.registeredEventListeners.isEmpty()) {
state.registeredEventListeners = null;
}
}
}
if (state.registeredEventListeners == null) {
return;
}
state.registeredEventListeners.remove(eventIdentifier);
if (state.registeredEventListeners.size() == 0) {
state.registeredEventListeners = null;
}
}

@@ -94,13 +87,9 @@ public final class ComponentStateUtil implements Serializable {
public static final Registration addRegisteredEventListener(
SharedState state, String eventListenerId) {
if (state.registeredEventListeners == null) {
state.registeredEventListeners = new HashMap<>();
}
Integer count = state.registeredEventListeners.get(eventListenerId);
if (count == null) {
count = 0;
state.registeredEventListeners = new HashSet<>();
}
state.registeredEventListeners.put(eventListenerId, count + 1);
state.registeredEventListeners.add(eventListenerId);
return () -> removeRegisteredEventListener(state, eventListenerId);
}
}

+ 1
- 1
shared/src/main/java/com/vaadin/shared/ui/grid/ColumnState.java View File

@@ -80,6 +80,6 @@ public class ColumnState extends AbstractGridExtensionState {
*
* @since 8.2
*/
public ContentMode contentMode;
public ContentMode tooltipContentMode;

}

+ 2
- 2
uitest/src/main/java/com/vaadin/tests/components/grid/AbstractGridDnD.java View File

@@ -66,9 +66,9 @@ public abstract class AbstractGridDnD extends AbstractTestUIWithLog {
}
});
CheckBox dropOnSortedGridRows = new CheckBox("Drop on Sorted Grid Rows",
dropTarget.isDropAllowedOnSortedGridRows());
dropTarget.isDropAllowedOnRowsWhenSorted());
dropOnSortedGridRows.addValueChangeListener(event -> {
dropTarget.setDropAllowedOnSortedGridRows(event.getValue());
dropTarget.setDropAllowedOnRowsWhenSorted(event.getValue());
});

RadioButtonGroup<Integer> frozenColumnSelect = new RadioButtonGroup<>(

+ 1
- 1
uitest/src/main/java/com/vaadin/tests/components/grid/GridRowDraggerTwoGrids.java View File

@@ -44,7 +44,7 @@ public class GridRowDraggerTwoGrids extends AbstractGridDnD {
CheckBox addItemsToEnd = new CheckBox("Add Items To End", false);
addItemsToEnd.addValueChangeListener(
event -> gridDragger.setDropIndexCalculator(event.getValue()
? DropIndexCalculator.ALWAYS_DROP_TO_END : null));
? DropIndexCalculator.alwaysDropToEnd() : null));
CheckBox removeItemsFromSource = new CheckBox(
"Remove items from source grid", true);
removeItemsFromSource.addValueChangeListener(event -> gridDragger

Loading…
Cancel
Save