@Test public void testOnClearValuePairWithoutDefaultValue() { prepareValuePairClear(); when(valuePairDefinition.getDefaultValue()).thenReturn(null); annotationListEditor.onClearValuePair(annotation, "valuePairName"); String expectedMessage = Constants.INSTANCE.advanced_domain_annotation_list_editor_message_value_pair_has_no_default_value("valuePairName", "AnnotationClassName"); verify(view, times(1)).showYesNoDialog(eq(expectedMessage), yesCommandCaptor.capture()); yesCommandCaptor.getValue().execute(); verify(clearValuePairHandler, times(0)).onClearValuePair(eq(annotation), anyString()); }
protected void onClearValuePair(Annotation annotation, String valuePair) { AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition(); AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(valuePair); if (valuePairDefinition.getDefaultValue() == null) { String message = Constants.INSTANCE.advanced_domain_annotation_list_editor_message_value_pair_has_no_default_value(valuePair, annotation.getClassName()); view.showYesNoDialog(message, getNoActionCommand()); } else if (clearValuePairHandler != null) { clearValuePairHandler.onClearValuePair(annotation, valuePair); } }
AdvancedAnnotationListEditor implements IsWidget,
                   AdvancedAnnotationListEditorView.Presenter { protected void onClearValuePair(Annotation annotation, String valuePair) { AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition(); AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(valuePair); if (valuePairDefinition.getDefaultValue() == null) { String message = Constants.INSTANCE.advanced_domain_annotation_list_editor_message_value_pair_has_no_default_value(valuePair, annotation.getClassName()); view.showYesNoDialog(message, getNoActionCommand()); } else if (clearValuePairHandler != null) { clearValuePairHandler.onClearValuePair(annotation, valuePair); } } }
AdvancedAnnotationListEditor implements IsWidget,
                   AdvancedAnnotationListEditorView.Presenter { protected void onClearValuePair(Annotation annotation, String valuePair) { AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition(); AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(valuePair); if (valuePairDefinition.getDefaultValue() == null) { String message = Constants.INSTANCE.advanced_domain_annotation_list_editor_message_value_pair_has_no_default_value(valuePair, annotation.getClassName()); view.showYesNoDialog(message, getNoActionCommand()); } else if (clearValuePairHandler != null) { clearValuePairHandler.onClearValuePair(annotation, valuePair); } } @Inject  AdvancedAnnotationListEditor(AdvancedAnnotationListEditorView view,
                                        Caller<DataModelerService> modelerService,
                                        Instance<ValuePairEditorPopup> valuePairEditorInstance,
                                        Instance<AnnotationListItem> itemInstance); }
AdvancedAnnotationListEditor implements IsWidget,
                   AdvancedAnnotationListEditorView.Presenter { protected void onClearValuePair(Annotation annotation, String valuePair) { AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition(); AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(valuePair); if (valuePairDefinition.getDefaultValue() == null) { String message = Constants.INSTANCE.advanced_domain_annotation_list_editor_message_value_pair_has_no_default_value(valuePair, annotation.getClassName()); view.showYesNoDialog(message, getNoActionCommand()); } else if (clearValuePairHandler != null) { clearValuePairHandler.onClearValuePair(annotation, valuePair); } } @Inject  AdvancedAnnotationListEditor(AdvancedAnnotationListEditorView view,
                                        Caller<DataModelerService> modelerService,
                                        Instance<ValuePairEditorPopup> valuePairEditorInstance,
                                        Instance<AnnotationListItem> itemInstance); @Override Widget asWidget(); void init(final KieModule module,
                     final ElementType elementType); void loadAnnotations(List<Annotation> annotations); void loadAnnotations(List<Annotation> annotations,
                                Map<String, AnnotationSource> annotationSources); boolean isReadonly(); void setReadonly(boolean readonly); @Override void onAddAnnotation(); void addDeleteAnnotationHandler(AdvancedAnnotationListEditorView.DeleteAnnotationHandler deleteAnnotationHandler); void addClearValuePairHandler(AdvancedAnnotationListEditorView.ClearValuePairHandler clearValuePairHandler); void addValuePairChangeHandler(AdvancedAnnotationListEditorView.ValuePairChangeHandler valuePairChangeHandler); void addAddAnnotationHandler(AdvancedAnnotationListEditorView.AddAnnotationHandler addAnnotationHandler); void clear(); void removeAnnotation(Annotation annotation); }
AdvancedAnnotationListEditor implements IsWidget,
                   AdvancedAnnotationListEditorView.Presenter { protected void onClearValuePair(Annotation annotation, String valuePair) { AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition(); AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(valuePair); if (valuePairDefinition.getDefaultValue() == null) { String message = Constants.INSTANCE.advanced_domain_annotation_list_editor_message_value_pair_has_no_default_value(valuePair, annotation.getClassName()); view.showYesNoDialog(message, getNoActionCommand()); } else if (clearValuePairHandler != null) { clearValuePairHandler.onClearValuePair(annotation, valuePair); } } @Inject  AdvancedAnnotationListEditor(AdvancedAnnotationListEditorView view,
                                        Caller<DataModelerService> modelerService,
                                        Instance<ValuePairEditorPopup> valuePairEditorInstance,
                                        Instance<AnnotationListItem> itemInstance); @Override Widget asWidget(); void init(final KieModule module,
                     final ElementType elementType); void loadAnnotations(List<Annotation> annotations); void loadAnnotations(List<Annotation> annotations,
                                Map<String, AnnotationSource> annotationSources); boolean isReadonly(); void setReadonly(boolean readonly); @Override void onAddAnnotation(); void addDeleteAnnotationHandler(AdvancedAnnotationListEditorView.DeleteAnnotationHandler deleteAnnotationHandler); void addClearValuePairHandler(AdvancedAnnotationListEditorView.ClearValuePairHandler clearValuePairHandler); void addValuePairChangeHandler(AdvancedAnnotationListEditorView.ValuePairChangeHandler valuePairChangeHandler); void addAddAnnotationHandler(AdvancedAnnotationListEditorView.AddAnnotationHandler addAnnotationHandler); void clear(); void removeAnnotation(Annotation annotation);  }