Search in sources :

Example 6 with ConfirmParams

use of org.openforis.collect.designer.util.MessageUtil.ConfirmParams in project collect by openforis.

the class CalculatedAttributeVM method deleteFormula.

@Command
@NotifyChange({ "selectedFormula", "formulas" })
public void deleteFormula() {
    ConfirmParams params = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {

        @Override
        public void onOk() {
            editedItem.removeFormula(selectedFormula);
            selectedFormula = null;
            initFormulas();
            notifyChange("selectedFormula", "formulas");
        }
    }, "survey.schema.attribute.calculated.formula.confirm_delete");
    params.setOkLabelKey("global.delete_item");
    MessageUtil.showConfirm(params);
}
Also used : ConfirmParams(org.openforis.collect.designer.util.MessageUtil.ConfirmParams) MessageUtil(org.openforis.collect.designer.util.MessageUtil) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 7 with ConfirmParams

use of org.openforis.collect.designer.util.MessageUtil.ConfirmParams in project collect by openforis.

the class SurveySelectVM method unpublishSelectedSurvey.

@Command
public void unpublishSelectedSurvey(@ContextParam(ContextType.BINDER) final Binder binder) throws IOException {
    final String surveyName = selectedSurvey.getName();
    // ask for a confirmation about survey unpublishing
    String messageKey = selectedSurvey.isTemporary() ? "survey.unpublish_overwrite_temporary.confirm" : "survey.unpublish.confirm";
    MessageUtil.ConfirmParams confirmParams = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {

        public void onOk() {
            // ask for a second confirmation about records deletion
            ConfirmParams confirmParams2 = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {

                public void onOk() {
                    performSelectedSurveyUnpublishing(binder);
                }
            });
            confirmParams2.setMessage("survey.delete_records.confirm", surveyName);
            confirmParams2.setOkLabelKey("survey.unpublish");
            confirmParams2.setTitle("survey.unpublish.confirm_title", surveyName);
            MessageUtil.showConfirm(confirmParams2);
        }
    }, messageKey);
    confirmParams.setMessage(messageKey, surveyName);
    confirmParams.setOkLabelKey("survey.unpublish");
    confirmParams.setTitle("survey.unpublish.confirm_title", surveyName);
    MessageUtil.showConfirm(confirmParams);
}
Also used : ConfirmParams(org.openforis.collect.designer.util.MessageUtil.ConfirmParams) MessageUtil(org.openforis.collect.designer.util.MessageUtil) ConfirmParams(org.openforis.collect.designer.util.MessageUtil.ConfirmParams) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Aggregations

MessageUtil (org.openforis.collect.designer.util.MessageUtil)7 ConfirmParams (org.openforis.collect.designer.util.MessageUtil.ConfirmParams)7 Command (org.zkoss.bind.annotation.Command)5 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)4 CodeList (org.openforis.idm.metamodel.CodeList)2 NotifyChange (org.zkoss.bind.annotation.NotifyChange)2 ArrayList (java.util.ArrayList)1 CodeAttributeDefinitionFormObject (org.openforis.collect.designer.form.CodeAttributeDefinitionFormObject)1 SessionStatus (org.openforis.collect.designer.session.SessionStatus)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 CodeAttributeDefinition (org.openforis.idm.metamodel.CodeAttributeDefinition)1