Search in sources :

Example 6 with DataModelerPropertyEditorFieldInfo

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

the class SequenceGeneratorEditionDialog method show.

@Override
public void show() {
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    String sequenceName = (String) fieldInfo.getCurrentValue(SequenceGeneratorValueHandler.SEQUENCE_NAME);
    String generatorName = (String) fieldInfo.getCurrentValue(SequenceGeneratorValueHandler.NAME);
    Object initialValue = fieldInfo.getCurrentValue(SequenceGeneratorValueHandler.INITIAL_VALUE);
    Object allocationSize = fieldInfo.getCurrentValue(SequenceGeneratorValueHandler.ALLOCATION_SIZE);
    view.setSequenceName(sequenceName);
    view.setGeneratorName(generatorName);
    view.setInitialValue(initialValue != null ? initialValue.toString() : null);
    view.clearInitialValueError();
    view.setAllocationSize(allocationSize != null ? allocationSize.toString() : null);
    view.clearAllocationSizeError();
    view.setEnabled(!fieldInfo.isDisabled());
    view.show();
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 7 with DataModelerPropertyEditorFieldInfo

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

the class SequenceGeneratorEditionDialog method onOK.

void onOK() {
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    fieldInfo.clearCurrentValues();
    String generatorName = view.getGeneratorName();
    if (generatorName != null && !generatorName.isEmpty()) {
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.NAME, generatorName);
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.SEQUENCE_NAME, view.getSequenceName());
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.INITIAL_VALUE, getInitialValue());
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.ALLOCATION_SIZE, getAllocationSize());
    }
    view.hide();
    if (okCommand != null) {
        okCommand.execute();
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 8 with DataModelerPropertyEditorFieldInfo

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

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

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

the class JPADataObjectFieldEditor method updateSequenceGeneratorField.

private void updateSequenceGeneratorField(Annotation annotation) {
    clearSequenceGeneratorField();
    if (annotation != null) {
        SequenceGeneratorValueHandler valueHandler = new SequenceGeneratorValueHandler(annotation);
        DataModelerPropertyEditorFieldInfo fieldInfo = getField(JPADataObjectFieldEditorView.SEQUENCE_GENERATOR_FIELD);
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.NAME, valueHandler.getName());
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.SEQUENCE_NAME, valueHandler.getSequenceName());
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.INITIAL_VALUE, valueHandler.getInitialValue());
        fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.ALLOCATION_SIZE, valueHandler.getAllocationSize());
        updatePropertyEditorField(JPADataObjectFieldEditorView.SEQUENCE_GENERATOR_FIELD, annotation, valueHandler.getName());
    }
}
Also used : SequenceGeneratorValueHandler(org.kie.workbench.common.screens.datamodeller.client.handlers.jpadomain.util.SequenceGeneratorValueHandler) DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 10 with DataModelerPropertyEditorFieldInfo

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

the class JPADataObjectFieldEditorTest method createFieldInfo.

private DataModelerPropertyEditorFieldInfo createFieldInfo(String key, Pair<String, Object>... currentValues) {
    DataModelerPropertyEditorFieldInfo fieldInfo = new DataModelerPropertyEditorFieldInfo(key, "not_used", null);
    if (currentValues != null) {
        for (Pair<String, Object> value : currentValues) {
            fieldInfo.setCurrentValue(value.getK1(), value.getK2());
        }
    }
    fieldInfo.withKey(key);
    return fieldInfo;
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo) DataObject(org.kie.workbench.common.services.datamodeller.core.DataObject)

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