Search in sources :

Example 1 with IFilterToolkit

use of org.jowidgets.cap.ui.api.filter.IFilterToolkit in project jo-client-platform by jo-source.

the class BeanLinkPanelImpl method doFilter.

private void doFilter(final IBeanProxy<LINKABLE_BEAN_TYPE> bean) {
    final IBeanTableModel<LINKABLE_BEAN_TYPE> tableModel = linkableTable.getModel();
    final IFilterToolkit filterToolkit = CapUiToolkit.filterToolkit();
    final IUiFilterFactory filterFactory = filterToolkit.filterFactory();
    final IUiBooleanFilterBuilder filterBuilder;
    filterBuilder = filterFactory.booleanFilterBuilder().setOperator(BooleanOperator.AND);
    if (bean != null) {
        for (final IBeanModification modification : bean.getModifications()) {
            final String propertyName = modification.getPropertyName();
            final IAttribute<Object> attribute = tableModel.getAttribute(propertyName);
            final IIncludingFilterFactory<Object> includingFilterFactory = getIncludingFilterFactory(attribute);
            if (includingFilterFactory != null) {
                final Object operand = getModifiedFilterOperand(modification.getNewValue());
                filterBuilder.addFilter(includingFilterFactory.getIncludingFilter(operand));
            }
        }
    }
    if (filterBuilder.hasEntries()) {
        tableModel.setFilter(BEAN_LINK_SEARCH_FILTER_ID, filterBuilder.build());
    } else {
        tableModel.setFilter(BEAN_LINK_SEARCH_FILTER_ID, null);
    }
    tableModel.loadScheduled(LOAD_DELAY);
}
Also used : IUiFilterFactory(org.jowidgets.cap.ui.api.filter.IUiFilterFactory) IFilterToolkit(org.jowidgets.cap.ui.api.filter.IFilterToolkit) IUiBooleanFilterBuilder(org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder) IBeanModification(org.jowidgets.cap.common.api.bean.IBeanModification)

Aggregations

IBeanModification (org.jowidgets.cap.common.api.bean.IBeanModification)1 IFilterToolkit (org.jowidgets.cap.ui.api.filter.IFilterToolkit)1 IUiBooleanFilterBuilder (org.jowidgets.cap.ui.api.filter.IUiBooleanFilterBuilder)1 IUiFilterFactory (org.jowidgets.cap.ui.api.filter.IUiFilterFactory)1