Search in sources :

Example 21 with UIOptions

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");
            }
        }
    }
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) Treeitem(org.zkoss.zul.Treeitem) HashMap(java.util.HashMap) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) Component(org.zkoss.zk.ui.Component) Listen(org.zkoss.zk.ui.select.annotation.Listen)

Example 22 with UIOptions

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;
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 23 with UIOptions

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;
}
Also used : UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) ArrayList(java.util.ArrayList) ModelVersion(org.openforis.idm.metamodel.ModelVersion)

Example 24 with UIOptions

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");
    }
}
Also used : SessionStatus(org.openforis.collect.designer.session.SessionStatus) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) UITabSet(org.openforis.collect.metamodel.ui.UITabSet) NodeDefinition(org.openforis.idm.metamodel.NodeDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 25 with UIOptions

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);
}
Also used : UITab(org.openforis.collect.metamodel.ui.UITab) UIOptions(org.openforis.collect.metamodel.ui.UIOptions) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Aggregations

UIOptions (org.openforis.collect.metamodel.ui.UIOptions)69 CollectSurvey (org.openforis.collect.model.CollectSurvey)38 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)22 UITab (org.openforis.collect.metamodel.ui.UITab)19 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)18 Layout (org.openforis.collect.metamodel.ui.UIOptions.Layout)10 ArrayList (java.util.ArrayList)9 CollectAnnotations (org.openforis.collect.metamodel.CollectAnnotations)9 UITabSet (org.openforis.collect.metamodel.ui.UITabSet)9 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)9 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)5 Schema (org.openforis.idm.metamodel.Schema)5 Command (org.zkoss.bind.annotation.Command)5 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)5 ExternalizedProperty (org.granite.messaging.amf.io.util.externalizer.annotation.ExternalizedProperty)4 SchemaNodeData (org.openforis.collect.designer.component.SchemaTreeModel.SchemaNodeData)4 SchemaTreeNode (org.openforis.collect.designer.component.SchemaTreeModel.SchemaTreeNode)4 SurveyObjectsGenerator (org.openforis.collect.manager.SurveyObjectsGenerator)3 KeyAttributeDefinition (org.openforis.idm.metamodel.KeyAttributeDefinition)3 SurveyObject (org.openforis.idm.metamodel.SurveyObject)3