use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class TechnologyDetailsHooks method setRibbonState.
private void setRibbonState(final ViewDefinitionState view) {
FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup fillProductsGroup = window.getRibbon().getGroupByName(L_FILL_PRODUCTS);
RibbonActionItem fillProductsRibbonActionItem = fillProductsGroup.getItemByName(L_FILL_PRODUCTS);
RibbonActionItem moveProductsRibbonActionItem = fillProductsGroup.getItemByName(L_MOVE_PRODUCTS);
RibbonActionItem openOperationProductInComponentsImportPageRibbonActionItem = window.getRibbon().getGroupByName(L_IMPORT).getItemByName(L_OPEN_OPERATION_PRODUCT_IN_COMPONENTS_IMPORT_PAGE);
Entity technology = technologyForm.getEntity();
String state = technology.getStringField(TechnologyFields.STATE);
boolean isTemplateAccepted = technology.getBooleanField(TechnologyFields.IS_TEMPLATE_ACCEPTED);
boolean isSaved = Objects.nonNull(technologyForm.getEntityId());
boolean isDraft = TechnologyState.DRAFT.getStringValue().equals(state);
fillProductsRibbonActionItem.setEnabled(isSaved && isDraft && !isTemplateAccepted);
fillProductsRibbonActionItem.setMessage("technologies.technologyDetails.window.ribbon.fillProducts.fillProducts.description");
fillProductsRibbonActionItem.requestUpdate(true);
moveProductsRibbonActionItem.setEnabled(isSaved && isDraft && !isTemplateAccepted);
moveProductsRibbonActionItem.setMessage("technologies.technologyDetails.window.ribbon.fillProducts.moveProducts.description");
moveProductsRibbonActionItem.requestUpdate(true);
openOperationProductInComponentsImportPageRibbonActionItem.setEnabled(isSaved && isDraft && !isTemplateAccepted);
openOperationProductInComponentsImportPageRibbonActionItem.setMessage("technologies.technologyDetails.window.ribbon.import.openOperationProductInComponentsImportPage.description");
openOperationProductInComponentsImportPageRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project qcadoo by qcadoo.
the class CustomTranslationsListViewHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup clean = window.getRibbon().getGroupByName(L_CLEAN);
RibbonActionItem cleanCustomTranslations = clean.getItemByName(L_CLEAN_CUSTOM_TRANSLATIONS);
boolean isAnyTranslationSelected = customTranslationsGrid.getSelectedEntities().isEmpty();
updateButtonState(cleanCustomTranslations, !isAnyTranslationSelected);
}
Aggregations