use of com.qcadoo.view.api.components.LookupComponent 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.LookupComponent in project mes by qcadoo.
the class DeliveredProductAttributeValDetailsHooks method setValueBold.
private void setValueBold(ViewDefinitionState view) {
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(DeliveredProductAttributeValFields.ATTRIBUTE_VALUE);
attributeValueLookup.setRequired(true);
attributeValueLookup.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class DeliveredProductDetailsHooks method fillConversion.
public void fillConversion(final ViewDefinitionState view) {
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(DeliveredProductFields.PRODUCT);
Entity product = productLookup.getEntity();
if (Objects.nonNull(product)) {
String additionalUnit = product.getStringField(ProductFields.ADDITIONAL_UNIT);
String unit = product.getStringField(ProductFields.UNIT);
FieldComponent conversionField = (FieldComponent) view.getComponentByReference(DeliveredProductFields.CONVERSION);
if (StringUtils.isEmpty(additionalUnit)) {
conversionField.setFieldValue(BigDecimal.ONE);
conversionField.setEnabled(false);
} else {
String conversion = numberService.formatWithMinimumFractionDigits(getConversion(product, unit, additionalUnit), 0);
conversionField.setFieldValue(conversion);
conversionField.setEnabled(true);
}
conversionField.requestComponentUpdateState();
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class DeliveredProductDetailsHooks method setBatchLookupProductFilterValue.
public void setBatchLookupProductFilterValue(final ViewDefinitionState view, final Entity deliveredProduct) {
LookupComponent batchLookup = (LookupComponent) view.getComponentByReference(DeliveredProductFields.BATCH);
Entity product = deliveredProduct.getBelongsToField(DeliveredProductFields.PRODUCT);
if (Objects.nonNull(product)) {
batchCriteriaModifier.putProductFilterValue(batchLookup, product);
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class DeliveredProductDetailsHooks method fillOrderedQuantities.
public void fillOrderedQuantities(final ViewDefinitionState view) {
FormComponent deliveredProductForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(DeliveredProductFields.PRODUCT);
FieldComponent orderedQuantity = (FieldComponent) view.getComponentByReference(OrderedProductFields.ORDERED_QUANTITY);
Entity deliveredProduct = deliveredProductForm.getEntity();
Entity product = productLookup.getEntity();
if (Objects.isNull(product)) {
orderedQuantity.setFieldValue(null);
} else {
orderedQuantity.setFieldValue(numberService.format(getOrderedProductQuantity(deliveredProduct)));
}
orderedQuantity.requestComponentUpdateState();
}
Aggregations