diff --git a/Task_Managment_application/.classpath b/Task_Managment_application/.classpath index 144797c..9784fe3 100644 --- a/Task_Managment_application/.classpath +++ b/Task_Managment_application/.classpath @@ -6,5 +6,6 @@ + diff --git a/Task_Managment_application/bin/Account_Module$1.class b/Task_Managment_application/bin/Account_Module$1.class index d03284f..39e9205 100644 Binary files a/Task_Managment_application/bin/Account_Module$1.class and b/Task_Managment_application/bin/Account_Module$1.class differ diff --git a/Task_Managment_application/bin/Account_Module$2.class b/Task_Managment_application/bin/Account_Module$2.class index 4fd2937..fa84611 100644 Binary files a/Task_Managment_application/bin/Account_Module$2.class and b/Task_Managment_application/bin/Account_Module$2.class differ diff --git a/Task_Managment_application/bin/Account_Module$User.class b/Task_Managment_application/bin/Account_Module$User.class index 020e868..3797e71 100644 Binary files a/Task_Managment_application/bin/Account_Module$User.class and b/Task_Managment_application/bin/Account_Module$User.class differ diff --git a/Task_Managment_application/bin/Account_Module.class b/Task_Managment_application/bin/Account_Module.class index 0b9a087..aa20717 100644 Binary files a/Task_Managment_application/bin/Account_Module.class and b/Task_Managment_application/bin/Account_Module.class differ diff --git a/Task_Managment_application/bin/Main.class b/Task_Managment_application/bin/Main.class index 6eae8e3..2656379 100644 Binary files a/Task_Managment_application/bin/Main.class and b/Task_Managment_application/bin/Main.class differ diff --git a/Task_Managment_application/bin/Manager_Module$1.class b/Task_Managment_application/bin/Manager_Module$1.class index 13b5c66..df5db38 100644 Binary files a/Task_Managment_application/bin/Manager_Module$1.class and b/Task_Managment_application/bin/Manager_Module$1.class differ diff --git a/Task_Managment_application/bin/Manager_Module$2.class b/Task_Managment_application/bin/Manager_Module$2.class index 1a0dd7e..51e59e7 100644 Binary files a/Task_Managment_application/bin/Manager_Module$2.class and b/Task_Managment_application/bin/Manager_Module$2.class differ diff --git a/Task_Managment_application/bin/Manager_Module$3.class b/Task_Managment_application/bin/Manager_Module$3.class index 1608a18..afe6f34 100644 Binary files a/Task_Managment_application/bin/Manager_Module$3.class and b/Task_Managment_application/bin/Manager_Module$3.class differ diff --git a/Task_Managment_application/bin/Manager_Module$Direction_Button$1.class b/Task_Managment_application/bin/Manager_Module$Direction_Button$1.class index b451dac..0c30453 100644 Binary files a/Task_Managment_application/bin/Manager_Module$Direction_Button$1.class and b/Task_Managment_application/bin/Manager_Module$Direction_Button$1.class differ diff --git a/Task_Managment_application/bin/Manager_Module$Direction_Button.class b/Task_Managment_application/bin/Manager_Module$Direction_Button.class index dbee025..7eb09cd 100644 Binary files a/Task_Managment_application/bin/Manager_Module$Direction_Button.class and b/Task_Managment_application/bin/Manager_Module$Direction_Button.class differ diff --git a/Task_Managment_application/bin/Manager_Module$Task_Container.class b/Task_Managment_application/bin/Manager_Module$Task_Container.class index 8516341..1ef4ed8 100644 Binary files a/Task_Managment_application/bin/Manager_Module$Task_Container.class and b/Task_Managment_application/bin/Manager_Module$Task_Container.class differ diff --git a/Task_Managment_application/bin/Manager_Module.class b/Task_Managment_application/bin/Manager_Module.class index e2fe42d..7cfa4ed 100644 Binary files a/Task_Managment_application/bin/Manager_Module.class and b/Task_Managment_application/bin/Manager_Module.class differ diff --git a/Task_Managment_application/david_data.txt b/Task_Managment_application/david_data.txt deleted file mode 100644 index 387cec0..0000000 --- a/Task_Managment_application/david_data.txt +++ /dev/null @@ -1,3 +0,0 @@ -,s -,Enter task here -hellworld,Enter task here,rhdrh \ No newline at end of file diff --git a/Task_Managment_application/rohane_data.txt b/Task_Managment_application/rohane_data.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Task_Managment_application/src/Account_Module.java b/Task_Managment_application/src/Account_Module.java index 5d95c00..b215c78 100644 --- a/Task_Managment_application/src/Account_Module.java +++ b/Task_Managment_application/src/Account_Module.java @@ -21,7 +21,15 @@ import javafx.geometry.Insets; public class Account_Module extends VBox { - private class User + Manager_Module mm; //for junit test + + + public Manager_Module get_new_manager_module(String name) //for junit + { + return new Manager_Module(name); + } + + private class User //"struct" for users { private String username; private String password; @@ -112,10 +120,11 @@ public class Account_Module extends VBox { try { + if(DEBUG)System.out.println("Attempted login"); if (attemptLogin(usernameField.getText(), passwordField.getText())) { - if(DEBUG)System.out.println("Attempted login"); + Manager_Module hbox = new Manager_Module(usernameField.getText()); System.out.println("LOGIN SUCCESS"); Scene mod_scene = new Scene(hbox, 600, 600); @@ -137,7 +146,7 @@ public class Account_Module extends VBox } }); - // if(this.getScene() != null) + HBox buttonContainer = new HBox(); @@ -152,7 +161,7 @@ public class Account_Module extends VBox } - private boolean add_user_to_list(String username, String password) throws IOException + public boolean add_user_to_list(String username, String password) throws IOException { User user = new User(username, password); refresh_user_list(); @@ -171,6 +180,7 @@ public class Account_Module extends VBox { if (DEBUG) System.out.println("user name already exists, not adding"); + return false; } } @@ -183,7 +193,7 @@ public class Account_Module extends VBox return true; } - private boolean attemptLogin(String username, String password) throws IOException + public boolean attemptLogin(String username, String password) throws IOException { refresh_user_list(); for (int i = 0; i < user_list.size(); ++i) @@ -254,10 +264,7 @@ public class Account_Module extends VBox BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(FILE)); for (int i = 0; i < user_list.size(); ++i) { - if (DEBUG) - System.out.println("size is " + i); - if (DEBUG) - debug_print_list(); + if (i != 0) { bufferedWriter.write('\n'); diff --git a/Task_Managment_application/src/Main.java b/Task_Managment_application/src/Main.java index 97913e7..0f87a64 100644 --- a/Task_Managment_application/src/Main.java +++ b/Task_Managment_application/src/Main.java @@ -2,9 +2,16 @@ import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; -public class Main extends Application +public class Main extends Application //basis for application { private static Stage stage; + Account_Module Test_am; //junit + + public Account_Module get_account_module() //for junit + { + return Test_am; + } + public static void main(String [] args) { launch(); @@ -15,6 +22,7 @@ public class Main extends Application { set_stage(stage); Account_Module account_mod = new Account_Module(); + Test_am = account_mod; Scene account_scene = new Scene(account_mod); stage.sizeToScene(); stage.setScene(account_scene); @@ -22,6 +30,9 @@ public class Main extends Application stage.show(); + + + } public static Stage get_stage() diff --git a/Task_Managment_application/src/Manager_Module.java b/Task_Managment_application/src/Manager_Module.java index 8c68d25..e0ed765 100644 --- a/Task_Managment_application/src/Manager_Module.java +++ b/Task_Managment_application/src/Manager_Module.java @@ -7,6 +7,7 @@ import java.io.FileWriter; import java.io.IOException; import java.util.LinkedList; +import javafx.beans.Observable; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; @@ -68,7 +69,7 @@ public class Manager_Module extends HBox } } - class Task_Container extends VBox + class Task_Container extends VBox //container visual and data structure for task items { ListView task_view; @@ -77,11 +78,14 @@ public class Manager_Module extends HBox Task_Container(String title) { + task_list = FXCollections.observableArrayList(); + task_view = new ListView(); task_view.setOrientation(Orientation.VERTICAL); - task_view.setItems(task_list); + this.title = title; + Label title_label = new Label(); title_label.setText(title); title_label.setPrefWidth(100); @@ -95,6 +99,7 @@ public class Manager_Module extends HBox public void add_task(String task) { + if(DEBUG)System.out.println("Task is " +task); task_list.add(task); task_view.setItems(task_list); @@ -155,6 +160,10 @@ public class Manager_Module extends HBox public Manager_Module(String username) { + todo_container = new Task_Container("To Do"); + doing_container = new Task_Container("In Progress"); + done_container = new Task_Container("Done"); + DEBUG = true; FILE = new File(username + "_data.txt"); @@ -164,9 +173,7 @@ public class Manager_Module extends HBox this.setSpacing(11); this.setMinSize(500, 500); - todo_container = new Task_Container("To Do"); - doing_container = new Task_Container("In Progress"); - done_container = new Task_Container("Done"); + Button add_task_button = new Button(); Button remove_task_button = new Button(); @@ -209,7 +216,7 @@ public class Manager_Module extends HBox String next_task = new String(); next_task = task_textfield.getText(); todo_container.add_task(next_task); - task_textfield.clear(); + try { save(); @@ -280,55 +287,47 @@ public class Manager_Module extends HBox return; } BufferedReader bufferedReader = new BufferedReader(new FileReader(FILE)); - ObservableList temp_list = FXCollections.observableArrayList(); + String line = bufferedReader.readLine(); String[] task_desc = null; - if(line != null) + if(line != null && !line.isEmpty()) { task_desc = line.split(","); for(int i = 0; i < task_desc.length; ++i) { - temp_list.add(task_desc[i]); + todo_container.add_task(task_desc[i]); } - todo_container.set_task_list(temp_list); + } - else - { - todo_container.set_task_list(null); - } - temp_list = FXCollections.observableArrayList(); + + line = bufferedReader.readLine(); task_desc = null; - if(line != null) + if(line != null && !line.isEmpty()) { task_desc = line.split(","); for(int i = 0; i < task_desc.length; ++i) { - temp_list.add(task_desc[i]); + + doing_container.add_task(task_desc[i]); } - doing_container.set_task_list(temp_list); + } - else - { - doing_container.set_task_list(null); - } - temp_list = FXCollections.observableArrayList(); + + line = bufferedReader.readLine(); task_desc = null; - if(line != null) + if(line != null && !line.isEmpty()) { task_desc = line.split(","); for(int i = 0; i < task_desc.length; ++i) { - temp_list.add(task_desc[i]); + done_container.add_task(task_desc[i]); } - done_container.set_task_list(temp_list); - } - else - { - done_container.set_task_list(null); + } + bufferedReader.close(); } diff --git a/Task_Managment_application/user_data.txt b/Task_Managment_application/user_data.txt deleted file mode 100644 index 983647a..0000000 --- a/Task_Managment_application/user_data.txt +++ /dev/null @@ -1,2 +0,0 @@ -david,w -rohane,rohane \ No newline at end of file diff --git a/tma_westgate.jar b/tma_westgate.jar deleted file mode 100644 index 3684268..0000000 Binary files a/tma_westgate.jar and /dev/null differ