Skip to content
Snippets Groups Projects
Commit b6526491 authored by ArktikHunter's avatar ArktikHunter
Browse files

drop shift buggy

parent 7b3e5123
No related branches found
No related tags found
No related merge requests found
Showing with 20 additions and 14 deletions
......@@ -165,7 +165,6 @@ public class Controller {
System.out.println("manager daily clicked");
isDaily = true;
System.out.println(isDaily);
root = new BorderPane();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
headerLoader.setController(this);
header = headerLoader.load();
......@@ -179,14 +178,7 @@ public class Controller {
root.setTop(header);;
root.setLeft(sidePanel);
root.setBottom(bottomPanel);
dailyView = new DailyView();
dailyView.setModel(model);
root.setCenter(dailyView);
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
HBox box = (HBox) bottomPanel.getChildrenUnmodifiable().get(1);
Label currentDateText = (Label) box.getChildren().get(1);
......
......@@ -7,7 +7,9 @@ import java.util.ArrayList;
public class DailyView extends ScheduleView{
public DailyView() {}
public DailyView() {
System.out.println("new daily view");
}
public void draw(){
//clear
......
......@@ -234,7 +234,7 @@ public class Model {
return convertToShift(getShiftsByDay(date.toString()));
}
//format id.yyyy-mm-dd.start.end
//format id.yyyy-mm-dd.start.end.shiftID
//convert ArrayList<String> to ArrayList<Shift>
protected ArrayList<Shift> convertToShift(ArrayList<String> input){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-ddHHmm");
......@@ -246,7 +246,8 @@ public class Model {
if (strings[3].length() == 3) strings[3] = "0" + strings[3];
LocalDateTime start = LocalDateTime.parse(strings[1] + strings[2], formatter);
LocalDateTime end = LocalDateTime.parse(strings[1] + strings[3], formatter);
output.add(new Shift(id, start, end));
int shiftID = Integer.parseInt(strings[4]);
output.add(new Shift(id, start, end, shiftID));
}
return output;
}
......
......@@ -88,7 +88,7 @@ public class ScheduleView extends ScrollPane implements ModelSubscriber{
//Manager Buttons
Button remove = new Button("Remove Shift");
remove.setOnAction(removeShift);
remove.setOnAction(e -> removeShiftTest(shift.getShiftID()));
Button edit = new Button("Edit Shift");
edit.setOnAction(editShift);
......@@ -185,10 +185,15 @@ public class ScheduleView extends ScrollPane implements ModelSubscriber{
@Override
public void handle(ActionEvent actionEvent) {
System.out.println("todo: delete shift");
//model.removeShift();
dropShift.hide();
}
};
private void removeShiftTest(int shiftID){
model.removeShift(shiftID);
}
EventHandler<ActionEvent> editShift =
new EventHandler<ActionEvent>() {
@Override
......
......@@ -7,13 +7,15 @@ public class Shift {
private LocalDateTime start;
private LocalDateTime end;
private boolean available;
private int shiftID;
//todo: error checking on start/end? (end cannot be before start)
public Shift(int EmpID, LocalDateTime start, LocalDateTime end){
public Shift(int EmpID, LocalDateTime start, LocalDateTime end, int shiftID){
this.EmployeeID = EmpID;
this.start = start;
this.end = end;
this.available = false;
this.shiftID = shiftID;
}
public int getEmployeeID() {
......@@ -48,6 +50,10 @@ public class Shift {
this.available = available;
}
public int getShiftID(){
return shiftID;
}
//todo
// output: true if this shift and the given shift overlap at all, otherwise false
public boolean overlaps(Shift otherShift){
......
......@@ -28,7 +28,7 @@ public class WeeklyView extends ScheduleView{
public void draw(){
//clear
this.getChildren().clear();
contents.getChildren().clear();
//add to gridpane - time axis never changes
int i = 1;
......
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