Search in sources :

Example 1 with FormDataValue

use of edu.stanford.bmir.protege.web.shared.form.data.FormDataValue in project webprotege by protegeproject.

the class CollectionElementDataRepository_IT method shouldFindByCollectionIdAndElementId.

@Test
public void shouldFindByCollectionIdAndElementId() {
    Map<FormElementId, FormDataValue> map = new HashMap<>();
    map.put(FormElementId.get("theElement"), FormDataPrimitive.get("theValue"));
    FormData formData = new FormData(map);
    CollectionItemData data = new CollectionItemData(collectionId, elementId, formData);
    repository.save(data);
    assertThat(repository.find(collectionId, elementId), is(data));
}
Also used : FormData(edu.stanford.bmir.protege.web.shared.form.FormData) CollectionItemData(edu.stanford.bmir.protege.web.shared.collection.CollectionItemData) FormElementId(edu.stanford.bmir.protege.web.shared.form.field.FormElementId) HashMap(java.util.HashMap) FormDataValue(edu.stanford.bmir.protege.web.shared.form.data.FormDataValue) Test(org.junit.Test)

Example 2 with FormDataValue

use of edu.stanford.bmir.protege.web.shared.form.data.FormDataValue in project webprotege by protegeproject.

the class FormDataConverter method decodeObject.

@Override
public FormData decodeObject(DBObject fromDBObject, MappedField optionalExtraInfo) {
    Map<FormElementId, FormDataValue> map = new HashMap<>();
    fromDBObject.keySet().forEach(key -> {
        FormDataValue value = valueConverter.decodeObject(fromDBObject.get(key), optionalExtraInfo);
        map.put(FormElementId.get(key), value);
    });
    return new FormData(map);
}
Also used : FormData(edu.stanford.bmir.protege.web.shared.form.FormData) FormElementId(edu.stanford.bmir.protege.web.shared.form.field.FormElementId) HashMap(java.util.HashMap) FormDataValue(edu.stanford.bmir.protege.web.shared.form.data.FormDataValue)

Example 3 with FormDataValue

use of edu.stanford.bmir.protege.web.shared.form.data.FormDataValue in project webprotege by protegeproject.

the class ChoiceFieldComboBoxEditor method setValue.

@Override
public void setValue(FormDataValue value) {
    FormDataValue first = value.asList().get(0);
    int index = 1;
    for (ChoiceDescriptor descriptor : choiceDescriptors) {
        if (descriptor.getValue().equals(first)) {
            comboBox.setSelectedIndex(index);
            break;
        }
        index++;
    }
}
Also used : FormDataValue(edu.stanford.bmir.protege.web.shared.form.data.FormDataValue) ChoiceDescriptor(edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor)

Example 4 with FormDataValue

use of edu.stanford.bmir.protege.web.shared.form.data.FormDataValue in project webprotege by protegeproject.

the class ChoiceFieldSegmentedEditor method decrementSelection.

private void decrementSelection() {
    if (selectedIndex - 1 > -1) {
        FormDataValue choice = choices.get(selectedIndex - 1);
        setSelection(choice, true);
    }
}
Also used : FormDataValue(edu.stanford.bmir.protege.web.shared.form.data.FormDataValue)

Example 5 with FormDataValue

use of edu.stanford.bmir.protege.web.shared.form.data.FormDataValue in project webprotege by protegeproject.

the class ChoiceFieldSegmentedEditor method incrementSelection.

private void incrementSelection() {
    if (selectedIndex + 1 < choices.size()) {
        FormDataValue choice = choices.get(selectedIndex + 1);
        setSelection(choice, true);
    }
}
Also used : FormDataValue(edu.stanford.bmir.protege.web.shared.form.data.FormDataValue)

Aggregations

FormDataValue (edu.stanford.bmir.protege.web.shared.form.data.FormDataValue)16 FormElementId (edu.stanford.bmir.protege.web.shared.form.field.FormElementId)9 HashMap (java.util.HashMap)8 FormData (edu.stanford.bmir.protege.web.shared.form.FormData)7 CollectionItemData (edu.stanford.bmir.protege.web.shared.collection.CollectionItemData)3 FormDataList (edu.stanford.bmir.protege.web.shared.form.data.FormDataList)3 FormDataObject (edu.stanford.bmir.protege.web.shared.form.data.FormDataObject)3 Test (org.junit.Test)3 FormId (edu.stanford.bmir.protege.web.shared.form.FormId)2 CheckBox (com.google.gwt.user.client.ui.CheckBox)1 DBObject (com.mongodb.DBObject)1 OWLEntityConverter (edu.stanford.bmir.protege.web.server.persistence.OWLEntityConverter)1 TypeSafeConverter (edu.stanford.bmir.protege.web.server.persistence.TypeSafeConverter)1 FormDataPrimitive (edu.stanford.bmir.protege.web.shared.form.data.FormDataPrimitive)1 ChoiceDescriptor (edu.stanford.bmir.protege.web.shared.form.field.ChoiceDescriptor)1 FormElementDescriptor (edu.stanford.bmir.protege.web.shared.form.field.FormElementDescriptor)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1