Exemplo n.º 1
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {

    ImageView backImgBtnLayout =
        createImageBtnLayout(
            Constants.BACK_IMAGE_PATH, Constants.BACK_IMAGE_WIDTH, Constants.BACK_IMAGE_HEIGHT);
    backBtn.setGraphic(backImgBtnLayout);
    ImageView addImgBtnLayout =
        createImageBtnLayout(
            Constants.ADD_BUTTON_IMAGE_PATH, Constants.ADD_IMAGE_WIDTH, Constants.ADD_IMAGE_HEIGHT);
    addButton.setGraphic(addImgBtnLayout);

    cancelBtn.setOnAction(
        event -> {
          showWindow(true, false);
          setTitle(Constants.CHARACTER_SCENE_HEADER.toUpperCase());
        });

    levelField.setEditable(false);

    classBox.setItems(
        FXCollections.observableArrayList(
            "Guardin",
            "Assassin",
            "Archmage",
            "Necromancer",
            "Prophet",
            "Shaman",
            "Druid",
            "Ranger"));
    characterRaceBox.setItems(
        FXCollections.observableArrayList(
            "Human", "Gnome", "Dwarf", "Elf", "Eladin", "Tiefling", "Deva", "Goliath"));
  }
Exemplo n.º 2
0
 @FXML
 void toggleState() {
   if (tweenBlock) return;
   tweenBlock = true;
   if (isPlaying) {
     stateButton.setGraphic(imagePlay);
     pause(
         () -> {
           tweenBlock = false;
         });
   } else {
     if (currentTrack != null) {
       stateButton.setGraphic(imagePause);
       resume(
           () -> {
             tweenBlock = false;
           });
     }
   }
 }
  private void configureButtons() {
    // Restaurant button
    restaurantButton.setGraphic(restaurantIMV);
    restaurantButton.setStyle("-fx-background-color: transparent");

    // reservations button
    reservationsButton.setGraphic(reservationsIMV);
    reservationsButton.setStyle("-fx-background-color: transparent");

    // customers button
    customersButton.setGraphic(customersIMV);
    customersButton.setStyle("-fx-background-color: transparent");

    // employees button
    employeesButton.setGraphic(employeesIMV);
    employeesButton.setStyle("-fx-background-color: transparent");

    // rating button
    ratingButton.setGraphic(ratingIMV);
    ratingButton.setStyle("-fx-background-color: transparent");

    // archive button
    archiveButton.setGraphic(archiveIMV);
    archiveButton.setStyle("-fx-background-color: transparent");
  }
Exemplo n.º 4
0
  private Button createCharacterBtn(String imgPath, double imgWidth, double imgHeight) {
    Button characterBtn = new Button();
    characterBtn.setMaxWidth(400.0d);
    characterBtn.setMaxHeight(100.0d);
    characterBtn.setMinWidth(400.0d);
    characterBtn.setMinHeight(100.0d);
    characterBtn.setTextAlignment(TextAlignment.LEFT);

    ImageView avatarImgBtnLayout = createImageBtnLayout(imgPath, imgWidth, imgHeight);
    characterBtn.setGraphic(avatarImgBtnLayout);

    return characterBtn;
  }
  @FXML
  private void customersButtonClicked(ActionEvent event) {
    configureButtons();
    customersButton.setGraphic(customersSelectedIMV);

    // Clear old content
    contentPane.getChildren().clear();

    titleLabel.setText("Customer Information");

    ScrollPane scrollPane = new ScrollPane();

    contentPane.getChildren().add(scrollPane);

    VBox box = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // set up for ALL CUSTOMERS
    Text cHeader = new Text("All Customers");
    cHeader.setFont(new Font("System", 24));

    ObservableList<Customer> data = FXCollections.observableArrayList(operation.getAllCustomers());
    TableView cTable = new TableView();

    TableColumn cfnCol = new TableColumn("First Name");
    cfnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn clnCol = new TableColumn("Last Name");
    clnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn cEmailCol = new TableColumn("Email");
    cEmailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
    TableColumn cUpdatedAtCol = new TableColumn("Updated At");
    cUpdatedAtCol.setCellValueFactory(new PropertyValueFactory<>("updatedAt"));
    TableColumn cDiscountCol = new TableColumn("Discount");
    cDiscountCol.setCellValueFactory(new PropertyValueFactory<>("discount"));

    cTable.getColumns().addAll(cfnCol, clnCol, cEmailCol, cUpdatedAtCol, cDiscountCol);
    cTable.setItems(data);
    cTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    box.getChildren().addAll(cHeader, cTable);
    scrollPane.setContent(box);
  }
Exemplo n.º 6
0
  @Override
  public void start(Stage stage) throws Exception {

    // ----------MENU----------

    MenuBar menuBar = new MenuBar();

    Menu menuFile = new Menu("File");
    MenuItem menuItemPurchase = new MenuItem("New Purchase");
    MenuItem menuItemStore = new MenuItem("New Store");
    MenuItem menuItemCategory = new MenuItem("New Category");
    MenuItem menuItemExit = new MenuItem("Exit");
    menuFile.getItems().addAll(menuItemPurchase, menuItemStore, menuItemCategory, menuItemExit);

    Menu menuHelp = new Menu("Help");
    menuBar.getMenus().addAll(menuFile, menuHelp);

    // ----------TOOLBAR----------

    ToolBar toolBar = new ToolBar();
    Button buttonPurchase = new Button();
    Button buttonStore = new Button();
    Button buttonCategory = new Button();
    buttonPurchase.setGraphic(new ImageView("/pictures/purchase.png"));
    buttonStore.setGraphic(new ImageView("/pictures/store.png"));
    buttonCategory.setGraphic(new ImageView("/pictures/category.png"));
    toolBar.getItems().addAll(buttonPurchase, buttonStore, buttonCategory);

    buttonStore.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent actionEvent) {
            Stage stage = new Stage();
            try {
              new StoreWindows().start(stage);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });

    // ----------WORKSPACE----------

    GridPane gridPane = new GridPane();
    gridPane.setAlignment(Pos.CENTER);
    gridPane.setVgap(10);
    gridPane.setHgap(10);
    gridPane.setPadding(new Insets(0, 25, 25, 0));

    Label storeLabel = new Label("Store: ");
    storeLabel.setId("simpleLabel");
    gridPane.add(storeLabel, 0, 1);

    final ComboBox<String> stores = new ComboBox<String>();
    gridPane.add(stores, 1, 1);

    Label categoryLabel = new Label("Category: ");
    categoryLabel.setId("simpleLabel");
    gridPane.add(categoryLabel, 2, 1);

    final ComboBox<String> categories = new ComboBox<String>();
    gridPane.add(categories, 3, 1);

    Button bCount = new Button("Count");
    HBox hBox = new HBox(10);
    hBox.setAlignment(Pos.BOTTOM_RIGHT);
    hBox.getChildren().add(bCount);
    gridPane.add(hBox, 4, 1);

    FlowPane flowPane1 = new FlowPane();
    flowPane1.setAlignment(Pos.CENTER);
    flowPane1.setPadding(new Insets(10, 25, 25, 10));

    final Text spentTitle = new Text("SPENT: ");
    spentTitle.setId("headline");
    flowPane1.getChildren().add(spentTitle);

    // ----------DATABASE----------

    Label statusLabel = new Label();
    DaoFactory daoFactory = new MySQLDaoFactory();
    try {
      Connection connection = daoFactory.getConnection();
      statusLabel.setText("Database connection: success");
      StoreDao storeDao = new MySQLStoreDao(connection);
      ArrayList<Store> storeList = (ArrayList) storeDao.getStores();
      for (Store store : storeList) {
        stores.getItems().add(store.getName());
      }
      CategoryDao categoryDao = new MySQLCategoryDao(connection);
      ArrayList<Category> categoryList = (ArrayList) categoryDao.getCategories();
      for (Category category : categoryList) {
        categories.getItems().add(category.getTitle());
      }
    } catch (SQLException e) {
      statusLabel.setText("Database connection: failed");
    }
    FlowPane footer = new FlowPane();

    footer.setPadding(new Insets(10, 10, 10, 10));
    footer.getChildren().add(statusLabel);

    bCount.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent actionEvent) {
            try {
              PurchaseDao purchaseDao = new MySQLPurchaseDao(new MySQLDaoFactory().getConnection());
              spentTitle.setText(
                  "SPENT: " + purchaseDao.showSpent(stores.getValue(), categories.getValue()));
            } catch (SQLException e) {
              e.printStackTrace();
            }
          }
        });

    // ----------VIEW----------

    Scene scene = new Scene(new VBox(), 800, 600);
    scene.getStylesheets().add("css/style.css");
    ((VBox) scene.getRoot()).getChildren().addAll(menuBar, toolBar, gridPane, flowPane1, footer);

    stage.setScene(scene);
    stage.setTitle("Cash Organizer");
    stage.getIcons().add(new Image("pictures/icon.png"));
    stage.show();
  }
Exemplo n.º 7
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    AppController.instance = this;
    this.res = resources;

    ObservableList<String> modeItems =
        FXCollections.observableArrayList(
            Settings.MODE_NEXT, Settings.MODE_RANDOM, Settings.MODE_SAME);
    modeList.setItems(modeItems);
    modeList.getSelectionModel().select(Settings.currentMode);
    modeList
        .valueProperty()
        .addListener(
            (ObservableValue ov, Object oldVal, Object newVal) -> {
              Settings.currentMode = (String) newVal;
            });

    setupPlaylistsView();
    setupPlaylistsContextMenu();

    setupTracksView();

    tracksView.setContextMenu(tracksContextMenu);
    tracksView.setOnContextMenuRequested(
        (ContextMenuEvent evt) -> {
          setupTracksContextMenu();
          evt.consume();
        });
    tracksView
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            (ObservableValue observable, Object oldValue, Object newValue) -> {
              Settings.lastTrackId = newValue != null ? ((Track) newValue).getId() : null;
            });

    playlistsView
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            (ObservableValue observable, Object oldValue, Object newValue) -> {
              loadSelectedPlaylist();
              Settings.lastPlaylistId = newValue != null ? ((Playlist) newValue).getId() : null;
              searching = false;
              searchText.setText(StringUtils.EMPTY);
            });

    volumeSlider.setCursor(Cursor.HAND);
    volumeSlider
        .valueProperty()
        .addListener(
            (ObservableValue<? extends Number> ov, Number oldVal, Number newVal) -> {
              if (player != null) {
                player.setVolume(newVal.doubleValue());
              }
              Settings.currentVolume = newVal.doubleValue();
              volumeLabel.setText(
                  String.valueOf((int) Math.ceil(newVal.doubleValue() * 100)) + "%");
            });
    volumeSlider.setValue(Settings.currentVolume);

    imagePlay = new ImageView(new Image(getClass().getResourceAsStream("/images/button_play.png")));
    imagePlay.setScaleX(0.40);
    imagePlay.setScaleY(0.40);
    imagePause =
        new ImageView(new Image(getClass().getResourceAsStream("/images/button_pause.png")));
    imagePause.setScaleX(0.5);
    imagePause.setScaleY(0.5);
    imageSettings =
        new ImageView(new Image(getClass().getResourceAsStream("/images/settings.png")));
    imageSettings.setScaleX(0.5);
    imageSettings.setScaleY(0.5);
    imageUpdate = new ImageView(new Image(getClass().getResourceAsStream("/images/refresh.png")));
    imageUpdate.setScaleX(0.5);
    imageUpdate.setScaleY(0.5);
    imageAdd = new ImageView(new Image(getClass().getResourceAsStream("/images/add.png")));
    imageAdd.setScaleX(0.5);
    imageAdd.setScaleY(0.5);
    imageRename = new ImageView(new Image(getClass().getResourceAsStream("/images/rename.png")));
    imageRename.setScaleX(0.5);
    imageRename.setScaleY(0.5);
    imageDelete = new ImageView(new Image(getClass().getResourceAsStream("/images/delete.png")));
    imageDelete.setScaleX(0.5);
    imageDelete.setScaleY(0.5);

    stateButton.setGraphic(imagePlay);
    settingsButton.setGraphic(imageSettings);
    refreshButton.setGraphic(imageUpdate);
    refreshButton.setTooltip(new Tooltip(res.getString("tooltip_sync")));

    addButton.setGraphic(imageAdd);
    addButton.setOnAction((evt) -> createOfflinePlaylist());
    addButton.setTooltip(new Tooltip(res.getString("tooltip_add_offline")));
    renameButton.setGraphic(imageRename);
    renameButton.setOnAction(evt -> renamePlaylist());
    renameButton.setTooltip(new Tooltip(res.getString("rename_playlist")));
    deleteButton.setGraphic(imageDelete);
    deleteButton.setOnAction(evt -> deletePlaylist());
    deleteButton.setTooltip(new Tooltip(res.getString("delete_playlist")));

    loadProgressBar.setCursor(Cursor.HAND);
    volumeSlider.setCursor(Cursor.HAND);
    updatePlaylists();
    if (Settings.lastPlaylistId != null) {
      currentPlaylist =
          ((ObservableList<Playlist>) playlistsView.getItems())
              .stream()
              .filter((playlist) -> playlist.getId().equals(Settings.lastPlaylistId))
              .findFirst()
              .orElse(null);
      playlistsView.getSelectionModel().select(currentPlaylist);
      playlistsView.scrollTo(currentPlaylist);
      Platform.runLater(
          () -> {
            if (Settings.lastTrackId != null) {
              currentTrack =
                  ((ObservableList<Track>) tracksView.getItems())
                      .stream()
                      .filter((track) -> track.getId().equals(Settings.lastTrackId))
                      .findFirst()
                      .orElse(null);
              tracksView.getSelectionModel().select(currentTrack);
              tracksView.scrollTo(currentTrack);
            }
          });
    }
    new Timer()
        .scheduleAtFixedRate(
            new TimerTask() {
              @Override
              public void run() {
                updatePlayProgress();
              }
            },
            100,
            100);
    setupTracksContextMenu();

    setupShortcuts();

    Platform.runLater(
        () -> {
          tracksView.requestFocus();
        });
  }
Exemplo n.º 8
0
  @FXML
  void playTrack(Track t) {
    if (tweenBlock) return;
    tweenBlock = true;
    stop(
        () -> {
          currentPlaylist = (Playlist) playlistsView.getSelectionModel().getSelectedItem();
          currentTrack = t;
          if (player != null) {
            player.dispose();
          }
          if (t == null) {
            return;
          }
          timeUpdate = 9;
          if (currentPlaylist != null) {
            Tray.announce("[" + currentPlaylist.getTitle() + "] " + t.getTitle());
          }

          Platform.runLater(
              () -> {
                infoLabel.setText(res.getString("playing_offline") + t.getTitle());
                log.info("Playing offline: " + t.getTitle());
              });
          try {
            Media media = new Media(Cache.getContent(t).toURI().toString());
            player = new MediaPlayer(media);
            player.setVolume(Settings.currentVolume);
            player.play();
          } catch (MediaException ex) {
            Platform.runLater(
                () -> {
                  infoLabel.setText(
                      String.format(res.getString("cant_play_offline_not_exist"), t.getTitle()));
                  log.error("Can't play: seems that track does not exist - " + t.getTitle());
                });
          }

          if (player != null) {
            pushToPlayStack(getSelectedPlaylist(), t);
            player.setOnEndOfMedia(
                () -> {
                  String mode = Settings.currentMode;
                  if (mode.equals(Settings.MODE_NEXT)) {
                    playNext();
                  } else if (mode.equals(Settings.MODE_RANDOM)) {
                    playRandom();
                  } else if (mode.equals(Settings.MODE_SAME)) {
                    playSame();
                  }
                });
          }

          Platform.runLater(
              () -> {
                isPlaying = true;
                tweenBlock = false;
                titleLabel.setText(t.getTitle());
                stateButton.setGraphic(imagePause);
              });
        });
  }
  @FXML
  private void archiveButtonClicked(ActionEvent event) {
    configureButtons();
    archiveButton.setGraphic(archiveSelectedIMV);

    // clear old content
    contentPane.getChildren().clear();

    // ask for archive date
    titleLabel.setText("Archiving");

    // create text and textfield
    VBox mainBox = new VBox();
    mainBox.setSpacing(20);
    mainBox.setAlignment(Pos.CENTER);

    HBox box = new HBox();
    contentPane.getChildren().add(mainBox);

    box.setSpacing(5);
    box.setAlignment(Pos.CENTER);

    Label dateLabel = new Label("Cut Off Date:");
    dateLabel.setFont(new Font("System", 24));

    TextField dateTF = new TextField();
    dateTF.setPromptText("YYYY-MM-DD");

    Label errorLabel = new Label();
    errorLabel.setTextFill(Paint.valueOf("#f5515f"));
    errorLabel.setFont(new Font("System", 14));

    Button confirmButton = new Button("Confirm");
    confirmButton.setStyle(
        "-fx-background-color: #e63347;" + "-fx-background-radius: 7;" + "-fx-text-fill: white");
    confirmButton.setPrefSize(130, 40);

    confirmButton.setOnAction(
        e -> {
          if (dateTF.getText() != null) {
            String cutoffDate = dateTF.getText().trim();
            if (cutoffDate.length() > 10) {
              errorLabel.setText("Too long");
              return;
            } else if (!isDate(cutoffDate)) {
              errorLabel.setText("Wrong date format");
              return;
            }

            boolean success = operation.archive(cutoffDate);
            if (success) {
              // set up content
              contentPane.getChildren().clear();

              TableView table = new TableView();
              TableColumn fnCol = new TableColumn("First Name");
              fnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
              TableColumn lnCol = new TableColumn("Last Name");
              lnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
              TableColumn emailCol = new TableColumn("Email");
              emailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
              TableColumn lvCol = new TableColumn("Updated At");
              lvCol.setCellValueFactory(new PropertyValueFactory<>("updatedAt"));
              TableColumn discountCol = new TableColumn("Discount");
              discountCol.setCellValueFactory(new PropertyValueFactory<>("discount"));

              table.getColumns().addAll(fnCol, lnCol, emailCol, lvCol, discountCol);
              ObservableList<Customer> data =
                  FXCollections.observableArrayList(operation.getArchivedCustomers());
              table.setItems(data);

              contentPane.getChildren().add(table);

              titleLabel.setText("Archived Customers");

            } else {
              titleLabel.setText("Can't archive");
              return;
            }

          } else {
            errorLabel.setText("Please enter a date");
            return;
          }
        });

    box.getChildren().addAll(dateLabel, dateTF, errorLabel);
    mainBox.getChildren().addAll(box, confirmButton);
  }
  @FXML
  private void ratingButtonClicked(ActionEvent event) throws SQLException {
    configureButtons();
    ratingButton.setGraphic(ratingSelectedIMV);

    // clear old content
    contentPane.getChildren().clear();

    // set up
    titleLabel.setText("Rating and Feedback");

    // rating box
    HBox ratingBox = new HBox();
    ratingBox.setAlignment(Pos.CENTER);
    ratingBox.setSpacing(20);
    ratingBox.setPadding(new Insets(10, 0, 10, 0));

    // Rating label
    Label ratingTitle = new Label("Average Rating: ");
    ratingTitle.setFont(new Font("System", 24));

    // 5 stars
    String yellowStarURL = "Graphics/StarYellow.png";
    String blankStarURL = "Graphics/StarBlank.png";

    ImageView starBlank1 =
        new ImageView(new Image(getClass().getResourceAsStream("Graphics/StarBlank.png")));
    ImageView starBlank2 =
        new ImageView(new Image(getClass().getResourceAsStream("Graphics/StarBlank.png")));
    ImageView starBlank3 =
        new ImageView(new Image(getClass().getResourceAsStream("Graphics/StarBlank.png")));
    ImageView starBlank4 =
        new ImageView(new Image(getClass().getResourceAsStream("Graphics/StarBlank.png")));
    ImageView starBlank5 =
        new ImageView(new Image(getClass().getResourceAsStream("Graphics/StarBlank.png")));

    Button star1 = new Button();
    star1.setGraphic(starBlank1);
    star1.setStyle("-fx-background-color: transparent");
    Button star2 = new Button();
    star2.setGraphic(starBlank2);
    star2.setStyle("-fx-background-color: transparent");
    Button star3 = new Button();
    star3.setGraphic(starBlank3);
    star3.setStyle("-fx-background-color: transparent");
    Button star4 = new Button();
    star4.setGraphic(starBlank4);
    star4.setStyle("-fx-background-color: transparent");
    Button star5 = new Button();
    star5.setGraphic(starBlank5);
    star5.setStyle("-fx-background-color: transparent");

    // get average rating
    double avgRating = 0;
    try {
      avgRating = operation.getAverageRating();
    } catch (SQLException e) {
      e.printStackTrace();
      ratingTitle.setText("Error! Can't get average rating");
    }

    Button[] buttonlist = new Button[5];
    buttonlist[0] = star1;
    buttonlist[1] = star2;
    buttonlist[2] = star3;
    buttonlist[3] = star4;
    buttonlist[4] = star5;

    for (int i = 0; i < Math.floor(avgRating); i++) {
      ImageView image = new ImageView(new Image(getClass().getResourceAsStream(yellowStarURL)));
      buttonlist[i].setGraphic(image);
    }

    // feedback box
    VBox feedBackBox = new VBox();
    feedBackBox.setAlignment(Pos.CENTER);
    feedBackBox.setSpacing(20);

    // Feedback title
    Label feedBackLabel = new Label("Feedback:");
    feedBackLabel.setFont(new Font("System", 24));

    // get feedback string
    String feedback = "";
    ArrayList<Rating> list = operation.getRatingsAndFeedbacks();

    for (Rating r : list) {
      feedback += r.getFeedback() + "\n\n";
    }

    Text feedbackText = new Text(feedback);
    feedbackText.setFont(new Font("System", 14));

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(feedbackText);

    // Add children nodes to appropriate boxes
    ratingBox.getChildren().addAll(ratingTitle, star1, star2, star3, star4, star5);
    feedBackBox.getChildren().addAll(feedBackLabel, scrollPane);

    // main box
    VBox mainBox = new VBox();
    mainBox.setSpacing(40);
    mainBox.getChildren().addAll(ratingBox, feedBackBox);

    contentPane.getChildren().add(mainBox);
  }
  @FXML
  private void employeesButtonClicked(ActionEvent event) {
    configureButtons();
    employeesButton.setGraphic(employeesSelectedIMV);

    // Clear old content
    contentPane.getChildren().clear();

    titleLabel.setText("Employees");

    // 2 horizontal boxes for All Employees and Employees are Customers
    HBox hbox = new HBox();
    hbox.setSpacing(5);

    // 2 vboxes for each hbox
    VBox leftBox = new VBox();
    VBox rightBox = new VBox();

    // Set up All employees
    ObservableList<Employee> data = FXCollections.observableArrayList(operation.getAllEmployees());
    TableView table = new TableView();

    // Add title for all employees
    Text leftTitle = new Text("All Employees");
    leftTitle.setFont(new Font("System", 24));

    // add left table and title to left box
    leftBox.getChildren().addAll(leftTitle, table);
    leftBox.setSpacing(5);

    TableColumn efnCol = new TableColumn("First Name");
    efnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn elnCol = new TableColumn("Last Name");
    elnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn epositionCol = new TableColumn("Position");
    epositionCol.setCellValueFactory(new PropertyValueFactory<>("position"));
    TableColumn eemailCol = new TableColumn("Email");
    eemailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
    TableColumn elastworkedCol = new TableColumn("Last Worked");
    elastworkedCol.setCellValueFactory(new PropertyValueFactory<>("lastWorked"));

    table.getColumns().addAll(efnCol, elnCol, epositionCol, eemailCol, elastworkedCol);
    table.setItems(data);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    // Set up for employees and also customers
    ObservableList<Employee> rightData =
        FXCollections.observableArrayList(operation.getEmployeesWhoAreCustomers());
    TableView rightTable = new TableView();

    // Add title for all employees
    Text rightTitle = new Text("Employees Are Customers");
    rightTitle.setFont(new Font("System", 24));

    TableColumn RfnCol = new TableColumn("First Name");
    RfnCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn RlnCol = new TableColumn("Last Name");
    RlnCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn RpositionCol = new TableColumn("Position");
    RpositionCol.setCellValueFactory(new PropertyValueFactory<>("position"));
    TableColumn RemailCol = new TableColumn("Email");
    RemailCol.setCellValueFactory(new PropertyValueFactory<>("email"));
    TableColumn RlastworkedCol = new TableColumn("Last Worked");
    RlastworkedCol.setCellValueFactory(new PropertyValueFactory<>("lastWorked"));

    rightTable.getColumns().addAll(RfnCol, RlnCol, RpositionCol, RemailCol, RlastworkedCol);
    rightTable.setItems(rightData);

    // add right table to the right box
    rightBox.getChildren().addAll(rightTitle, rightTable);
    rightBox.setSpacing(5);

    hbox.getChildren().addAll(leftBox, rightBox);
    hbox.setSpacing(10);
    hbox.setAlignment(Pos.CENTER);

    // add hbox to content pane
    contentPane.getChildren().add(hbox);
  }
  @FXML
  private void reservationsButtonClicked(ActionEvent event) {
    configureButtons();
    reservationsButton.setGraphic(reservationsSelectedIMV);

    // Clear the content of contentPane
    contentPane.getChildren().clear();

    // Set title
    titleLabel.setText("Reservations");

    // Make box for weekly availability and reservations
    VBox box = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // box for availability
    VBox abox = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // box for reservations
    VBox resbox = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // set up for weekly table availability
    Text aHeader = new Text("Tables still available");
    aHeader.setFont(new Font("System", 24));

    TableView aTable = new TableView();
    TableColumn aDateCol = new TableColumn("Date");
    aDateCol.setCellValueFactory(new PropertyValueFactory<>("date"));
    TableColumn tablesCol = new TableColumn("Tables Available");
    tablesCol.setCellValueFactory(new PropertyValueFactory<>("tablesAvailable"));

    // add table and title to availability box
    abox.getChildren().addAll(aHeader, aTable);
    abox.setSpacing(5);

    // set width for all cols
    aDateCol.setMinWidth(100);
    tablesCol.setMinWidth(100);

    aTable.getColumns().addAll(aDateCol, tablesCol);
    // Populate data to the table view
    operation.callDates();
    ObservableList<Availability> adata =
        FXCollections.observableArrayList(operation.getWeeklyAvailability());
    aTable.setItems(adata);
    aTable.setMaxHeight(235);
    aTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    // set up for reservations
    Text resHeader = new Text("All Reservations");
    resHeader.setFont(new Font("System", 24));

    TableView resTable = new TableView();
    TableColumn firstNameCol = new TableColumn("First Name");
    firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn lastNameCol = new TableColumn("Last Name");
    lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn tidCol = new TableColumn("tID");
    tidCol.setCellValueFactory(new PropertyValueFactory<>("tID"));
    TableColumn partySizeCol = new TableColumn("Party Size");
    partySizeCol.setCellValueFactory(new PropertyValueFactory<>("partySize"));
    TableColumn seatsCol = new TableColumn("Seats");
    seatsCol.setCellValueFactory(new PropertyValueFactory<>("seats"));
    TableColumn dateCol = new TableColumn("Reservation Date");
    dateCol.setCellValueFactory(new PropertyValueFactory<>("reservationDate"));

    // set width for all cols
    firstNameCol.setMinWidth(100);
    lastNameCol.setMinWidth(100);
    tidCol.setMinWidth(100);
    partySizeCol.setMinWidth(100);
    seatsCol.setMinWidth(100);
    dateCol.setMinWidth(300);

    // add table and title to availability box
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(resTable);
    scrollPane.setFitToWidth(true);
    resbox.getChildren().addAll(resHeader, scrollPane);
    resbox.setSpacing(5);

    resTable
        .getColumns()
        .addAll(firstNameCol, lastNameCol, tidCol, partySizeCol, seatsCol, dateCol);
    // Populate data to the table view
    ObservableList<ReservationInfo> resdata =
        FXCollections.observableArrayList(operation.getAllReservations());
    resTable.setItems(resdata);
    resTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    // add table view to content pane
    box.getChildren().addAll(abox, resbox);
    contentPane.getChildren().add(box);
  }