use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductionCountingQuantityAdvancedDetailsHooks method setCriteriaModifierParameters.
private void setCriteriaModifierParameters(final ViewDefinitionState view) {
FormComponent productionCountingQuantityForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent technologyOperationComponentLookup = (LookupComponent) view.getComponentByReference(ProductionCountingQuantityFields.TECHNOLOGY_OPERATION_COMPONENT);
Entity productionCountingQuantity = productionCountingQuantityForm.getEntity();
Entity order = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.ORDER);
Entity basicProductionCounting = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING);
if (order != null) {
Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
if (technology != null) {
FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
technologyOperationComponentLookup.setFilterValue(filterValueHolder);
return;
}
}
if (basicProductionCounting != null) {
Entity basicProductionCountingOrder = basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER);
if (basicProductionCountingOrder != null) {
Entity technology = basicProductionCountingOrder.getBelongsToField(OrderFields.TECHNOLOGY);
if (technology != null) {
FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
technologyOperationComponentLookup.setFilterValue(filterValueHolder);
}
}
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductionCountingQuantityAdvancedDetailsHooks method fillProductField.
private void fillProductField(final ViewDefinitionState view) {
FormComponent productionCountingQuantityForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(ProductionCountingQuantityFields.PRODUCT);
Long productionCountingQuantityId = productionCountingQuantityForm.getEntityId();
if (productionCountingQuantityId != null) {
return;
}
Entity productionCountingQuantity = productionCountingQuantityForm.getEntity();
Entity basicProductionCounting = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING);
if (basicProductionCounting != null) {
Entity product = basicProductionCounting.getBelongsToField(BasicProductionCountingFields.PRODUCT);
if (product != null) {
productLookup.setFieldValue(product.getId());
productLookup.setEnabled(false);
productLookup.requestComponentUpdateState();
}
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductionCountingAttributeValueDetailsListeners method onChangeAttribute.
public void onChangeAttribute(final ViewDefinitionState view, final ComponentState state, final String[] args) {
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.ATTRIBUTE_VALUE);
FieldComponent valueField = (FieldComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.VALUE);
attributeValueLookup.setFieldValue(null);
attributeValueLookup.requestComponentUpdateState();
valueField.setFieldValue(null);
valueField.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductAttributeValueDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
setValueBold(view);
setFilters(view);
LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ProductAttributeValueFields.ATTRIBUTE);
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductAttributeValueFields.ATTRIBUTE_VALUE);
FieldComponent valueField = (FieldComponent) view.getComponentByReference(ProductAttributeValueFields.VALUE);
if (Objects.nonNull(attributeLookup.getEntity())) {
Entity attribute = attributeLookup.getEntity();
FieldComponent unitField = (FieldComponent) view.getComponentByReference(L_UNIT);
unitField.setFieldValue(attribute.getStringField(AttributeFields.UNIT));
unitField.requestComponentUpdateState();
if (AttributeDataType.CONTINUOUS.getStringValue().equals(attribute.getStringField(AttributeFields.DATA_TYPE))) {
valueField.setVisible(true);
attributeValueLookup.setVisible(false);
} else {
valueField.setVisible(false);
attributeValueLookup.setVisible(true);
}
} else {
valueField.setVisible(false);
attributeValueLookup.setVisible(false);
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductDetailsHooks method disableProductFormForExternalItems.
public void disableProductFormForExternalItems(final ViewDefinitionState view) {
FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
FieldComponent entityTypeField = (FieldComponent) view.getComponentByReference(ProductFields.ENTITY_TYPE);
FieldComponent parentField = (FieldComponent) view.getComponentByReference(ProductFields.PARENT);
FieldComponent categoryField = (FieldComponent) view.getComponentByReference(ProductFields.CATEGORY);
LookupComponent supplierLookup = (LookupComponent) view.getComponentByReference(ProductFields.SUPPLIER);
LookupComponent assortmentLookup = (LookupComponent) view.getComponentByReference(ProductFields.ASSORTMENT);
LookupComponent modelLookup = (LookupComponent) view.getComponentByReference(ProductFields.MODEL);
Long productId = productForm.getEntityId();
if (Objects.isNull(productId)) {
productForm.setFormEnabled(true);
return;
}
Entity product = getProductDD().get(productId);
if (Objects.isNull(product)) {
return;
}
String externalNumber = product.getStringField(ProductFields.EXTERNAL_NUMBER);
if (StringUtils.isEmpty(externalNumber)) {
productForm.setFormEnabled(true);
} else {
productForm.setFormEnabled(false);
entityTypeField.setEnabled(true);
parentField.setEnabled(true);
categoryField.setEnabled(true);
supplierLookup.setEnabled(true);
assortmentLookup.setEnabled(true);
modelLookup.setEnabled(true);
}
}
Aggregations