Search in sources :

Example 76 with RibbonGroup

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);
    }
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 77 with RibbonGroup

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 78 with RibbonGroup

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);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 79 with RibbonGroup

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 80 with RibbonGroup

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);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Aggregations

RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)92 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)86 WindowComponent (com.qcadoo.view.api.components.WindowComponent)75 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)37 FormComponent (com.qcadoo.view.api.components.FormComponent)36 Entity (com.qcadoo.model.api.Entity)34 GridComponent (com.qcadoo.view.api.components.GridComponent)23 FieldComponent (com.qcadoo.view.api.components.FieldComponent)9 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)3 LookupComponent (com.qcadoo.view.api.components.LookupComponent)3 JSONObject (org.json.JSONObject)3 AssignmentToShiftState (com.qcadoo.mes.assignmentToShift.states.constants.AssignmentToShiftState)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)2 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)2 Optional (com.google.common.base.Optional)1 HashMultimap (com.google.common.collect.HashMultimap)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Multimap (com.google.common.collect.Multimap)1