use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class SupplyParametersListenersPFTD method toggleGenerateIssuesTo.
public void toggleGenerateIssuesTo(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
String value = (String) componentState.getFieldValue();
if (StringUtils.isNotEmpty(value)) {
WarehouseIssueProductsSource warehouseIssueProductsSource = WarehouseIssueProductsSource.parseString(value);
CheckBoxComponent generateWarehouseIssuesToDeliveries = (CheckBoxComponent) view.getComponentByReference(ParameterFieldsPFTD.GENERATE_WAREHOUSE_ISSUES_TO_DELIVERIES);
CheckBoxComponent generateWarehouseIssuesToOrders = (CheckBoxComponent) view.getComponentByReference(ParameterFieldsPFTD.GENERATE_WAREHOUSE_ISSUES_TO_ORDERS);
if (WarehouseIssueProductsSource.MANUAL.equals(warehouseIssueProductsSource)) {
generateWarehouseIssuesToDeliveries.setEnabled(true);
uncheckAndDisable(generateWarehouseIssuesToOrders);
lockDeliveriesComponents(view, generateWarehouseIssuesToDeliveries, args);
} else if (WarehouseIssueProductsSource.ORDER.equals(warehouseIssueProductsSource)) {
generateWarehouseIssuesToOrders.setEnabled(true);
uncheckAndDisable(generateWarehouseIssuesToDeliveries);
onGenerateWarehouseIssuesToOrdersChange(view, generateWarehouseIssuesToOrders, args);
}
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class SupplyParametersListenersPFTD method onGenerateWarehouseIssuesToOrdersChange.
public void onGenerateWarehouseIssuesToOrdersChange(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
CheckBoxComponent generateWarehouseIssues = (CheckBoxComponent) componentState;
toggleDaysBeforeOrderStart(generateWarehouseIssues.isChecked(), view);
toggleIssueLocation(generateWarehouseIssues.isChecked(), view);
toggleAutomaticReleaseAfterGeneration(generateWarehouseIssues.isChecked(), view);
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ProductionPerShiftDetailsHooks method markViewAsInitialized.
private void markViewAsInitialized(final ViewDefinitionState view) {
Optional<CheckBoxComponent> maybeCheckbox = view.tryFindComponentByReference(VIEW_IS_INITIALIZED_CHECKBOX_REF);
for (CheckBoxComponent checkbox : maybeCheckbox.asSet()) {
checkbox.setChecked(true);
checkbox.requestComponentUpdateState();
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ModifyTechnologyDetailsHooks method configureReplacePart.
private void configureReplacePart(ViewDefinitionState view) {
CheckBoxComponent replaceCheckBox = (CheckBoxComponent) view.getComponentByReference(ModifyTechnologyHelperFields.REPLACE);
LookupComponent replaceProductLookup = (LookupComponent) view.getComponentByReference(ModifyTechnologyHelperFields.REPLACE_PRODUCT);
FieldComponent replaceProductQuantityComponent = (FieldComponent) view.getComponentByReference(ModifyTechnologyHelperFields.REPLACE_PRODUCT_QUANTITY);
if (replaceCheckBox.isChecked()) {
replaceProductLookup.setEnabled(true);
replaceProductQuantityComponent.setEnabled(true);
FieldComponent replaceProductUnit = (FieldComponent) view.getComponentByReference(L_REPLACE_PRODUCT_UNIT);
if (Objects.nonNull(replaceProductLookup.getFieldValue())) {
replaceProductUnit.setFieldValue(replaceProductLookup.getEntity().getStringField(ProductFields.UNIT));
}
} else {
replaceProductLookup.setEnabled(false);
replaceProductQuantityComponent.setEnabled(false);
}
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class OPICDetailsHooks method setProductBySizeGroupsGridEnabledAndClear.
private void setProductBySizeGroupsGridEnabledAndClear(final ViewDefinitionState view) {
FormComponent operationProductInComponentForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
CheckBoxComponent differentProductsInDifferentSizesCheckBox = (CheckBoxComponent) view.getComponentByReference(OperationProductInComponentFields.DIFFERENT_PRODUCTS_IN_DIFFERENT_SIZES);
CheckBoxComponent variousQuantitiesInProductsBySize = (CheckBoxComponent) view.getComponentByReference(OperationProductInComponentFields.VARIOUS_QUANTITIES_IN_PRODUCTS_BY_SIZE);
FieldComponent givenQuantity = (FieldComponent) view.getComponentByReference(OperationProductInComponentFields.GIVEN_QUANTITY);
FieldComponent givenQuantityUnit = (FieldComponent) view.getComponentByReference(OperationProductInComponentFields.GIVEN_UNIT);
LookupComponent productLookup = (LookupComponent) view.getComponentByReference(OperationProductInComponentFields.PRODUCT);
GridComponent productBySizeGroupsGrid = (GridComponent) view.getComponentByReference(OperationProductInComponentFields.PRODUCT_BY_SIZE_GROUPS);
Entity operationProductInComponent = operationProductInComponentForm.getEntity();
Entity operationComponent = operationProductInComponent.getBelongsToField(OperationProductInComponentFields.OPERATION_COMPONENT);
Entity technology = null;
if (Objects.isNull(operationComponent)) {
technology = operationProductInComponent.getBelongsToField(OperationProductInComponentFields.TECHNOLOGY);
} else {
technology = operationComponent.getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
}
Entity product = technology.getBelongsToField(TechnologyFields.PRODUCT);
String entityType = product.getStringField(ProductFields.ENTITY_TYPE);
boolean isEnabled = ProductFamilyElementType.PRODUCTS_FAMILY.getStringValue().equals(entityType);
boolean isChecked = differentProductsInDifferentSizesCheckBox.isChecked();
if (isChecked) {
productLookup.setFieldValue(null);
} else {
productBySizeGroupsGrid.setEntities(Lists.newArrayList());
}
differentProductsInDifferentSizesCheckBox.setEnabled(isEnabled);
differentProductsInDifferentSizesCheckBox.requestComponentUpdateState();
productLookup.setEnabled(!isChecked);
productLookup.requestComponentUpdateState();
productBySizeGroupsGrid.setEnabled(isChecked);
String givenQuantityValue = (String) givenQuantity.getFieldValue();
String givenQuantityUnitValue = (String) givenQuantityUnit.getFieldValue();
if (!variousQuantitiesInProductsBySize.isChecked() && (StringUtils.isEmpty(givenQuantityValue) || StringUtils.isEmpty(givenQuantityUnitValue))) {
productBySizeGroupsGrid.setEnabled(false);
}
}
Aggregations