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();
}
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();
}
}
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();
}
}
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);
}
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());
}
}
}
Aggregations