public ConceptFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel, IModel<AnnotatorState> aStateModel, AnnotationActionHandler aHandler) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label(MID_FEATURE, getModelObject().feature.getUiName())); add(focusComponent = createAutoCompleteTextField(aStateModel.getObject(), aHandler)); }
@Override protected void onInitialize() { super.onInitialize(); LOG.trace("TextFeatureEditor(path: " + getPageRelativePath() + ", " + getModelObject().feature.getUiName() + ": " + getModelObject().value + ")"); }
public ConceptFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel, IModel<AnnotatorState> aStateModel, AnnotationActionHandler aHandler) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label(MID_FEATURE, getModelObject().feature.getUiName())); add(focusComponent = createAutoCompleteTextField(aStateModel.getObject(), aHandler)); }
@Override protected void onInitialize() { super.onInitialize(); LOG.trace("TextFeatureEditor(path: " + getPageRelativePath() + ", " + getModelObject().feature.getUiName() + ": " + getModelObject().value + ")"); }
@Override public MultiValuedMap<String, String> indexFeatureValue(String aFieldPrefix, AnnotationFS aAnnotation, String aFeaturePrefix, AnnotationFeature aFeature) { FeatureSupport<?> featSup = featureSupportRegistry.getFeatureSupport(aFeature); String featureValue = featSup.renderFeatureValue(aFeature, aAnnotation); MultiValuedMap<String, String> values = new HashSetValuedHashMap<String, String>(); if (isEmpty(featureValue)) { return values; } values.put(aFieldPrefix + aFeaturePrefix + ATTRIBUTE_SEP + aFeature.getUiName(), featureValue); return values; } }
@Override public MultiValuedMap<String, String> indexFeatureValue(String aFieldPrefix, AnnotationFS aAnnotation, String aFeaturePrefix, AnnotationFeature aFeature) { FeatureSupport<?> featSup = featureSupportRegistry.getFeatureSupport(aFeature); String featureValue = featSup.renderFeatureValue(aFeature, aAnnotation); MultiValuedMap<String, String> values = new HashSetValuedHashMap<String, String>(); if (isEmpty(featureValue)) { return values; } values.put(aFieldPrefix + aFeaturePrefix + ATTRIBUTE_SEP + aFeature.getUiName(), featureValue); return values; } }
public BooleanFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label("feature", getModelObject().feature.getUiName())); field = new CheckBox("value"); add(field); }
public BooleanFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label("feature", getModelObject().feature.getUiName())); field = new CheckBox("value"); add(field); }
/** * @return String with substituted variables */ public static Map<String, Object> parse(AnnotationLayer aLayer, List<AnnotationFeature> aFeatures, SourceDocument aDocument, AnnotationFS aAnnotation) { Map<String, Object> valuesMap = new HashMap<>(); // add some defaults valuesMap.put("PID", aLayer.getProject().getId()); valuesMap.put("PNAME", aLayer.getProject().getName()); valuesMap.put("DOCID", aDocument.getId()); valuesMap.put("DOCNAME", aDocument.getName()); valuesMap.put("LAYERNAME", aLayer.getName()); // add fields from the annotation layer features and use the values from before aFeatures.stream().forEach(feat -> { if (WebAnnoCasUtil.isPrimitiveFeature(aAnnotation, feat.getName())) { Object val = WebAnnoCasUtil.getFeature(aAnnotation, feat.getName()); if (val != null) { valuesMap.put(feat.getUiName(), String.valueOf(val)); } } }); return valuesMap; } }
/** * @return String with substituted variables */ public static Map<String, Object> parse(AnnotationLayer aLayer, List<AnnotationFeature> aFeatures, SourceDocument aDocument, AnnotationFS aAnnotation) { Map<String, Object> valuesMap = new HashMap<>(); // add some defaults valuesMap.put("PID", aLayer.getProject().getId()); valuesMap.put("PNAME", aLayer.getProject().getName()); valuesMap.put("DOCID", aDocument.getId()); valuesMap.put("DOCNAME", aDocument.getName()); valuesMap.put("LAYERNAME", aLayer.getName()); // add fields from the annotation layer features and use the values from before aFeatures.stream().forEach(feat -> { if (WebAnnoCasUtil.isPrimitiveFeature(aAnnotation, feat.getName())) { Object val = WebAnnoCasUtil.getFeature(aAnnotation, feat.getName()); if (val != null) { valuesMap.put(feat.getUiName(), String.valueOf(val)); } } }); return valuesMap; } }
private void writeFeatureEditorModelsToCas(TypeAdapter aAdapter, JCas aJCas) throws IOException { List<FeatureState> featureStates = featureList.getModelObject(); LOG.trace("writeFeatureEditorModelsToCas()"); List<AnnotationFeature> features = new ArrayList<>(); for (FeatureState featureState : featureStates) { features.add(featureState.feature); // For string features with extensible tagsets, extend the tagset if (CAS.TYPE_NAME_STRING.equals(featureState.feature.getType())) { String value = (String) featureState.value; if (value != null && featureState.feature.getTagset() != null && featureState.feature.getTagset().isCreateTag() && !annotationService.existsTag(value, featureState.feature.getTagset())) { Tag selectedTag = new Tag(); selectedTag.setName(value); selectedTag.setTagSet(featureState.feature.getTagset()); annotationService.createTag(selectedTag); } } LOG.trace("writeFeatureEditorModelsToCas() " + featureState.feature.getUiName() + " = " + featureState.value); aAdapter.setFeatureValue(sourceDocument.getObject(), username.getObject(), aJCas, getModelObject().getId(), featureState.feature, featureState.value); } }
public TextFeatureEditorBase(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label("feature", getModelObject().feature.getUiName())); field = createInputField(); add(field); // Checks whether hide un-constraint feature is enabled or not hideUnconstrainedFeature = getModelObject().feature.isHideUnconstraintFeature(); add(createConstraintsInUseIndicatorContainer()); }
public TextFeatureEditorBase(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label("feature", getModelObject().feature.getUiName())); field = createInputField(); add(field); // Checks whether hide un-constraint feature is enabled or not hideUnconstrainedFeature = getModelObject().feature.isHideUnconstraintFeature(); add(createConstraintsInUseIndicatorContainer()); }
private String generateName(Recommender aRecommender) { if (aRecommender.getFeature() == null || aRecommender.getLayer() == null || aRecommender.getTool() == null) { return null; } else { RecommendationEngineFactory factory = recommenderRegistry .getFactory(aRecommender.getTool()); return String.format(Locale.US, "[%s@%s] %s", aRecommender.getLayer().getUiName(), aRecommender.getFeature().getUiName(), factory.getName()); } }
public NumberFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label("feature", getModelObject().feature.getUiName())); switch (getModelObject().feature.getType()) { case CAS.TYPE_NAME_INTEGER: { field = new NumberTextField<>("value", Integer.class); break; } case CAS.TYPE_NAME_FLOAT: { field = new NumberTextField<>("value", Float.class); add(field); break; } default: throw new IllegalArgumentException("Type [" + getModelObject().feature.getType() + "] cannot be rendered as a numeric input field"); } add(field); }
public NumberFeatureEditor(String aId, MarkupContainer aItem, IModel<FeatureState> aModel) { super(aId, aItem, new CompoundPropertyModel<>(aModel)); add(new Label("feature", getModelObject().feature.getUiName())); switch (getModelObject().feature.getType()) { case CAS.TYPE_NAME_INTEGER: { field = new NumberTextField<>("value", Integer.class); break; } case CAS.TYPE_NAME_FLOAT: { field = new NumberTextField<>("value", Float.class); add(field); break; } default: throw new IllegalArgumentException("Type [" + getModelObject().feature.getType() + "] cannot be rendered as a numeric input field"); } add(field); }
public PropertyFeatureEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, final IModel<AnnotatorState> aStateModel, IModel<FeatureState> aFeatureStateModel) { super(aId, aOwner, new CompoundPropertyModel<>(aFeatureStateModel)); stateModel = aStateModel; actionHandler = aHandler; project = this.getModelObject().feature.getProject(); traits = factService.getFeatureTraits(project); add(new Label("feature", getModelObject().feature.getUiName())); add(focusComponent = createAutoCompleteTextField()); add(createStatementIndicatorLabel()); add(createNoStatementLabel()); }
public PropertyFeatureEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, final IModel<AnnotatorState> aStateModel, IModel<FeatureState> aFeatureStateModel) { super(aId, aOwner, new CompoundPropertyModel<>(aFeatureStateModel)); stateModel = aStateModel; actionHandler = aHandler; project = this.getModelObject().feature.getProject(); traits = factService.getFeatureTraits(project); add(new Label("feature", getModelObject().feature.getUiName())); add(focusComponent = createAutoCompleteTextField()); add(createStatementIndicatorLabel()); add(createNoStatementLabel()); }
public SubjectObjectFeatureEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, final IModel<AnnotatorState> aStateModel, final IModel<FeatureState> aFeatureStateModel, String role) { super(aId, aOwner, CompoundPropertyModel.of(aFeatureStateModel)); stateModel = aStateModel; actionHandler = aHandler; project = this.getModelObject().feature.getProject(); add(new Label("feature", getModelObject().feature.getUiName())); content = new WebMarkupContainer("content"); content.setOutputMarkupId(true); add(content); List<LinkWithRoleModel> links = (List<LinkWithRoleModel>) SubjectObjectFeatureEditor.this .getModelObject().value; roleModel = new LinkWithRoleModel(); roleModel.role = role; if (links.size() == 1) { roleModel = links.get(0); } content.add(createSubjectObjectLabel()); content.add(createRemoveLabelIcon()); content.add(focusComponent = createAutoCompleteTextField()); }
public SubjectObjectFeatureEditor(String aId, MarkupContainer aOwner, AnnotationActionHandler aHandler, final IModel<AnnotatorState> aStateModel, final IModel<FeatureState> aFeatureStateModel, String role) { super(aId, aOwner, CompoundPropertyModel.of(aFeatureStateModel)); stateModel = aStateModel; actionHandler = aHandler; project = this.getModelObject().feature.getProject(); add(new Label("feature", getModelObject().feature.getUiName())); content = new WebMarkupContainer("content"); content.setOutputMarkupId(true); add(content); List<LinkWithRoleModel> links = (List<LinkWithRoleModel>) SubjectObjectFeatureEditor.this .getModelObject().value; roleModel = new LinkWithRoleModel(); roleModel.role = role; if (links.size() == 1) { roleModel = links.get(0); } content.add(createSubjectObjectLabel()); content.add(createRemoveLabelIcon()); content.add(focusComponent = createAutoCompleteTextField()); }