Search in sources :

Example 1 with BooleanFeatureEditor

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.BooleanFeatureEditor in project webanno by webanno.

the class PrimitiveUimaFeatureSupport method createEditor.

@Override
public FeatureEditor createEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, final IModel<AnnotatorState> aStateModel, final IModel<FeatureState> aFeatureStateModel) {
    FeatureState featureState = aFeatureStateModel.getObject();
    final FeatureEditor editor;
    switch(featureState.feature.getMultiValueMode()) {
        case NONE:
            switch(featureState.feature.getType()) {
                case CAS.TYPE_NAME_INTEGER:
                    {
                        editor = new NumberFeatureEditor(aId, aOwner, aFeatureStateModel);
                        break;
                    }
                case CAS.TYPE_NAME_FLOAT:
                    {
                        editor = new NumberFeatureEditor(aId, aOwner, aFeatureStateModel);
                        break;
                    }
                case CAS.TYPE_NAME_BOOLEAN:
                    {
                        editor = new BooleanFeatureEditor(aId, aOwner, aFeatureStateModel);
                        break;
                    }
                case CAS.TYPE_NAME_STRING:
                    {
                        editor = new TextFeatureEditor(aId, aOwner, aFeatureStateModel);
                        break;
                    }
                default:
                    throw unsupportedFeatureTypeException(featureState);
            }
            break;
        case // fallthrough
        ARRAY:
            throw unsupportedLinkModeException(featureState);
        default:
            throw unsupportedMultiValueModeException(featureState);
    }
    return editor;
}
Also used : BooleanFeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.BooleanFeatureEditor) TextFeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.TextFeatureEditor) NumberFeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.NumberFeatureEditor) FeatureState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.FeatureState) BooleanFeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.BooleanFeatureEditor) NumberFeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.NumberFeatureEditor) TextFeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.TextFeatureEditor) FeatureEditor(de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.FeatureEditor)

Aggregations

BooleanFeatureEditor (de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.BooleanFeatureEditor)1 FeatureEditor (de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.FeatureEditor)1 NumberFeatureEditor (de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.NumberFeatureEditor)1 TextFeatureEditor (de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.TextFeatureEditor)1 FeatureState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.FeatureState)1