Search in sources :

Example 1 with UITabSet

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

the class UIOptionsBinder method unmarshalTabSet.

private UITabSet unmarshalTabSet(XmlPullParser parser, UIOptions uiOptions) throws IOException, XmlPullParserException, XmlParseException {
    try {
        UITabSetPR tabSetPR = new UITabSetPR(this, uiOptions);
        tabSetPR.parse(parser);
        UITabSet tabSet = tabSetPR.getTabSet();
        return tabSet;
    } catch (XmlParseException e) {
        if (parser != null && parser.getEventType() == XmlPullParser.END_DOCUMENT) {
            return null;
        } else {
            throw e;
        }
    }
}
Also used : UITabSetPR(org.openforis.collect.persistence.xml.internal.unmarshal.UITabSetPR) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) XmlParseException(org.openforis.idm.metamodel.xml.XmlParseException)

Example 2 with UITabSet

use of org.openforis.collect.metamodel.ui.UITabSet 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);
    }
}
Also used : XmlPullParserFactory(org.xmlpull.v1.XmlPullParserFactory) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) XmlPullParser(org.xmlpull.v1.XmlPullParser) StringReader(java.io.StringReader) Reader(java.io.Reader) StringReader(java.io.StringReader) DataInconsistencyException(org.openforis.collect.persistence.DataInconsistencyException) IOException(java.io.IOException) DataInconsistencyException(org.openforis.collect.persistence.DataInconsistencyException) XmlParseException(org.openforis.idm.metamodel.xml.XmlParseException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 3 with UITabSet

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

the class UITabSetPRBase method handleChildTag.

@Override
protected final void handleChildTag(XmlPullReader childPR) throws XmlPullParserException, IOException, XmlParseException {
    if (childPR instanceof UITabPR) {
        UITabPR tabSetPR = (UITabPR) childPR;
        // Store child state in case reused recursively
        UITabSet tmpParentTabSet = tabSetPR.parentTabSet;
        UITabSet tmpTabSet = tabSetPR.tabSet;
        tabSetPR.parentTabSet = tabSet;
        tabSetPR.tabSet = null;
        super.handleChildTag(childPR);
        tabSetPR.parentTabSet = tmpParentTabSet;
        tabSetPR.tabSet = tmpTabSet;
    } else {
        super.handleChildTag(childPR);
    }
}
Also used : UITabSet(org.openforis.collect.metamodel.ui.UITabSet)

Example 4 with UITabSet

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

the class SchemaLayoutSimpleVM method performRemoveSelectedTab.

protected void performRemoveSelectedTab() {
    UITabSet parent = selectedTab.getParent();
    parent.removeTab(selectedTab);
    treeModel.removeSelectedNode();
    selectedTab = null;
    notifyChange("treeModel", "selectedTab");
    dispatchTabSetChangedCommand();
}
Also used : UITabSet(org.openforis.collect.metamodel.ui.UITabSet)

Example 5 with UITabSet

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

the class SchemaLayoutSimpleVM method moveItem.

protected void moveItem(int newIndex) {
    UITabSet parent = selectedTab.getParent();
    parent.moveTab(selectedTab, newIndex);
    treeModel.moveSelectedNode(newIndex);
    dispatchTabSetChangedCommand();
    notifyChange("treeModel", "moveItemUpDisabled", "moveItemDownDisabled");
    treeModel.select(selectedTab);
}
Also used : UITabSet(org.openforis.collect.metamodel.ui.UITabSet)

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