Search in sources :

Example 1 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) {
    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 2 with DataModelerPropertyEditorFieldInfo

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

the class RelationshipEditionDialog 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 relationTypeValueStr = relationType.getValue();
    fieldInfo.removeCurrentValue(RELATION_TYPE);
    fieldInfo.removeCurrentValue(CASCADE);
    fieldInfo.removeCurrentValue(FETCH);
    fieldInfo.removeCurrentValue(OPTIONAL);
    fieldInfo.removeCurrentValue(MAPPED_BY);
    fieldInfo.removeCurrentValue(ORPHAN_REMOVAL);
    if (!relationTypeValueStr.equals(UIUtil.NOT_SELECTED)) {
        fieldInfo.setCurrentValue(RELATION_TYPE, RelationType.valueOf(relationType.getValue()));
        fieldInfo.setCurrentValue(CASCADE, getCascadeTypes());
        fieldInfo.setCurrentValue(FETCH, FetchMode.valueOf(fetchMode.getValue()));
        if (relationType.getValue().equals(RelationType.ONE_TO_ONE.name()) || relationType.getValue().equals(RelationType.MANY_TO_ONE.name())) {
            fieldInfo.setCurrentValue(OPTIONAL, optional.getValue());
        }
        if (relationType.getValue().equals(RelationType.ONE_TO_ONE.name()) || relationType.getValue().equals(RelationType.ONE_TO_MANY.name()) || relationType.getValue().equals(RelationType.MANY_TO_MANY.name())) {
            fieldInfo.setCurrentValue(MAPPED_BY, mappedBy.getText());
        }
        if (relationType.getValue().equals(RelationType.ONE_TO_ONE.name()) || relationType.getValue().equals(RelationType.ONE_TO_MANY.name())) {
            fieldInfo.setCurrentValue(ORPHAN_REMOVAL, orphanRemoval.getValue());
        }
    } else {
        fieldInfo.setCurrentValue(RELATION_TYPE, null);
    }
    super.hide();
    revertChanges = Boolean.FALSE;
    if (okCommand != null) {
        okCommand.execute();
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 3 with DataModelerPropertyEditorFieldInfo

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

the class SequenceGeneratorEditionDialog 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 sequenceName = this.sequenceName.getText();
    String generatorName = this.generatorName.getText();
    fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.SEQUENCE_NAME, sequenceName);
    fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.NAME, generatorName);
    fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.INITIAL_VALUE, getInitialValue());
    fieldInfo.setCurrentValue(SequenceGeneratorValueHandler.ALLOCATION_SIZE, getAllocationSize());
    super.hide();
    revertChanges = Boolean.FALSE;
    if (okCommand != null) {
        okCommand.execute();
    }
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 4 with DataModelerPropertyEditorFieldInfo

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

the class IdGeneratorEditionDialog method show.

@Override
public void show() {
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    String strategy = (String) fieldInfo.getCurrentValue(STRATEGY);
    String generator = (String) fieldInfo.getCurrentValue(GENERATOR);
    strategy = strategy != null ? strategy : UIUtil.NOT_SELECTED;
    view.setGeneratorType(strategy);
    view.setGeneratorName(generator);
    view.setEnabled(!fieldInfo.isDisabled());
    view.show();
}
Also used : DataModelerPropertyEditorFieldInfo(org.kie.workbench.common.screens.datamodeller.client.model.DataModelerPropertyEditorFieldInfo)

Example 5 with DataModelerPropertyEditorFieldInfo

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

the class RelationshipEditionDialog method show.

@Override
@SuppressWarnings("unchecked")
public void show() {
    DataModelerPropertyEditorFieldInfo fieldInfo = (DataModelerPropertyEditorFieldInfo) property;
    RelationType relationTypeValue = (RelationType) fieldInfo.getCurrentValue(RELATION_TYPE);
    if (relationTypeValue != null) {
        view.setRelationType(relationTypeValue.name());
    } else {
        view.setRelationType(UIUtil.NOT_SELECTED);
    }
    enableRelationDependentFields(relationTypeValue);
    cascadeAllWasClicked = false;
    setCascadeTypes((List<CascadeType>) fieldInfo.getCurrentValue(CASCADE));
    enableCascadeTypes(true, true);
    FetchMode fetchModeValue = (FetchMode) fieldInfo.getCurrentValue(FETCH);
    if (fetchModeValue != null) {
        view.setFetchMode(fetchModeValue.name());
    } else {
        view.setFetchMode(UIUtil.NOT_SELECTED);
    }
    Boolean optionalValue = (Boolean) fieldInfo.getCurrentValue(OPTIONAL);
    if (optionalValue != null) {
        view.setOptional(optionalValue);
    }
    String mappedBy = (String) fieldInfo.getCurrentValue(MAPPED_BY);
    view.setMappedBy(mappedBy);
    Boolean orphanRemovalValue = (Boolean) fieldInfo.getCurrentValue(ORPHAN_REMOVAL);
    if (orphanRemovalValue != null) {
        view.setOrphanRemoval(orphanRemovalValue);
    }
    view.setEnabled(!fieldInfo.isDisabled());
    view.show();
}
Also used : FetchMode(org.kie.workbench.common.screens.datamodeller.model.jpadomain.FetchMode) RelationType(org.kie.workbench.common.screens.datamodeller.model.jpadomain.RelationType) CascadeType(org.kie.workbench.common.screens.datamodeller.model.jpadomain.CascadeType) 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