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;
}
}
}
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);
}
}
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);
}
}
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();
}
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);
}
Aggregations