use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class PalletBalanceDetailsHooks method changeRibbonState.
private void changeRibbonState(final ViewDefinitionState view, final boolean generated) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup reportGroup = window.getRibbon().getGroupByName("report");
RibbonActionItem generate = reportGroup.getItemByName("generate");
RibbonActionItem print = reportGroup.getItemByName("print");
generate.setEnabled(!generated);
generate.requestUpdate(true);
print.setEnabled(generated);
print.requestUpdate(true);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class MRCForOrderDetailsHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FieldComponent generatedField = (FieldComponent) view.getComponentByReference(CoverageForOrderFields.GENERATED);
boolean generated = "1".equals(generatedField.getFieldValue());
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup coverage = (RibbonGroup) window.getRibbon().getGroupByName(L_COVERAGE);
RibbonActionItem printMaterialRequirementCoverage = (RibbonActionItem) coverage.getItemByName(L_PRINT_MATERIAL_REQUIREMENT_COVERAGE);
updateButtonState(printMaterialRequirementCoverage, generated);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class OperationDurationInOrderDetailsHooksOFSPG method setSaveButtonState.
private void setSaveButtonState(final ViewDefinitionState view) {
WindowComponent windowComponent = ((WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW));
RibbonActionItem ribbonActionItem = windowComponent.getRibbon().getGroupByName("subOrders").getItemByName(CoverageForOrderFieldsOFSPG.SAVE_DATE_IN_SUBORDERS);
String dateStart = (String) view.getComponentByReference(CoverageForOrderFieldsOFSPG.CALCULATED_START_ALL_ORDERS).getFieldValue();
String dateEnd = (String) view.getComponentByReference(CoverageForOrderFieldsOFSPG.CALCULATED_FINISH_ALL_ORDERS).getFieldValue();
if (dateStart.isEmpty() || dateEnd.isEmpty()) {
ribbonActionItem.setEnabled(false);
} else {
ribbonActionItem.setEnabled(true);
}
ribbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class MRCForOrderDetailsHooksOFSPG method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FieldComponent generatedField = (FieldComponent) view.getComponentByReference(CoverageForOrderFields.GENERATED);
boolean isEnabled = "1".equals(generatedField.getFieldValue());
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup coverage = (RibbonGroup) window.getRibbon().getGroupByName(ORDERS_RIBBON_GROUP);
RibbonActionItem generateOrders = (RibbonActionItem) coverage.getItemByName(ORDERS_RIBBON_GROUP_GENERATE_ORDERS);
generateOrders.setMessage("ordersForSubproductsGeneration.ordersForSubproducts.generateFromCoverage.msg");
FormComponent coverageForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Long coverageId = coverageForm.getEntityId();
Entity coverageEntity = coverageForm.getPersistedEntityWithIncludedFormValues();
Entity order = coverageEntity.getBelongsToField(CoverageForOrderFields.ORDER);
List<Entity> coverageOrders = coverageEntity.getHasManyField(MaterialRequirementCoverageFields.COVERAGE_ORDERS);
if (coverageId != null) {
if (ordersForSubproductsGenerationService.hasSubOrders(order) || ordersForSubproductsGenerationService.hasSubOrders(getOrdersIds(coverageEntity))) {
isEnabled = false;
}
}
if (order == null && coverageOrders.isEmpty()) {
isEnabled = false;
}
updateButtonState(generateOrders, isEnabled);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class OrdersForSubproductsHooks method toggleGenerateOrderButton.
private void toggleGenerateOrderButton(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Long id = form.getEntityId();
boolean isEnabled = false;
if (Objects.nonNull(id)) {
Entity entity = form.getEntity().getDataDefinition().get(id);
isEnabled = !hasGeneratedOrders(entity);
}
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup group = window.getRibbon().getGroupByName("orders");
RibbonActionItem generateOrders = group.getItemByName("generateOrders");
generateOrders.setMessage("ordersForSubproductsGeneration.ordersForSubproducts.generate.msg");
updateButtonState(generateOrders, isEnabled);
}
Aggregations