Search in sources :

Example 11 with GlobalCommand

use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.

the class CodeAttributeVM method codeListsPopUpClosed.

@GlobalCommand
public void codeListsPopUpClosed(@ContextParam(ContextType.BINDER) Binder binder, @BindingParam(CodeListsVM.EDITING_ATTRIBUTE_PARAM) Boolean editingAttribute, @BindingParam(CodeListsVM.SELECTED_CODE_LIST_PARAM) CodeList selectedCodeList) {
    if (editingAttribute && selectedCodeList != null) {
        CodeAttributeDefinitionFormObject fo = (CodeAttributeDefinitionFormObject) getFormObject();
        CodeList oldList = fo.getList();
        if (oldList != null && !oldList.equals(selectedCodeList)) {
            if (oldList != survey.getSamplingDesignCodeList()) {
                confirmCodeListChange(binder, selectedCodeList);
            }
        } else {
            onListChanged(binder, selectedCodeList);
            validateForm(binder);
        }
    }
}
Also used : CodeList(org.openforis.idm.metamodel.CodeList) CodeAttributeDefinitionFormObject(org.openforis.collect.designer.form.CodeAttributeDefinitionFormObject) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 12 with GlobalCommand

use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.

the class SurveyExportParametersVM method jobCompleted.

@GlobalCommand
public void jobCompleted(@BindingParam("job") Job job) {
    boolean jobStartedByThis = isJobStartedByThis(job);
    if (job == surveyBackupJob) {
        File file = surveyBackupJob.getOutputFile();
        downloadFile(file, surveyBackupJob.getOutputFormat().getOutputFileExtension(), MediaType.APPLICATION_OCTET_STREAM_VALUE, surveyBackupJob.getSurvey(), surveyBackupJob.getOutputSurveyDefaultLanguage());
        final List<DataBackupError> dataBackupErrors = surveyBackupJob.getDataBackupErrors();
        if (!dataBackupErrors.isEmpty()) {
            DataExportErrorsPopUpVM.showPopUp(dataBackupErrors);
        }
    } else if (job == rdbExportJob) {
        File file = rdbExportJob.getOutputFile();
        CollectSurvey survey = rdbExportJob.getSurvey();
        String extension = "sql";
        downloadFile(file, extension, MediaType.TEXT_PLAIN_VALUE, survey, survey.getDefaultLanguage());
    }
    if (jobStartedByThis) {
        onJobEnd(job);
    }
}
Also used : DataBackupError(org.openforis.collect.io.data.DataBackupError) CollectSurvey(org.openforis.collect.model.CollectSurvey) File(java.io.File) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 13 with GlobalCommand

use of org.zkoss.bind.annotation.GlobalCommand in project collect by openforis.

the class SurveySelectVM method jobCompleted.

@GlobalCommand
public void jobCompleted(@BindingParam("job") Job job) {
    boolean jobStartedByThis = isJobStartedByThis(job);
    if (job == surveyCloneJob) {
        CollectSurvey survey = surveyCloneJob.getOutputSurvey();
        surveyCloneJob = null;
        SurveyEditVM.redirectToSurveyEditPage(survey.getId());
    }
    if (jobStartedByThis) {
        onJobEnd(job);
    }
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Aggregations

GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)13 CodeList (org.openforis.idm.metamodel.CodeList)3 File (java.io.File)2 CollectSurvey (org.openforis.collect.model.CollectSurvey)2 PersistedCodeListItem (org.openforis.idm.metamodel.PersistedCodeListItem)2 Component (org.zkoss.zk.ui.Component)2 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 CodeAttributeDefinitionFormObject (org.openforis.collect.designer.form.CodeAttributeDefinitionFormObject)1 CodeListFormObject (org.openforis.collect.designer.form.CodeListFormObject)1 Type (org.openforis.collect.designer.form.CodeListFormObject.Type)1 DataBackupError (org.openforis.collect.io.data.DataBackupError)1 SchemaSummaryCSVExportJob (org.openforis.collect.io.metadata.SchemaSummaryCSVExportJob)1 CodeListBatchImportJob (org.openforis.collect.io.metadata.codelist.CodeListBatchImportJob)1 CodeListImportTask (org.openforis.collect.io.metadata.codelist.CodeListImportTask)1 SurveySummary (org.openforis.collect.model.SurveySummary)1 SurveyStoreException (org.openforis.collect.persistence.SurveyStoreException)1