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();
}
}
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();
}
});
}
}
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));
}
}
});
}
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();
}
}
});
}
});
}
Aggregations