You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HasFilterableDataProvider.java 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.data;
  17. import com.vaadin.data.provider.DataProvider;
  18. import com.vaadin.server.SerializableFunction;
  19. /**
  20. * A generic interface for listing components that use a filterable data
  21. * provider for showing data.
  22. * <p>
  23. * A listing component should implement either this interface or
  24. * {@link HasDataProvider}, but not both.
  25. *
  26. * @author Vaadin Ltd.
  27. *
  28. * @param <T>
  29. * the item data type
  30. * @param <F>
  31. * the filter type
  32. * @since 8.0
  33. *
  34. * @see HasDataProvider
  35. */
  36. public interface HasFilterableDataProvider<T, F> extends HasItems<T> {
  37. /**
  38. * Sets the data provider for this listing. The data provider is queried for
  39. * displayed items as needed.
  40. *
  41. * @param dataProvider
  42. * the data provider, not <code>null</code>
  43. */
  44. public default void setDataProvider(DataProvider<T, F> dataProvider) {
  45. setDataProvider(dataProvider, SerializableFunction.identity());
  46. }
  47. /**
  48. * Sets the data provider and filter converter for this listing. The data
  49. * provider is queried for displayed items as needed.
  50. *
  51. * @param dataProvider
  52. * the data provider, not <code>null</code>
  53. * @param filterConverter
  54. * a function that converts filter values produced by this
  55. * listing into filter values expected by the provided data
  56. * provider, not <code>null</code>
  57. */
  58. public <C> void setDataProvider(DataProvider<T, C> dataProvider,
  59. SerializableFunction<F, C> filterConverter);
  60. }