File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
src/main/java/org/ainm/controllers/todolist Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,8 @@ void setTodo(String todo) {
1515 String getTodo () {
1616 return checkBox .getText ();
1717 }
18- }
18+
19+ Boolean isDone () {
20+ return checkBox .isChecked ()
21+ }
22+ }
Original file line number Diff line number Diff line change @@ -73,11 +73,12 @@ void saveFile(Path file) throws IOException {
7373 String saveData = "" ;
7474 for (Node todoItem :todos_list .getChildren ()) {
7575 TodoitemController controller = (TodoitemController ) getController (todoItem );
76- saveData += controller .getTodo () + "\n " ;
76+ saveData += "[" + (( controller . isDone () ? "x" : " " ) + "]" + controller .getTodo () + "\n " ;
7777 }
7878 //Save this string to the given file
7979 Files .writeString (file , saveData );
8080 }
81+
8182 public static Object getController (Node node ) {
8283 Object controller = null ;
8384 do {
@@ -86,4 +87,4 @@ public static Object getController(Node node) {
8687 } while (controller == null && node != null );
8788 return controller ;
8889 }
89- }
90+ }
You can’t perform that action at this time.
0 commit comments