Skip to content

Commit

Permalink
Updated sign in/sign out software for use in the front office of Pool…
Browse files Browse the repository at this point in the history
…esville High School.
  • Loading branch information
ishanashastri committed Jun 4, 2017
1 parent 615e240 commit 2934d72
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 51 deletions.
8 changes: 3 additions & 5 deletions src/JavaFXGUI/EnterInfoTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ public void addData(ArrayList<String> option){
printWriter.print("\"" + st.getStudentID() + "\",");
printWriter.print("\"" + st.getName() + "\",");
printWriter.print("\"" + st.getGrade() + "\",");
for(int i = 0;i<st.getTime().size();i++){
printWriter.print("\"" + st.getTime().get(i) + "\",");
}
printWriter.print("\"" + st.getTime() + "\",");
for(int i = 0;i<st.getReason().size();i++){
printWriter.print("\"" + st.getReason().get(i) + "\",");
}
Expand Down Expand Up @@ -288,8 +286,8 @@ public void addData(ArrayList<String> option){
for(int i = 0;i<st.getExcused().size();i++){
printWriter.print("\"" + st.getExcused().get(i) + "\",");
}
for(int i = 0;i<st.getTime().size();i++){
printWriter.print("\"" + st.getTime().get(i) + "\",");
for(int i = 0;i<st.getDepTime().size();i++){
printWriter.print("\"" + st.getDepTime().get(i) + "\",");
}
for(int i = 0;i<st.getArrTime().size();i++){
printWriter.print("\"" + st.getArrTime().get(i) + "\",");
Expand Down
33 changes: 15 additions & 18 deletions src/JavaFXGUI/SettingHBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ private void print(){
htmlIn = htmlIn + "<td>" + st.getStudentID() + "</td>";
htmlIn = htmlIn + "<td>" + st.getName() + "</td>";
htmlIn = htmlIn + "<td>" + st.getGrade() + "</td>";
for(int i = 0;i<st.getTime().size();i++){
htmlIn = htmlIn + "<td>" + st.getTime().get(i) + "</td>";
}
htmlIn = htmlIn + "<td>" + st.getTime() + "</td>";
for(int i = 0;i<st.getReason().size();i++){
htmlIn = htmlIn + "<td>" + st.getReason().get(i) + "</td>";
}
Expand Down Expand Up @@ -242,8 +240,8 @@ private void print(){
for(int i = 0;i<st.getExcused().size();i++){
htmlOut = htmlOut + "<td>" + st.getExcused().get(i) + "</td>";
}
for(int i = 0;i<st.getTime().size();i++){
htmlOut = htmlOut + "<td>" + st.getTime().get(i) + "</td>";
for(int i = 0;i<st.getDepTime().size();i++){
htmlOut = htmlOut + "<td>" + st.getDepTime().get(i) + "</td>";
}
for(int i = 0;i<st.getArrTime().size();i++){
htmlOut = htmlOut + "<td>" + st.getArrTime().get(i) + "</td>";
Expand Down Expand Up @@ -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<temp.get(i).getTime().size();j++){
writer.print (temp.get(i).getTime().get(j) + ", ");
}
writer.print (temp.get(i).getTime() + ", ");
for(int j = 0; j< temp.get(i).getReason().size(); j++){
writer.print (temp.get(i).getReason().get(j) + ", ");
}
Expand Down Expand Up @@ -369,8 +365,8 @@ private void saveFile(){
for(int j = 0;j<temp.get(i).getExcused().size();j++){
writerOutIn.print (temp.get(i).getExcused().get(j) + ", ");
}
for(int j = 0;j<temp.get(i).getTime().size();j++){
writerOutIn.print (temp.get(i).getTime().get(j) + ", ");
for(int j = 0;j<temp.get(i).getDepTime().size();j++){
writerOutIn.print (temp.get(i).getDepTime().get(j) + ", ");
}
for(int j = 0;j<temp.get(i).getArrTime().size();j++){
writerOutIn.print (temp.get(i).getArrTime().get(j) + ", ");
Expand Down Expand Up @@ -601,11 +597,11 @@ public TableView createTableIn(){
columnList.get(i).prefWidthProperty().bind(tableSignIn.widthProperty().multiply(widths[i]));
if (i != 3){
columnList.get(i).setCellFactory(column -> {
return new TableCell<StudentProperty, Object>() {
return new TableCell<StudentProperty, String>() {
@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);
Expand Down Expand Up @@ -633,7 +629,7 @@ protected void updateItem(Object item, boolean empty) {
columnList.get(4).setCellValueFactory(new PropertyValueFactory<StudentProperty,
ArrayList<String>>("reason"));
columnList.get(5).setCellValueFactory(new PropertyValueFactory<StudentProperty,
ArrayList<String>>("time"));
String>("time"));

columnList.get(5).setSortable(true);
// columnList.get(5).setComparator(new TimeComparator());
Expand Down Expand Up @@ -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<StudentProperty, Object>() {
return new TableCell<StudentProperty, String>() {
@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);
Expand All @@ -691,8 +687,9 @@ protected void updateItem(Object item, boolean empty) {
ArrayList<String>>("reason"));
columnListOut.get(5).setCellValueFactory(new PropertyValueFactory<StudentProperty,
ArrayList<String>>("excused"));
String depTime = "";
columnListOut.get(6).setCellValueFactory(new PropertyValueFactory<StudentProperty,
ArrayList<String>>("time"));
ArrayList<String>>("depTime"));
columnListOut.get(7).setCellValueFactory(new PropertyValueFactory<StudentProperty,
ArrayList<String>>("arrTime"));

Expand Down
2 changes: 1 addition & 1 deletion src/JavaFXGUI/StartApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")));
Expand Down
4 changes: 1 addition & 3 deletions src/JavaFXGUI/StartTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<st.getTime().size();i++){
printWriter.print("\"" + st.getTime().get(i) + "\",");
}
printWriter.print("\"" + st.getTime() + "\",");
for(int i = 0;i<st.getReason().size();i++){
printWriter.print("\"" + st.getReason().get(i) + "\",");
}
Expand Down
2 changes: 1 addition & 1 deletion src/JavaFXGUI/TimeComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TimeComparator implements Comparator<Student>{
@Override

public int compare(Student o1, Student o2) {
return o1.getTime().get(0).compareTo(o2.getTime().get(0));
return o1.getTime().compareTo(o2.getTime());
}

}
21 changes: 14 additions & 7 deletions src/backend/Student.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class Student implements Comparable<Student>{
private String studentID;
private ArrayList<String> reason = new ArrayList<String>();
private String date;
private ArrayList<String> time = new ArrayList<String>();
private String time;
private ArrayList<String> depTime = new ArrayList<String>();
private ArrayList<String> excused = new ArrayList<String>();
private ArrayList<String> arrTime = new ArrayList<String>();

Expand All @@ -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);
}


Expand All @@ -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);
}


Expand Down Expand Up @@ -92,12 +93,12 @@ public void setReason(String reason) {
this.reason.add(reason);
}

public ArrayList<String> getTime(){
public String getTime(){
return time;
}

public void setTime(String t){
time.add(t);
time = t;
}

public String getDate(){
Expand All @@ -112,6 +113,12 @@ public ArrayList<String> getExcused() {
public void setExcused(String excused) {
this.excused.add(excused);
}
public void setDepTime(String depTime){
this.depTime.add(depTime);
}
public ArrayList<String> getDepTime(){
return depTime;
}
public void setArrTime(String arrTime) {
this.arrTime.add(arrTime);
}
Expand Down
38 changes: 23 additions & 15 deletions src/backend/StudentProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class StudentProperty {
private SimpleStringProperty studentID;
private ArrayList<SimpleStringProperty> reason = new ArrayList<SimpleStringProperty>();
private SimpleStringProperty date;
private ArrayList<SimpleStringProperty> time = new ArrayList<SimpleStringProperty>();
private SimpleStringProperty time;
private ArrayList<SimpleStringProperty> depTime = new ArrayList<SimpleStringProperty>();
private ArrayList<SimpleStringProperty> excused = new ArrayList<SimpleStringProperty>();
private ArrayList<SimpleStringProperty> arrTime = new ArrayList<SimpleStringProperty>();

Expand All @@ -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<st.getTime().size();i++){
time.add(new SimpleStringProperty(st.getTime().get(i)));
}
time = new SimpleStringProperty(st.getTime());
for(int i = 0;i<st.getExcused().size();i++){
excused.add(new SimpleStringProperty(st.getExcused().get(i)));
}
Expand Down Expand Up @@ -65,8 +64,8 @@ public void setStudentID(String studentID) {
this.studentID.set(studentID);
}

public ArrayList<SimpleStringProperty> getReason() {
return reason;
public String getReason(int i) {
return reason.get(i).get();
}

public void setReason(String reason) {
Expand All @@ -82,30 +81,39 @@ public void setDate(String date) {
this.date.set(date);
}

public ArrayList<SimpleStringProperty> 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<SimpleStringProperty> getArrTime() {
return arrTime;
public String getDepTime(int i){
// String dt = "";
// for(int i = 0;i<depTime.size();i++){
// dt+=depTime.get(i)+"\n";
// }return dt;
return depTime.get(0).get();
}
public void setDepTime(String depTime){
SimpleStringProperty d = new SimpleStringProperty(depTime);
this.depTime.add(d);
}
public String getArrTime(int i) {
return arrTime.get(i).get();
}

public void setArrTime(String arrTime) {
SimpleStringProperty a = new SimpleStringProperty(arrTime);
this.arrTime.add(a);
}
public ArrayList<SimpleStringProperty> 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);
}


Expand Down
3 changes: 2 additions & 1 deletion src/backup/2017-06-03-IN.csv
Original file line number Diff line number Diff line change
@@ -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""""",
1 change: 1 addition & 0 deletions src/backup/2017-06-03-OUT.csv
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DATE,ID,NAME,GR,REASON,EXCUSED,TIME,ARRTIME
"2017-06-03","353851","Ishana Shastri","10","Religious Reason","","10:48 PM",

0 comments on commit 2934d72

Please sign in to comment.