FilterGroup { public void addListener(FilterListener<T> listener) { this.listeners.add(listener); } FilterGroup(AttributeModel attributeModel, FilterType filterType, Component filterComponent, Component field,
            Component auxField); void addListener(FilterListener<T> listener); Component getAuxField(); Component getField(); Component getFilterComponent(); List<FilterListener<T>> getListeners(); String getPropertyId(); void reset(); void setEnabled(boolean enabled); void setListeners(List<FilterListener<T>> listeners); void valueChange(Component field, Object value);  }
@Test public void testTextFieldStringLike() { TextField tf = (TextField) constructField("name"); FilterGroup<TestEntity> fg = new FilterGroup<>(model.getAttributeModel("name"), FilterType.LIKE, null, tf, null); fg.addListener(event -> { assertTrue(event.getNewFilter() instanceof SimpleStringPredicate); listened = true; }); tf.setValue("bob"); assertTrue(listened); }
@Test public void testLongFieldBetween() { TextField tf = (TextField) constructField("age"); FilterGroup<TestEntity> fg = new FilterGroup<>(model.getAttributeModel("age"), FilterType.BETWEEN, null, tf, null); fg.addListener(event -> { assertTrue(event.getNewFilter() instanceof GreaterOrEqualPredicate); listened = true; }); tf.setValue("4"); assertTrue(listened); }
@Test public void testLongFieldBetween2() { TextField main = (TextField) constructField("age"); TextField aux = (TextField) constructField("age"); FilterGroup<TestEntity> fg = new FilterGroup<>(model.getAttributeModel("age"), FilterType.BETWEEN, null, main, aux); fg.addListener(event -> { if (!listened) { assertTrue(event.getNewFilter() instanceof GreaterOrEqualPredicate); listened = true; } else { assertTrue(event.getNewFilter() instanceof AndPredicate); } }); main.setValue("4"); assertTrue(listened); aux.setValue("10"); }
@Test public void testTextFieldStringEqual() { TextField tf = (TextField) constructField("name"); FilterGroup<TestEntity> fg = new FilterGroup<>(model.getAttributeModel("name"), FilterType.EQUAL, null, tf, null); fg.addListener(event -> { assertTrue(event.getNewFilter() instanceof EqualsPredicate); listened = true; }); tf.setValue("bob"); assertTrue(listened); }