Search in sources :

Example 71 with FilterValueHolder

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

the class SizeGroupDetailsHooks method fillCriteriaModifiers.

public void fillCriteriaModifiers(final ViewDefinitionState view) {
    FormComponent sizeGroupForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    LookupComponent sizeLookup = (LookupComponent) view.getComponentByReference("sizeLookup");
    Long sizeGroupId = sizeGroupForm.getEntityId();
    if (Objects.nonNull(sizeGroupId)) {
        FilterValueHolder filter = sizeLookup.getFilterValue();
        filter.put("sizeGroupId", sizeGroupId);
        sizeLookup.setFilterValue(filter);
    }
    sizeLookup.requestComponentUpdateState();
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) FormComponent(com.qcadoo.view.api.components.FormComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 72 with FilterValueHolder

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

the class DeliveredProductDetailsHooks method filterBy.

private void filterBy(final LookupComponent componentState, final String field, final Long id) {
    FilterValueHolder filterValueHolder = componentState.getFilterValue();
    filterValueHolder.put(field, id);
    componentState.setEnabled(true);
    componentState.setFilterValue(filterValueHolder);
    componentState.requestComponentUpdateState();
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 73 with FilterValueHolder

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

the class OrderedProductDetailsHooks method fillCriteriaModifiers.

private void fillCriteriaModifiers(final ViewDefinitionState viewDefinitionState) {
    LookupComponent product = (LookupComponent) viewDefinitionState.getComponentByReference("product");
    LookupComponent qualityCard = (LookupComponent) viewDefinitionState.getComponentByReference("qualityCard");
    if (product.getEntity() != null) {
        FilterValueHolder filter = qualityCard.getFilterValue();
        filter.put(QualityCardCriteriaModifiers.L_PRODUCT_ID, product.getEntity().getId());
        qualityCard.setFilterValue(filter);
        qualityCard.requestComponentUpdateState();
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 74 with FilterValueHolder

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

the class OrderedProductDetailsHooks method fillAdditionalCodesLookup.

private void fillAdditionalCodesLookup(final ViewDefinitionState view) {
    LookupComponent additionalCodeLookup = (LookupComponent) view.getComponentByReference(OrderedProductFields.ADDITIONAL_CODE);
    LookupComponent productLookup = (LookupComponent) view.getComponentByReference(OrderedProductFields.PRODUCT);
    Entity product = productLookup.getEntity();
    if (Objects.nonNull(product)) {
        additionalCodeLookup.setEnabled(true);
        FilterValueHolder filterValueHolder = additionalCodeLookup.getFilterValue();
        filterValueHolder.put(AdditionalCodeFields.PRODUCT, product.getId());
        additionalCodeLookup.setFilterValue(filterValueHolder);
    } else {
        additionalCodeLookup.setFieldValue(null);
        additionalCodeLookup.setEnabled(false);
    }
    additionalCodeLookup.requestComponentUpdateState();
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 75 with FilterValueHolder

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

the class ChangeStorageLocationHelperHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity entity = form.getEntity();
    Entity delivery = entity.getBelongsToField(DeliveredProductFields.DELIVERY);
    Entity location = delivery.getBelongsToField(DeliveryFields.LOCATION);
    if (location != null) {
        LookupComponent storageLocationLookup = (LookupComponent) view.getComponentByReference("storageLocation");
        FilterValueHolder filter = storageLocationLookup.getFilterValue();
        filter.put("location", location.getId());
        storageLocationLookup.setFilterValue(filter);
    }
}
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)

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