package scheduler.view; import javafx.fxml.FXML; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import scheduler.Main; public class ViewTableController extends ViewScheduleController { @FXML private TableView<Section> sectionTable; @FXML private TableColumn<Section, String> course; @FXML private TableColumn<Section, String> section; @FXML private TableColumn<Section, String> type; @FXML private TableColumn<Section, String> num; @FXML private TableColumn<Section, String> instructor; @FXML private TableColumn<Section, String> days; @FXML private TableColumn<Section, String> start; @FXML private TableColumn<Section, String> end; @FXML private TableColumn<Section, String> building; @FXML private TableColumn<Section, String> room; @FXML private TableColumn<Section, String> capacity; @FXML private TableColumn<Section, String> technology; /** * The constructor. The constructor is called before the initialize() method. */ public ViewTableController() { } /** * Initializes the controller class. This method is automatically called * after the fxml file has been loaded. */ @FXML private void initialize() { // Initialize the person table with the two columns. course.setCellValueFactory(cellData -> cellData.getValue().courseProperty()); section.setCellValueFactory(cellData -> cellData.getValue().sectionProperty()); type.setCellValueFactory(cellData -> cellData.getValue().typeProperty()); num.setCellValueFactory(cellData -> cellData.getValue().classNumProperty()); instructor.setCellValueFactory(cellData -> cellData.getValue().instructorProperty()); days.setCellValueFactory(cellData -> cellData.getValue().daysProperty()); start.setCellValueFactory(cellData -> cellData.getValue().startProperty()); end.setCellValueFactory(cellData -> cellData.getValue().endProperty()); building.setCellValueFactory(cellData -> cellData.getValue().buildingProperty()); room.setCellValueFactory(cellData -> cellData.getValue().roomProperty()); capacity.setCellValueFactory(cellData -> cellData.getValue().capacityProperty()); technology.setCellValueFactory(cellData -> cellData.getValue().technologyProperty()); } @FXML private void handleOpenAction() { System.out.println("Open clicked\n"); } @FXML private void handleSaveAction() { System.out.println("Save clicked\n"); } @FXML private void handleRatingAction() { System.out.println("Rating clicked\n"); } /** * Is called by the main application to give a reference back to itself. * * @param mainApp */ public void setMainApp(Main mainApp) { super.setMainApp(mainApp); // Add observable list data to the table sectionTable.setItems(mainApp.getSectionData()); } }