Search in sources :

Example 16 with DataModelerPropertyEditorFieldInfo

use of org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo in project kie-wb-common by kiegroup.

the class JPADataObjectFieldEditor method updateGeneratedValueField.

private void updateGeneratedValueField(Annotation annotation) {
    clearGeneratedValueField();
    if (annotation != null) {
        DataModelerPropertyEditorFieldInfo fieldInfo = getField(JPADataObjectFieldEditorView.GENERATED_VALUE_FIELD);
        String strategy = AnnotationValueHandler.getStringValue(annotation, IdGeneratorField.STRATEGY, null);
        String generator = AnnotationValueHandler.getStringValue(annotation, IdGeneratorField.GENERATOR, null);
        fieldInfo.setCurrentValue(IdGeneratorField.STRATEGY, strategy);
        fieldInfo.setCurrentValue(IdGeneratorField.GENERATOR, generator);
        updatePropertyEditorField(JPADataObjectFieldEditorView.GENERATED_VALUE_FIELD, annotation, strategy != null ? strategy : IdGeneratorField.NOT_CONFIGURED_LABEL);
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 17 with DataModelerPropertyEditorFieldInfo

use of org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo in project kie-wb-common by kiegroup.

the class JPADataObjectFieldEditor method createField.

private DataModelerPropertyEditorFieldInfo createField(String label, String key, String currentStringValue, Class<?> customFieldClass, String helpHeading, String helpText, boolean readonly) {
    DataModelerPropertyEditorFieldInfo fieldInfo = propertyEditorFields.get(key);
    if (fieldInfo == null) {
        fieldInfo = new DataModelerPropertyEditorFieldInfo(label, currentStringValue, customFieldClass);
        fieldInfo.withKey(key);
        if (helpHeading != null) {
            fieldInfo.withHelpInfo(helpHeading, helpText);
        }
        propertyEditorFields.put(key, fieldInfo);
    }
    fieldInfo.setDisabled(readonly);
    return fieldInfo;
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 18 with DataModelerPropertyEditorFieldInfo

use of org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo in project kie-wb-common by kiegroup.

the class IdGeneratorEditionDialog method onOK.

void onOK() {
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    fieldInfo.clearCurrentValues();
    String strategy = view.getGeneratorType();
    if (!UIUtil.NOT_SELECTED.equals(strategy)) {
        fieldInfo.setCurrentValue(STRATEGY, strategy);
        fieldInfo.setCurrentValue(GENERATOR, view.getGeneratorName());
    }
    view.hide();
    if (okCommand != null) {
        okCommand.execute();
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 19 with DataModelerPropertyEditorFieldInfo

use of org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo in project kie-wb-common by kiegroup.

the class RelationshipEditionDialog method onOK.

void onOK() {
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    fieldInfo.clearCurrentValues();
    String relationType = view.getRelationType();
    if (!relationType.equals(UIUtil.NOT_SELECTED)) {
        fieldInfo.setCurrentValue(RELATION_TYPE, RelationType.valueOf(relationType));
        fieldInfo.setCurrentValue(CASCADE, getCascadeTypes());
        fieldInfo.setCurrentValue(FETCH, FetchMode.valueOf(view.getFetchMode()));
        if (relationType.equals(RelationType.ONE_TO_ONE.name()) || relationType.equals(RelationType.MANY_TO_ONE.name())) {
            fieldInfo.setCurrentValue(OPTIONAL, view.getOptional());
        }
        if (relationType.equals(RelationType.ONE_TO_ONE.name()) || relationType.equals(RelationType.ONE_TO_MANY.name()) || relationType.equals(RelationType.MANY_TO_MANY.name())) {
            fieldInfo.setCurrentValue(MAPPED_BY, view.getMappedBy());
        }
        if (relationType.equals(RelationType.ONE_TO_ONE.name()) || relationType.equals(RelationType.ONE_TO_MANY.name())) {
            fieldInfo.setCurrentValue(ORPHAN_REMOVAL, view.getOrphanRemoval());
        }
    }
    view.hide();
    if (okCommand != null) {
        okCommand.execute();
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Aggregations

DataModelerPropertyEditorFieldInfo (org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)19 RelationshipAnnotationValueHandler (org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.util.RelationshipAnnotationValueHandler)1 SequenceGeneratorValueHandler (org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.util.SequenceGeneratorValueHandler)1 CascadeType (org.kie.workbench.common.screens.datamodeller.model.jpadomain.CascadeType)1 FetchMode (org.kie.workbench.common.screens.datamodeller.model.jpadomain.FetchMode)1 RelationType (org.kie.workbench.common.screens.datamodeller.model.jpadomain.RelationType)1 DataObject (org.kie.workbench.common.services.datamodeller.core.DataObject)1