Search in sources :

Example 66 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class LineChangeoverNormsForOrderDetailsViewHooks method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    FieldComponent productionLineField = (FieldComponent) view.getComponentByReference(OrderFields.PRODUCTION_LINE);
    LookupComponent previousOrderLookup = (LookupComponent) view.getComponentByReference(OrderFieldsLCNFO.PREVIOUS_ORDER);
    LookupComponent lineChangeoverNormLookup = (LookupComponent) view.getComponentByReference(OrderFieldsLCNFO.LINE_CHANGEOVER_NORM);
    FieldComponent previousOrderTechnologyGroupNumberField = (FieldComponent) view.getComponentByReference("previousOrderTechnologyGroupNumber");
    FieldComponent technologyGroupNumberField = (FieldComponent) view.getComponentByReference("technologyGroupNumber");
    FieldComponent previousOrderTechnologyNumberField = (FieldComponent) view.getComponentByReference("previousOrderTechnologyNumber");
    FieldComponent technologyNumberField = (FieldComponent) view.getComponentByReference("technologyNumber");
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup orders = window.getRibbon().getGroupByName("orders");
    RibbonGroup lineChangeoverNorms = window.getRibbon().getGroupByName("lineChangeoverNorms");
    RibbonActionItem showPreviousOrder = orders.getItemByName("showPreviousOrder");
    RibbonActionItem showBestFittingLineChangeoverNorm = lineChangeoverNorms.getItemByName("showBestFittingLineChangeoverNorm");
    RibbonActionItem showChangeoverNormForGroup = lineChangeoverNorms.getItemByName("showLineChangeoverNormForGroup");
    RibbonActionItem showChangeoverNormForTechnology = lineChangeoverNorms.getItemByName("showLineChangeoverNormForTechnology");
    Entity productionLine = lineChangeoverNormsForOrdersService.getProductionLineFromDB((Long) productionLineField.getFieldValue());
    boolean hasDefinedPreviousOrder = !previousOrderLookup.isEmpty();
    updateButtonState(showPreviousOrder, hasDefinedPreviousOrder);
    boolean hasMatchingChangeoverNorm = !lineChangeoverNormLookup.isEmpty();
    updateButtonState(showBestFittingLineChangeoverNorm, hasMatchingChangeoverNorm);
    if (StringUtils.isEmpty((String) previousOrderTechnologyGroupNumberField.getFieldValue()) || StringUtils.isEmpty((String) technologyGroupNumberField.getFieldValue())) {
        updateButtonState(showChangeoverNormForGroup, false);
    } else {
        Entity fromTechnologyGroup = lineChangeoverNormsForOrdersService.getTechnologyGroupByNumberFromDB((String) previousOrderTechnologyGroupNumberField.getFieldValue());
        Entity toTechnologyGroup = lineChangeoverNormsForOrdersService.getTechnologyGroupByNumberFromDB((String) technologyGroupNumberField.getFieldValue());
        if ((changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyGroupWithLine(fromTechnologyGroup, toTechnologyGroup, productionLine) == null) && (changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyGroupWithLine(fromTechnologyGroup, toTechnologyGroup, null) == null)) {
            updateButtonState(showChangeoverNormForGroup, false);
        } else {
            updateButtonState(showChangeoverNormForGroup, true);
        }
    }
    if (StringUtils.isEmpty((String) previousOrderTechnologyNumberField.getFieldValue()) || StringUtils.isEmpty((String) technologyNumberField.getFieldValue())) {
        updateButtonState(showChangeoverNormForTechnology, false);
    } else {
        Entity fromTechnology = lineChangeoverNormsForOrdersService.getTechnologyByNumberFromDB((String) previousOrderTechnologyNumberField.getFieldValue());
        Entity toTechnology = lineChangeoverNormsForOrdersService.getTechnologyByNumberFromDB((String) technologyNumberField.getFieldValue());
        if ((changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyWithLine(fromTechnology, toTechnology, productionLine) == null) && (changeoverNormsSearchService.searchMatchingChangeroverNormsForTechnologyWithLine(fromTechnology, toTechnology, null) == null)) {
            updateButtonState(showChangeoverNormForTechnology, false);
        } else {
            updateButtonState(showChangeoverNormForTechnology, true);
        }
    }
}
Also used : Entity(com.qcadoo.model.api.Entity) RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) LookupComponent(com.qcadoo.view.api.components.LookupComponent) WindowComponent(com.qcadoo.view.api.components.WindowComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 67 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class DetailedProductionCountingAndProgressListHooksBPC method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    String releaseOfMaterials = parameterService.getParameter().getStringField(ParameterFieldsPC.RELEASE_OF_MATERIALS);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup issueRibbonGroup = ribbon.getGroupByName(L_ISSUE);
    RibbonActionItem resourceIssueRibbonActionItem = issueRibbonGroup.getItemByName(L_RESOURCE_ISSUE);
    if (!ReleaseOfMaterials.MANUALLY_TO_ORDER_OR_GROUP.getStringValue().equals(releaseOfMaterials)) {
        resourceIssueRibbonActionItem.setEnabled(false);
        resourceIssueRibbonActionItem.setMessage("basicProductionCounting.detailedProductionCountingAndProgressList.resourceIssue.description");
        resourceIssueRibbonActionItem.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 68 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class ProductionTrackingServiceImplTest method init.

@Before
public void init() {
    MockitoAnnotations.initMocks(this);
    productionTrackingService = new ProductionTrackingServiceImpl();
    given(view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT)).willReturn(technologyOperationComponentLookup);
    given(view.getComponentByReference(QcadooViewConstants.L_WINDOW)).willReturn(window);
    given(window.getRibbon()).willReturn(ribbon);
    RibbonGroup workTimeGroup = mock(RibbonGroup.class);
    given(ribbon.getGroupByName("workTime")).willReturn(workTimeGroup);
    given(workTimeGroup.getItemByName("calcTotalLaborTime")).willReturn(calcTotalLaborTimeRibbonBtn);
    FormComponent form = mock(FormComponent.class);
    given(view.getComponentByReference(QcadooViewConstants.L_FORM)).willReturn(form);
    given(form.getEntity()).willReturn(order);
    given(form.getPersistedEntityWithIncludedFormValues()).willReturn(order);
    given(view.getComponentByReference(L_TIME_TAB)).willReturn(timeTab);
    given(view.getComponentByReference(L_PIECEWORK_TAB)).willReturn(pieceworkTab);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) Before(org.junit.Before)

Example 69 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class OperationDurationDetailsInOrderHooks method disableCopyRealizationTimeButton.

private void disableCopyRealizationTimeButton(final ViewDefinitionState view) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup realizationTimeGroup = window.getRibbon().getGroupByName("operationDuration");
    RibbonActionItem realizationTime = realizationTimeGroup.getItemByName("copy");
    if (isGenerated(view)) {
        realizationTime.setEnabled(true);
    } else {
        realizationTime.setEnabled(false);
    }
    realizationTime.requestUpdate(true);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 70 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class OperationDurationDetailsInOrderHooks method disableCreateButton.

void disableCreateButton(final ViewDefinitionState view) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup operationalTasks = window.getRibbon().getGroupByName(L_OPERATIONAL_TASKS);
    RibbonActionItem createOperationalTasks = operationalTasks.getItemByName(L_CREATE_OPERATIONAL_TASKS);
    if (isGenerated(view) && orderHasTechnologyAndCorrectState(view)) {
        createOperationalTasks.setEnabled(true);
    } else {
        createOperationalTasks.setEnabled(false);
    }
    createOperationalTasks.requestUpdate(true);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) 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