--- /dev/null
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.data;
+
+import java.util.Collection;
+
+import com.vaadin.data.provider.DataProvider;
+
+/**
+ * A generic interface for listing components that use a data provider for
+ * showing data.
+ * <p>
+ * A listing component should implement either this interface or
+ * {@link HasFilterableDataProvider}, but not both.
+ *
+ * @author Vaadin Ltd.
+ *
+ * @param <T>
+ * the item data type
+ * @since 8.0
+ *
+ * @see HasFilterableDataProvider
+ */
+public interface HasDataProvider<T> extends HasItems<T> {
+
+ /**
+ * Returns the source of data items used by this listing.
+ *
+ * @return the data provider, not null
+ */
+ public DataProvider<T, ?> getDataProvider();
+
+ /**
+ * Sets the data provider for this listing. The data provider is queried for
+ * displayed items as needed.
+ *
+ * @param dataProvider
+ * the data provider, not null
+ */
+ public void setDataProvider(DataProvider<T, ?> dataProvider);
+
+ @Override
+ public default void setItems(Collection<T> items) {
+ setDataProvider(DataProvider.create(items));
+ }
+
+}
--- /dev/null
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.data;
+
+import com.vaadin.data.provider.DataProvider;
+
+/**
+ * A generic interface for listing components that use a filterable data
+ * provider for showing data.
+ * <p>
+ * A listing component should implement either this interface or
+ * {@link HasDataProvider}, but not both.
+ *
+ * @author Vaadin Ltd.
+ *
+ * @param <T>
+ * the item data type
+ * @param <F>
+ * the filter type
+ * @since 8.0
+ *
+ * @see HasDataProvider
+ */
+public interface HasFilterableDataProvider<T, F> extends HasItems<T> {
+
+ /**
+ * Returns the source of data items used by this listing.
+ *
+ * @return the data provider, not null
+ */
+ public DataProvider<T, F> getDataProvider();
+
+ /**
+ * Sets the data provider for this listing. The data provider is queried for
+ * displayed items as needed.
+ *
+ * @param dataProvider
+ * the data provider, not null
+ */
+ public void setDataProvider(DataProvider<T, F> dataProvider);
+}
--- /dev/null
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.data;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import com.vaadin.data.provider.BackEndDataProvider;
+import com.vaadin.ui.Component;
+
+/**
+ * A component that displays a collection of items.
+ *
+ * @author Vaadin Ltd
+ *
+ * @param <T>
+ * the type of the displayed item
+ */
+public interface HasItems<T> extends Component, Serializable {
+ /**
+ * Sets the data items of this component provided as a collection.
+ * <p>
+ * The provided collection instance may be used as-is. Subsequent
+ * modification of the collection might cause inconsistent data to be shown
+ * in the component unless it is explicitly instructed to read the data
+ * again.
+ *
+ * @param items
+ * the data items to display, not null
+ *
+ */
+ public void setItems(Collection<T> items);
+
+ /**
+ * Sets the data items of this listing.
+ *
+ * @param items
+ * the data items to display
+ */
+ public default void setItems(@SuppressWarnings("unchecked") T... items) {
+ setItems(Arrays.asList(items));
+ }
+
+ /**
+ * Sets the data items of this listing provided as a stream.
+ * <p>
+ * This is just a shorthand for {@link #setItems(Collection)}, by
+ * <b>collecting all the items in the stream to a list</b>.
+ * <p>
+ * <strong>Using big streams is not recommended, you should instead use a
+ * lazy data provider.</strong> See {@link BackEndDataProvider} for more
+ * info.
+ *
+ * @param streamOfItems
+ * the stream of data items to display, not {@code null}
+ */
+ public default void setItems(Stream<T> streamOfItems) {
+ setItems(streamOfItems.collect(Collectors.toList()));
+ }
+}
+++ /dev/null
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.data;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.stream.Stream;
-
-import com.vaadin.data.provider.BackEndDataProvider;
-import com.vaadin.data.provider.DataProvider;
-import com.vaadin.ui.Component;
-
-/**
- * A generic interface for components that show a list of data.
- *
- * @author Vaadin Ltd.
- *
- * @param <T>
- * the item data type
- * @param <D>
- * the data provider type; used to provide constraints on the data
- * provider and filter
- * @since 8.0
- */
-public interface Listing<T, D extends DataProvider<T, ?>>
- extends Component, Serializable {
-
- /**
- * Returns the source of data items used by this listing.
- *
- * @return the data provider, not null
- */
- D getDataProvider();
-
- /**
- * Sets the data provider for this listing. The data provider is queried for
- * displayed items as needed.
- *
- * @param dataProvider
- * the data provider, not null
- */
- void setDataProvider(D dataProvider);
-
- /**
- * Sets the data items of this listing provided as a collection.
- * <p>
- * <strong>Note for component developers: </strong> If the component
- * implementing this interface uses a custom data provider and/or filter
- * types, this method should be overridden to provide the same functionality
- * with the correct data provider type. This might require filter conversion
- * or a completely custom implementation.
- *
- * @param items
- * the data items to display, not null
- *
- */
- default void setItems(Collection<T> items) {
- setDataProvider((D) DataProvider.create(items));
- }
-
- /**
- * Sets the data items of this listing.
- * <p>
- * <strong>Note for component developers: </strong> If the component
- * implementing this interface uses a custom data provider and/or filter
- * types, this method should be overridden to provide the same functionality
- * with the correct data provider type. This might require filter conversion
- * or a completely custom implementation.
- *
- * @param items
- * the data items to display
- */
- default void setItems(@SuppressWarnings("unchecked") T... items) {
- setDataProvider((D) DataProvider.create(items));
- }
-
- /**
- * Sets the data items of this listing provided as a stream.
- * <p>
- * This is just a shorthand for {@link #setItems(Collection)}, by
- * <b>collecting all the items in the stream to a list</b>.
- * <p>
- * <strong>Using big streams is not recommended, you should instead use a
- * lazy data provider.</strong> See {@link BackEndDataProvider} for more
- * info.
- * <p>
- * <strong>Note for component developers: </strong> If the component
- * implementing this interface uses a custom data provider and/or filter
- * types, this method should be overridden to provide the same functionality
- * with the correct data provider type. This might require filter conversion
- * or a completely custom implementation.
- *
- * @param streamOfItems
- * the stream of data items to display, not {@code null}
- */
- default void setItems(Stream<T> streamOfItems) {
- setDataProvider((D) DataProvider.create(streamOfItems));
- }
-
-}
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
+import com.vaadin.data.HasFilterableDataProvider;
import com.vaadin.server.SerializableFunction;
import com.vaadin.shared.Registration;
/**
* A common interface for fetching data from a backend. The {@link DataProvider}
- * interface is used by {@link Listing} components. The listing component will
- * provide a {@link Query} object with request information, and the data
- * provider uses this information to return a stream containing requested beans.
+ * interface is used by listing components implementing {@link HasDataProvider}
+ * or {@link HasFilterableDataProvider}. The listing component will provide a
+ * {@link Query} object with request information, and the data provider uses
+ * this information to return a stream containing requested beans.
* <p>
* Vaadin comes with a ready-made solution for in-memory data, known as
* {@link ListDataProvider} which can be created using static {@code create}
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
+import com.vaadin.data.HasFilterableDataProvider;
+import com.vaadin.data.HasItems;
import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.data.provider.DataGenerator;
import com.vaadin.data.provider.DataProvider;
* backend data items, selection logic, and server-client communication.
* <p>
* <strong>Note: </strong> concrete component implementations should implement
- * the {@link Listing} interface.
+ * the {@link HasDataProvider} or {@link HasFilterableDataProvider} interface.
*
* @author Vaadin Ltd.
* @since 8.0
* @param <T>
* the item data type
*
- * @see Listing
*/
public abstract class AbstractListing<T> extends AbstractComponent
- implements Focusable {
+ implements Focusable, HasItems<T> {
/**
* The item icon caption provider.
*/
/**
* Writes listing specific state into the given design.
* <p>
- * This method is separated from {@link #writeDesign(Element, DesignContext)}
- * to be overridable in subclasses that need to replace this, but still must
- * be able to call {@code super.writeDesign(...)}.
+ * This method is separated from
+ * {@link #writeDesign(Element, DesignContext)} to be overridable in
+ * subclasses that need to replace this, but still must be able to call
+ * {@code super.writeDesign(...)}.
*
* @see #doReadDesign(Element, DesignContext)
*
import org.jsoup.nodes.Element;
import com.vaadin.data.HasValue;
-import com.vaadin.data.Listing;
import com.vaadin.data.SelectionModel;
import com.vaadin.data.SelectionModel.Multi;
import com.vaadin.data.provider.DataGenerator;
.map(child -> readItem(child, selected, context))
.collect(Collectors.toList());
deselectAll();
- if (!items.isEmpty() && this instanceof Listing) {
- ((Listing<T, ?>) this).setItems(items);
+ if (!items.isEmpty()) {
+ setItems(items);
}
selected.forEach(this::select);
}
}
private void updateSelection(SerializableConsumer<Set<T>> handler,
- boolean userOriginated) {
+ boolean userOriginated) {
LinkedHashSet<T> oldSelection = new LinkedHashSet<>(selection);
handler.accept(selection);
import org.jsoup.nodes.Element;
import com.vaadin.data.HasValue;
-import com.vaadin.data.Listing;
import com.vaadin.data.SelectionModel.Single;
import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.event.selection.SingleSelectionEvent;
/**
* Sets the selection based on a client request. Does nothing if the select
- * component is {@linkplain #isReadOnly()} or if the selection
- * would not change. Otherwise updates the selection and fires a selection
- * change event with {@code isUserOriginated == true}.
+ * component is {@linkplain #isReadOnly()} or if the selection would not
+ * change. Otherwise updates the selection and fires a selection change
+ * event with {@code isUserOriginated == true}.
*
* @param key
* the key of the item to select or {@code null} to clear
List<T> items = design.children().stream()
.map(child -> readItem(child, selected, context))
.collect(Collectors.toList());
- if (!items.isEmpty() && this instanceof Listing) {
- ((Listing<T, ?>) this).setItems(items);
+ if (!items.isEmpty()) {
+ setItems(items);
}
selected.forEach(this::setValue);
}
import org.jsoup.nodes.Element;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
* @since 8.0
*/
public class CheckBoxGroup<T> extends AbstractMultiSelect<T>
- implements FocusNotifier, BlurNotifier, Listing<T, DataProvider<T, ?>> {
+ implements FocusNotifier, BlurNotifier, HasDataProvider<T> {
/**
* Constructs a new CheckBoxGroup with caption.
*
* @param caption
* caption text
- * @see Listing#setDataProvider(DataProvider)
*/
public CheckBoxGroup(String caption) {
this();
* the caption text
* @param dataProvider
* the data provider, not null
- * @see Listing#setDataProvider(DataProvider)
+ * @see HasDataProvider#setDataProvider(DataProvider)
*/
public CheckBoxGroup(String caption, DataProvider<T, ?> dataProvider) {
this(caption);
* the caption text
* @param items
* the data items to use, not null
- * @see Listing#setDataProvider(DataProvider)
+ * @see #setItems(Collection)
*/
public CheckBoxGroup(String caption, Collection<T> items) {
this(caption, DataProvider.create(items));
/**
* Constructs a new CheckBoxGroup.
- *
- * @see Listing#setDataProvider(DataProvider)
*/
public CheckBoxGroup() {
registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent));
package com.vaadin.ui;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.jsoup.nodes.Element;
+import com.vaadin.data.HasFilterableDataProvider;
import com.vaadin.data.HasValue;
-import com.vaadin.data.Listing;
import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.data.provider.DataKeyMapper;
import com.vaadin.data.provider.DataProvider;
@SuppressWarnings("serial")
public class ComboBox<T> extends AbstractSingleSelect<T>
implements HasValue<T>, FieldEvents.BlurNotifier,
- FieldEvents.FocusNotifier, Listing<T, DataProvider<T, String>> {
+ FieldEvents.FocusNotifier, HasFilterableDataProvider<T, String> {
/**
* Handler that adds a new item based on user input when the new items
setDataProvider(provider);
}
- @Override
- public void setItems(@SuppressWarnings("unchecked") T... items) {
- DataProvider<T, String> provider = DataProvider.create(items)
- .convertFilter(filterText -> item -> defaultFilterMethod
- .test(filterText, item));
- setDataProvider(provider);
- }
-
/**
* Sets the data items of this listing and a simple string filter with which
* the item string and the text the user has input are compared.
*/
public void setItems(CaptionFilter captionFilter,
@SuppressWarnings("unchecked") T... items) {
- DataProvider<T, String> provider = DataProvider.create(items)
- .convertFilter(filterText -> item -> captionFilter.test(
- getItemCaptionGenerator().apply(item), filterText));
- setDataProvider(provider);
+ setItems(captionFilter, Arrays.asList(items));
}
/**
import org.jsoup.select.Elements;
import com.vaadin.data.Binder;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.ValueProvider;
import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.data.provider.DataProvider;
* @param <T>
* the grid bean type
*/
-public class Grid<T> extends AbstractListing<T> implements HasComponents,
- Listing<T, DataProvider<T, ?>>, SortNotifier<Grid.Column<T, ?>> {
+public class Grid<T> extends AbstractListing<T>
+ implements HasComponents, HasDataProvider<T>, SortNotifier<Grid.Column<T, ?>> {
@Deprecated
private static final Method COLUMN_REORDER_METHOD = ReflectTools.findMethod(
import java.util.Collection;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.shared.ui.listselect.ListSelectState;
* item type
*/
public class ListSelect<T> extends AbstractMultiSelect<T>
- implements Listing<T, DataProvider<T, ?>> {
+ implements HasDataProvider<T> {
/** Default number of rows visible for select. */
// protected to allow javadoc linking
import java.util.Collection;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
* @see com.vaadin.ui.ComboBox
*/
public class NativeSelect<T> extends AbstractSingleSelect<T>
- implements FocusNotifier, BlurNotifier, Listing<T, DataProvider<T, ?>> {
+ implements FocusNotifier, BlurNotifier, HasDataProvider<T> {
/**
* Creates a new {@code NativeSelect} with an empty caption and no items.
import org.jsoup.nodes.Element;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.DataGenerator;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.event.FieldEvents.BlurEvent;
* @since 8.0
*/
public class RadioButtonGroup<T> extends AbstractSingleSelect<T>
- implements FocusNotifier, BlurNotifier, Listing<T, DataProvider<T, ?>> {
+ implements FocusNotifier, BlurNotifier, HasDataProvider<T> {
private SerializablePredicate<T> itemEnabledProvider = item -> true;
*
* @param caption
* caption text
- * @see Listing#setDataProvider(DataProvider)
*/
public RadioButtonGroup(String caption) {
this();
* the caption text
* @param dataProvider
* the data provider, not null
- * @see Listing#setDataProvider(DataProvider)
+ * @see HasDataProvider#setDataProvider(DataProvider)
*/
public RadioButtonGroup(String caption, DataProvider<T, ?> dataProvider) {
this(caption);
* the caption text
* @param items
* the data items to use, not null
- * @see Listing#setDataProvider(DataProvider)
+ * @see #setItems(Collection)
*/
public RadioButtonGroup(String caption, Collection<T> items) {
this(caption, DataProvider.create(items));
/**
* Constructs a new RadioButtonGroup.
- *
- * @see Listing#setDataProvider(DataProvider)
*/
public RadioButtonGroup() {
registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent));
import java.util.Collection;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.shared.ui.twincolselect.TwinColSelectState;
* item type
*/
public class TwinColSelect<T> extends AbstractMultiSelect<T>
- implements Listing<T, DataProvider<T, ?>> {
+ implements HasDataProvider<T> {
/**
* Constructs a new TwinColSelect.
import org.junit.Assert;
import org.junit.Test;
-import com.vaadin.data.Listing;
import com.vaadin.data.provider.Query;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.FileResource;
* a component type
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
-public abstract class AbstractListingDeclarativeTest<T extends AbstractListing & Listing>
+public abstract class AbstractListingDeclarativeTest<T extends AbstractListing>
extends AbstractComponentDeclarativeTestBase<T> {
private static final String EXTERNAL_URL = "http://example.com/example.gif";
private void testReadData(String design, T expected, T read,
DesignContext context) {
- Assert.assertEquals(read.getDataProvider().size(new Query<>()),
- expected.getDataProvider().size(new Query<>()));
+ Assert.assertEquals(
+ read.getDataCommunicator().getDataProvider()
+ .size(new Query<>()),
+ expected.getDataCommunicator().getDataProvider()
+ .size(new Query<>()));
testWrite(read, design, context);
}
import org.junit.Assert;
import org.junit.Test;
-import com.vaadin.data.Listing;
import com.vaadin.tests.design.DeclarativeTestBaseBase;
import com.vaadin.tests.server.component.abstractlisting.AbstractListingDeclarativeTest;
import com.vaadin.ui.AbstractMultiSelect;
* a component type
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
-public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMultiSelect & Listing>
+public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMultiSelect>
extends AbstractListingDeclarativeTest<T> {
@Override
import org.junit.Assert;
import org.junit.Test;
-import com.vaadin.data.Listing;
import com.vaadin.tests.design.DeclarativeTestBaseBase;
import com.vaadin.tests.server.component.abstractlisting.AbstractListingDeclarativeTest;
import com.vaadin.ui.AbstractSingleSelect;
* a component type
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
-public abstract class AbstractSingleSelectDeclarativeTest<T extends AbstractSingleSelect & Listing>
+public abstract class AbstractSingleSelectDeclarativeTest<T extends AbstractSingleSelect>
extends AbstractListingDeclarativeTest<T> {
@Override
import org.junit.Before;
import org.junit.Test;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.BackEndDataProvider;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.data.provider.ListDataProvider;
public class AbstractListingTest {
private final class TestListing extends AbstractSingleSelect<String>
- implements Listing<String, DataProvider<String, ?>> {
+ implements HasDataProvider<String> {
/**
* Used to execute data generation
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import org.mockito.Mockito;
import com.vaadin.data.HasValue.ValueChangeEvent;
-import com.vaadin.data.Listing;
-import com.vaadin.data.provider.DataProvider;
import com.vaadin.event.selection.MultiSelectionEvent;
import com.vaadin.event.selection.MultiSelectionListener;
import com.vaadin.shared.Registration;
import com.vaadin.shared.data.selection.MultiSelectServerRpc;
@RunWith(Parameterized.class)
-public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String> & Listing<String, DataProvider<String, ?>>> {
+public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
@Parameters(name = "{0}")
public static Iterable<?> multiSelects() {
public void setUp() {
selectToTest.deselectAll();
// Intentional deviation from upcoming selection order
- selectToTest.setDataProvider(
- DataProvider.create("3", "2", "1", "5", "8", "7", "4", "6"));
+ selectToTest.setItems("3", "2", "1", "5", "8", "7", "4", "6");
rpc = ComponentTest.getRpcProxy(selectToTest,
MultiSelectServerRpc.class);
public Set<String> getSelectedItems() {
return set;
}
+
+ @Override
+ public void setItems(Collection<String> items) {
+ throw new UnsupportedOperationException(
+ "Not implemented for this test");
+ }
};
Assert.assertSame(set, select.getValue());
public Set<String> getValue() {
return set;
}
+
+ @Override
+ public void setItems(Collection<String> items) {
+ throw new UnsupportedOperationException(
+ "Not implemented for this test");
+ }
};
AtomicReference<ValueChangeEvent<?>> event = new AtomicReference<>();
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Test;
import org.mockito.Mockito;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.HasValue.ValueChangeEvent;
-import com.vaadin.data.Listing;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.data.provider.bov.Person;
import com.vaadin.event.selection.SingleSelectionEvent;
private List<Person> oldSelections;
private static class PersonListing extends AbstractSingleSelect<Person>
- implements Listing<Person, DataProvider<Person, ?>> {
+ implements HasDataProvider<Person> {
@Override
protected Element writeItem(Element design, Person item,
protected void readItems(Element design,
DesignContext context) {
}
+
+ @Override
+ public void setItems(Collection<String> items) {
+ throw new UnsupportedOperationException(
+ "Not needed in this test");
+ }
};
AtomicReference<ValueChangeEvent<?>> event = new AtomicReference<>();
import java.util.stream.IntStream;
import com.googlecode.gentyref.GenericTypeReflector;
-import com.vaadin.data.Listing;
import com.vaadin.event.FieldEvents.BlurNotifier;
import com.vaadin.event.FieldEvents.FocusNotifier;
import com.vaadin.server.VaadinRequest;
* @author Vaadin Ltd
*
*/
-public abstract class AbstractListingFocusBlurTest<T extends AbstractListing<Integer> & FocusNotifier & BlurNotifier & Listing<Integer, ?>>
+public abstract class AbstractListingFocusBlurTest<T extends AbstractListing<Integer> & FocusNotifier & BlurNotifier>
extends AbstractTestUIWithLog {
@Override
import java.util.stream.IntStream;
import com.vaadin.annotations.Widgetset;
-import com.vaadin.data.Listing;
import com.vaadin.tests.components.AbstractComponentTest;
import com.vaadin.ui.AbstractListing;
@Widgetset("com.vaadin.DefaultWidgetSet")
-public abstract class AbstractListingTestUI<T extends AbstractListing<Object> & Listing<Object, ?>>
+public abstract class AbstractListingTestUI<T extends AbstractListing<Object>>
extends AbstractComponentTest<T> {
@Override
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import com.vaadin.data.Listing;
import com.vaadin.ui.AbstractMultiSelect;
import com.vaadin.ui.ItemCaptionGenerator;
-public abstract class AbstractMultiSelectTestUI<MULTISELECT extends AbstractMultiSelect<Object> & Listing<Object, ?>>
+public abstract class AbstractMultiSelectTestUI<MULTISELECT extends AbstractMultiSelect<Object>>
extends AbstractListingTestUI<MULTISELECT> {
protected final String selectionCategory = "Selection";
"None", (abstractMultiSelect, captionGenerator, data) -> {
abstractMultiSelect
.setItemCaptionGenerator(captionGenerator);
- abstractMultiSelect.getDataProvider().refreshAll();
+ abstractMultiSelect.getDataCommunicator().getDataProvider()
+ .refreshAll();
}, true);
}
import java.util.LinkedHashMap;
-import com.vaadin.data.Listing;
import com.vaadin.ui.AbstractSingleSelect;
-public abstract class AbstractSingleSelectTestUI<T extends AbstractSingleSelect<Object> & Listing<Object, ?>>
+public abstract class AbstractSingleSelectTestUI<T extends AbstractSingleSelect<Object>>
extends AbstractListingTestUI<T> {
@Override
import java.util.stream.Stream;
import com.vaadin.annotations.Widgetset;
-import com.vaadin.data.Listing;
+import com.vaadin.data.HasDataProvider;
import com.vaadin.data.provider.DataProvider;
import com.vaadin.data.provider.ListDataProvider;
import com.vaadin.data.provider.Query;
* shown as bold text.
*/
public static class DummyComponent extends AbstractSingleSelect<String>
- implements Listing<String, DataProvider<String, ?>> {
+ implements HasDataProvider<String> {
private String selected;