use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class MasterOrdersMaterialRequirementDetailsHooks method setFormEnabled.
private void setFormEnabled(final ViewDefinitionState view) {
FormComponent masterOrdersMaterialRequirementForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
GridComponent masterOrdersGrid = (GridComponent) view.getComponentByReference(MasterOrdersMaterialRequirementFields.MASTER_ORDERS);
CheckBoxComponent generatedCheckBox = (CheckBoxComponent) view.getComponentByReference(MasterOrdersMaterialRequirementFields.GENERATED);
Long masterOrdersMaterialRequirementId = masterOrdersMaterialRequirementForm.getEntityId();
boolean isEnabled = Objects.isNull(masterOrdersMaterialRequirementId);
boolean isGenerated = generatedCheckBox.isChecked();
masterOrdersMaterialRequirementForm.setFormEnabled(isEnabled || !isGenerated);
masterOrdersGrid.setEnabled(isEnabled || !isGenerated);
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class MasterOrdersMaterialRequirementDetailsHooks method setRibbonEnabled.
private void setRibbonEnabled(final ViewDefinitionState view) {
FormComponent masterOrdersMaterialRequirementForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
CheckBoxComponent generatedCheckBox = (CheckBoxComponent) view.getComponentByReference(MasterOrdersMaterialRequirementFields.GENERATED);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup generateRibbonGroup = ribbon.getGroupByName(L_GENERATE);
RibbonActionItem generateRibbonActionItem = generateRibbonGroup.getItemByName(L_GENERATE_MASTER_ORDERS_MATERIAL_REQUIREMENT);
Long masterOrdersMaterialRequirementId = masterOrdersMaterialRequirementForm.getEntityId();
boolean isEnabled = Objects.nonNull(masterOrdersMaterialRequirementId);
boolean isGenerated = generatedCheckBox.isChecked();
generateRibbonActionItem.setEnabled(isEnabled && !isGenerated);
generateRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class SalesPlanMaterialRequirementDetailsHooks method setRibbonEnabled.
private void setRibbonEnabled(final ViewDefinitionState view) {
FormComponent salesPlanMaterialRequirementForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
GridComponent salesPlanMaterialRequirementProductsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
CheckBoxComponent generatedCheckBox = (CheckBoxComponent) view.getComponentByReference(SalesPlanMaterialRequirementFields.GENERATED);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup generateRibbonGroup = ribbon.getGroupByName(L_GENERATE);
RibbonGroup deliveriesRibbonGroup = ribbon.getGroupByName(L_DELIVERIES);
RibbonGroup technologiesRibbonGroup = ribbon.getGroupByName(TECHNOLOGIES);
RibbonActionItem generateRibbonActionItem = generateRibbonGroup.getItemByName(L_GENERATE_SALES_PLAN_MATERIAL_REQUIREMENT);
RibbonActionItem createDeliveryRibbonActionItem = deliveriesRibbonGroup.getItemByName(L_CREATE_DELIVERY);
RibbonActionItem showSalesPlanDeliveriesRibbonActionItem = deliveriesRibbonGroup.getItemByName(SHOW_SALES_PLAN_DELIVERIES);
RibbonActionItem showTechnologiesWithUsingProductRibbonActionItem = technologiesRibbonGroup.getItemByName(SHOW_TECHNOLOGIES_WITH_USING_PRODUCT);
Long salesPlanMaterialRequirementId = salesPlanMaterialRequirementForm.getEntityId();
boolean isEnabled = Objects.nonNull(salesPlanMaterialRequirementId);
boolean isGenerated = generatedCheckBox.isChecked();
boolean isSalesPlanMaterialRequirementProductsSelected = !salesPlanMaterialRequirementProductsGrid.getSelectedEntities().isEmpty();
generateRibbonActionItem.setEnabled(isEnabled && !isGenerated);
generateRibbonActionItem.requestUpdate(true);
createDeliveryRibbonActionItem.setEnabled(isEnabled && isGenerated && isSalesPlanMaterialRequirementProductsSelected);
createDeliveryRibbonActionItem.requestUpdate(true);
showTechnologiesWithUsingProductRibbonActionItem.setEnabled(salesPlanMaterialRequirementProductsGrid.getSelectedEntities().size() == 1);
showTechnologiesWithUsingProductRibbonActionItem.requestUpdate(true);
showSalesPlanDeliveriesRibbonActionItem.setEnabled(isEnabled);
showSalesPlanDeliveriesRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class SalesPlanMaterialRequirementDetailsHooks method setFormEnabled.
private void setFormEnabled(final ViewDefinitionState view) {
FormComponent salesPlanMaterialRequirementForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
CheckBoxComponent generatedCheckBox = (CheckBoxComponent) view.getComponentByReference(SalesPlanMaterialRequirementFields.GENERATED);
Long salesPlanMaterialRequirementId = salesPlanMaterialRequirementForm.getEntityId();
boolean isEnabled = Objects.isNull(salesPlanMaterialRequirementId);
boolean isGenerated = generatedCheckBox.isChecked();
salesPlanMaterialRequirementForm.setFormEnabled(isEnabled || !isGenerated);
}
use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.
the class ResourceAttributeValueDetailsHooks method fillFromDefinition.
private void fillFromDefinition(final ViewDefinitionState view) {
CheckBoxComponent fromDefinition = (CheckBoxComponent) view.getComponentByReference(ResourceAttributeValueFields.FROM_DEFINITION);
fromDefinition.setChecked(true);
fromDefinition.requestComponentUpdateState();
}
Aggregations