Here are the examples of the java api org.vaadin.dialogs.ConfirmDialog.getFactory() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
18
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);
}
15
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);
}
6
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);
}
6
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);
}