diff --git a/src/JavaFXGUI/EnterInfoTab.java b/src/JavaFXGUI/EnterInfoTab.java index c891822..f46954e 100644 --- a/src/JavaFXGUI/EnterInfoTab.java +++ b/src/JavaFXGUI/EnterInfoTab.java @@ -252,9 +252,7 @@ public void addData(ArrayList option){ printWriter.print("\"" + st.getStudentID() + "\","); printWriter.print("\"" + st.getName() + "\","); printWriter.print("\"" + st.getGrade() + "\","); - for(int i = 0;i option){ for(int i = 0;i" + st.getStudentID() + ""; htmlIn = htmlIn + "" + st.getName() + ""; htmlIn = htmlIn + "" + st.getGrade() + ""; - for(int i = 0;i" + st.getTime().get(i) + ""; - } + htmlIn = htmlIn + "" + st.getTime() + ""; for(int i = 0;i" + st.getReason().get(i) + ""; } @@ -242,8 +240,8 @@ private void print(){ for(int i = 0;i" + st.getExcused().get(i) + ""; } - for(int i = 0;i" + st.getTime().get(i) + ""; + for(int i = 0;i" + st.getDepTime().get(i) + ""; } for(int i = 0;i" + st.getArrTime().get(i) + ""; @@ -334,9 +332,7 @@ private void saveFile(){ writer.print (temp.get(i).getName() + ", "); writer.print (temp.get(i).getStudentID() + ", "); writer.print (temp.get(i).getGrade() + ", "); - for(int j = 0;j { - return new TableCell() { + return new TableCell() { @Override - protected void updateItem(Object item, boolean empty) { + protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); - Text text = new Text(item.toString()); + Text text = new Text(item); text.wrappingWidthProperty().bind(getTableColumn().widthProperty()); // Setting the wrapping width to the Text text.setTextAlignment(TextAlignment.CENTER); setGraphic(text); @@ -633,7 +629,7 @@ protected void updateItem(Object item, boolean empty) { columnList.get(4).setCellValueFactory(new PropertyValueFactory>("reason")); columnList.get(5).setCellValueFactory(new PropertyValueFactory>("time")); + String>("time")); columnList.get(5).setSortable(true); // columnList.get(5).setComparator(new TimeComparator()); @@ -663,11 +659,11 @@ public TableView createTableInOut(){ columnListOut.get(i).prefWidthProperty().bind(tableSignOut.widthProperty().multiply(widthsOut[i])); if (i != 3){ columnListOut.get(i).setCellFactory(column -> { - return new TableCell() { + return new TableCell() { @Override - protected void updateItem(Object item, boolean empty) { + protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); - Text text = new Text(item.toString()); + Text text = new Text(item); text.wrappingWidthProperty().bind(getTableColumn().widthProperty()); // Setting the wrapping width to the Text text.setTextAlignment(TextAlignment.CENTER); setGraphic(text); @@ -691,8 +687,9 @@ protected void updateItem(Object item, boolean empty) { ArrayList>("reason")); columnListOut.get(5).setCellValueFactory(new PropertyValueFactory>("excused")); + String depTime = ""; columnListOut.get(6).setCellValueFactory(new PropertyValueFactory>("time")); + ArrayList>("depTime")); columnListOut.get(7).setCellValueFactory(new PropertyValueFactory>("arrTime")); diff --git a/src/JavaFXGUI/StartApplication.java b/src/JavaFXGUI/StartApplication.java index 3e98fcc..a1fee83 100644 --- a/src/JavaFXGUI/StartApplication.java +++ b/src/JavaFXGUI/StartApplication.java @@ -257,7 +257,7 @@ else if (opt == "o"){ String name = student.get(field.get("NAME")); int grade = Integer.parseInt(student.get(field.get("GR"))); Student st = new Student (name,grade,id); - st.setTime(student.get(field.get("TIME"))); + st.setDepTime(student.get(field.get("DEPTIME"))); st.setReason(student.get(field.get("REASON"))); st.setArrTime(student.get(field.get("ARRTIME"))); st.setExcused(student.get(field.get("EXCUSED"))); diff --git a/src/JavaFXGUI/StartTab.java b/src/JavaFXGUI/StartTab.java index 1dd4151..89d7ecd 100644 --- a/src/JavaFXGUI/StartTab.java +++ b/src/JavaFXGUI/StartTab.java @@ -373,9 +373,7 @@ public void submit(String txt){ printWriter.print("\"" + st.getStudentID() + "\","); printWriter.print("\"" + st.getName() + "\","); printWriter.print("\"" + st.getGrade() + "\","); - for(int i = 0;i{ @Override public int compare(Student o1, Student o2) { - return o1.getTime().get(0).compareTo(o2.getTime().get(0)); + return o1.getTime().compareTo(o2.getTime()); } } diff --git a/src/backend/Student.java b/src/backend/Student.java index 92b0b5f..5222e79 100644 --- a/src/backend/Student.java +++ b/src/backend/Student.java @@ -17,7 +17,8 @@ public class Student implements Comparable{ private String studentID; private ArrayList reason = new ArrayList(); private String date; - private ArrayList time = new ArrayList(); + private String time; + private ArrayList depTime = new ArrayList(); private ArrayList excused = new ArrayList(); private ArrayList arrTime = new ArrayList(); @@ -38,8 +39,8 @@ public Student(String n, int g, String sID){ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm a", Locale.US); LocalTime todayTime = LocalTime.now(); - time.add(formatter.format(todayTime)); - + time = formatter.format(todayTime); + depTime.add(time); } @@ -57,8 +58,8 @@ public Student(Student other) { date = todayDate.toString(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm a", Locale.US); LocalTime todayTime = LocalTime.now(); - time.add(formatter.format(todayTime)); - + time = formatter.format(todayTime); + depTime.add(time); } @@ -92,12 +93,12 @@ public void setReason(String reason) { this.reason.add(reason); } - public ArrayList getTime(){ + public String getTime(){ return time; } public void setTime(String t){ - time.add(t); + time = t; } public String getDate(){ @@ -112,6 +113,12 @@ public ArrayList getExcused() { public void setExcused(String excused) { this.excused.add(excused); } + public void setDepTime(String depTime){ + this.depTime.add(depTime); + } + public ArrayList getDepTime(){ + return depTime; + } public void setArrTime(String arrTime) { this.arrTime.add(arrTime); } diff --git a/src/backend/StudentProperty.java b/src/backend/StudentProperty.java index 4dae185..23ab9a5 100644 --- a/src/backend/StudentProperty.java +++ b/src/backend/StudentProperty.java @@ -14,7 +14,8 @@ public class StudentProperty { private SimpleStringProperty studentID; private ArrayList reason = new ArrayList(); private SimpleStringProperty date; - private ArrayList time = new ArrayList(); + private SimpleStringProperty time; + private ArrayList depTime = new ArrayList(); private ArrayList excused = new ArrayList(); private ArrayList arrTime = new ArrayList(); @@ -30,9 +31,7 @@ public StudentProperty(Student st){ reason.add(new SimpleStringProperty(st.getReason().get(i))); } date = new SimpleStringProperty(st.getDate()); - for(int i = 0;i getReason() { - return reason; + public String getReason(int i) { + return reason.get(i).get(); } public void setReason(String reason) { @@ -82,30 +81,39 @@ public void setDate(String date) { this.date.set(date); } - public ArrayList getExcused() { - return excused; + public String getExcused(int i) { + return excused.get(i).get(); } public void setExcused(String excused) { SimpleStringProperty e = new SimpleStringProperty(excused); this.excused.add(e); } - - public ArrayList getArrTime() { - return arrTime; + public String getDepTime(int i){ +// String dt = ""; +// for(int i = 0;i getTime() { - return time; + public String getTime() { + return time.get(); } public void setTime(String time) { - SimpleStringProperty t = new SimpleStringProperty(time); - this.time.add(t); + this.time.set(time); } diff --git a/src/backup/2017-06-03-IN.csv b/src/backup/2017-06-03-IN.csv index da2a27d..fcdf38b 100644 --- a/src/backup/2017-06-03-IN.csv +++ b/src/backup/2017-06-03-IN.csv @@ -1,2 +1,3 @@ DATE,ID,NAME,GR,TIME,REASON -"2017-06-03","441161","Mariam Rahman","9","04:43 PM","Transportation", +"2017-06-03","441161","Mariam Rahman","9","08:39 PM","04:56 PM"""", +"2017-06-03","363974","Tess Insalaco","9","08:39 PM","Unexcused""""", diff --git a/src/backup/2017-06-03-OUT.csv b/src/backup/2017-06-03-OUT.csv index 8be6953..f3cdaf0 100644 --- a/src/backup/2017-06-03-OUT.csv +++ b/src/backup/2017-06-03-OUT.csv @@ -1 +1,2 @@ DATE,ID,NAME,GR,REASON,EXCUSED,TIME,ARRTIME +"2017-06-03","353851","Ishana Shastri","10","Religious Reason","","10:48 PM",