Zeige gemachte Tasks
parent
7df5dc20f7
commit
710b10969e
|
@ -2,11 +2,11 @@ package TodoListApp.Domain;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ProgrammSystem {
|
||||
public class Fassade {
|
||||
|
||||
private TaskList tasks;
|
||||
|
||||
public ProgrammSystem() {
|
||||
public Fassade() {
|
||||
this.tasks = new TaskList();
|
||||
}
|
||||
|
||||
|
@ -26,4 +26,8 @@ public class ProgrammSystem {
|
|||
return tasks.markTaskAsDone(title);
|
||||
}
|
||||
|
||||
public ArrayList<String> getAllGemachteTasks() {
|
||||
return tasks.printAlleGemachteTasks();
|
||||
}
|
||||
|
||||
}
|
|
@ -16,6 +16,7 @@ public class GUI_UserInterface extends JFrame {
|
|||
private JButton clear;
|
||||
private JButton removeTask;
|
||||
private JButton taskDone;
|
||||
private JButton zeigeAlleGemachteTasks;
|
||||
|
||||
public GUI_UserInterface() {
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
|
||||
|
@ -70,6 +71,10 @@ public class GUI_UserInterface extends JFrame {
|
|||
taskDone = new JButton("Gemacht!");
|
||||
taskDone.setBounds(193, 549, 159, 25);
|
||||
panel.add(taskDone);
|
||||
|
||||
zeigeAlleGemachteTasks = new JButton("Zeige Alle gemachte Taks");
|
||||
zeigeAlleGemachteTasks.setBounds(384, 546, 159, 29);
|
||||
panel.add(zeigeAlleGemachteTasks);
|
||||
setLocationRelativeTo(null);
|
||||
this.setVisible(true);
|
||||
|
||||
|
@ -105,6 +110,10 @@ public class GUI_UserInterface extends JFrame {
|
|||
public JButton getTaskDone() {
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
public JButton getZeigeAlleGemachteTasks() {
|
||||
return zeigeAlleGemachteTasks;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package TodoListApp.GUI_UserInterface;
|
||||
|
||||
import TodoListApp.Domain.ProgrammSystem;
|
||||
import TodoListApp.Domain.Fassade;
|
||||
|
||||
public class Userverwalter {
|
||||
|
||||
private ProgrammSystem system;
|
||||
private Fassade fassade;
|
||||
private GUI_UserInterface user;
|
||||
private GUI_addTask taskHinziFuegenFenster;
|
||||
private RemoveTask taskLöschenFenster;
|
||||
|
@ -12,7 +12,7 @@ public class Userverwalter {
|
|||
private int index = 0;
|
||||
|
||||
public Userverwalter() {
|
||||
this.system = new ProgrammSystem();
|
||||
this.fassade = new Fassade();
|
||||
this.user = new GUI_UserInterface();
|
||||
this.taskHinziFuegenFenster = new GUI_addTask();
|
||||
this.taskLöschenFenster = new RemoveTask();
|
||||
|
@ -26,6 +26,7 @@ public class Userverwalter {
|
|||
markTaskFenster.getMarkTaskButton().addActionListener(e -> markTaskAsDone());
|
||||
taskLöschenFenster.getRemoveTaskButton().addActionListener(e-> removeTask());
|
||||
user.getTaskDone().addActionListener(e ->zeigeMarkTaskFenster());
|
||||
user.getZeigeAlleGemachteTasks().addActionListener(e -> zeigeAlleGemachteTasks());
|
||||
|
||||
user.getZeigeAlleTasks().addActionListener(e -> showAllTasks());
|
||||
user.getClear().addActionListener(e -> clearTextArea());
|
||||
|
@ -52,21 +53,21 @@ public class Userverwalter {
|
|||
else
|
||||
priorität = "niedrig";
|
||||
|
||||
system.addTask(title, beschreibung, priorität);
|
||||
fassade.addTask(title, beschreibung, priorität);
|
||||
taskHinziFuegenFenster.resetButtons();
|
||||
taskHinziFuegenFenster.showInfo("Neuer Task wurde Erfolgreich hinzugefügt!");
|
||||
}
|
||||
|
||||
public void showAllTasks() {
|
||||
if (system.showAllTasks().size() == 0)
|
||||
if (fassade.showAllTasks().size() == 0)
|
||||
user.showInfo("Momentan befinden sich keine Taks");
|
||||
|
||||
else if (index >= system.showAllTasks().size())
|
||||
else if (index >= fassade.showAllTasks().size())
|
||||
user.showInfo("Es gibt keine Tasks mehr!");
|
||||
|
||||
else {
|
||||
while (index < system.showAllTasks().size()) {
|
||||
user.getAllTasksArea().append(system.showAllTasks().get(index++));
|
||||
while (index < fassade.showAllTasks().size()) {
|
||||
user.getAllTasksArea().append(fassade.showAllTasks().get(index++));
|
||||
user.getAllTasksArea().append("\n");
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ public class Userverwalter {
|
|||
|
||||
public void removeTask() {
|
||||
String title = taskLöschenFenster.getRemoveTaskEingabe().getText();
|
||||
if (system.removeTask(title)) {
|
||||
if (fassade.removeTask(title)) {
|
||||
taskLöschenFenster.showInfo("Task erfolgreich gelöscht");
|
||||
clearTextArea();
|
||||
showAllTasks();
|
||||
|
@ -105,11 +106,24 @@ public class Userverwalter {
|
|||
|
||||
if (title.isEmpty())
|
||||
markTaskFenster.showError("Sie müssen Title eingeben");
|
||||
else if (system.markTaskAsDone(title)) {
|
||||
else if (fassade.markTaskAsDone(title)) {
|
||||
markTaskFenster.showInfo("Task ist als Gemacht makiert");
|
||||
clearTextArea();
|
||||
showAllTasks();
|
||||
}
|
||||
}
|
||||
|
||||
public void zeigeAlleGemachteTasks() {
|
||||
if (fassade.getAllGemachteTasks().size() == 0)
|
||||
user.showInfo("Es gibt keine erledigte Tasks");
|
||||
else {
|
||||
clearTextArea();
|
||||
while (index < fassade.showAllTasks().size()) {
|
||||
user.getAllTasksArea().append(fassade.getAllGemachteTasks().get(index++));
|
||||
user.getAllTasksArea().append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue