clean up repo

This commit is contained in:
David Westgate 2016-06-02 22:50:01 -07:00
parent f565f29a10
commit 1224c1c97d
20 changed files with 58 additions and 45 deletions

View File

@ -6,5 +6,6 @@
</accessrules>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,3 +0,0 @@
,s
,Enter task here
hellworld,Enter task here,rhdrh

View File

@ -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');

View File

@ -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()

View File

@ -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<String> task_view;
@ -77,11 +78,14 @@ public class Manager_Module extends HBox
Task_Container(String title)
{
task_list = FXCollections.observableArrayList();
task_view = new ListView<String>();
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<String> 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();
}

View File

@ -1,2 +0,0 @@
david,w
rohane,rohane

Binary file not shown.