Search in sources :

Example 91 with RibbonGroup

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);
}
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 92 with RibbonGroup

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) 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