Search in sources :

Example 26 with ListModel

use of org.apache.wicket.model.util.ListModel in project wicket-orientdb by OrienteerBAP.

the class TestFilters method testRangeFilterCriteriaSecondNull.

@Test
public void testRangeFilterCriteriaSecondNull() {
    List<Integer> models = Lists.newArrayList();
    models.add(NUM_VALUE_3);
    models.add(null);
    IModel<List<Integer>> listModel = new ListModel<>(models);
    IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
    manager.addFilterCriteria(manager.createRangeFilterCriteria(listModel, Model.of(true)));
    String field = wicket.getProperty(NUMBER_FIELD).getObject().getName();
    queryModel.addFilterCriteriaManager(field, manager);
    queryModel.setSort(NUMBER_FIELD, SortOrder.ASCENDING);
    assertTrue("size must be 2, but it is - " + queryModel.size(), queryModel.size() == 2);
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) ListModel(org.apache.wicket.model.util.ListModel) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)

Example 27 with ListModel

use of org.apache.wicket.model.util.ListModel in project wicket-orientdb by OrienteerBAP.

the class TestFilters method testRangeFilterCriteriaFirstNull.

@Test
public void testRangeFilterCriteriaFirstNull() {
    List<Integer> models = Lists.newArrayList();
    models.add(null);
    models.add(NUM_VALUE_2);
    IModel<List<Integer>> listModel = new ListModel<>(models);
    IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
    manager.addFilterCriteria(manager.createRangeFilterCriteria(listModel, Model.of(true)));
    String field = wicket.getProperty(NUMBER_FIELD).getObject().getName();
    queryModel.addFilterCriteriaManager(field, manager);
    queryModel.setSort(NUMBER_FIELD, SortOrder.ASCENDING);
    assertTrue("size must be 2, but it is - " + queryModel.size(), queryModel.size() == 2);
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) ListModel(org.apache.wicket.model.util.ListModel) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)

Example 28 with ListModel

use of org.apache.wicket.model.util.ListModel in project wicket-orientdb by OrienteerBAP.

the class TestFilters method testRangeFilterCriteria.

@Test
public void testRangeFilterCriteria() {
    List<Integer> models = Lists.newArrayList();
    models.add(NUM_VALUE_1);
    models.add(NUM_VALUE_3);
    IModel<List<Integer>> listModel = new ListModel<>(models);
    IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
    manager.addFilterCriteria(manager.createRangeFilterCriteria(listModel, Model.of(true)));
    String field = wicket.getProperty(NUMBER_FIELD).getObject().getName();
    queryModel.addFilterCriteriaManager(field, manager);
    queryModel.setSort(NUMBER_FIELD, SortOrder.ASCENDING);
    assertTrue("size must be 3, but it is - " + queryModel.size(), queryModel.size() == 3);
    assertTrue(queryModel.getObject().get(0).field(NUMBER_FIELD).equals(NUM_VALUE_1));
    assertTrue(queryModel.getObject().get(1).field(NUMBER_FIELD).equals(NUM_VALUE_2));
    assertTrue(queryModel.getObject().get(2).field(NUMBER_FIELD).equals(NUM_VALUE_3));
}
Also used : IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) ListModel(org.apache.wicket.model.util.ListModel) IFilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager) FilterCriteriaManager(ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)

Aggregations

ListModel (org.apache.wicket.model.util.ListModel)28 ArrayList (java.util.ArrayList)14 List (java.util.List)13 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)12 IModel (org.apache.wicket.model.IModel)9 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)8 Test (org.junit.Test)8 FormTester (org.apache.wicket.util.tester.FormTester)7 Model (org.apache.wicket.model.Model)5 QName (javax.xml.namespace.QName)4 EmptyOnChangeAjaxFormUpdatingBehavior (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior)3 IOException (java.io.IOException)3 FilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.FilterCriteriaManager)3 IFilterCriteriaManager (ru.ydn.wicket.wicketorientdb.utils.query.filter.IFilterCriteriaManager)3 AutoCompleteTextPanel (com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteTextPanel)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)2 ColumnTypeDto (com.evolveum.midpoint.web.component.data.column.ColumnTypeDto)2