本文整理汇总了Java中org.vaadin.dialogs.ConfirmDialog类的典型用法代码示例。如果您正苦于以下问题:Java ConfirmDialog类的具体用法?Java ConfirmDialog怎么用?Java ConfirmDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfirmDialog类属于org.vaadin.dialogs包,在下文中一共展示了ConfirmDialog类的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: create
import org.vaadin.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public ConfirmDialog create(String caption, String message, String okCaption, String cancelCaption, String notOkCaption) {
ConfirmDialog d = super.create(caption, message, okCaption, cancelCaption, notOkCaption);
d.getContent().setStyleName("custom-dialog");
d.getContent().setHeightUndefined();
d.setHeightUndefined();
Button ok = d.getOkButton();
ok.setStyleName(WebThemes.BUTTON_ACTION);
HorizontalLayout buttons = (HorizontalLayout) ok.getParent();
buttons.setHeightUndefined();
Button cancelBtn = d.getCancelButton();
cancelBtn.setStyleName(WebThemes.BUTTON_OPTION);
cancelBtn.focus();
return d;
}
示例8: buttonClick
import org.vaadin.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public void buttonClick(ClickEvent event) {
if(event.getButton().equals(downloadButton)) {
FileResource resource = new FileResource((File) filesTable.getValue());
EnterpriseApplication.getInstance().getMainWindow().open(resource, "", true);
updateTable();
} else if(event.getButton().equals(deleteButton)) {
Utils.yesNoDialog(this, Constants.uiConfirmDeletion, new ConfirmDialog.Listener() {
public void onClose(ConfirmDialog dialog) {
if(dialog.isConfirmed()) {
File file = (File) filesTable.getValue();
file.delete();
updateTable();
}
}
});
}
}
示例9: 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();
}
示例10: 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();
}
}
});
}
示例11: styleConfirmDialog
import org.vaadin.dialogs.ConfirmDialog; //导入依赖的package包/类
void styleConfirmDialog()
{
final ConfirmDialog.Factory df = new DefaultConfirmDialogFactory()
{
private static final long serialVersionUID = 1L;
// We change the default order of the buttons
@Override
public ConfirmDialog create(final String caption, final String message, final String okCaption,
final String cancelCaption)
{
final ConfirmDialog d = super.create(caption, message, okCaption, cancelCaption);
d.setStyleName("black");
d.setModal(true);
return d;
}
};
ConfirmDialog.setFactory(df);
}
示例12: 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;
}
示例13: 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);
}
示例14: enter
import org.vaadin.dialogs.ConfirmDialog; //导入依赖的package包/类
@Override
public void enter(ViewChangeEvent event) {
getAddButton().setCaption("Nouvelle aventure");
setFilterAllowed(false);
if (CurrentUser.get().getAdventure() == null) {
grid.addComponentColumn(adventure -> {
FButton button = new FButton("Joindre").withEnabled(adventure.isOpened())
.withStyleName(ValoTheme.BUTTON_PRIMARY)
.withClickListener(clickEvent -> {
ConfirmDialog.show(getUI(), "Joindre l'aventure",
"Êtes-vous certain de joindre cette aventure", "Oui", "Non", new Runnable() {
@Override
public void run() {
User user = CurrentUser.get();
user.setAdventure(adventure);
user = userService.update(user);
CurrentUser.set(user);
grid.removeColumn("join");
EventBus.post(new ViewAddedEvent(AdventureView.class,
ViewDestination.MENUBAR, "Mon aventure",
AdventureView.URI + "/" + adventure.getId()));
}
});
});
return button;
}).setId("join");
grid.setRowHeight(40);
}
super.enter(event);
}
示例15: 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);
}