use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.FeatureEditor in project webanno by webanno.
the class SlotFeatureSupport 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 ARRAY:
switch(featureState.feature.getLinkMode()) {
case WITH_ROLE:
editor = new LinkFeatureEditor(aId, aOwner, aHandler, aStateModel, aFeatureStateModel);
break;
default:
throw unsupportedFeatureTypeException(featureState);
}
break;
case NONE:
throw unsupportedLinkModeException(featureState);
default:
throw unsupportedMultiValueModeException(featureState);
}
return editor;
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.FeatureEditor 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;
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.feature.editor.FeatureEditor in project webanno by webanno.
the class AnnotationFeatureForm method createForwardAnnotationCheckBox.
private CheckBox createForwardAnnotationCheckBox() {
return new CheckBox("forwardAnnotation") {
private static final long serialVersionUID = 8908304272310098353L;
{
setOutputMarkupId(true);
add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 5179816588460867471L;
@Override
protected void onUpdate(AjaxRequestTarget aTarget) {
if (AnnotationFeatureForm.this.getModelObject().isForwardAnnotation()) {
List<AnnotationFeature> features = getEnabledFeatures(AnnotationFeatureForm.this.getModelObject().getSelectedAnnotationLayer());
if (features.size() > 1) {
// forward annotation process checking)
return;
}
// forward annotations
if (!features.isEmpty() && features.get(0).getTagset() == null) {
FeatureEditor editor = getFirstFeatureEditor();
if (editor != null) {
aTarget.focusComponent(editor.getFocusComponent());
}
} else {
aTarget.appendJavaScript(JavascriptUtils.getFocusScript(forwardAnnotationText));
selectedTag = "";
}
}
}
});
}
@Override
protected void onConfigure() {
super.onConfigure();
setEnabled(isForwardable());
if (!isForwardable()) {
AnnotationFeatureForm.this.getModelObject().setForwardAnnotation(false);
}
}
};
}
Aggregations