diff --git a/src/JavaFXGUI/EnterInfoTab.java b/src/JavaFXGUI/EnterInfoTab.java index afe08ee..02e7504 100644 --- a/src/JavaFXGUI/EnterInfoTab.java +++ b/src/JavaFXGUI/EnterInfoTab.java @@ -94,7 +94,7 @@ public EnterInfoTab(MenuTabPane par, EnterStudentTab prev, String title, // infoOptionSelect.removeChoiceBox(); if (stringData.equals("+++")){ v ++; - infoOptionSelect.removeChoiceBox(); +// infoOptionSelect.addChoiceBox(true, infoOptionSelect); } else if (stringData.equals("++")&& version == v){ page++; @@ -106,7 +106,7 @@ else if (stringData.equals("++")&& version == v){ else{ infoOptionSelect.addPage(stringData); } - infoOptionSelect.removeChoiceBox(); +// infoOptionSelect.addChoiceBox(true, infoOptionSelect); } else if (stringData.equals("++++")){ stringData=file.nextLine(); @@ -129,13 +129,13 @@ else if (stringData.equals("++++")){ data2.add(stringData); stringData=file.nextLine(); } - infoOptionSelect.splitScreen(page+1, title1, title2, data1, data2); - infoOptionSelect.addChoiceBox(); + infoOptionSelect.splitScreen(page+1, title1, title2, data1, data2, infoOptionSelect); } +// infoOptionSelect.addChoiceBox(false, infoOptionSelect); } else if (version == v){ infoOptionSelect.addButton(page, stringData, stringData); - infoOptionSelect.removeChoiceBox(); +// infoOptionSelect.addChoiceBox(true, infoOptionSelect); } } file.close(); @@ -143,8 +143,7 @@ else if (version == v){ Button backButton = new Button("Back to Start"); backButton.setOnAction(e -> goBackToHome()); - backButton.setPrefSize(150, 20); -// backButton.getStylesheets().add(getClass().getResource("backButton").toString()); + backButton.setPrefSize(175, 20); HBox navHBox = new HBox(); navHBox.setPadding(new Insets(15, 12, 15, 12)); @@ -172,36 +171,6 @@ else if (version == v){ setContent(content); } - public void updateScrollPane(ArrayList option){ - - summaryLeftVBox.getChildren().clear(); - summariesOptions = new ArrayList(); - - Separator separator = new Separator(); - summaryLeftVBox.getChildren().add(separator); - ArrayList titleList = infoOptionSelect.getPageTitles(); - for (int i = 0; i < titleList.size(); i++){ - summariesOptions.add(new AnimatedLabel (titleList.get(i) +" "+option.get(i))); - } - - for (int i = 0; i < summariesOptions.size(); i++){ - summariesOptions.get(i).getStyleClass().add("summaryLabel"); - summariesOptions.get(i).setWrapText(true); - summaryLeftVBox.getChildren().add(summariesOptions.get(i)); - } - } - public void updateAnimation(int page){ - - for (int i = 0; i < summariesOptions.size(); i++){ - if ( page == i){ - summariesOptions.get(i).play(); - - } - else{ - summariesOptions.get(i).stop(); - } - } - } /** * Transfers focus to the previous tab. */ @@ -223,13 +192,15 @@ public void die(){ */ public void addData(ArrayList option){ - if (option.get(0).isEmpty()){ + if (option.get(0).isEmpty() || option.get(1).isEmpty()){ alert.play(); } else{ if (!goingIn){ student.setReason(option.get(0)); student.setExcused(option.get(1)); + System.out.println(option.get(0)); + System.out.println(option.get(1)); data.get("outin").add(student); } else{ diff --git a/src/JavaFXGUI/EnterStudentTab.java b/src/JavaFXGUI/EnterStudentTab.java index 4e7c172..66d757d 100644 --- a/src/JavaFXGUI/EnterStudentTab.java +++ b/src/JavaFXGUI/EnterStudentTab.java @@ -280,21 +280,11 @@ private void moveOn(boolean signIn, Student student){ int j = 0; for (int i =0; i < data.get("outin").getStudentList().size(); i++){ if (student.equals(data.get("outin").getStudentList().get(i))){ - System.out.println(student.getArrTime()); - System.out.println(student.getArrTime().equals("None")); +// System.out.println(student.getArrTime()); +// System.out.println(student.getArrTime().equals("None")); if(student.getArrTime().equals("None")){ j = i; outin=true; - }else{ - if (signIn){ - tab3= new EnterInfoTab(parent, this, "Enter Information", data, signIn, student); - } - else{ - tab3 = new EnterInfoTab(parent, this, "Enter Information", data, signIn, student); - } - setDisable(true); - parent.getTabs().add(tab3); - parent.getSelectionModel().select(tab3); } } } @@ -304,8 +294,11 @@ private void moveOn(boolean signIn, Student student){ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm a", Locale.US); LocalTime todayTime = LocalTime.now(); String time = formatter.format(todayTime); - - data.get("outin").getStudentList().get(j).setArrTime(time); + if(data.get("outin").getStudentList().get(j).getArrTime().length()>data.get("outin").getStudentList().get(j).getTime().length()){ + data.get("outin").getStudentList().get(j).setTime(time); + }else{ + data.get("outin").getStudentList().get(j).setArrTime(time); + } LocalDate todayDate = LocalDate.now(); String date = todayDate.toString(); File f = new File("src/backup/" + date+"-OUT.csv"); @@ -337,8 +330,7 @@ private void moveOn(boolean signIn, Student student){ } goBack(true); } - else - { + else{ if (signIn){ tab3= new EnterInfoTab(parent, this, "Enter Information", data, signIn, student); } @@ -349,9 +341,6 @@ private void moveOn(boolean signIn, Student student){ parent.getTabs().add(tab3); parent.getSelectionModel().select(tab3); } - } - - - } + diff --git a/src/JavaFXGUI/OptionSelect.java b/src/JavaFXGUI/OptionSelect.java index ac4faf1..9d0bd24 100644 --- a/src/JavaFXGUI/OptionSelect.java +++ b/src/JavaFXGUI/OptionSelect.java @@ -53,6 +53,8 @@ public class OptionSelect extends VBox{ private FadeTransition ftOut; private ArrayList optionHBoxArray = new ArrayList(); private ChoiceBox c; + private HBox hb; + private ToggleGroup tg; /** * Constructor. The data of the optionSelect is represented by an ArrayList of Strings that indicates what options where selected. * @param w Width of the optionSelect @@ -105,19 +107,10 @@ public void init(){ getStyleClass().add("optionSelect"); HBox contentHBox = new HBox(); -// pageButtonLeft = new Button(); -// pageButtonLeft.getStyleClass().add("pageButton-left"); -// pageButtonLeft.setOnAction(new NextHandler(false)); - -// pageButtonRight = new Button(); -// pageButtonRight.getStyleClass().add("pageButton-right"); -// pageButtonRight.setOnAction(new NextHandler(true)); - -// contentHBox.getChildren().add(pageButtonLeft); buttonVBox = new VBox(); buttonVBox.getStyleClass().add("buttonVBox"); - contentHBox.getChildren().addAll(buttonVBox);//, pageButtonRight); + contentHBox.getChildren().addAll(buttonVBox); getChildren().add(contentHBox); bottomHBox = new HBox(); @@ -159,31 +152,11 @@ public void addPage(String t){ * @param pg The page to be displayed */ private void updateState(int pg){ -// if(pg == 0 && pg == buttonList.size()-1){ -// pageButtonLeft.setDisable(true); -// pageButtonRight.setDisable(true); -// } -// else if(pg == 0 && pg == buttonList.size()-2){ -// pageButtonLeft.setDisable(true); -// pageButtonRight.setDisable(true); -// } -// else if (pg == 0){ -// pageButtonLeft.setDisable(true); -// pageButtonRight.setDisable(false); -// } -// else if (pg == buttonList.size()-1){ -// pageButtonLeft.setDisable(false); -// pageButtonRight.setDisable(true); -// } -// else{ -// pageButtonLeft.setDisable(false); -// pageButtonRight.setDisable(false); -// } titleLabel.setText(title.get(pg)); page = pg; buttonVBox.getChildren().clear(); - double buttonHeight = (double)(height-80)/ (buttonList.get(page).size()+1); + double buttonHeight = (double)(height-100)/ (buttonList.get(page).size()+1); double buttonWidth = (double)(width); if (buttonList.get(page).size() >=3){ @@ -235,57 +208,65 @@ else if (buttonList.get(page).size() == 1){ optionHBoxArray.get(page).setPrefWidth(buttonWidth); buttonVBox.getChildren().add(optionHBoxArray.get(page)); - tabToBeClosed.updateScrollPane(option); - tabToBeClosed.updateAnimation(pg); + } - public void splitScreen(int page, String title1, String title2, ArrayList data1, ArrayList data2){ + public void splitScreen(int page, String title1, String title2, ArrayList data1, ArrayList data2, OptionSelect o){ ArrayList left = new ArrayList(); for(int i =0;i right = new ArrayList(); - VBox bV = new VBox(); - for(int i = 0; i< data2.size();i++){ - OptionButton opt = new OptionButton(data2.get(i), data2.get(i), page); - opt.setPrefWidth((double)width-100); - opt.setPrefHeight((double)(height-80)/(buttonList.get(page).size()+1)); - right.add(opt); - } - bV.getChildren().add(right.get(page)); - bV.getChildren().add(left.get(page)); - - buttonList.get(page).addAll(left) ; option.add(""); - OptionHBox textFieldOtherHBox = new OptionHBox(width, this, buttonList.size()-1); - textFieldOtherHBox.getStyleClass().add("optionTextFieldOther"); - optionHBoxArray.add(textFieldOtherHBox); + + buttonVBox.getChildren().remove(optionHBoxArray.get(page)); updateState(0); - + addChoiceBox(false,o); + buttonVBox.getChildren().remove(optionHBoxArray.get(page)); } - public void addChoiceBox(){ - c = new ChoiceBox(FXCollections.observableArrayList("Health Room", "Parent", "Other")); - c.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, Number value, Number new_value) { -// new ChoiceHandler(c.getSelectionModel().getSelectedItem().toString(),this); - addInfo(c.getSelectionModel().getSelectedItem().toString()); + public void addChoiceBox(boolean rem, OptionSelect o){ + RadioButton h = new RadioButton("Health Room"); + h.getStyleClass().add("RadioButton"); + RadioButton p = new RadioButton("Parent"); + p.getStyleClass().add("RadioButton"); + + Label l = new Label("Enter who you were excused by: "); + l.getStyleClass().add("RadioButton"); + + tg = new ToggleGroup(); + h.setToggleGroup(tg); p.setToggleGroup(tg); + tg.selectedToggleProperty().addListener((ObservableValue ov, Toggle toggle, Toggle new_toggle) -> { + for(String opt: option){ + System.out.println(opt); } + String[] pts = tg.getSelectedToggle().toString().split("'"); + option.add(1,pts[1]); + submitButton.requestFocus(); }); - c.setMaxSize(100,100); - buttonVBox.getChildren().add(c); - JRadioButton h = new JRadioButton("Health Room"); - JRadioButton p = new JRadioButton("Parent"); - ButtonGroup bg = new ButtonGroup(); - bg.add(p); bg.add(h); + + HBox hb = new HBox(70); + hb.getChildren().addAll(l,h,p); + hb.setAlignment(Pos.CENTER); + + buttonVBox.getChildren().add(hb); + System.out.println("called1"); submitButton.requestFocus(); + if(rem){ + removeChoiceBox(); + } } public void removeChoiceBox(){ + if(buttonVBox.getChildren().contains(optionHBoxArray)){ + buttonVBox.getChildren().remove(hb); + } + System.out.println("called"); // if(buttonVBox.getChildren().contains(c)){ - buttonVBox.getChildren().remove(c); +//// System.out.println(buttonVBox.getChildren().contains(c)); +// c.setDisable(true); +// buttonVBox.getChildren().remove(c); // } } /** diff --git a/src/JavaFXGUI/StartApplication.java b/src/JavaFXGUI/StartApplication.java index e642aa2..e6fa3ce 100644 --- a/src/JavaFXGUI/StartApplication.java +++ b/src/JavaFXGUI/StartApplication.java @@ -205,14 +205,14 @@ public StudentList readStudentDatabase(String fileName, String opt){ int i = 0; for(String fieldName: file.nextLine().split(",")){ field.put(fieldName.trim(), i++); - System.out.println(field); } - + //Load in student data ArrayList> studentData = new ArrayList>(); while(file.hasNext()){ ArrayList aStudent = new ArrayList(); String line = file.nextLine(); +// System.out.println(line); // System.out.println("nl"+line); line = line.substring(1); line = line.substring(0,line.length()-1); diff --git a/src/css/application.css b/src/css/application.css index 7e31b8c..114556f 100644 --- a/src/css/application.css +++ b/src/css/application.css @@ -278,6 +278,9 @@ -fx-alignment: center; } +.RadioButton { + -fx-font-size: 15px; +} .tab{ -fx-background-color: #FFF; -fx-border-color: #eeeeee;