Search in sources :

Example 36 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class DeliveredProductDetailsListeners method filterByProduct.

private void filterByProduct(final LookupComponent lookupComponent, final Long id) {
    lookupComponent.setFieldValue(null);
    lookupComponent.setEnabled(true);
    FilterValueHolder filterValueHolder = lookupComponent.getFilterValue();
    filterValueHolder.put(DeliveredProductFields.PRODUCT, id);
    lookupComponent.setFilterValue(filterValueHolder);
    lookupComponent.requestComponentUpdateState();
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 37 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class DeliveredProductAddMultiHooks method setStorageLocationFilter.

private void setStorageLocationFilter(final ViewDefinitionState view) {
    FormComponent deliveredProductMultiForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity deliveredProductMultiEntity = deliveredProductMultiForm.getPersistedEntityWithIncludedFormValues();
    Entity delivery = deliveredProductMultiEntity.getBelongsToField(DeliveredProductMultiFields.DELIVERY);
    Entity location = delivery.getBelongsToField(DeliveryFields.LOCATION);
    if (Objects.nonNull(location)) {
        LookupComponent storageLocationLookup = (LookupComponent) view.getComponentByReference(DeliveredProductMultiFields.STORAGE_LOCATION);
        FilterValueHolder filterValueHolder = storageLocationLookup.getFilterValue();
        filterValueHolder.put(L_LOCATION, location.getId());
        storageLocationLookup.setFilterValue(filterValueHolder);
        storageLocationLookup.requestComponentUpdateState();
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 38 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class DeliveredProductAddMultiHooks method filterAdditionalCode.

public void filterAdditionalCode(final LookupComponent additionalCodeLookup, final Entity product) {
    if (Objects.nonNull(product)) {
        additionalCodeLookup.setEnabled(true);
        FilterValueHolder filterValueHolder = additionalCodeLookup.getFilterValue();
        filterValueHolder.put(L_PRODUCT, product.getId());
        additionalCodeLookup.setFilterValue(filterValueHolder);
        additionalCodeLookup.requestComponentUpdateState();
    } else {
        additionalCodeLookup.setFieldValue(null);
        additionalCodeLookup.setEnabled(false);
        additionalCodeLookup.requestComponentUpdateState();
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 39 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class DeliveredProductAttributeValDetailsHooks method setFilters.

private void setFilters(ViewDefinitionState view) {
    LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(DeliveredProductAttributeValFields.ATTRIBUTE);
    LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(DeliveredProductAttributeValFields.ATTRIBUTE_VALUE);
    FilterValueHolder attributeValueLookupFilters = attributeValueLookup.getFilterValue();
    if (Objects.nonNull(attributeLookup.getEntity())) {
        attributeValueLookupFilters.put(L_ATTRIBUTE_ID, attributeLookup.getEntity().getId());
    } else if (attributeValueLookupFilters.has(L_ATTRIBUTE_ID)) {
        attributeValueLookupFilters.remove(L_ATTRIBUTE_ID);
    }
    attributeValueLookup.setFilterValue(attributeValueLookupFilters);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 40 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class MasterOrderDetailsHooks method fillDefaultTechnology.

public void fillDefaultTechnology(final ViewDefinitionState view) {
    LookupComponent productField = (LookupComponent) view.getComponentByReference("product");
    FieldComponent defaultTechnologyField = (FieldComponent) view.getComponentByReference("defaultTechnology");
    LookupComponent technologyLookup = (LookupComponent) view.getComponentByReference("technology");
    Entity product = productField.getEntity();
    if (Objects.nonNull(product)) {
        FilterValueHolder holder = technologyLookup.getFilterValue();
        holder.put(TechnologyCriteriaModifiersO.PRODUCT_PARAMETER, product.getId());
        technologyLookup.setFilterValue(holder);
        Entity defaultTechnology = technologyServiceO.getDefaultTechnology(product);
        if (Objects.nonNull(defaultTechnology)) {
            String defaultTechnologyValue = expressionService.getValue(defaultTechnology, "#number + ' - ' + #name", view.getLocale());
            defaultTechnologyField.setFieldValue(defaultTechnologyValue);
            technologyLookup.setFieldValue(defaultTechnology.getId());
        }
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Aggregations

FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)119 LookupComponent (com.qcadoo.view.api.components.LookupComponent)69 Entity (com.qcadoo.model.api.Entity)64 FormComponent (com.qcadoo.view.api.components.FormComponent)45 GridComponent (com.qcadoo.view.api.components.GridComponent)26 FieldComponent (com.qcadoo.view.api.components.FieldComponent)13 Collectors (java.util.stream.Collectors)11 Autowired (org.springframework.beans.factory.annotation.Autowired)11 Service (org.springframework.stereotype.Service)11 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)10 SearchCriteriaBuilder (com.qcadoo.model.api.search.SearchCriteriaBuilder)10 SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)10 Objects (java.util.Objects)10 DataDefinition (com.qcadoo.model.api.DataDefinition)9 JSONObject (org.json.JSONObject)9 UserFieldsMF (com.qcadoo.mes.materialFlow.constants.UserFieldsMF)8 UserLocationFields (com.qcadoo.mes.materialFlow.constants.UserLocationFields)8 EntityList (com.qcadoo.model.api.EntityList)8 SecurityService (com.qcadoo.security.api.SecurityService)8 QcadooSecurityConstants (com.qcadoo.security.constants.QcadooSecurityConstants)8