Search in sources :

Example 1 with Type

use of org.openforis.collect.designer.form.CodeListFormObject.Type in project collect by openforis.

the class CodeListsVM method closeCodeListImportPopUp.

@GlobalCommand
public void closeCodeListImportPopUp() {
    closePopUp(codeListImportPopUp);
    codeListImportPopUp = null;
    if (editedItem != null) {
        boolean hasMultipleLevels = editedItem.getHierarchy().size() > 1;
        Type type = hasMultipleLevels ? Type.HIERARCHICAL : Type.FLAT;
        CodeListFormObject fo = (CodeListFormObject) formObject;
        fo.setType(type.name());
        selectedItemsPerLevel = new ArrayList<CodeListItem>();
        initItemsPerLevel();
        notifyChange("formObject", "listLevels", "selectedItemsPerLevel");
    }
}
Also used : Type(org.openforis.collect.designer.form.CodeListFormObject.Type) ContextType(org.zkoss.bind.annotation.ContextType) CodeListFormObject(org.openforis.collect.designer.form.CodeListFormObject) PersistedCodeListItem(org.openforis.idm.metamodel.PersistedCodeListItem) CodeListItem(org.openforis.idm.metamodel.CodeListItem) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 2 with Type

use of org.openforis.collect.designer.form.CodeListFormObject.Type in project collect by openforis.

the class CodeListsVM method typeChanged.

@Command
public void typeChanged(@BindingParam("type") String type) {
    Type typeEnum = CodeListFormObject.Type.valueOf(type);
    switch(typeEnum) {
        case HIERARCHICAL:
            addLevel();
            break;
        default:
            editedItem.removeLevel(0);
    }
    CodeListFormObject fo = (CodeListFormObject) formObject;
    fo.setType(type);
    notifyChange("formObject", "listLevels");
}
Also used : Type(org.openforis.collect.designer.form.CodeListFormObject.Type) ContextType(org.zkoss.bind.annotation.ContextType) CodeListFormObject(org.openforis.collect.designer.form.CodeListFormObject) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand) Command(org.zkoss.bind.annotation.Command)

Aggregations

CodeListFormObject (org.openforis.collect.designer.form.CodeListFormObject)2 Type (org.openforis.collect.designer.form.CodeListFormObject.Type)2 ContextType (org.zkoss.bind.annotation.ContextType)2 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)2 CodeListItem (org.openforis.idm.metamodel.CodeListItem)1 PersistedCodeListItem (org.openforis.idm.metamodel.PersistedCodeListItem)1 Command (org.zkoss.bind.annotation.Command)1