use of com.qcadoo.view.api.components.AwesomeDynamicListComponent in project mes by qcadoo.
the class ProductionPerShiftDetailsHooks method disableReasonOfCorrection.
void disableReasonOfCorrection(final ViewDefinitionState view, final ProgressType progressType, final OrderState orderState) {
boolean enabled = progressType != ProgressType.PLANNED && !UNSUPPORTED_ORDER_STATES.contains(orderState);
AwesomeDynamicListComponent plannedProgressCorrectionTypes = (AwesomeDynamicListComponent) view.getComponentByReference(CORRECTION_CAUSE_TYPES_ADL_REF);
plannedProgressCorrectionTypes.setEnabled(enabled);
for (FormComponent plannedProgressCorrectionTypeForm : plannedProgressCorrectionTypes.getFormComponents()) {
plannedProgressCorrectionTypeForm.setFormEnabled(enabled);
}
view.getComponentByReference(CORRECTION_COMMENT_TEXT_AREA_REF).setEnabled(enabled);
}
use of com.qcadoo.view.api.components.AwesomeDynamicListComponent in project mes by qcadoo.
the class ProductionPerShiftDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
Entity order = getEntityFromLookup(view, ORDER_LOOKUP_REF).get();
OrderState orderState = OrderState.of(order);
ProgressType progressType = resolveProgressType(view);
AwesomeDynamicListComponent progressForDaysADL = (AwesomeDynamicListComponent) view.getComponentByReference(PROGRESS_ADL_REF);
if (!isViewAlreadyInitialized(view)) {
fillOrderDateComponents(view, order);
setupProgressTypeComboBox(view, orderState, progressType);
setProductAndFillProgressForDays(view, progressForDaysADL, orderState, progressType);
}
disableReasonOfCorrection(view, progressType, orderState);
disableComponents(progressForDaysADL, progressType, orderState);
changeButtonState(view, progressType, orderState);
updateAutoFillButtonState(view);
setupHasBeenCorrectedCheckbox(view);
checkOrderDates(view, order);
markViewAsInitialized(view);
deviationNotify(view);
}
use of com.qcadoo.view.api.components.AwesomeDynamicListComponent in project mes by qcadoo.
the class ProductionPerShiftDetailsHooks method fillProgressesUnitFields.
private void fillProgressesUnitFields(final AwesomeDynamicListComponent progressForDaysADL, final Optional<Entity> maybeMainOperationProduct) {
String unit = FluentOptional.wrap(maybeMainOperationProduct).flatMap(EntityUtils.<String>getSafeFieldExtractor(ProductFields.UNIT)).toOpt().orNull();
for (FormComponent progressForDayForm : progressForDaysADL.getFormComponents()) {
AwesomeDynamicListComponent dailyProgressADL = (AwesomeDynamicListComponent) progressForDayForm.findFieldComponentByName(DAILY_PROGRESS_ADL_REF);
for (FormComponent dailyProgressForm : dailyProgressADL.getFormComponents()) {
FieldComponent unitField = dailyProgressForm.findFieldComponentByName(UNIT_COMPONENT_NAME);
unitField.setFieldValue(unit);
unitField.requestComponentUpdateState();
}
dailyProgressADL.requestComponentUpdateState();
}
progressForDaysADL.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.AwesomeDynamicListComponent in project mes by qcadoo.
the class ModifyTechnologyDetailsHooks method configureAddPart.
private void configureAddPart(ViewDefinitionState view) {
CheckBoxComponent addNewCheckBox = (CheckBoxComponent) view.getComponentByReference(ModifyTechnologyHelperFields.ADD_NEW);
AwesomeDynamicListComponent addProductAdl = (AwesomeDynamicListComponent) view.getComponentByReference(L_MODIFY_TECHNOLOGY_ADD_PRODUCTS);
if (addNewCheckBox.isChecked()) {
addProductAdl.setEnabled(true);
addProductAdl.getFormComponents().forEach(fc -> {
fc.setFormEnabled(true);
Entity addEntity = fc.getPersistedEntityWithIncludedFormValues();
Entity product = addEntity.getBelongsToField(PRODUCT);
if (Objects.nonNull(product)) {
addEntity.setField(L_UNIT, product.getStringField(ProductFields.UNIT));
fc.setEntity(addEntity);
}
});
} else {
addProductAdl.setEnabled(false);
addProductAdl.getFormComponents().forEach(fc -> fc.setFormEnabled(false));
}
}
use of com.qcadoo.view.api.components.AwesomeDynamicListComponent in project mes by qcadoo.
the class ProductDetailsHooks method disableUnitFromWhenFormIsSaved.
public void disableUnitFromWhenFormIsSaved(final ViewDefinitionState view) {
FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
AwesomeDynamicListComponent conversionItemsAdl = (AwesomeDynamicListComponent) view.getComponentByReference(CONVERSION_ITEMS);
conversionItemsAdl.setEnabled(Objects.nonNull(productForm.getEntityId()));
for (FormComponent formComponent : conversionItemsAdl.getFormComponents()) {
formComponent.findFieldComponentByName(UNIT_FROM).setEnabled(Objects.isNull(formComponent.getEntityId()));
}
FieldComponent additionalUnit = (FieldComponent) view.getComponentByReference(ProductFields.ADDITIONAL_UNIT);
additionalUnit.setEnabled(Objects.nonNull(productForm.getEntityId()));
}
Aggregations