use of org.kie.workbench.common.services.datamodeller.driver.model.AnnotationSource in project kie-wb-common by kiegroup.
the class AdvancedAnnotationListEditor method onEditValuePair.
protected void onEditValuePair(Annotation annotation, String valuePair) {
ValuePairEditorPopup valuePairEditor = createValuePairEditor(annotation, valuePair);
if (valuePairEditor.isGenericEditor()) {
AnnotationSource annotationSource = annotationSources.get(annotation.getClassName());
String valuePairSource = annotationSource != null ? annotationSource.getValuePairSource(valuePair) : null;
valuePairEditor.setValue(valuePairSource);
} else {
valuePairEditor.setValue(annotation.getValue(valuePair));
}
valuePairEditor.show();
}
use of org.kie.workbench.common.services.datamodeller.driver.model.AnnotationSource in project kie-wb-common by kiegroup.
the class AdvancedAnnotationListEditorTest method setup.
@Before
public void setup() {
yesCommandCaptor = ArgumentCaptor.forClass(Command.class);
noCommandCaptor = ArgumentCaptor.forClass(Command.class);
cancelCommandCaptor = ArgumentCaptor.forClass(Command.class);
annotationCallbackCaptor = (ArgumentCaptor) ArgumentCaptor.forClass(Callback.class);
Annotation annotation;
AnnotationSource annotationSource;
for (int i = 0; i < MAX_ITEMS; i++) {
annotation = mock(Annotation.class);
when(annotation.getClassName()).thenReturn("AnnotationClass" + i);
annotations.add(annotation);
annotationSource = mock(AnnotationSource.class);
annotationSourcesMap.put(annotation.getClassName(), annotationSource);
}
setupItemInstances();
annotationListEditor = new AdvancedAnnotationListEditor(view, new CallerMock(dataModelerService), valuePairEditorInstance, itemInstance) {
@Override
protected AnnotationListItem createListItem() {
if (listItemsCount >= itemInstances.size()) {
throw new RuntimeException("too many invocations");
} else {
super.createListItem();
return itemInstances.get(listItemsCount++);
}
}
@Override
protected ValuePairEditorPopup createValuePairEditor() {
super.createValuePairEditor();
return valuePairEditor;
}
};
annotationListEditor.addAddAnnotationHandler(addAnnotationHandler);
annotationListEditor.addDeleteAnnotationHandler(deleteAnnotationHandler);
annotationListEditor.addValuePairChangeHandler(valuePairChangeHandler);
annotationListEditor.addClearValuePairHandler(clearValuePairHandler);
}
Aggregations