Search in sources :

Example 61 with Command

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

the class SurveyObjectBaseVM method deleteItem.

@Command
public void deleteItem(@BindingParam("item") final T item) {
    MessageUtil.ConfirmParams params = new MessageUtil.ConfirmParams(new ConfirmHandler() {

        @Override
        public void onOk() {
            performDeleteItem(item);
        }
    }, getConfirmDeleteMessageKey());
    params.setOkLabelKey("global.delete_item");
    MessageUtil.showConfirm(params);
}
Also used : MessageUtil(org.openforis.collect.designer.util.MessageUtil) ConfirmHandler(org.openforis.collect.designer.util.MessageUtil.ConfirmHandler) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 62 with Command

use of org.zkoss.bind.annotation.Command 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

Command (org.zkoss.bind.annotation.Command)62 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)44 NotifyChange (org.zkoss.bind.annotation.NotifyChange)26 File (java.io.File)12 CollectSurvey (org.openforis.collect.model.CollectSurvey)10 MessageUtil (org.openforis.collect.designer.util.MessageUtil)9 UITab (org.openforis.collect.metamodel.ui.UITab)6 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)6 FileInputStream (java.io.FileInputStream)5 ConfirmParams (org.openforis.collect.designer.util.MessageUtil.ConfirmParams)5 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)5 SurveyObject (org.openforis.idm.metamodel.SurveyObject)5 Media (org.zkoss.util.media.Media)5 Window (org.zkoss.zul.Window)5 UserCredential (es.bsc.compss.ui.auth.UserCredential)4 IOException (java.io.IOException)4 Date (java.util.Date)4 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)4 SessionStatus (org.openforis.collect.designer.session.SessionStatus)3 ConfirmHandler (org.openforis.collect.designer.util.MessageUtil.ConfirmHandler)3