use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class CollectSurveyContext method createSurvey.
@Override
public Survey createSurvey() {
CollectSurvey survey = new CollectSurvey(this);
// application options
UIOptions uiOptions = survey.createUIOptions();
survey.addApplicationOptions(uiOptions);
return survey;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class UITreeModelCreator method createFirstLevelNodes.
@Override
protected List<AbstractNode<SchemaNodeData>> createFirstLevelNodes(EntityDefinition rootEntity) {
List<AbstractNode<SchemaNodeData>> firstLevelTreeNodes = new ArrayList<AbstractNode<SchemaNodeData>>();
if (includeRootEntity) {
SchemaTreeNode node = createRootNode(rootEntity);
if (node != null) {
firstLevelTreeNodes.add(node);
}
} else {
CollectSurvey survey = (CollectSurvey) rootEntity.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
UITabSet tabSet = uiOptions.getAssignedRootTabSet(rootEntity);
for (UITab tab : tabSet.getTabs()) {
SchemaTreeNode node = createNode(tab);
if (node != null) {
firstLevelTreeNodes.add(node);
}
}
}
return firstLevelTreeNodes;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class UITreeModelCreator method createNodes.
protected List<SchemaTreeNode> createNodes(UITab parentTab, List<? extends NodeDefinition> nodes) {
List<SchemaTreeNode> result = null;
if (nodes != null) {
result = new ArrayList<SchemaTreeNode>();
for (NodeDefinition nodeDefn : nodes) {
if (includeNodePredicate == null || includeNodePredicate.evaluate(nodeDefn)) {
CollectSurvey survey = (CollectSurvey) nodeDefn.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
UITab assignedTab = uiOptions.getAssignedTab(nodeDefn);
if (assignedTab == parentTab && (version == null || version.isApplicable(nodeDefn))) {
SchemaNodeData data = new SchemaNodeData(nodeDefn, nodeDefn.getName(), false, false);
SchemaTreeNode treeNode = (SchemaTreeNode) createNode(data, false);
if (treeNode != null) {
result.add(treeNode);
}
}
}
}
}
return result;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class CodeAttributeDefinitionFormObject method saveTo.
@Override
public void saveTo(CodeAttributeDefinition dest, String languageCode) {
super.saveTo(dest, languageCode);
dest.setList(list);
dest.setAllowUnlisted(!strict);
dest.setParentCodeAttributeDefinition(parentCodeAttributeDefinition);
dest.setAllowValuesSorting(dest.isMultiple() && allowValuesSorting);
CollectSurvey survey = (CollectSurvey) dest.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
uiOptions.setShowAllowedValuesPreviewValue(dest, showAllowedValuesPreview);
uiOptions.setLayoutType(dest, CodeAttributeLayoutType.valueOf(layoutType));
uiOptions.setLayoutDirection(dest, StringUtils.isBlank(layoutDirection) ? null : Orientation.valueOf(layoutDirection));
uiOptions.setShowCode(dest, showCode);
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class CodeAttributeDefinitionFormObject method loadFrom.
@Override
public void loadFrom(CodeAttributeDefinition source, String languageCode) {
super.loadFrom(source, languageCode);
list = source.getList();
setParentCodeAttributeDefinition(source.getParentCodeAttributeDefinition());
hierarchicalLevel = extractHierarchicalLevel(source);
strict = !source.isAllowUnlisted();
allowValuesSorting = source.isMultiple() && source.isAllowValuesSorting();
CollectSurvey survey = (CollectSurvey) source.getSurvey();
UIOptions uiOptions = survey.getUIOptions();
showAllowedValuesPreview = uiOptions.getShowAllowedValuesPreviewValue(source);
layoutType = uiOptions.getLayoutType(source).name();
Orientation sourceItemsDirection = uiOptions.getLayoutDirection(source);
layoutDirection = sourceItemsDirection == null ? null : sourceItemsDirection.name();
showCode = uiOptions.getShowCode(source);
}
Aggregations