Search in sources :

Example 1 with MessageBoxEvent

use of com.extjs.gxt.ui.client.event.MessageBoxEvent in project activityinfo by bedatadriven.

the class AbstractGridView method confirmDeleteSelected.

@Override
public void confirmDeleteSelected(final ConfirmCallback callback) {
    M selection = getSelection();
    if (selection instanceof ActivityDTO) {
        ActivityDTO activity = (ActivityDTO) selection;
        MessageBox.confirm(fromString(ClientContext.getAppTitle()), I18N.MESSAGES.confirmDeleteForm(activity.getName()), new Listener<MessageBoxEvent>() {

            @Override
            public void handleEvent(MessageBoxEvent be) {
                if (be.getButtonClicked().getItemId().equals(Dialog.YES)) {
                    callback.confirmed();
                }
            }
        });
    } else {
        callback.confirmed();
    }
}
Also used : MessageBoxEvent(com.extjs.gxt.ui.client.event.MessageBoxEvent) ActivityDTO(org.activityinfo.legacy.shared.model.ActivityDTO)

Example 2 with MessageBoxEvent

use of com.extjs.gxt.ui.client.event.MessageBoxEvent in project activityinfo by bedatadriven.

the class ShareReportDialog method populateGrid.

private void populateGrid(IndicatorResult indicators, ReportVisibilityResult visibility) {
    gridStore.removeAll();
    Map<Integer, ReportVisibilityDTO> databases = Maps.newHashMap();
    for (ReportVisibilityDTO model : visibility.getList()) {
        databases.put(model.getDatabaseId(), model);
    }
    for (IndicatorDTO indicator : indicators.getIndicators()) {
        if (!databases.containsKey(indicator.getDatabaseId())) {
            ReportVisibilityDTO model = new ReportVisibilityDTO();
            model.setDatabaseId(indicator.getDatabaseId());
            model.setDatabaseName(indicator.getDatabaseName());
            databases.put(indicator.getDatabaseId(), model);
        }
    }
    for (ReportVisibilityDTO model : databases.values()) {
        gridStore.add(model);
    }
    if (gridStore.getCount() == 0) {
        MessageBox.alert(I18N.CONSTANTS.share(), I18N.CONSTANTS.emptyReportsCannotBeShared(), new Listener<MessageBoxEvent>() {

            @Override
            public void handleEvent(MessageBoxEvent be) {
                hide();
            }
        });
    }
}
Also used : ReportVisibilityDTO(org.activityinfo.legacy.shared.model.ReportVisibilityDTO) MessageBoxEvent(com.extjs.gxt.ui.client.event.MessageBoxEvent) IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO)

Example 3 with MessageBoxEvent

use of com.extjs.gxt.ui.client.event.MessageBoxEvent in project activityinfo by bedatadriven.

the class ElementWidget method editTitle.

private void editTitle() {
    final MessageBox box = new MessageBox();
    box.setTitle(I18N.CONSTANTS.changeTitleDialogTitle());
    box.setType(MessageBoxType.PROMPT);
    box.setButtons(Dialog.OKCANCEL);
    box.show();
    box.getTextBox().setValue(model.getTitle());
    box.addCallback(new Listener<MessageBoxEvent>() {

        @Override
        public void handleEvent(MessageBoxEvent be) {
            if (be.getButtonClicked().getItemId().equals(Dialog.OK)) {
                model.setTitle(box.getTextBox().getValue());
                titleElement.setInnerText(ElementTitles.format(model));
            }
        }
    });
}
Also used : MessageBoxEvent(com.extjs.gxt.ui.client.event.MessageBoxEvent) MessageBox(com.extjs.gxt.ui.client.widget.MessageBox)

Example 4 with MessageBoxEvent

use of com.extjs.gxt.ui.client.event.MessageBoxEvent in project activityinfo by bedatadriven.

the class AppCacheMonitor method start.

public static void start() {
    AppCache appCache = AppCacheFactory.get();
    appCache.addUpdateReadyHandler(new UpdateReadyEventHandler() {

        @Override
        public void onAppCacheUpdateReady() {
            MessageBox.confirm(I18N.MESSAGES.newVersion(ClientContext.getAppTitle()), I18N.CONSTANTS.newVersionChoice(), new Listener<MessageBoxEvent>() {

                @Override
                public void handleEvent(MessageBoxEvent be) {
                    if (be.getButtonClicked().getItemId().equals(Dialog.YES)) {
                        Window.Location.reload();
                    }
                }
            });
        }
    });
}
Also used : MessageBoxEvent(com.extjs.gxt.ui.client.event.MessageBoxEvent) AppCache(com.bedatadriven.rebar.appcache.client.AppCache) Listener(com.extjs.gxt.ui.client.event.Listener) UpdateReadyEventHandler(com.bedatadriven.rebar.appcache.client.events.UpdateReadyEventHandler)

Aggregations

MessageBoxEvent (com.extjs.gxt.ui.client.event.MessageBoxEvent)4 AppCache (com.bedatadriven.rebar.appcache.client.AppCache)1 UpdateReadyEventHandler (com.bedatadriven.rebar.appcache.client.events.UpdateReadyEventHandler)1 Listener (com.extjs.gxt.ui.client.event.Listener)1 MessageBox (com.extjs.gxt.ui.client.widget.MessageBox)1 ActivityDTO (org.activityinfo.legacy.shared.model.ActivityDTO)1 IndicatorDTO (org.activityinfo.legacy.shared.model.IndicatorDTO)1 ReportVisibilityDTO (org.activityinfo.legacy.shared.model.ReportVisibilityDTO)1