Skip to content
Snippets Groups Projects
Commit d7dd8f45 authored by eyan_'s avatar eyan_
Browse files

test

parent 1398fbec
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,6 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
......@@ -14,6 +12,8 @@ import javafx.scene.layout.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
public class Controller {
@FXML
......@@ -46,7 +46,8 @@ public class Controller {
Stage popupStage;
Scene popupScene;
Model model = new Model();
public void scheduleButtonClicked() throws IOException {
......@@ -92,26 +93,31 @@ public class Controller {
public void addShiftClicked() throws IOException {
FXMLLoader popupLoader = new FXMLLoader(this.getClass().getResource("addShiftPopup.fxml"));
Scene popupScene = new Scene(popupLoader.load(),500,500);
Stage popupStage = new Stage();
popupScene = new Scene(popupLoader.load(),500,500);
popupStage = new Stage();
popupStage.setScene(popupScene);
popupStage.show();
}
public void populateEmployeeBox(MouseEvent event) {
ArrayList<String> aList = model.getEmployees();
ObservableList<String> list = FXCollections.observableArrayList();
list.add("test");
list.add("test1");
aList.forEach(employee-> list.add(employee));
ComboBox test = (ComboBox) event.getSource();
test.setItems(list);
}
public void addShiftSubmitClicked(){
public void addShiftSubmitClicked(MouseEvent event){
System.out.println("submit clicked");
String employee = (String) addShiftEmployeeBox.getValue();
System.out.println(addShiftEmployeeBox.getSelectionModel().getSelectedIndex());
String startTime = addShiftStartTime.getText();
String endTime = addShiftEndTime.getText();
LocalDate date = addShiftDatePicker.getValue();
System.out.println(employee + startTime + endTime + date);
}
......
......@@ -6,11 +6,13 @@ public class Model {
protected Staff staff;
protected Schedule schedule;
private Connection dbConnection;
ScheduleClient sc;
public Model(){
connectDataBase();
this.staff = new Staff(dbConnection);
this.schedule = new Schedule(dbConnection);
this.sc = new ScheduleClient("10.237.93.139",8989);
}
protected String connectDataBase(){
......@@ -32,5 +34,4 @@ public class Model {
*/
}
}
......@@ -119,4 +119,27 @@ public class ScheduleClient {
System.out.println("Data retrieved.");
System.out.println("ScheduleClient is ready to use!");
}
public ArrayList<String> returnFormattedEmployee(){
ArrayList<String> result = new ArrayList<>();
ArrayList<String> temp = this.employees;
String tempName = "";
temp.remove(0);
for(int i = 0; i < temp.size(); i++){
String[] templist = temp.get(i).split("\\.");
for(int j =0; j < 3; j++){
if(j == 1 || j == 2){
tempName += templist[j];
}
if(j == 1){
tempName += " ";
}
}
result.add(tempName);
tempName = "";
}
System.out.println(result);
return result;
}
}
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment