@Test public void shouldUpdateRibbonStateIfCustomTranslationIsSelected() { given(view.getComponentByReference(QcadooViewConstants.L_GRID)).willReturn(customTranslationsGrid); given(customTranslationsGrid.getSelectedEntities()).willReturn(customTranslations); given(customTranslations.isEmpty()).willReturn(false); given(view.getComponentByReference(QcadooViewConstants.L_WINDOW)).willReturn((ComponentState) window); given(window.getRibbon()).willReturn(ribbon); given(ribbon.getGroupByName(L_CLEAN)).willReturn(clean); given(clean.getItemByName(L_CLEAN_CUSTOM_TRANSLATIONS)).willReturn(cleanCustomTranslations); customTranslationsListViewHooks.updateRibbonState(view); verify(cleanCustomTranslations).setEnabled(true); }
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); }
CustomTranslationsListViewHooks { 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); } }
CustomTranslationsListViewHooks { 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); }  }
CustomTranslationsListViewHooks { 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); }  void updateRibbonState(final ViewDefinitionState view); void setLocaleToDefault(final ViewDefinitionState view); void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view, final ComponentState state, final String[] args); void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view); }
CustomTranslationsListViewHooks { 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); }  void updateRibbonState(final ViewDefinitionState view); void setLocaleToDefault(final ViewDefinitionState view); void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view, final ComponentState state, final String[] args); void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view);  }