Search in sources :

Example 11 with UITabSet

use of org.openforis.collect.metamodel.ui.UITabSet 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;
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) AbstractNode(org.openforis.collect.designer.component.BasicTreeModel.AbstractNode) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) ArrayList(java.util.ArrayList) CollectSurvey(org.openforis.collect.model.CollectSurvey) SchemaNodeData(org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)

Example 12 with UITabSet

use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.

the class UIOptionsSerializer method write.

public void write(UIOptions options, Writer out, String defaultLanguage) {
    try {
        XmlSerializer serializer = createXmlSerializer();
        serializer.setOutput(out);
        List<UITabSet> tabSets = options.getTabSets();
        for (UITabSet tabSet : tabSets) {
            writeTabSet(serializer, tabSet, defaultLanguage);
        }
        serializer.flush();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : UITabSet(org.openforis.collect.metamodel.ui.UITabSet) IOException(java.io.IOException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) XmlSerializer(org.xmlpull.v1.XmlSerializer)

Example 13 with UITabSet

use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.

the class UITabSetProxy method fromList.

public static List<UITabSetProxy> fromList(List<UITabSet> tabSets) {
    List<UITabSetProxy> result = new ArrayList<UITabSetProxy>();
    for (UITabSet tabSet : tabSets) {
        UITabSetProxy proxy = new UITabSetProxy(tabSet);
        result.add(proxy);
    }
    return result;
}
Also used : UITabSet(org.openforis.collect.metamodel.ui.UITabSet) ArrayList(java.util.ArrayList)

Example 14 with UITabSet

use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.

the class SchemaVM method performRemoveTab.

protected void performRemoveTab(UITab tab) {
    // remove all nodes associated to the tab
    UIOptions uiOptions = tab.getUIOptions();
    List<NodeDefinition> nodesPerTab = uiOptions.getNodesPerTab(tab, false);
    for (NodeDefinition nodeDefn : nodesPerTab) {
        EntityDefinition parentDefn = nodeDefn.getParentEntityDefinition();
        parentDefn.removeChildDefinition(nodeDefn);
    }
    performRemoveSelectedTreeNode();
    UITabSet parent = tab.getParent();
    parent.removeTab(tab);
    refreshTreeModel();
    dispatchSurveyChangedCommand();
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition)

Example 15 with UITabSet

use of org.openforis.collect.metamodel.ui.UITabSet in project collect by openforis.

the class SchemaVM method moveNode.

protected void moveNode(int newIndexInTree) {
    SurveyObject surveyObject = selectedTreeNode.getSurveyObject();
    List<SurveyObject> siblings = getSiblingsInTree(surveyObject);
    SurveyObject newIndexItem = siblings.get(newIndexInTree);
    SchemaTreeNode newIndexNode = treeModel.getTreeNode(newIndexItem);
    int newIndexInModel = newIndexNode.getIndexInModel();
    if (surveyObject instanceof NodeDefinition) {
        NodeDefinition nodeDefn = (NodeDefinition) surveyObject;
        EntityDefinition parentEntity = nodeDefn.getParentEntityDefinition();
        if (parentEntity != null) {
            parentEntity.moveChildDefinition(nodeDefn, newIndexInModel);
        } else {
            EntityDefinition rootEntity = nodeDefn.getRootEntity();
            Schema schema = rootEntity.getSchema();
            schema.moveRootEntityDefinition(rootEntity, newIndexInModel);
        }
    } else {
        UITab tab = (UITab) surveyObject;
        UITabSet parent = tab.getParent();
        parent.moveTab(tab, newIndexInModel);
    }
    treeModel.moveSelectedNode(newIndexInTree);
    notifyChange("treeModel", "moveNodeUpDisabled", "moveNodeDownDisabled");
    dispatchSurveyChangedCommand();
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) UITab(org.openforis.collect.metamodel.ui.UITab) SchemaTreeNode(org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode) SurveyObject(org.openforis.idm.metamodel.SurveyObject) Schema(org.openforis.idm.metamodel.Schema) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition)

Aggregations

UITabSet (org.openforis.collect.metamodel.ui.UITabSet)20 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)9 UITab (org.openforis.collect.metamodel.ui.UITab)8 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)6 CollectSurvey (org.openforis.collect.model.CollectSurvey)5 Schema (org.openforis.idm.metamodel.Schema)5 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)4 ArrayList (java.util.ArrayList)3 SurveyObjectsGenerator (org.openforis.collect.manager.SurveyObjectsGenerator)3 IOException (java.io.IOException)2 SchemaTreeNode (org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode)2 XmlParseException (org.openforis.idm.metamodel.xml.XmlParseException)2 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)2 Command (org.zkoss.bind.annotation.Command)2 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)2 NotifyChange (org.zkoss.bind.annotation.NotifyChange)2 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 Stack (java.util.Stack)1 Test (org.junit.Test)1