Search in sources :

Example 1 with DocumentFilterDescriptor

use of de.metas.ui.web.document.filter.DocumentFilterDescriptor in project metasfresh-webui-api by metasfresh.

the class SqlViewFactory method createViewLayout.

private ViewLayout createViewLayout(final SqlViewBindingKey sqlViewBindingKey, final JSONViewDataType viewDataType) {
    final ViewLayout viewLayoutOrig = documentDescriptorFactory.getDocumentDescriptor(sqlViewBindingKey.getWindowId()).getViewLayout(viewDataType);
    final SqlViewBinding sqlViewBinding = getViewBinding(sqlViewBindingKey);
    final Collection<DocumentFilterDescriptor> filters = sqlViewBinding.getViewFilterDescriptors().getAll();
    final boolean hasTreeSupport = sqlViewBinding.hasGroupingFields();
    final ViewLayout.ChangeBuilder viewLayoutBuilder = viewLayoutOrig.toBuilder().profileId(sqlViewBindingKey.getProfileId()).filters(filters).treeSupport(hasTreeSupport, true, /* treeCollapsible */
    ViewLayout.TreeExpandedDepth_AllCollapsed);
    final SqlViewCustomizer sqlViewCustomizer = getSqlViewCustomizer(sqlViewBindingKey.getWindowId(), sqlViewBindingKey.getProfileId());
    if (sqlViewCustomizer != null) {
        sqlViewCustomizer.customizeViewLayout(viewLayoutBuilder);
    }
    return viewLayoutBuilder.build();
}
Also used : ViewLayout(de.metas.ui.web.view.descriptor.ViewLayout) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) DocumentFilterDescriptor(de.metas.ui.web.document.filter.DocumentFilterDescriptor)

Example 2 with DocumentFilterDescriptor

use of de.metas.ui.web.document.filter.DocumentFilterDescriptor in project metasfresh-webui-api by metasfresh.

the class JSONDocumentFilter method unwrap.

public static final DocumentFilter unwrap(final JSONDocumentFilter jsonFilter, final DocumentFilterDescriptorsProvider filterDescriptorProvider) {
    final String filterId = jsonFilter.getFilterId();
    final DocumentFilterDescriptor filterDescriptor = filterDescriptorProvider.getByFilterIdOrNull(filterId);
    // Ad-hoc filters (e.g. zoom references)
    if (filterDescriptor == null) {
        return unwrapAsGenericFilter(jsonFilter);
    } else // Filter with descriptor
    {
        return unwrapUsingDescriptor(jsonFilter, filterDescriptor);
    }
}
Also used : DocumentFilterDescriptor(de.metas.ui.web.document.filter.DocumentFilterDescriptor)

Example 3 with DocumentFilterDescriptor

use of de.metas.ui.web.document.filter.DocumentFilterDescriptor in project metasfresh-webui-api by metasfresh.

the class HUEditorViewFactoryTemplate method createFilterDescriptorsProvider.

@OverridingMethodsMustInvokeSuper
protected DocumentFilterDescriptorsProvider createFilterDescriptorsProvider() {
    final DocumentEntityDescriptor huEntityDescriptor = getHUEntityDescriptor();
    final Collection<DocumentFilterDescriptor> huStandardFilters = huEntityDescriptor.getFilterDescriptors().getAll();
    return ImmutableDocumentFilterDescriptorsProvider.builder().addDescriptors(huStandardFilters).addDescriptor(HUBarcodeSqlDocumentFilterConverter.createDocumentFilterDescriptor()).build();
}
Also used : DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) DocumentFilterDescriptor(de.metas.ui.web.document.filter.DocumentFilterDescriptor) OverridingMethodsMustInvokeSuper(javax.annotation.OverridingMethodsMustInvokeSuper)

Example 4 with DocumentFilterDescriptor

use of de.metas.ui.web.document.filter.DocumentFilterDescriptor in project metasfresh-webui-api by metasfresh.

the class SqlViewFactory method createAutoFilters.

private List<DocumentFilter> createAutoFilters(final SqlViewBindingKey sqlViewBindingKey) {
    final SqlViewBinding sqlViewBinding = getViewBinding(sqlViewBindingKey);
    final Collection<DocumentFilterDescriptor> filters = sqlViewBinding.getViewFilterDescriptors().getAll();
    return filters.stream().filter(DocumentFilterDescriptor::isAutoFilter).map(SqlViewFactory::createAutoFilter).collect(ImmutableList.toImmutableList());
}
Also used : SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) DocumentFilterDescriptor(de.metas.ui.web.document.filter.DocumentFilterDescriptor)

Aggregations

DocumentFilterDescriptor (de.metas.ui.web.document.filter.DocumentFilterDescriptor)4 SqlViewBinding (de.metas.ui.web.view.descriptor.SqlViewBinding)2 ViewLayout (de.metas.ui.web.view.descriptor.ViewLayout)1 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)1 OverridingMethodsMustInvokeSuper (javax.annotation.OverridingMethodsMustInvokeSuper)1