use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class MaintenanceEventContextService method setEnableOfRibbonActions.
private void setEnableOfRibbonActions(ViewDefinitionState viewDefinitionState, boolean enabled) {
WindowComponent window = (WindowComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup customActions = ribbon.getGroupByName("customActions");
if (customActions == null) {
return;
}
for (RibbonActionItem ribbonActionItem : customActions.getItems()) {
ribbonActionItem.setEnabled(enabled);
ribbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class ActionDetailsHooks method disableActionsWhenDefault.
public void disableActionsWhenDefault(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName("actions");
for (RibbonActionItem item : actions.getItems()) {
item.setEnabled(false);
item.requestUpdate(true);
}
GridComponent workstationsGrid = (GridComponent) view.getComponentByReference(ActionFields.WORKSTATIONS);
GridComponent subassembliesGrid = (GridComponent) view.getComponentByReference(ActionFields.SUBASSEMBLIES);
GridComponent workstationTypesGrid = (GridComponent) view.getComponentByReference(ActionFields.WORKSTATION_TYPES);
workstationsGrid.setEnabled(false);
subassembliesGrid.setEnabled(false);
workstationTypesGrid.setEnabled(false);
FieldComponent nameField = (FieldComponent) view.getComponentByReference(ActionFields.NAME);
FieldComponent appliesToField = (FieldComponent) view.getComponentByReference(ActionFields.APPLIES_TO);
nameField.setEnabled(false);
appliesToField.setEnabled(false);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class GenerateMRCForOrderHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FormComponent materialRequirementCoverageForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Long materialRequirementCoverageId = materialRequirementCoverageForm.getEntityId();
Entity mRCForOrder = materialRequirementCoverageForm.getEntity();
Entity order = mRCForOrder.getBelongsToField("order");
boolean saved = checkIfMaterialRequirementCoverageIsSaved(materialRequirementCoverageId);
boolean enable = false;
if (order.getStringField(OrderFields.STATE).equals(OrderState.ACCEPTED.getStringValue())) {
enable = true;
}
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);
RibbonGroup reports = (RibbonGroup) window.getRibbon().getGroupByName(L_REPORTS);
RibbonActionItem generateMaterialRequirementCoverage = (RibbonActionItem) coverage.getItemByName(L_GENERATE_MATERIAL_REQUIREMENT_COVERAGE);
RibbonActionItem printMaterialRequirementCoverage = (RibbonActionItem) coverage.getItemByName(L_PRINT_MATERIAL_REQUIREMENT_COVERAGE);
RibbonActionItem saveMaterialRequirementCoverage = (RibbonActionItem) reports.getItemByName(L_SAVE_MATERIAL_REQUIREMENT_COVERAGE);
RibbonActionItem showMaterialRequirementCoverages = (RibbonActionItem) reports.getItemByName(L_SHOW_MATERIAL_REQUIREMENT_COVERAGES);
boolean areSaved = checkIfThereAreSavedMaterialRequirementCoverages();
updateButtonState(generateMaterialRequirementCoverage, enable);
updateButtonState(printMaterialRequirementCoverage, generated && !saved);
updateButtonState(saveMaterialRequirementCoverage, generated && !saved);
updateButtonState(showMaterialRequirementCoverages, areSaved);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class OperationalTasksDetailsHooks method disableButtons.
public void disableButtons(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
FieldComponent typeField = (FieldComponent) view.getComponentByReference(OperationalTaskFields.TYPE);
LookupComponent orderLookup = (LookupComponent) view.getComponentByReference(OperationalTaskFields.ORDER);
LookupComponent technologyOperationComponentLookup = (LookupComponent) view.getComponentByReference(OperationalTaskFields.TECHNOLOGY_OPERATION_COMPONENT);
String type = (String) typeField.getFieldValue();
boolean isOperationalTaskTypeExecutionOperationInOrder = operationalTasksService.isOperationalTaskTypeExecutionOperationInOrder(type);
boolean isOrderSelected = !Objects.isNull(orderLookup.getEntity());
boolean isTechnologyOperationComponentSelected = !Objects.isNull(technologyOperationComponentLookup.getEntity());
RibbonGroup order = window.getRibbon().getGroupByName(L_ORDER);
RibbonGroup technologyOperationComponent = window.getRibbon().getGroupByName(L_TECHNOLOGY_OPERATION_COMPONENT);
RibbonGroup operationalTasks = window.getRibbon().getGroupByName(L_OPERATIONAL_TASKS);
RibbonActionItem showOrder = order.getItemByName(L_SHOW_ORDER);
RibbonActionItem showOperationParameters = technologyOperationComponent.getItemByName(L_SHOW_OPERATION_PARAMETERS);
RibbonActionItem showOperationalTasksWithOrder = operationalTasks.getItemByName(L_SHOW_OPERATIONAL_TASKS_WITH_ORDER);
showOrder.setEnabled(isOperationalTaskTypeExecutionOperationInOrder && isOrderSelected);
showOrder.requestUpdate(true);
showOperationParameters.setEnabled(isOperationalTaskTypeExecutionOperationInOrder && isOrderSelected && isTechnologyOperationComponentSelected);
showOperationParameters.requestUpdate(true);
showOperationalTasksWithOrder.setEnabled(isOperationalTaskTypeExecutionOperationInOrder && isOrderSelected);
showOperationalTasksWithOrder.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class OrderDetailsHooks method disabledRibbonWhenOrderIsSynchronized.
public void disabledRibbonWhenOrderIsSynchronized(final ViewDefinitionState view) {
FormComponent orderForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
List<RibbonGroup> ribbonGroups = ribbon.getGroups();
Long orderId = orderForm.getEntityId();
if (Objects.isNull(orderId)) {
return;
}
Entity order = orderService.getOrder(orderId);
if (orderStateService.isSynchronized(order)) {
return;
}
for (RibbonGroup ribbonGroup : ribbonGroups) {
for (RibbonActionItem ribbonActionItem : ribbonGroup.getItems()) {
ribbonActionItem.setEnabled(false);
ribbonActionItem.requestUpdate(true);
}
}
RibbonActionItem refreshRibbonActionItem = ribbon.getGroupByName(L_ORDER_DETAILS_ACTIONS).getItemByName(L_REFRESH);
RibbonActionItem backRibbonActionItem = ribbon.getGroupByName(L_NAVIGATION).getItemByName(L_BACK);
refreshRibbonActionItem.setEnabled(true);
backRibbonActionItem.setEnabled(true);
refreshRibbonActionItem.requestUpdate(true);
backRibbonActionItem.requestUpdate(true);
orderForm.setFormEnabled(false);
}
Aggregations