Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package controllers;
- import app.GCUToursApp;
- import javafx.collections.FXCollections;
- import javafx.collections.ObservableList;
- import javafx.fxml.FXML;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.Scene;
- import javafx.scene.control.ListView;
- import javafx.scene.layout.BorderPane;
- import javafx.stage.Stage;
- import model.GCUTour;
- import repositories.Repository;
- import views.RootLayoutController;
- import java.io.IOException;
- import java.util.List;
- public class Controller {
- private Stage primaryStage;
- private BorderPane rootLayout;
- private Repository repository;
- @FXML
- ListView<GCUTour> tourListView;
- public Controller(Stage primaryStage) {
- this.primaryStage = primaryStage;
- this.repository = new Repository();
- }
- public void initRootLayout() {
- try {
- FXMLLoader loader = new FXMLLoader();
- loader.setLocation(GCUToursApp.class.getResource("/views/RootLayout.fxml"));
- rootLayout = loader.load();
- Scene scene = new Scene(rootLayout);
- primaryStage.setScene(scene);
- RootLayoutController rootLayoutController = loader.getController();
- rootLayoutController.setMainController(this);
- rootLayoutController.setTourListView(tourListView); // Initialize tourListView
- primaryStage.show();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public void listGCUTours() {
- // Retrieve GCUTours from the database
- List<GCUTour> gcuTours = repository.getGCUTours();
- // Update the ListView with the retrieved GCUTours
- ObservableList<GCUTour> observableList = FXCollections.observableList(gcuTours);
- tourListView.setItems(observableList);
- }
- public void addGCUTourForm() {
- }
- public void addGCUTour(String tourDate, int tourDuration) {
- }
- public void addPlaceForm(int GCUTourId) {
- }
- public void addPlace(String placeName, String country, int GCUTourId) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment