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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations