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