@Override
public void run() {
try {
updateProgressBar(0);
initProgressBar(items.size());
list.setCursor(new Cursor(Cursor.WAIT_CURSOR));
setStatus("Deleting " + items.size() + " items from to the database");
if (!DcSwingUtilities.displayQuestion("msgDeleteQuestion")) {
return;
} else {
startTask();
denyActions();
int counter = 1;
for (DcObject dco : items) {
updateProgressBar(counter);
dco.markAsUnchanged();
if (counter == items.size()) {
Requests requests = getAfterDeleteRequests();
for (int j = 0; j < requests.get().length; j++) {
dco.addRequest(requests.get()[j]);
}
}
try {
dco.delete(true);
} catch (ValidationException e) {
DcSwingUtilities.displayWarningMessage(e.getMessage());
}
try {
sleep(300);
} catch (Exception ignore) {}
counter++;
}
list.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
} finally {
list.setSelectedIndex(0);
endTask();
allowActions();