Search in sources :

Example 1 with DialogHideEvent

use of com.sencha.gxt.widget.core.client.event.DialogHideEvent in project activityinfo by bedatadriven.

the class AnalysisView method ensureTitle.

private Promise<Void> ensureTitle() {
    if (model.getWorking().isLoading()) {
        return new Promise<>();
    }
    if (model.getWorking().get().getLabel().isPresent()) {
        return Promise.done();
    }
    Promise<Void> result = new Promise<>();
    PromptMessageBox box = new PromptMessageBox(I18N.CONSTANTS.save(), I18N.CONSTANTS.chooseReportTitle());
    box.show();
    box.addDialogHideHandler(new DialogHideEvent.DialogHideHandler() {

        @Override
        public void onDialogHide(DialogHideEvent event) {
            if (event.getHideButton() == Dialog.PredefinedButton.OK) {
                AnalysisView.this.model.updateTitle(box.getTextField().getValue());
                result.resolve(null);
            }
        }
    });
    return result;
}
Also used : Promise(org.activityinfo.promise.Promise) DialogHideEvent(com.sencha.gxt.widget.core.client.event.DialogHideEvent) PromptMessageBox(com.sencha.gxt.widget.core.client.box.PromptMessageBox)

Aggregations

PromptMessageBox (com.sencha.gxt.widget.core.client.box.PromptMessageBox)1 DialogHideEvent (com.sencha.gxt.widget.core.client.event.DialogHideEvent)1 Promise (org.activityinfo.promise.Promise)1