@Test public void shouldntCleanCustomTranslationsWhenCustomTranslationIsntSelected() { customTranslations = mockEntityList(new ArrayList<Entity>()); given(view.getComponentByReference(QcadooViewConstants.L_GRID)).willReturn(customTranslationsGrid); given(customTranslationsGrid.getSelectedEntities()).willReturn(customTranslations); customTranslationsListListeners.cleanCustomTranslations(view, null, null); verify(customTranslation, never()).setField(Mockito.anyString(), Mockito.any()); verify(customTranslationDD, never()).save(Mockito.any(Entity.class)); verify(customTranslationsGrid, never()).addMessage(Mockito.anyString(), Mockito.any(MessageType.class)); }
public void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args) { GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID); List<Entity> customTranslations = customTranslationsGrid.getSelectedEntities(); if (!customTranslations.isEmpty()) { for (Entity customTranslation : customTranslations) { customTranslation.setField(CUSTOM_TRANSLATION, null); customTranslation.getDataDefinition().save(customTranslation); } customTranslationsGrid .addMessage("qcadooCustomTranslations.customTranslationsList.message.cleanCustomTranslationsSuccess", MessageType.SUCCESS); } }
CustomTranslationsListListeners { public void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args) { GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID); List<Entity> customTranslations = customTranslationsGrid.getSelectedEntities(); if (!customTranslations.isEmpty()) { for (Entity customTranslation : customTranslations) { customTranslation.setField(CUSTOM_TRANSLATION, null); customTranslation.getDataDefinition().save(customTranslation); } customTranslationsGrid .addMessage("qcadooCustomTranslations.customTranslationsList.message.cleanCustomTranslationsSuccess", MessageType.SUCCESS); } } }
CustomTranslationsListListeners { public void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args) { GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID); List<Entity> customTranslations = customTranslationsGrid.getSelectedEntities(); if (!customTranslations.isEmpty()) { for (Entity customTranslation : customTranslations) { customTranslation.setField(CUSTOM_TRANSLATION, null); customTranslation.getDataDefinition().save(customTranslation); } customTranslationsGrid .addMessage("qcadooCustomTranslations.customTranslationsList.message.cleanCustomTranslationsSuccess", MessageType.SUCCESS); } }  }
CustomTranslationsListListeners { public void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args) { GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID); List<Entity> customTranslations = customTranslationsGrid.getSelectedEntities(); if (!customTranslations.isEmpty()) { for (Entity customTranslation : customTranslations) { customTranslation.setField(CUSTOM_TRANSLATION, null); customTranslation.getDataDefinition().save(customTranslation); } customTranslationsGrid .addMessage("qcadooCustomTranslations.customTranslationsList.message.cleanCustomTranslationsSuccess", MessageType.SUCCESS); } }  void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args); void replaceCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args); }
CustomTranslationsListListeners { public void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args) { GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID); List<Entity> customTranslations = customTranslationsGrid.getSelectedEntities(); if (!customTranslations.isEmpty()) { for (Entity customTranslation : customTranslations) { customTranslation.setField(CUSTOM_TRANSLATION, null); customTranslation.getDataDefinition().save(customTranslation); } customTranslationsGrid .addMessage("qcadooCustomTranslations.customTranslationsList.message.cleanCustomTranslationsSuccess", MessageType.SUCCESS); } }  void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args); void replaceCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args);  }