Search in sources :

Example 31 with AnnotationValuePairDefinition

use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.

the class StringValuePairEditorTest method testEditorLoad.

@Test
public void testEditorLoad() {
    StringValuePairEditor stringEditor = new StringValuePairEditor(view);
    AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair("stringParam1");
    stringEditor.init(valuePairDefinition);
    verify(view, times(1)).setValuePairLabel(valuePairDefinition.getName());
    verify(view, times(1)).showValuePairRequiredIndicator(false);
}
Also used : AnnotationValuePairDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition) Test(org.junit.Test)

Example 32 with AnnotationValuePairDefinition

use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.

the class AdvancedAnnotationListEditor method onClearValuePair.

protected void onClearValuePair(Annotation annotation, String valuePair) {
    AnnotationDefinition annotationDefinition = annotation.getAnnotationDefinition();
    AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(valuePair);
    if (valuePairDefinition.getDefaultValue() == null) {
        // if the value pair has no default value, it should be applied wherever the annotation is applied, if not
        // the resulting code won't compile.
        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);
    }
}
Also used : AnnotationDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition) AnnotationValuePairDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition)

Example 33 with AnnotationValuePairDefinition

use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.

the class CreateAnnotationWizard method updateValuePairPages.

private void updateValuePairPages(AnnotationDefinition annotationDefinition) {
    clearCurrentValuePairEditorPages();
    pages.clear();
    pages.add(searchAnnotationPage);
    this.annotationDefinition = annotationDefinition;
    if (annotationDefinition != null) {
        for (AnnotationValuePairDefinition valuePairDefinition : annotationDefinition.getValuePairs()) {
            pages.add(createValuePairEditorPage(valuePairDefinition));
        }
    }
    super.start();
}
Also used : AnnotationValuePairDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition)

Aggregations

AnnotationValuePairDefinition (org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition)33 Test (org.junit.Test)22 ArrayList (java.util.ArrayList)8 AnnotationDefinition (org.kie.workbench.common.services.datamodeller.core.AnnotationDefinition)8 DataObject (org.kie.workbench.common.services.datamodeller.core.DataObject)4 AnnotationImpl (org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl)4 AnnotationSource (org.jboss.forge.roaster.model.source.AnnotationSource)3 DataModelerService (org.kie.workbench.common.screens.datamodeller.service.DataModelerService)3 Annotation (org.kie.workbench.common.services.datamodeller.core.Annotation)3 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Entity (javax.persistence.Entity)1 ValuePair (org.jboss.forge.roaster.model.ValuePair)1 AdvancedAnnotationListEditorView (org.kie.workbench.common.screens.datamodeller.client.widgets.advanceddomain.annotationlisteditor.AdvancedAnnotationListEditorView)1 GenerationTools (org.kie.workbench.common.services.datamodeller.codegen.GenerationTools)1 AnnotationDefinitionRequest (org.kie.workbench.common.services.datamodeller.driver.model.AnnotationDefinitionRequest)1 AnnotationDefinitionResponse (org.kie.workbench.common.services.datamodeller.driver.model.AnnotationDefinitionResponse)1 AnnotationDescr (org.kie.workbench.common.services.datamodeller.parser.descr.AnnotationDescr)1 ElementValueDescr (org.kie.workbench.common.services.datamodeller.parser.descr.ElementValueDescr)1 ElementValuePairDescr (org.kie.workbench.common.services.datamodeller.parser.descr.ElementValuePairDescr)1