Search in sources :

Example 1 with NativeTypeKind

use of org.obeonetwork.dsl.typeslibrary.NativeTypeKind in project InformationSystem by ObeoNetwork.

the class CustomColumnPropertiesEditionComponent method updateTypeFieldsVisibility.

private void updateTypeFieldsVisibility(Column column, ColumnPropertiesEditionPart basePart) {
    if (column.getType() instanceof TypeInstance) {
        TypeInstance typeInstance = (TypeInstance) column.getType();
        if (typeInstance.getNativeType() != null) {
            NativeTypeKind nativeTypeKind = typeInstance.getNativeType().getSpec();
            boolean lengthVisible = (nativeTypeKind == NativeTypeKind.LENGTH || nativeTypeKind == NativeTypeKind.LENGTH_AND_PRECISION);
            boolean precisionVisible = (nativeTypeKind == NativeTypeKind.LENGTH_AND_PRECISION);
            boolean literalsVisible = (nativeTypeKind == NativeTypeKind.ENUM);
            basePart.updateTypeFields(lengthVisible, precisionVisible, literalsVisible);
        }
    }
}
Also used : NativeTypeKind(org.obeonetwork.dsl.typeslibrary.NativeTypeKind) TypeInstance(org.obeonetwork.dsl.typeslibrary.TypeInstance)

Example 2 with NativeTypeKind

use of org.obeonetwork.dsl.typeslibrary.NativeTypeKind in project InformationSystem by ObeoNetwork.

the class CustomTypeInstancePropertiesEditionComponent method updateTypeFieldsVisibility.

private void updateTypeFieldsVisibility(TypeInstance typeInstance, TypeInstancePropertiesEditionPart basePart) {
    if (typeInstance.getNativeType() != null) {
        NativeTypeKind nativeTypeKind = typeInstance.getNativeType().getSpec();
        boolean lengthVisible = (nativeTypeKind == NativeTypeKind.LENGTH || nativeTypeKind == NativeTypeKind.LENGTH_AND_PRECISION);
        boolean precisionVisible = (nativeTypeKind == NativeTypeKind.LENGTH_AND_PRECISION);
        boolean literalsVisible = (nativeTypeKind == NativeTypeKind.ENUM);
        basePart.updateTypeFields(lengthVisible, precisionVisible, literalsVisible);
    }
}
Also used : NativeTypeKind(org.obeonetwork.dsl.typeslibrary.NativeTypeKind)

Aggregations

NativeTypeKind (org.obeonetwork.dsl.typeslibrary.NativeTypeKind)2 TypeInstance (org.obeonetwork.dsl.typeslibrary.TypeInstance)1