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