version 1 of project
This commit is contained in:
parent
49d5b36b61
commit
c9d1267ca1
10
Task_Managment_application/.classpath
Normal file
10
Task_Managment_application/.classpath
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<accessrules>
|
||||
<accessrule kind="accessible" pattern="javafx/**"/>
|
||||
</accessrules>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
Task_Managment_application/.project
Normal file
17
Task_Managment_application/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Task_Managment_Application</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
BIN
Task_Managment_application/bin/Account_Module$1.class
Normal file
BIN
Task_Managment_application/bin/Account_Module$1.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Account_Module$2.class
Normal file
BIN
Task_Managment_application/bin/Account_Module$2.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Account_Module$User.class
Normal file
BIN
Task_Managment_application/bin/Account_Module$User.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Account_Module.class
Normal file
BIN
Task_Managment_application/bin/Account_Module.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Main.class
Normal file
BIN
Task_Managment_application/bin/Main.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Manager_Module$1.class
Normal file
BIN
Task_Managment_application/bin/Manager_Module$1.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Manager_Module$2.class
Normal file
BIN
Task_Managment_application/bin/Manager_Module$2.class
Normal file
Binary file not shown.
BIN
Task_Managment_application/bin/Manager_Module$3.class
Normal file
BIN
Task_Managment_application/bin/Manager_Module$3.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Task_Managment_application/bin/Manager_Module.class
Normal file
BIN
Task_Managment_application/bin/Manager_Module.class
Normal file
Binary file not shown.
3
Task_Managment_application/david_data.txt
Normal file
3
Task_Managment_application/david_data.txt
Normal file
@ -0,0 +1,3 @@
|
||||
,s
|
||||
,Enter task here
|
||||
hellworld,Enter task here,rhdrh
|
0
Task_Managment_application/rohane_data.txt
Normal file
0
Task_Managment_application/rohane_data.txt
Normal file
273
Task_Managment_application/src/Account_Module.java
Normal file
273
Task_Managment_application/src/Account_Module.java
Normal file
@ -0,0 +1,273 @@
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
|
||||
public class Account_Module extends VBox
|
||||
{
|
||||
private class User
|
||||
{
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
User()
|
||||
{
|
||||
|
||||
}
|
||||
User(String username, String password)
|
||||
{
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String get_password()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public String get_username()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void set_password(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void set_username(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
}
|
||||
|
||||
final File FILE;
|
||||
final boolean DEBUG;
|
||||
private LinkedList<User> user_list;
|
||||
|
||||
|
||||
Account_Module()
|
||||
{
|
||||
|
||||
DEBUG = true;
|
||||
FILE = new File("user_data.txt");
|
||||
user_list = new LinkedList<User>();
|
||||
|
||||
this.setPadding(new Insets(15, 15, 15, 15));
|
||||
this.setStyle("-fx-background-color: #336699;");
|
||||
this.setSpacing(11);
|
||||
this.setMinSize(500, 500);
|
||||
|
||||
TextField usernameField = new TextField();
|
||||
PasswordField passwordField = new PasswordField();
|
||||
Button registerButton = new Button();
|
||||
Button loginButton = new Button();
|
||||
|
||||
passwordField.setText("Enter Password");
|
||||
usernameField.setText("Enter Username");
|
||||
loginButton.setText("Login");
|
||||
registerButton.setText("Register");
|
||||
|
||||
registerButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent arg0)
|
||||
{
|
||||
try
|
||||
{
|
||||
add_user_to_list(usernameField.getText(), passwordField.getText());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
loginButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
|
||||
{
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
try
|
||||
{
|
||||
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);
|
||||
Main.get_stage().setScene(mod_scene);
|
||||
|
||||
|
||||
|
||||
} else
|
||||
{
|
||||
if (DEBUG)
|
||||
System.out.println("LOGIN FAIL");
|
||||
}
|
||||
} catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
// if(this.getScene() != null)
|
||||
|
||||
|
||||
HBox buttonContainer = new HBox();
|
||||
buttonContainer.getChildren().addAll(registerButton, loginButton);
|
||||
buttonContainer.setSpacing(10);
|
||||
this.getChildren().addAll(usernameField, passwordField, buttonContainer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean add_user_to_list(String username, String password) throws IOException
|
||||
{
|
||||
User user = new User(username, password);
|
||||
refresh_user_list();
|
||||
if (user_list.isEmpty())
|
||||
{
|
||||
if (DEBUG)
|
||||
System.out.println("user list is empty");
|
||||
user_list.add(user);
|
||||
} else
|
||||
{
|
||||
if (DEBUG)
|
||||
System.out.println("user list is not empty");
|
||||
for (int i = 0; i < user_list.size(); ++i)
|
||||
{
|
||||
if (user_list.get(i).get_username().equalsIgnoreCase(user.get_username()))
|
||||
{
|
||||
if (DEBUG)
|
||||
System.out.println("user name already exists, not adding");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (DEBUG)
|
||||
System.out.println("Adding user to list");
|
||||
user_list.add(user);
|
||||
}
|
||||
save_user_list();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean attemptLogin(String username, String password) throws IOException
|
||||
{
|
||||
refresh_user_list();
|
||||
for (int i = 0; i < user_list.size(); ++i)
|
||||
{
|
||||
if (user_list.get(i).get_username().equalsIgnoreCase(username))
|
||||
{
|
||||
if (user_list.get(i).get_password().equals(password))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void debug_print_list()
|
||||
{
|
||||
for (int i = 0; i < user_list.size(); ++i)
|
||||
{
|
||||
System.out.println("size is " + i);
|
||||
System.out.print(user_list.get(i).get_username() + ' ');
|
||||
System.out.println(user_list.get(i).get_password());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void refresh_user_list() throws IOException
|
||||
{
|
||||
if (DEBUG)
|
||||
System.out.println("getting user list");
|
||||
|
||||
user_list.clear();
|
||||
|
||||
if (!FILE.exists())
|
||||
{
|
||||
user_list.clear();
|
||||
System.out.println("file wasnt found");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("file was found");
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(FILE));
|
||||
String line;
|
||||
line = bufferedReader.readLine();
|
||||
while (line != null)
|
||||
{
|
||||
User temp = new User();
|
||||
|
||||
temp.set_username(line.substring(0, line.indexOf(',')));
|
||||
temp.set_password(line.substring(line.indexOf(',') + 1));
|
||||
if (DEBUG)
|
||||
System.out.println(temp.get_username());
|
||||
if (DEBUG)
|
||||
System.out.println(temp.get_password());
|
||||
user_list.add(temp);
|
||||
line = bufferedReader.readLine();
|
||||
}
|
||||
bufferedReader.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void save_user_list() throws IOException
|
||||
{
|
||||
|
||||
|
||||
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');
|
||||
}
|
||||
bufferedWriter.write(user_list.get(i).get_username());
|
||||
bufferedWriter.write(',');
|
||||
bufferedWriter.write(user_list.get(i).get_password());
|
||||
}
|
||||
bufferedWriter.close();
|
||||
|
||||
}
|
||||
|
||||
}
|
36
Task_Managment_application/src/Main.java
Normal file
36
Task_Managment_application/src/Main.java
Normal file
@ -0,0 +1,36 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main extends Application
|
||||
{
|
||||
private static Stage stage;
|
||||
public static void main(String [] args)
|
||||
{
|
||||
launch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception
|
||||
{
|
||||
set_stage(stage);
|
||||
Account_Module account_mod = new Account_Module();
|
||||
Scene account_scene = new Scene(account_mod);
|
||||
stage.sizeToScene();
|
||||
stage.setScene(account_scene);
|
||||
stage.setTitle("Task Manager Application");
|
||||
stage.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Stage get_stage()
|
||||
{
|
||||
return stage;
|
||||
}
|
||||
|
||||
public void set_stage(Stage stage)
|
||||
{
|
||||
this.stage = stage;
|
||||
}
|
||||
}
|
374
Task_Managment_application/src/Manager_Module.java
Normal file
374
Task_Managment_application/src/Manager_Module.java
Normal file
@ -0,0 +1,374 @@
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.layout.BackgroundFill;
|
||||
import javafx.scene.layout.Border;
|
||||
import javafx.scene.layout.BorderStroke;
|
||||
import javafx.scene.layout.CornerRadii;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.stage.Popup;
|
||||
|
||||
public class Manager_Module extends HBox
|
||||
{
|
||||
class Direction_Button extends Button
|
||||
{
|
||||
Direction_Button(Task_Container from, Task_Container to, String button_text, Manager_Module mm)
|
||||
{
|
||||
this.setText(button_text);
|
||||
this.setMinSize(30, 10);
|
||||
this.setOnAction(new EventHandler<ActionEvent>(){
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
if(!from.get_list_view().getSelectionModel().isEmpty())
|
||||
{
|
||||
int selected_index = from.get_list_view().getSelectionModel().getSelectedIndex();
|
||||
String current_task = from.get_task_list().get(selected_index);
|
||||
from.remove_task(current_task);
|
||||
to.add_task(current_task);
|
||||
from.get_list_view().getSelectionModel().clearSelection();
|
||||
to.get_list_view().getSelectionModel().clearSelection();
|
||||
try
|
||||
{
|
||||
mm.save();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Task_Container extends VBox
|
||||
{
|
||||
|
||||
ListView<String> task_view;
|
||||
private String title;
|
||||
ObservableList<String> task_list;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
this.getChildren().addAll(title_label, task_view);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void add_task(String task)
|
||||
{
|
||||
task_list.add(task);
|
||||
task_view.setItems(task_list);
|
||||
|
||||
}
|
||||
|
||||
public void remove_task(String task)
|
||||
{
|
||||
for(int i = 0; i < task_list.size(); ++i)
|
||||
{
|
||||
if(task_list.get(i).equals(task))
|
||||
{
|
||||
task_list.remove(i);
|
||||
i = task_list.size();
|
||||
}
|
||||
}
|
||||
task_view.setItems(task_list);
|
||||
|
||||
}
|
||||
|
||||
public ObservableList<String> get_task_list()
|
||||
{
|
||||
return task_list;
|
||||
}
|
||||
|
||||
public ListView<String> get_list_view()
|
||||
{
|
||||
return task_view;
|
||||
}
|
||||
|
||||
public String get_title()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void set_task_list(ObservableList<String> task_list)
|
||||
{
|
||||
this.task_list = task_list;
|
||||
if(task_list != null && !task_list.isEmpty())
|
||||
task_view.setItems(task_list);
|
||||
|
||||
}
|
||||
public void set_title(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
final boolean DEBUG;
|
||||
final File FILE;
|
||||
Task_Container todo_container;
|
||||
Task_Container doing_container;
|
||||
Task_Container done_container;
|
||||
|
||||
|
||||
|
||||
public Manager_Module(String username)
|
||||
{
|
||||
DEBUG = true;
|
||||
FILE = new File(username + "_data.txt");
|
||||
|
||||
Manager_Module mm = this;
|
||||
this.setPadding(new Insets(10,10,10,10));
|
||||
this.setBackground(new Background(new BackgroundFill(Color.TAN, CornerRadii.EMPTY, Insets.EMPTY)));
|
||||
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();
|
||||
add_task_button.setText("Add task");
|
||||
remove_task_button.setText("Remove Completed Task");
|
||||
|
||||
|
||||
Popup popup = new Popup();
|
||||
popup.setX(505);
|
||||
popup.setY(405);
|
||||
VBox popup_box = new VBox();
|
||||
popup_box.setLayoutX(500);
|
||||
popup_box.setLayoutY(400);
|
||||
popup_box.setMinHeight(100);
|
||||
popup_box.setMinWidth(100);
|
||||
TextField task_textfield = new TextField("Enter task here");
|
||||
Button ok_popup = new Button();
|
||||
ok_popup.setMinWidth(50);
|
||||
ok_popup.setText("ADD");
|
||||
popup_box.getChildren().addAll(task_textfield, ok_popup);
|
||||
popup.getContent().add(popup_box);
|
||||
|
||||
|
||||
VBox transitions1 = new VBox();
|
||||
transitions1.getChildren().add(new Direction_Button(todo_container, doing_container, "->", this));
|
||||
transitions1.getChildren().add(new Direction_Button(doing_container, todo_container, "<-", this));
|
||||
|
||||
VBox transitions2 = new VBox();
|
||||
transitions2.getChildren().add(new Direction_Button(doing_container, done_container, "->", this));
|
||||
transitions2.getChildren().add(new Direction_Button(done_container, doing_container, "<-", this));
|
||||
|
||||
|
||||
|
||||
ok_popup.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
String next_task = new String();
|
||||
next_task = task_textfield.getText();
|
||||
todo_container.add_task(next_task);
|
||||
task_textfield.clear();
|
||||
try
|
||||
{
|
||||
save();
|
||||
} catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
popup.hide();
|
||||
}
|
||||
|
||||
});
|
||||
add_task_button.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent arg0)
|
||||
{
|
||||
if(DEBUG) System.out.println("Add task button click");
|
||||
popup.show(mm, mm.getLayoutX(), mm.getLayoutY());
|
||||
}
|
||||
|
||||
});
|
||||
remove_task_button.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
if(!done_container.get_list_view().getSelectionModel().isEmpty())
|
||||
{
|
||||
int remove_index = done_container.get_list_view().getSelectionModel().getSelectedIndex();
|
||||
done_container.get_task_list().remove(remove_index);
|
||||
done_container.get_list_view().setItems(done_container.get_task_list());
|
||||
try
|
||||
{
|
||||
save();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
done_container.get_list_view().getSelectionModel().clearSelection();
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
todo_container.getChildren().add(add_task_button);
|
||||
done_container.getChildren().add(remove_task_button);
|
||||
try
|
||||
{
|
||||
load();
|
||||
} catch (IOException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.getChildren().addAll(todo_container, transitions1, doing_container, transitions2, done_container);
|
||||
}
|
||||
|
||||
private void load() throws IOException
|
||||
{
|
||||
|
||||
if(!FILE.exists())
|
||||
{
|
||||
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)
|
||||
{
|
||||
task_desc = line.split(",");
|
||||
for(int i = 0; i < task_desc.length; ++i)
|
||||
{
|
||||
temp_list.add(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)
|
||||
{
|
||||
task_desc = line.split(",");
|
||||
|
||||
for(int i = 0; i < task_desc.length; ++i)
|
||||
{
|
||||
temp_list.add(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)
|
||||
{
|
||||
task_desc = line.split(",");
|
||||
for(int i = 0; i < task_desc.length; ++i)
|
||||
{
|
||||
temp_list.add(task_desc[i]);
|
||||
}
|
||||
done_container.set_task_list(temp_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
done_container.set_task_list(null);
|
||||
}
|
||||
bufferedReader.close();
|
||||
|
||||
}
|
||||
|
||||
private void save() throws IOException
|
||||
{
|
||||
|
||||
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(FILE));
|
||||
ObservableList<String> temp = todo_container.get_task_list();
|
||||
for(int i = 0; i < temp.size(); ++i)
|
||||
{
|
||||
if(i != 0)
|
||||
bufferedWriter.write(',');
|
||||
bufferedWriter.write(temp.get(i));
|
||||
|
||||
}
|
||||
bufferedWriter.write('\n');
|
||||
temp = doing_container.get_task_list();
|
||||
for(int i = 0; i < temp.size(); ++i)
|
||||
{
|
||||
if(i != 0)
|
||||
bufferedWriter.write(',');
|
||||
bufferedWriter.write(temp.get(i));
|
||||
|
||||
}
|
||||
bufferedWriter.write('\n');
|
||||
temp = done_container.get_task_list();
|
||||
for(int i = 0; i < temp.size(); ++i)
|
||||
{
|
||||
if(i != 0)
|
||||
bufferedWriter.write(',');
|
||||
bufferedWriter.write(temp.get(i));
|
||||
|
||||
}
|
||||
bufferedWriter.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
2
Task_Managment_application/user_data.txt
Normal file
2
Task_Managment_application/user_data.txt
Normal file
@ -0,0 +1,2 @@
|
||||
david,w
|
||||
rohane,rohane
|
BIN
tma_westgate.jar
Normal file
BIN
tma_westgate.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user