patch4
This commit is contained in:
parent
fbdaf6d368
commit
a2920dc5f0
@ -20,7 +20,7 @@ public interface ActivityRepositoryApi {
|
||||
|
||||
Activity read(String id);
|
||||
|
||||
void delete(String id);
|
||||
boolean delete(String id);
|
||||
|
||||
List<String> getYears();
|
||||
|
||||
|
@ -68,11 +68,11 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
public boolean delete(String id) {
|
||||
System.out.println("Going to delete: " + id);
|
||||
Activity activityToBeDeleted = read(id);
|
||||
if(!Utils.askYesNo(null, "Do you really want to delete this activity? " + read(id), "Deletion of activity")) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@ -99,7 +99,7 @@ public class ActivityRepositorySQLiteImpl implements ActivityRepositoryApi {
|
||||
ex.printStackTrace();
|
||||
throw new TimeCalcException(ex);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -220,9 +220,12 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
||||
// //dayPanel.moveMarkedActivityBeforeThisActivity(getActivity());
|
||||
// });
|
||||
deleteButton.addActionListener(e -> {
|
||||
activityRepository.delete(this.activity.getId());
|
||||
this.setVisible(false);
|
||||
deleted = true;
|
||||
boolean deleted = activityRepository.delete(this.activity.getId());
|
||||
if(deleted) {
|
||||
this.setVisible(false);
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
});
|
||||
copyButton.addActionListener(e -> {
|
||||
activityRepository.putToClipboard(this.activity);
|
||||
|
Loading…
x
Reference in New Issue
Block a user