Search in sources :

Example 11 with DataModelerPropertyEditorFieldInfo

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

the class JPADataObjectEditor method createField.

private DataModelerPropertyEditorFieldInfo createField(String label, String key, String currentStringValue, Class<?> customFieldClass, String helpHeading, String helpText) {
    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);
    }
    return fieldInfo;
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 12 with DataModelerPropertyEditorFieldInfo

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

the class IdGeneratorEditionDialog method okButton.

void okButton() {
    // TODO add validation in order to establish if the ok operation can be performed. If validation is ok,
    // then new current values can be set.
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    String strategy = generatorType.getValue();
    strategy = "NONE".equals(strategy) ? null : strategy;
    String generator = generatorName.getText();
    fieldInfo.setCurrentValue("strategy", strategy);
    fieldInfo.setCurrentValue("generator", generator);
    super.hide();
    revertChanges = Boolean.FALSE;
    if (okCommand != null) {
        okCommand.execute();
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 13 with DataModelerPropertyEditorFieldInfo

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

the class JPADataObjectEditor 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 14 with DataModelerPropertyEditorFieldInfo

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

the class JPADataObjectFieldEditor method updatePropertyEditorField.

private void updatePropertyEditorField(String fieldId, Annotation currentValue, String currentStringValue) {
    DataModelerPropertyEditorFieldInfo fieldInfo = propertyEditorFields.get(fieldId);
    fieldInfo.setCurrentValue(currentValue);
    fieldInfo.setCurrentStringValue(currentStringValue);
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 15 with DataModelerPropertyEditorFieldInfo

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

the class JPADataObjectFieldEditor method updateRelationshipField.

private void updateRelationshipField(Annotation annotation) {
    clearRelationshipField();
    if (annotation != null) {
        RelationshipAnnotationValueHandler valueHandler = new RelationshipAnnotationValueHandler(annotation);
        DataModelerPropertyEditorFieldInfo fieldInfo = getField(JPADataObjectFieldEditorView.RELATIONSHIP_TYPE_FIELD);
        fieldInfo.setCurrentValue(RelationshipAnnotationValueHandler.RELATION_TYPE, valueHandler.getRelationType());
        fieldInfo.setCurrentValue(RelationshipAnnotationValueHandler.CASCADE, valueHandler.getCascade());
        fieldInfo.setCurrentValue(RelationshipAnnotationValueHandler.FETCH, valueHandler.getFetch());
        fieldInfo.setCurrentValue(RelationshipAnnotationValueHandler.OPTIONAL, valueHandler.getOptional());
        fieldInfo.setCurrentValue(RelationshipAnnotationValueHandler.MAPPED_BY, valueHandler.getMappedBy());
        fieldInfo.setCurrentValue(RelationshipAnnotationValueHandler.ORPHAN_REMOVAL, valueHandler.getOrphanRemoval());
        if (valueHandler.isOneToMany()) {
            fieldInfo.removeCurrentValue(RelationshipAnnotationValueHandler.OPTIONAL);
        } else if (valueHandler.isManyToOne()) {
            fieldInfo.removeCurrentValue(RelationshipAnnotationValueHandler.MAPPED_BY);
            fieldInfo.removeCurrentValue(RelationshipAnnotationValueHandler.ORPHAN_REMOVAL);
        } else if (valueHandler.isManyToMany()) {
            fieldInfo.removeCurrentValue(RelationshipAnnotationValueHandler.OPTIONAL);
            fieldInfo.removeCurrentValue(RelationshipAnnotationValueHandler.ORPHAN_REMOVAL);
        }
        updatePropertyEditorField(JPADataObjectFieldEditorView.RELATIONSHIP_TYPE_FIELD, annotation, valueHandler.getRelationType().name());
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo) RelationshipAnnotationValueHandler(org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.util.RelationshipAnnotationValueHandler)

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