Search in sources :

Example 86 with RibbonGroup

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

the class ProductDetailsHooksPC method updateButtonsState.

public void updateButtonsState(final ViewDefinitionState view) {
    FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup showProductionTrackingsRibbonGroup = ribbon.getGroupByName(L_SHOW_PRODUCTION_TRACKINGS);
    RibbonActionItem showProductionTrackingsForProductRibbonActionItem = showProductionTrackingsRibbonGroup.getItemByName(L_SHOW_PRODUCTION_TRACKINGS_FOR_PRODUCT);
    RibbonActionItem showProductionTrackingsForProductGroupedRibbonActionItem = showProductionTrackingsRibbonGroup.getItemByName(L_SHOW_PRODUCTION_TRACKINGS_FOR_PRODUCT_GROUPED);
    Long productionTrackingId = productForm.getEntityId();
    boolean isSaved = (productionTrackingId != null);
    showProductionTrackingsForProductRibbonActionItem.setEnabled(isSaved);
    showProductionTrackingsForProductGroupedRibbonActionItem.setEnabled(isSaved);
    showProductionTrackingsForProductRibbonActionItem.requestUpdate(true);
    showProductionTrackingsForProductGroupedRibbonActionItem.requestUpdate(true);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) 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 87 with RibbonGroup

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

the class RequestForQuotationDetailsHooks method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    FormComponent requestForQuotationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup offers = (RibbonGroup) window.getRibbon().getGroupByName(L_OFFERS);
    RibbonActionItem createOffer = (RibbonActionItem) offers.getItemByName(L_CREATE_OFFER);
    RibbonActionItem showOffersForGivenRequestForQuotation = (RibbonActionItem) offers.getItemByName(L_SHOW_OFFERS_FOR_GIVEN_REQUEST_FOR_QUOTATION);
    boolean isEnabled = (requestForQuotationForm.getEntityId() != null);
    updateButtonState(createOffer, isEnabled);
    updateButtonState(showOffersForGivenRequestForQuotation, isEnabled);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 88 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup 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 89 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup 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 90 with RibbonGroup

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

the class OfferDetailsHooks method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    FormComponent offerForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    LookupComponent requestForQuotaitonLookup = (LookupComponent) view.getComponentByReference(REQUEST_FOR_QUOTATION);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup requestForQuotations = (RibbonGroup) window.getRibbon().getGroupByName(L_REQUEST_FOR_QUOTATIONS);
    RibbonGroup deliveries = (RibbonGroup) window.getRibbon().getGroupByName(L_DELIVERIES);
    RibbonActionItem showRequestForQuotation = (RibbonActionItem) requestForQuotations.getItemByName(L_SHOW_REQUEST_FOR_QUOTATION);
    RibbonActionItem createDelivery = (RibbonActionItem) deliveries.getItemByName(L_CREATE_DELIVERY);
    RibbonActionItem showSupplyItemsForGivenOffer = (RibbonActionItem) deliveries.getItemByName(L_SHOW_SUPPLY_ITEMS_FOR_GIVEN_OFFER);
    boolean isEnabled = (offerForm.getEntityId() != null);
    boolean isRequestForQuotationFilled = (requestForQuotaitonLookup.getEntity() != null);
    updateButtonState(showRequestForQuotation, isEnabled && isRequestForQuotationFilled);
    updateButtonState(createDelivery, isEnabled);
    updateButtonState(showSupplyItemsForGivenOffer, isEnabled);
}
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