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

fixed controller

parent 1d4356f2
No related branches found
No related tags found
No related merge requests found
package com.example.schedulerapp;
<<<<<<< HEAD
import javafx.event.Event;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Calendar;
......@@ -20,272 +26,239 @@ public class Controller {
VBox leftSideButtons;
@FXML
BorderPane rootBorderPane;
@FXML
TextArea employees;
@FXML
private TextField addFirstName;
@FXML
private TextField addLastName;
@FXML
private TextField removeID;
Calendar test;
public void scheduleButtonClicked() throws Exception {
=======
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.io.IOException;
public class Controller {
Model model = new Model();
public void scheduleButtonClicked(){
>>>>>>> combo
System.out.println("schedule button clicked");
dailyScheduleButtonClicked();
leftSideButtons.setVisible(true);
Model model = new Model();
}
public void paystubButtonClicked() throws IOException {
System.out.println("paystub button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("paystubView.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
leftSideButtons.setVisible(false);
public void scheduleButtonClicked() {
System.out.println("schedule button clicked");
dailyScheduleButtonClicked();
leftSideButtons.setVisible(true);
}
public void availabilityButtonClicked(){
System.out.println("availability button clicked");
}
public void timeoffButtonClicked(){
System.out.println("timeoff button clicked");
}
public void dailyScheduleButtonClicked() throws IOException {
test = new GregorianCalendar();
}
public void paystubButtonClicked() throws IOException {
System.out.println("paystub button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("paystubView.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
leftSideButtons.setVisible(false);
System.out.println("month" + test.get(Calendar.MONTH));
test.add(Calendar.MONTH,9);
System.out.println(test.get(Calendar.DAY_OF_MONTH));
}
public void availabilityButtonClicked() {
System.out.println("availability button clicked");
}
public void timeoffButtonClicked () {
System.out.println("timeoff button clicked");
}
public void weeklyScheduleButtonClicked () throws Exception {
System.out.println("weekly schedule button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("weeklySchedule.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
}
public void pickupsButtonClicked () {
System.out.println("pickups button clicked");
}
public void prevButtonClicked () {
System.out.println("prev button clicked");
}
public void jumpButtonClicked () {
System.out.println("jump button clicked");
}
public void nextButtonClicked () {
System.out.println("next button clicked");
}
public void managementButtonClicked () throws IOException {
System.out.println("management button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("managementView.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
}
public void createScheduleClicked () {
System.out.println("create schedule clicked");
}
public void modifyScheduleClicked () {
System.out.println("modify schedule clicked");
}
public void addEmployeeClicked () {
System.out.println("add employee clicked");
}
public void removeEmployeeClicked () {
System.out.println("remove employee clicked");
}
public void logInClicked () {
System.out.println("log in clicked");
}
public void employeeTestClicked () throws IOException {
System.out.println("employee test clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("employeeMainView.fxml"));
rootBorderPane.setCenter(fxmlLoader.load());
}
public void employerTestClicked () throws IOException {
System.out.println("employer test clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("employerMainView.fxml"));
rootBorderPane.setCenter(fxmlLoader.load());
}
System.out.println("daily schedule button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("dailySchedule.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
// Login Page
public void managerLoginClicked (MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("dailySchedManager.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("schedSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
FXMLLoader bottomLoader = new FXMLLoader(this.getClass().getResource("schedBottomPanelManager.fxml"));
Parent bottomPanel = bottomLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setBottom(bottomPanel);
root.setCenter(grid);
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
public void employeeLoginClicked (MouseEvent mouseEvent) throws IOException {
FXMLLoader employeeLoader = new FXMLLoader(this.getClass().getResource("mainView.fxml"));
Parent root = employeeLoader.load();
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
}
public void weeklyScheduleButtonClicked() throws Exception {
System.out.println("weekly schedule button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("weeklySchedule.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
}
public void pickupsButtonClicked(){
System.out.println("pickups button clicked");
}
public void prevButtonClicked(){
System.out.println("prev button clicked");
}
public void jumpButtonClicked(){
System.out.println("jump button clicked");
}
public void nextButtonClicked(){
System.out.println("next button clicked");
}
<<<<<<< HEAD
public void managementButtonClicked() throws IOException {
System.out.println("management button clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("managementView.fxml"));
myBorderPane.setCenter(null);
myBorderPane.setCenter(fxmlLoader.load());
}
public void createScheduleClicked(){
System.out.println("create schedule clicked");
}
public void modifyScheduleClicked(){
System.out.println("modify schedule clicked");
}
public void addEmployeeClicked(){
System.out.println("add employee clicked");
}
public void removeEmployeeClicked(){
System.out.println("remove employee clicked");
}
public void logInClicked(){
System.out.println("log in clicked");
}
public void employeeTestClicked() throws IOException {
System.out.println("employee test clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("employeeMainView.fxml"));
rootBorderPane.setCenter(fxmlLoader.load());
}
public void employerTestClicked() throws IOException {
System.out.println("employer test clicked");
FXMLLoader fxmlLoader = new FXMLLoader(ScheduleApp.class.getResource("employerMainView.fxml"));
rootBorderPane.setCenter(fxmlLoader.load());
=======
// Header
public void mangerLogoutClicked (MouseEvent mouseEvent) throws IOException {
FXMLLoader loginLoader = new FXMLLoader(this.getClass().getResource("login.fxml"));
Parent root = loginLoader.load();
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Login Page
public void managerLoginClicked(MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("dailySchedManager.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("schedSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
FXMLLoader bottomLoader = new FXMLLoader(this.getClass().getResource("schedBottomPanelManager.fxml"));
Parent bottomPanel = bottomLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setBottom(bottomPanel);
root.setCenter(grid);
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Manager Page
public void employeeLoginClicked(MouseEvent mouseEvent) throws IOException {
FXMLLoader employeeLoader = new FXMLLoader(this.getClass().getResource("mainView.fxml"));
Parent root = employeeLoader.load();
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Staff Section
// Switch to Staff Page
public void staffManagerClicked (MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("addEmployee.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Header
public void mangerLogoutClicked(MouseEvent mouseEvent) throws IOException {
FXMLLoader loginLoader = new FXMLLoader(this.getClass().getResource("login.fxml"));
Parent root = loginLoader.load();
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Side Panel
// Switch to Edit Employee
public void editStaffSidePanelClicked (MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("editEmployee.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Switch to Remove Employee
public void removeStaffSidePanelClicked (MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("removeEmployee.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Switch to View Employees
// Manager Page
public void viewStaffSidePanelClicked (MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("viewEmployees.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
// Staff Section
// Switch to Staff Page
public void staffManagerClicked(MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("addEmployee.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Side Panel
// Switch to Edit Employee
public void editStaffSidePanelClicked(MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("editEmployee.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
>>>>>>> combo
}
// Switch to Remove Employee
public void removeStaffSidePanelClicked(MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("removeEmployee.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Switch to View Employees
@FXML
TextArea employees = new TextArea();
public void viewStaffSidePanelClicked(MouseEvent mouseEvent) throws IOException {
BorderPane root = new BorderPane();
FXMLLoader gridLoader = new FXMLLoader(this.getClass().getResource("viewEmployees.fxml"));
Parent grid = gridLoader.load();
FXMLLoader headerLoader = new FXMLLoader(this.getClass().getResource("headerManager.fxml"));
Parent header = headerLoader.load();
FXMLLoader sideLoader = new FXMLLoader(this.getClass().getResource("staffManagerSidePanel.fxml"));
Parent sidePanel = sideLoader.load();
root.setTop(header);
root.setLeft(sidePanel);
root.setCenter(grid);
Stage stage = (Stage)((Node)mouseEvent.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 800, 600);
stage.setTitle("Scheduler App");
stage.setScene(scene);
stage.show();
}
// Add, Edit, Remove Functions
// Add Employee
@FXML
private TextField addFirstName;
@FXML
private TextField addLastName;
@FXML
private TextField removeID;
}
// Add, Edit, Remove Functions
// Add Employee
public void addEmployeeClicked(MouseEvent mouseEvent) {
String firstName = addFirstName.getText();
String lastName = addLastName.getText();
model.staff.addEmployee(firstName, lastName);
System.out.println("Employee " + firstName + " " + lastName + " added to Staff. Welcome "
+ firstName + "!");
}
public void addEmployeeClicked (MouseEvent mouseEvent){
String firstName = addFirstName.getText();
String lastName = addLastName.getText();
model.staff.addEmployee(firstName, lastName);
System.out.println("Employee " + firstName + " " + lastName + " added to Staff. Welcome "
+ firstName + "!");
}
// Edit employee
public void editEmployeeClicked(MouseEvent mouseEvent) {
//edit employee
}
// Edit employee
public void editEmployeeClicked (MouseEvent mouseEvent){
//edit employee
}
// Remove Employee
public void removeEmployeeClicked(MouseEvent mouseEvent) {
int id = Integer.parseInt(removeID.getText());
model.staff.removeEmployee(id);
}
// Remove Employee
public void removeEmployeeClicked (MouseEvent mouseEvent){
int id = Integer.parseInt(removeID.getText());
model.staff.removeEmployee(id);
}
// View Employees
// View Employees
private void dailyScheduleButtonClicked () {
}
}
}
\ No newline at end of file
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