Here are the examples of the java api org.vaadin.dialogs.ConfirmDialog.show() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
7 Examples
17
View Complete Implementation : PDPManagement.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
protected void deletePDP(final PDP pdp, final PDPGroup pdpGroup) {
String message = "Are you sure you want to delete <B>" + (pdp.getName() == null ? "" : pdp.getName()) + "</B> group?";
ConfirmDialog dialog = ConfirmDialog.getFactory().create("Confirm PDP Deletion", message, "Delete", "Cancel");
dialog.setContentMode(ContentMode.HTML);
dialog.show(getUI(), new ConfirmDialog.Listener() {
private static final long serialVersionUID = 1L;
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
try {
self.container.removePDP(pdp, pdpGroup);
} catch (PAPException e) {
logger.warn("Failed to remove pdp");
AdminNotification.warn("Failed to remove PDP");
}
}
}
}, true);
}
16
View Complete Implementation : ConfirmDialogExt.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public static ConfirmDialog show(UI parentWindow, String windowCaption, String message, String okCaption, String cancelCaption, Listener listener) {
ConfirmDialog.setFactory(new ConfirmDialogFactory());
return ConfirmDialog.show(parentWindow, windowCaption, message, okCaption, cancelCaption, listener);
}
16
View Complete Implementation : ConfirmButton.java
Copyright Apache License 2.0
Author : viritin
Copyright Apache License 2.0
Author : viritin
@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);
}
15
View Complete Implementation : PIPManagement.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
protected void removeConfiguration(final EnreplacedyItem<PIPConfiguration> enreplacedy) {
//
// Sanity checks
//
if (enreplacedy == null || enreplacedy.getEnreplacedy() == null) {
logger.error("Removing a null enreplacedy");
return;
}
String message = "Are you sure you want to remove the " + enreplacedy.getEnreplacedy().getName() + " configuration?";
ConfirmDialog dialog = ConfirmDialog.getFactory().create("Confirm PIP Configuration Deletion", message, "Remove", "Cancel");
dialog.setContentMode(ContentMode.HTML);
dialog.show(getUI(), new ConfirmDialog.Listener() {
private static final long serialVersionUID = 1L;
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
if (self.container.removeItem(enreplacedy.gereplacedemId()) == false) {
logger.warn("Failed to remove PIP configuration");
AdminNotification.warn("Failed to remove PIP configuration.");
} else {
self.setupButtons();
}
}
}
}, true);
}
14
View Complete Implementation : CrudActionDelete.java
Copyright GNU General Public License v3.0
Author : rlsutton1
Copyright GNU General Public License v3.0
Author : rlsutton1
@Override
public void exec(final BaseCrudView<E> crud, final EnreplacedyItem<E> enreplacedy) {
if (enreplacedy == null || enreplacedy.getEnreplacedy() == null) {
Notification.show("No record selected to delete.", Type.ERROR_MESSAGE);
return;
}
DeleteVetoResponseData response = crud.canDelete(enreplacedy.getEnreplacedy());
if (response.canDelete) {
String replacedleText = crud.getreplacedleText();
if (replacedleText.contains("getreplacedleText()")) {
replacedleText = enreplacedy.getEnreplacedy().getClreplaced().getSimpleName() + " (getreplacedleText() not implemented)";
}
String name = enreplacedy.getEnreplacedy().getName();
if (name == null) {
name = "" + enreplacedy.getEnreplacedy().getId();
}
ConfirmDialog.show(UI.getCurrent(), "Confirm Delete", "Are you sure you want to delete " + replacedleText + " - '" + name + "' ? " + message, "Delete", "Cancel", new ConfirmDialog.Listener() {
private static final long serialVersionUID = 1L;
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
if (action != null) {
try {
action.delete(enreplacedy);
} catch (Exception e) {
logger.error(e, e);
Notification.show("Errors occurred when deleting " + e.getMessage(), Type.ERROR_MESSAGE);
}
}
crud.delete();
}
}
});
} else {
Notification.show(response.getMessage(), Type.ERROR_MESSAGE);
}
}
11
View Complete Implementation : PDPManagement.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private void deleteGroup(final PDPGroup group) {
//
// Cannot be the default group
//
if (group.isDefaultGroup()) {
logger.error("Cannot delete the Default group");
return;
}
//
// Any PDPs in the group?
//
Set<PDP> pdps = group.getPdps();
if (pdps.isEmpty()) {
//
// There are no PDP's, so just prompt to remove it
//
String message = "Are you sure you want to delete <B>" + (group.getName() == null ? "" : group.getName()) + "</B> group?";
ConfirmDialog dialog = ConfirmDialog.getFactory().create("Confirm Group Deletion", message, "Delete", "Cancel");
dialog.setContentMode(ContentMode.HTML);
dialog.show(getUI(), new ConfirmDialog.Listener() {
private static final long serialVersionUID = 1L;
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
try {
self.container.removeGroup(group, null);
} catch (Exception e1) {
logger.warn("Container failed to remove group");
AdminNotification.error("Unable to delete group '" + group.getId() + "'. Reason:\n" + e1.getMessage());
}
return;
}
}
}, true);
return;
}
//
// Get our set of groups
//
List<PDPGroup> currentGroups = this.container.getGroups();
Set<PDPGroup> otherGroups = new HashSet<PDPGroup>(currentGroups);
if (otherGroups.remove(group) == false) {
logger.warn("Group list inconsistency - failed to remove group we are attempting to delete");
return;
}
//
// We should have at least one group
//
if (otherGroups.isEmpty()) {
logger.error("Group list inconsistency - no other groups to choose from.");
return;
}
//
// If there is only one group, it SHOULD be the default group
//
if (otherGroups.size() == 1) {
PDPGroup loneGroup = otherGroups.iterator().next();
if (loneGroup.isDefaultGroup() == false) {
logger.error("Group list inconsistency - lone group is NOT default.");
return;
}
}
//
// Create our confirmation window
//
final SelectPDPGroupWindow window = new SelectPDPGroupWindow(otherGroups, "Select New Group for PDPs");
window.setCaption("Confirm Group " + group.getName() + " Deletion");
window.setCloseShortcut(KeyCode.ESCAPE);
window.setModal(true);
window.addCloseListener(new CloseListener() {
private static final long serialVersionUID = 1L;
@Override
public void windowClose(CloseEvent e) {
if (window.isSaved()) {
PDPGroup newGroup = window.selectedGroup();
if (newGroup == null) {
logger.warn("No group selected for moving PDPs into");
AdminNotification.warn("No group selected for moving PDPs into. Group '" + group.getId() + "' not deleted");
return;
}
try {
self.container.removeGroup(group, newGroup);
} catch (Exception e1) {
logger.warn("Container failed to remove group: " + e1, e1);
AdminNotification.error("Unable to delete group '" + group.getId() + "'. Reason:\n" + e1.getMessage());
}
}
}
});
getUI().addWindow(window);
}
9
View Complete Implementation : PDPManagement.java
Copyright MIT License
Author : att
Copyright MIT License
Author : att
private void deleteGroup(final PDPGroup group) {
//
// Cannot be the default group
//
if (group.isDefaultGroup()) {
logger.error("Cannot delete the Default group");
return;
}
//
// Any PDPs in the group?
//
Set<PDP> pdps = group.getPdps();
if (pdps.isEmpty()) {
//
// There are no PDP's, so just prompt to remove it
//
String message = "Are you sure you want to delete <B>" + (group.getName() == null ? "" : group.getName()) + "</B> group?";
ConfirmDialog dialog = ConfirmDialog.getFactory().create("Confirm Group Deletion", message, "Delete", "Cancel");
dialog.setContentMode(ContentMode.HTML);
dialog.show(getUI(), new ConfirmDialog.Listener() {
private static final long serialVersionUID = 1L;
@Override
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
try {
self.container.removeGroup(group, null);
} catch (Exception e1) {
logger.warn("Container failed to remove group");
AdminNotification.error("Unable to delete group '" + group.getId() + "'. Reason:\n" + e1.getMessage());
}
return;
}
}
}, true);
return;
}
//
// Get our set of groups
//
List<PDPGroup> currentGroups = this.container.getGroups();
Set<PDPGroup> otherGroups = new HashSet<PDPGroup>(currentGroups);
if (otherGroups.remove(group) == false) {
logger.warn("Group list inconsistency - failed to remove group we are attempting to delete");
return;
}
//
// We should have at least one group
//
if (otherGroups.isEmpty()) {
logger.error("Group list inconsistency - no other groups to choose from.");
return;
}
//
// If there is only one group, it SHOULD be the default group
//
if (otherGroups.size() == 1) {
PDPGroup loneGroup = otherGroups.iterator().next();
if (loneGroup.isDefaultGroup() == false) {
logger.error("Group list inconsistency - lone group is NOT default.");
return;
}
}
//
// Create our confirmation window
//
final SelectPDPGroupWindow window = new SelectPDPGroupWindow(otherGroups, "Select New Group for PDPs");
window.setCaption("Confirm Group " + group.getName() + " Deletion");
window.setCloseShortcut(KeyCode.ESCAPE);
window.setModal(true);
;
window.addCloseListener(new CloseListener() {
private static final long serialVersionUID = 1L;
@Override
public void windowClose(CloseEvent e) {
if (window.isSaved()) {
PDPGroup newGroup = window.selectedGroup();
if (newGroup == null) {
logger.warn("No group selected for moving PDPs into");
AdminNotification.warn("No group selected for moving PDPs into. Group '" + group.getId() + "' not deleted");
return;
}
try {
self.container.removeGroup(group, newGroup);
} catch (Exception e1) {
logger.warn("Container failed to remove group: " + e1, e1);
AdminNotification.error("Unable to delete group '" + group.getId() + "'. Reason:\n" + e1.getMessage());
}
}
}
});
getUI().addWindow(window);
}