Search in sources :

Example 96 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class ProductionTrackingDetailsHooks method toggleCorrectButton.

private void toggleCorrectButton(final ViewDefinitionState view, final Entity entity) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonActionItem correctButton = window.getRibbon().getGroupByName(L_CORRECTION).getItemByName(L_CORRECT);
    String state = entity.getStringField(ProductionTrackingFields.STATE);
    Entity order = entity.getBelongsToField(ProductionTrackingFields.ORDER);
    String orderState = order.getStringField(OrderFields.STATE);
    boolean productionTrackingIsAccepted = ProductionTrackingStateStringValues.ACCEPTED.equals(state);
    boolean orderIsNotFinished = !OrderStateStringValues.COMPLETED.equals(orderState) && !OrderStateStringValues.ABANDONED.equals(orderState);
    if (productionTrackingIsAccepted && orderIsNotFinished) {
        correctButton.setEnabled(true);
    } else {
        correctButton.setEnabled(false);
    }
    correctButton.requestUpdate(true);
}
Also used : Entity(com.qcadoo.model.api.Entity) WindowComponent(com.qcadoo.view.api.components.WindowComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 97 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class ProductionTrackingServiceImpl method setTimeAndPieceworkComponentsVisible.

@Override
public void setTimeAndPieceworkComponentsVisible(final ViewDefinitionState view, final Entity order) {
    String recordingType = order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING);
    boolean recordingTypeEqualsForEach = TypeOfProductionRecording.FOR_EACH.getStringValue().equals(recordingType);
    boolean recordingTypeEqualsBasic = TypeOfProductionRecording.BASIC.getStringValue().equals(recordingType);
    LookupComponent tocComponent = (LookupComponent) view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT);
    tocComponent.setVisible(recordingTypeEqualsForEach);
    tocComponent.setRequired(recordingTypeEqualsForEach);
    boolean registerProductionTime = order.getBooleanField(OrderFieldsPC.REGISTER_PRODUCTION_TIME);
    view.getComponentByReference(L_TIME_TAB).setVisible(registerProductionTime && !recordingTypeEqualsBasic);
    ProductionTrackingState recordState = getTrackingState(view);
    final FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (form.getEntityId() != null) {
        WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
        RibbonActionItem calcTotalLaborTimeBtn = window.getRibbon().getGroupByName(L_WORK_TIME_RIBBON_GROUP).getItemByName(L_CALC_LABOR_TOTAL_TIME_RIBBON_BUTTON);
        calcTotalLaborTimeBtn.setEnabled(registerProductionTime && !recordingTypeEqualsBasic && ProductionTrackingState.DRAFT.equals(recordState));
        calcTotalLaborTimeBtn.requestUpdate(true);
    }
    boolean registerPiecework = order.getBooleanField(OrderFieldsPC.REGISTER_PIECEWORK);
    view.getComponentByReference(L_PIECEWORK_TAB).setVisible(registerPiecework && recordingTypeEqualsForEach);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) ProductionTrackingState(com.qcadoo.mes.productionCounting.states.constants.ProductionTrackingState) LookupComponent(com.qcadoo.view.api.components.LookupComponent) WindowComponent(com.qcadoo.view.api.components.WindowComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 98 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class CompanyDetailsHooksSN method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    FormComponent companyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity company = companyForm.getEntity();
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup suppliersGroup = (RibbonGroup) window.getRibbon().getGroupByName(L_SUPPLIERS_GROUP);
    RibbonActionItem redirectToFilteredOffersList = (RibbonActionItem) suppliersGroup.getItemByName(L_REDIRECT_TO_FILTERED_OFFERS_LIST);
    RibbonActionItem redirectToFilteredRequestsList = (RibbonActionItem) suppliersGroup.getItemByName(L_REDIRECT_TO_FILTERED_REQUESTS_LIST);
    boolean isEnabled = (company.getId() != null);
    updateButtonState(redirectToFilteredOffersList, isEnabled);
    updateButtonState(redirectToFilteredRequestsList, isEnabled);
}
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) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 99 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class NegotiationDetailsHooks method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    FormComponent negotiationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup requestForQuotations = (RibbonGroup) window.getRibbon().getGroupByName(L_REQUEST_FOR_QUOTATIONS);
    RibbonGroup offers = (RibbonGroup) window.getRibbon().getGroupByName(L_OFFERS);
    RibbonGroup status = window.getRibbon().getGroupByName(L_STATUS);
    RibbonActionItem generate = status.getItemByName(L_GENERATE);
    RibbonActionItem cancel = status.getItemByName(L_CANCEL);
    RibbonActionItem showRequestForQuotationsForGivenNegotiation = (RibbonActionItem) requestForQuotations.getItemByName(L_SHOW_REQUEST_FOR_QUOTATIONS_FOR_GIVEN_NEGOTIATION);
    RibbonActionItem showOffersForGivenNegotiation = (RibbonActionItem) offers.getItemByName(L_SHOW_OFFERS_FOR_GIVEN_NEGOTIATION);
    RibbonActionItem showOffersItemsForGivenNegotiation = (RibbonActionItem) offers.getItemByName(L_SHOW_OFFERS_ITEMS_FOR_GIVEN_NEGOTIATION);
    boolean isEnabled = ((negotiationForm.getEntityId() != null) && hasNegotiationProducts(negotiationForm.getEntity()));
    updateButtonState(generate, isEnabled);
    updateButtonState(cancel, isEnabled);
    updateButtonState(showRequestForQuotationsForGivenNegotiation, isEnabled);
    updateButtonState(showOffersForGivenNegotiation, isEnabled);
    updateButtonState(showOffersItemsForGivenNegotiation, isEnabled);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 100 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class TechnologyDetailsListeners method generateProductStructure.

public void generateProductStructure(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    FormComponent productStructureForm = (FormComponent) view.getComponentByReference(L_PRODUCT_STRUCTURE_FORM);
    Entity technology = technologyForm.getEntity();
    Entity productTechnology = technology.copy();
    EntityTree generatedTree = productStructureTreeService.generateProductStructureTree(view, technology);
    productTechnology.setField(PRODUCT_STRUCTURE_TREE, generatedTree);
    productStructureForm.setEntity(productTechnology);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    window.setActiveTab(L_PRODUCT_STRUCTURE);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) WindowComponent(com.qcadoo.view.api.components.WindowComponent) EntityTree(com.qcadoo.model.api.EntityTree)

Aggregations

WindowComponent (com.qcadoo.view.api.components.WindowComponent)105 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)93 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)75 FormComponent (com.qcadoo.view.api.components.FormComponent)51 Entity (com.qcadoo.model.api.Entity)46 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)31 GridComponent (com.qcadoo.view.api.components.GridComponent)28 FieldComponent (com.qcadoo.view.api.components.FieldComponent)12 LookupComponent (com.qcadoo.view.api.components.LookupComponent)8 EntityTree (com.qcadoo.model.api.EntityTree)4 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)3 JSONObject (org.json.JSONObject)3 Optional (com.google.common.base.Optional)2 AssignmentToShiftState (com.qcadoo.mes.assignmentToShift.states.constants.AssignmentToShiftState)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)2 TreeComponent (com.qcadoo.view.api.components.TreeComponent)2 Date (java.util.Date)2 HashMultimap (com.google.common.collect.HashMultimap)1 Lists (com.google.common.collect.Lists)1