use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class OrderedProductDetailsHooks method fillConversion.
private void fillConversion(final ViewDefinitionState view) {
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(OrderedProductFields.PRODUCT);
Entity product = productLookup.getEntity();
if (Objects.nonNull(product)) {
String additionalUnit = product.getStringField(ProductFields.ADDITIONAL_UNIT);
FieldComponent conversionField = (FieldComponent) view.getComponentByReference(OrderedProductFields.CONVERSION);
if (StringUtils.isEmpty(additionalUnit)) {
conversionField.setFieldValue(BigDecimal.ONE);
conversionField.setEnabled(false);
conversionField.requestComponentUpdateState();
}
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class DeliveredProductAttributeValDetailsListeners method onChangeAttributeValue.
public void onChangeAttributeValue(final ViewDefinitionState view, final ComponentState state, final String[] args) {
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ResourceAttributeValueFields.ATTRIBUTE_VALUE);
FieldComponent valueField = (FieldComponent) view.getComponentByReference(ResourceAttributeValueFields.VALUE);
if (Objects.nonNull(attributeValueLookup.getEntity())) {
valueField.setFieldValue(attributeValueLookup.getEntity().getStringField(AttributeValueFields.VALUE));
valueField.requestComponentUpdateState();
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class DeliveredProductDetailsListeners method onSelectedEntityChange.
public void onSelectedEntityChange(final ViewDefinitionState view, final ComponentState state, final String[] args) {
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(DeliveredProductFields.PRODUCT);
Entity product = productLookup.getEntity();
LookupComponent additionalCodeLookup = (LookupComponent) view.getComponentByReference(DeliveredProductFields.ADDITIONAL_CODE);
LookupComponent storageLocationLookup = (LookupComponent) view.getComponentByReference(DeliveredProductFields.STORAGE_LOCATION);
if (Objects.nonNull(product)) {
filterByProduct(additionalCodeLookup, product.getId());
filterByProduct(storageLocationLookup, product.getId());
} else {
clearAndDisable(additionalCodeLookup);
clearAndDisable(storageLocationLookup);
}
fillConversion(view, state, args);
quantityChange(view, state, args);
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class CompanyProductsDetailsHooks method onBeforeRenderForCompany.
public void onBeforeRenderForCompany(final ViewDefinitionState view) {
LookupComponent productLookupComponent = (LookupComponent) view.getComponentByReference(CompanyProductFields.PRODUCT);
FieldComponent unitField = (FieldComponent) view.getComponentByReference(L_UNIT);
FieldComponent daysField = (FieldComponent) view.getComponentByReference(L_DAYS);
daysField.setFieldValue(translationService.translate("deliveries.deliveryDetails.window.mainTab.deliveriesDetails.deliveryDateBufferDays.label", view.getLocale()));
if (productLookupComponent.isEmpty()) {
unitField.setFieldValue("");
} else {
Entity product = productLookupComponent.getEntity();
if (Objects.nonNull(product)) {
unitField.setFieldValue(product.getStringField(ProductFields.UNIT));
}
}
unitField.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent 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();
}
}
Aggregations