本文整理汇总了Java中org.vaadin.dialogs.ConfirmDialog.show方法的典型用法代码示例。如果您正苦于以下问题:Java ConfirmDialog.show方法的具体用法?Java ConfirmDialog.show怎么用?Java ConfirmDialog.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vaadin.dialogs.ConfirmDialog
的用法示例。
在下文中一共展示了ConfirmDialog.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTabClose
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
@Override
public void onTabClose(final TabSheet tabsheet, final Component tabContent) {
if (tabContent instanceof DashboardTab) {
final DashboardTab dashboardTab = (DashboardTab) tabContent;
ConfirmDialog.show(UI.getCurrent(), Translate.getMessage("windowTitleConfirm"), "Delete tab?", Translate.getMessage("btnOK"), Translate.getMessage("btnCancel"), new ConfirmDialog.Listener() {
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
HybridbpmUI.getDashboardAPI().deleteTabDefinition(dashboardTab.getTabDefinition().getId(), true);
tabsheet.removeComponent(tabContent);
tabsheet.setSelectedTab(0);
} else {
// this.close();
}
}
});
}
}
示例2: buttonClick
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
@Override
public void buttonClick(final Button.ClickEvent event) {
if (event.getButton() instanceof TableButton && ((TableButton) event.getButton()).getType().equals(TableButton.TYPE.EDIT)) {
addPermission(document, ((TableButton<Permission>) event.getButton()).getCustomData());
} else if (event.getButton() instanceof TableButton && ((TableButton) event.getButton()).getType().equals(TableButton.TYPE.DELETE)) {
ConfirmDialog.show(UI.getCurrent(), Translate.getMessage("windowTitleConfirm"), Translate.getMessage("questionDeletePermission"), Translate.getMessage("btnOK"), Translate.getMessage("btnCancel"), new ConfirmDialog.Listener() {
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
Permission permission = ((TableButton<Permission>) event.getButton()).getCustomData();
HybridbpmUI.getDocumentAPI().removeDocumentPermission(permission.getId().toString());
refreshTable();
}
}
});
}
}
示例3: saveAskMsg
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
/**
* Validates and saves changes with prior asking depending on customization
* parameters.
*
* @param actionClose
* the action to perform after successful saving. null - do
* nothing
*/
public void saveAskMsg(final Runnable actionClose) {
if (!validateSave(true))
return;
if (isModified() && isAskSave()) {
ConfirmDialog.show(getUI(), getI18S("SaveQ"),
getI18S("Save_changesQ"), getI18S("btYes"),
getI18S("btNo"), new Runnable() {
@Override
public void run() {
if (saveChk())
if (actionClose != null)
actionClose.run();
}
});
} else if (saveEInt())
if (actionClose != null)
actionClose.run();
}
示例4: discardAskMsg
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
/**
* Validates and discards changes with behaviour depending on customization
* parameters.
*
* @param actionClose
* the action to perform after successful discarding. null - do
* nothing
*/
public void discardAskMsg(final Runnable actionClose) {
if (!validateDiscard(true))
return;
if (isModified() && isAskDiscard()) {
ConfirmDialog.show(getUI(), getI18S("DiscardQ"),
getI18S("Discard_changesQ"), getI18S("btYes"),
getI18S("btNo"), new Runnable() {
@Override
public void run() {
if (discardChk())
if (actionClose != null)
actionClose.run();
}
});
} else if (discardChk())
if (actionClose != null)
actionClose.run();
}
示例5: deleteAskMsg
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
/**
* Validates and deletes the content with prior asking depending on
* customization parameters.
*/
public void deleteAskMsg() {
if (!canDeleteMsg())
return;
if (isAskDelete())
ConfirmDialog.show(getUI(), getI18S("DeleteQ"),
getI18S("Confirm_deleteQ"), getI18S("btYes"),
getI18S("btNo"), new Runnable() {
@Override
public void run() {
deleteIfNotMod();
}
});
else
deleteIfNotMod();
}
示例6: createAskMsg
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
/**
* Validates and creates the content with prior asking depending on
* customization parameters.
*/
public void createAskMsg() {
if (!canCreateMsg())
return;
if (isAskCreate())
ConfirmDialog.show(getUI(), getI18S("CreateQ"),
getI18S("Confirm_createQ"), getI18S("btYes"),
getI18S("btNo"), new Runnable() {
@Override
public void run() {
createIfNotMod();
}
});
else
createIfNotMod();
}
示例7: run
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
public void run(final RunnableSer action) {
checkNotNull(confirmCaption);
checkNotNull(confirmMessage);
checkNotNull(condition);
checkNotNull(predictAction);
checkNotNull(action);
// проверяем выполняется ли условие
if (!this.condition.get()) {
// запрашиваем подтверждение на выполнение предварительных операций
ConfirmDialog.show(UI.getCurrent(),
confirmCaption,
confirmMessage,
"Да", "Нет",
dialog -> {
if (dialog.isConfirmed()) {
// когда получили подтверждение - выполняем предварительные процедуры
predictAction.run();
// запускаем основную процедуру если предварительная закончилась успехом
if (this.condition.get())
action.run();
}
});
} else
action.run();
}
示例8: exec
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
@Override
public void exec(final BaseCrudView<E> crud, final EntityItem<E> entity)
{
ConfirmDialog.show(UI.getCurrent(), "Confirm Delete",
"Are you sure you want to delete " + entity.getEntity().getName() + "?", "Delete", "Cancel",
new ConfirmDialog.Listener()
{
private static final long serialVersionUID = 1L;
@Override
public void onClose(final ConfirmDialog dialog)
{
if (dialog.isConfirmed())
{
crud.delete();
}
}
});
}
示例9: createMenuButtonForNotification
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
private Button createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
final Button button
= new Button(caption,
(e) -> {
UI ui = UI.getCurrent();
ConfirmDialog.show(
ui,
message, // ToDo extract in Executor
(ConfirmDialog.Listener) dialog -> {
if (dialog.isConfirmed()) {
VaadinSession vaadinSession = ui.getSession();
vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
vaadinSession.close();
ui.getPage().setLocation("/");
}
else {
// User did not confirm
// CANCEL STUFF
}
});
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return button;
}
示例10: createMenuButtonForNotification
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
private Pair<String, Button> createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
final Button button
= new Button(caption,
(e) -> {
UI ui = UI.getCurrent();
ConfirmDialog.show(
ui,
message, // ToDo extract in Executor
(ConfirmDialog.Listener) dialog -> {
if (dialog.isConfirmed()) {
getSubject().logout(); //removes all identifying information and invalidates their session too.
VaadinSession vaadinSession = ui.getSession();
vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
vaadinSession.close();
ui.getPage().setLocation("/");
}
else {
// User did not confirm
// CANCEL STUFF
}
});
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return new Pair<>(mapToShiroRole(caption), button);
}
示例11: fireClick
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
@Override
protected void fireClick(final MouseEventDetails details) {
ConfirmDialog dialog = ConfirmDialog.show(getUI(), getConfirmWindowCaption(), getConfirmationText(), getOkCaption(),
getCancelCaption(), new Runnable() {
@Override
public void run() {
doFireClickListener(details);
}
});
dialog.getOkButton().addStyleName(confirmWindowOkButtonStyle);
}
示例12: confirmDelete
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
@Override
public void confirmDelete(T entity) {
ConfirmDialog.show(UI.getCurrent(), "Delete", "Are you sure you want to delete " + entityUtil.getDisplayName(entity) + "?", "OK", "Cancel",
dialog -> {
if (dialog.isConfirmed()) {
listeners.forEach(EntityEditorView.Listener::deleteConfirmed);
}
});
}
示例13: deleteViewDefinitionWindow
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
public static void deleteViewDefinitionWindow(final ViewDefinition vd) {
final ViewDefinition viewDefinition = vd;
ConfirmDialog.show(UI.getCurrent(), Translate.getMessage("windowTitleConfirm"), "Delete view?", Translate.getMessage("btnOK"), Translate.getMessage("btnCancel"), new ConfirmDialog.Listener() {
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
HybridbpmUI.getDashboardAPI().deleteViewDefinition(viewDefinition.getId(), true);
HybridbpmUI.navigateTo(viewDefinition.getUrl());
} else {
// this.close();
}
}
});
}
示例14: deletePanel
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
private void deletePanel() {
ConfirmDialog.show(UI.getCurrent(), Translate.getMessage("windowTitleConfirm"), "Delete panel?", Translate.getMessage("btnOK"), Translate.getMessage("btnCancel"), new ConfirmDialog.Listener() {
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
HybridbpmUI.getDashboardAPI().deletePanelDefinition(panelDefinition.getId().toString(), false);
dashboardTab.refresh();
}
}
});
}
示例15: buttonClick
import org.vaadin.dialogs.ConfirmDialog; //导入方法依赖的package包/类
@Override
public void buttonClick(final Button.ClickEvent event) {
super.buttonClick(event);
if (event.getButton() instanceof TableButton && ((TableButton)event.getButton()).getType().equals(TableButton.TYPE.DELETE)) {
ConfirmDialog.show(UI.getCurrent(), Translate.getMessage("windowTitleConfirm"), "Delete?", Translate.getMessage("btnOK"), Translate.getMessage("btnCancel"), new ConfirmDialog.Listener() {
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
HybridbpmUI.getAccessAPI().removeInstance(((TableButton) event.getButton()).getCustomData().toString());
refreshTable();
}
}
});
}
}