melistik / vaadin-grid-util

simplify the use of vaadin's grid and add features
https://vaadin.com/directory/component/gridutil
MIT License
32 stars 21 forks source link

GridCellFilter supports ListDataProvider only #48

Open mvysny opened 7 years ago

mvysny commented 7 years ago

Hi, wonderful work with the cell filter! It could be made so that instead of depending on ListDataProvider solely, it could use any ConfigurableFilterDataProvider data provider; the filters for that data provider can be created using a FilterFactory interface provided to the GridCellFilter in the constructor:

interface FilterFactory<F> : Serializable {
    fun and(filters: Set<F>): F?
    fun or(filters: Set<F>): F?
    fun eq(propertyName: String, value: Any): F
    fun le(propertyName: String, value: Any): F
    fun ge(propertyName: String, value: Any): F
    fun like(propertyName: String, value: String): F
    fun between(propertyName: String, min: Any, max: Any) = and(setOf(ge(propertyName, min), le(propertyName, max)))
}

Backward compatibility can be done easily, since ListDataProvider implements the ConfigurableFilterDataProvider interface.