use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class UIOptionsBinder method unmarshal.
@Override
public UIOptions unmarshal(Survey survey, String type, String body) {
XmlPullParser parser = null;
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
parser = factory.newPullParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
Reader reader = new StringReader(body);
parser.setInput(reader);
UIOptions uiOptions = new UIOptions((CollectSurvey) survey);
UITabSet tabSet = unmarshalTabSet(parser, uiOptions);
while (tabSet != null) {
uiOptions.addTabSet(tabSet);
tabSet = unmarshalTabSet(parser, uiOptions);
}
return uiOptions;
} catch (Exception e) {
throw new DataInconsistencyException(e.getMessage(), e);
}
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class CollectValidator method isReasonBlankAlwaysSpecified.
static boolean isReasonBlankAlwaysSpecified(Attribute<?, ?> attribute) {
int fieldCount = 0;
// ignore unit for numeric attributes
if (attribute instanceof NumberAttribute || attribute instanceof CodeAttribute) {
fieldCount = 1;
} else if (attribute instanceof NumericRangeAttribute) {
fieldCount = 2;
} else {
fieldCount = attribute.getFieldCount();
}
AttributeDefinition defn = attribute.getDefinition();
CollectSurvey survey = (CollectSurvey) defn.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
for (int i = 0; i < fieldCount; i++) {
Field<?> field = attribute.getField(i);
boolean visible = uiOptions.isVisibleField(defn, field.getName());
if (visible) {
FieldSymbol symbol = FieldSymbol.valueOf(field.getSymbol());
if (symbol == null || !symbol.isReasonBlank()) {
return false;
}
}
}
return true;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class TextAttributeDefinitionFormObject method saveTo.
@Override
public void saveTo(T dest, String languageCode) {
super.saveTo(dest, languageCode);
Type typeEnum = TextAttributeDefinition.Type.valueOf(type);
dest.setType(typeEnum);
dest.setAnnotation(Annotation.AUTOCOMPLETE.getQName(), autocompleteGroup);
UIOptions uiOptions = getUIOptions(dest);
uiOptions.setAutoUppercase(dest, autoUppercase);
CollectAnnotations annotations = ((CollectSurvey) dest.getSurvey()).getAnnotations();
TextInput textInput = TextInput.valueOf(input);
annotations.setTextInput(dest, textInput);
annotations.setGeometry(dest, geometry);
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class NodeDefinitionFormObject method getUIOptions.
protected UIOptions getUIOptions(NodeDefinition nodeDefn) {
CollectSurvey survey = (CollectSurvey) nodeDefn.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
return uiOptions;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class SchemaLayoutVM method getRootTabSet.
protected UITabSet getRootTabSet(Treeitem treeItem) {
if (treeItem != null) {
TreeNode<NodeDefinition> treeNode = treeItem.getValue();
NodeDefinition nodeDefn = treeNode.getData();
UIOptions uiOptions = survey.getUIOptions();
EntityDefinition rootEntity = nodeDefn.getRootEntity();
return uiOptions.getAssignedRootTabSet(rootEntity);
} else {
return null;
}
}
Aggregations