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
sectionTable; @FXML private TableColumn course; @FXML private TableColumn section; @FXML private TableColumn type; @FXML private TableColumn num; @FXML private TableColumn instructor; @FXML private TableColumn days; @FXML private TableColumn start; @FXML private TableColumn end; @FXML private TableColumn building; @FXML private TableColumn room; @FXML private TableColumn capacity; @FXML private TableColumn 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()); } }