use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class EditableListOfNodesVM method listOfNodesDropHandler.
@Listen("onDrop = listbox#listOfNodesListbox")
public void listOfNodesDropHandler(DropEvent evt) {
Component dragged = evt.getDragged();
if (dragged instanceof Treeitem) {
Treeitem draggedTreeItem = (Treeitem) dragged;
TreeNode<?> value = draggedTreeItem.getValue();
Object data = value.getData();
if (data instanceof NodeDefinition) {
NodeDefinition nodeDefn = (NodeDefinition) data;
UIOptions uiOpts = getUIOptions();
if (uiOpts.isAssignableTo(nodeDefn, tab)) {
UITab oldTab = uiOpts.getAssignedTab(nodeDefn);
uiOpts.assignToTab(nodeDefn, tab);
Map<String, Object> args = new HashMap<String, Object>();
args.put("oldTab", oldTab);
args.put("newTab", tab);
BindUtils.postGlobalCommand(null, null, "nodeAssignedToTab", args);
} else {
MessageUtil.showWarning("survey.layout.cannot_add_node_to_tab");
}
}
}
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class TabsGroupPanelVM method getUIOptions.
protected UIOptions getUIOptions() {
CollectSurvey survey = getSurvey();
UIOptions uiConf = survey.getUIOptions();
return uiConf;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class TabsGroupPanelVM method getNodesPerTab.
public List<NodeDefinition> getNodesPerTab() {
UIOptions uiOpts = getUIOptions();
List<NodeDefinition> result = new ArrayList<NodeDefinition>();
List<NodeDefinition> nodesPerTab = uiOpts.getNodesPerTab(tab, false);
ModelVersion version = getFormVersion();
for (NodeDefinition nodeDefn : nodesPerTab) {
if (version == null || version.isApplicable(nodeDefn)) {
result.add(nodeDefn);
}
}
return result;
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class TabsGroupVM method removeTab.
@Command
@NotifyChange({ "tabs" })
public void removeTab(@BindingParam("tab") UITab tab) {
if (tab.getTabs().isEmpty()) {
SessionStatus sessionStatus = getSessionStatus();
CollectSurvey survey = sessionStatus.getSurvey();
UIOptions uiOpts = survey.getUIOptions();
List<NodeDefinition> nodesPerTab = uiOpts.getNodesPerTab(tab, false);
if (nodesPerTab.isEmpty()) {
UITabSet parent = tab.getParent();
parent.removeTab(tab);
postTabChangedCommand(parent);
} else {
MessageUtil.showWarning("survey.layout.tab.remove.error.associated_nodes_present");
}
} else {
MessageUtil.showWarning("survey.layout.tab.remove.error.nested_tabs_present");
}
}
use of org.openforis.collect.metamodel.ui.UIOptions in project collect by openforis.
the class TabsGroupVM method addTab.
@Command
@NotifyChange({ "tabs" })
public void addTab() {
UIOptions uiOptions = tabSet.getUIOptions();
UITab tab = uiOptions.createTab();
String tabName = generateNewTabName(tabSet);
tab.setName(tabName);
tabSet.addTab(tab);
postTabChangedCommand(tabSet);
openTabLabelEditPopUp(tab);
}
Aggregations