use of org.kie.workbench.common.screens.datamodeller.client.widgets.advanceddomain.valuepaireditor.ValuePairEditorPopup 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.screens.datamodeller.client.widgets.advanceddomain.valuepaireditor.ValuePairEditorPopup in project kie-wb-common by kiegroup.
the class AdvancedAnnotationListEditor method createValuePairEditor.
private ValuePairEditorPopup createValuePairEditor(Annotation annotation, String valuePair) {
final ValuePairEditorPopup valuePairEditor = createValuePairEditor();
valuePairEditor.init(annotation.getClassName(), annotation.getAnnotationDefinition().getValuePair(valuePair));
valuePairEditor.addPopupHandler(new ValuePairEditorPopupView.ValuePairEditorPopupHandler() {
@Override
public void onOk() {
doValuePairChange(valuePairEditor, valuePairEditor.getValue());
}
@Override
public void onCancel() {
doValuePairNoAction(valuePairEditor);
}
@Override
public void onClose() {
doValuePairNoAction(valuePairEditor);
}
});
return valuePairEditor;
}
use of org.kie.workbench.common.screens.datamodeller.client.widgets.advanceddomain.valuepaireditor.ValuePairEditorPopup 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