コード例 #1
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // TODO 自動生成されたメソッド・スタブ
    addOption.setOnAction(
        event -> {
          for (int i = 0; i < cmb.size(); i++) {
            //				System.out.println(cmb.get(i).getValue());
            if (cmb.get(i).getValue() == null) {
              break;
            } else if (i == cmb.size() - 1) {
              addTask.setDisable(false);
            }
          }
        });

    addTask.setOnAction(
        event -> {
          try {
            String url = webView.getEngine().getLocation();
            System.out.println(url);
            Document document = Jsoup.connect(url).get();

            Elements input = document.select("input");

            Map params = new HashMap<String, String>();
            for (ComboBox cmbx : cmb) {
              ValuePair vp = (ValuePair) cmbx.getValue();
              params.put(vp.getName(), vp.getvalue());
            }
            //				System.out.println(input.select("[name=shop_bid]").first());
            //				System.out.println(input.select("[name=shop_bid]").first().val());
            params.put("shop_bid", input.select("[name=shop_bid]").first().val());
            params.put("item_id", input.select("[name=item_id]").first().val());
            params.put("__event", input.select("[name=__event]").first().val());
            params.put("units", "1");

            Map map = new HashMap<String, Long>();

            //				System.out.println(document.select("#stime").size());
            if (document.select("#stime").size() != 0) {
              System.out.println(document.select("#stime"));
              map.put("stime", Long.parseLong((input.select("#stime").first().val())));
              map.put("etime", Long.parseLong((input.select("#etime").first().val())));
            } else {
              map = null;
            }

            BuyTask task = new BuyTask(url, params, map);
            task.call();
            this.getScene().getWindow().hide();
          } catch (Exception e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
          }
        });
  }
コード例 #2
0
ファイル: CollectorGui.java プロジェクト: MattPfenn/Java_work
  public void open() throws IOException {

    paneCenter.getChildren().clear();

    String station = (String) cbStations.getValue();

    File f = new File("database\\" + station + "\\status.txt");
    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);

    paneCenter.add(new Label("Last seen : " + (br.readLine())), 0, 0);

    for (int i = 1; i < count; i++) {
      paneCenter.add(new Label(br.readLine()), 0, i);
    }
    br.close();
    fr2.close();

    addQuantityToCB();
  }
コード例 #3
0
ファイル: CollectorGui.java プロジェクト: MattPfenn/Java_work
  public void addStationsToCB() throws IOException {
    File f = new File("config");

    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);
    for (int i = 0; i < count; i++) {
      cbStations.getItems().add(br.readLine());
    }
    br.close();
    fr2.close();
  }
コード例 #4
0
ファイル: CollectorGui.java プロジェクト: MattPfenn/Java_work
  public void showGraph() {
    Stage secondaryStage = new Stage();

    String quantity = (String) cbQuantity.getValue().toString();
    secondaryStage.setTitle(quantity);

    LineChart<Long, Number> lc = null;

    switch (quantity) {
      case "Wind Speed":
        windSerie.add(new XYChart.Series<>("Wind Speed", windData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 130, 10), windSerie);
        break;

      case "Temperature":
        temperatureSerie.add(new XYChart.Series<>("Temperature", temperatureData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 50, 10), temperatureSerie);
        break;

      case "Rainfall Rate":
        rainfallSerie.add(new XYChart.Series<>("Rainfall Rate", rainfallData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 100, 10), rainfallSerie);
        break;

      case "Humidity":
        humiditySerie.add(new XYChart.Series<>("Humidity", humidityData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 100, 10), humiditySerie);
        break;

      case "Pressure":
        pressureSerie.add(new XYChart.Series<>("Pressure", pressureData));
        lc = new LineChart<>(new DateAxis(), new NumberAxis("Value", 0, 20, 10), pressureSerie);
        break;
    }

    graphic = new Scene(lc, 500, 250);

    secondaryStage.setScene(graphic);
    secondaryStage.show();
  }
コード例 #5
0
ファイル: CollectorGui.java プロジェクト: MattPfenn/Java_work
  public void addQuantityToCB() throws IOException {

    temperatureSerie.removeAll();
    pressureSerie.removeAll();
    windSerie.removeAll();
    rainfallSerie.removeAll();
    humiditySerie.removeAll();

    cbQuantity.getItems().clear();

    String station = (String) cbStations.getValue();
    File f = new File("database\\" + station + "\\data.txt");

    FileReader fr1 = new FileReader(f);
    LineNumberReader ln = new LineNumberReader(fr1);
    int count = 0;
    while (ln.readLine() != null) {
      count++;
    }
    ln.close();
    fr1.close();

    FileReader fr2 = new FileReader(f);
    BufferedReader br = new BufferedReader(fr2);

    boolean wsFlag = false;
    boolean prFlag = false;
    boolean teFlag = false;
    boolean huFlag = false;
    boolean rrFlag = false;

    for (int i = 0; i < count; i++) {

      String line = br.readLine();
      String[] words = line.split(" ");

      for (int j = 0; j < words.length; j++) {

        if (words[0].equals("") == false) {

          long timeValue = Long.parseLong(words[0]);

          if (words[j].equals("WS")) {
            windData.add(new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (wsFlag == false) {
              cbQuantity.getItems().add("Wind Speed");

              wsFlag = true;
            }
          } else if (words[j].equals("PR")) {
            pressureData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (prFlag == false) {
              cbQuantity.getItems().add("Pressure");
              prFlag = true;
            }
          } else if (words[j].equals("TE")) {
            temperatureData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (teFlag == false) {
              cbQuantity.getItems().add("Temperature");
              teFlag = true;
            }
          } else if (words[j].equals("HU")) {
            humidityData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (huFlag == false) {
              cbQuantity.getItems().add("Humidity");
              huFlag = true;
            }
          } else if (words[j].equals("RR")) {
            rainfallData.add(
                new XYChart.Data<Long, Number>(timeValue, Integer.parseInt(words[j + 2])));
            if (rrFlag == false) {
              cbQuantity.getItems().add("Rainfall Rate");
              rrFlag = true;
            }
          }
        }
      }
    }
    br.close();
    fr2.close();
  }
コード例 #6
0
  private void updateSelectedEntry() {
    ObservableList<PolizistDaten> Nutzerauswahl = Tabelle.getSelectionModel().getSelectedItems();
    if (Nutzerauswahl.size() != 1) {
      IM.setErrorText("Es muss genau ein Element ausgewählt werden");
      return;
    }
    PolizistDaten Auswahl = Nutzerauswahl.get(0);

    // Jetzt erzeugen wir ein PopUp zum veraendern des Eintrags

    Stage PopUp = new Stage();
    PopUp.initModality(Modality.APPLICATION_MODAL);
    PopUp.setTitle("Neuer Eintrag");
    PopUp.setAlwaysOnTop(true);
    PopUp.setResizable(false);

    GridPane Gitter = new GridPane();
    Gitter.setHgap(10);
    Gitter.setVgap(10);

    Label LabelA = new Label("PersonenID");
    Label LabelAWert = new Label(Integer.toString(Auswahl.getPersonenID()));

    Label LabelB = new Label("Name");
    TextField LabelBWert = new TextField();

    Label LabelC = new Label("Geburtsdatum");
    DatePicker LabelCWert = new DatePicker();

    Label LabelD = new Label("Nationalität");
    TextField LabelDWert = new TextField();

    Label LabelE = new Label("Geschlecht");
    ComboBox LabelEWert = new ComboBox();

    Label LabelF = new Label("Todesdatum");
    DatePicker LabelFWert = new DatePicker();

    Label LabelG = new Label("Dienstgrad");
    TextField LabelGWert = new TextField();

    final Callback<DatePicker, DateCell> TagesZellenFabtrik =
        new Callback<DatePicker, DateCell>() {
          @Override
          public DateCell call(final DatePicker DP) {
            return new DateCell() {
              @Override
              public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if (item.isBefore(LabelCWert.getValue().plusDays(1))) {
                  setDisable(true);
                  setStyle("-fx-background-color: #ffc0cb;");
                }
              }
            };
          }
        };
    LabelFWert.setDayCellFactory(TagesZellenFabtrik);

    LabelEWert.getItems().addAll("m", "w");
    LabelEWert.setValue(Auswahl.getGeschlecht());

    LabelBWert.setText(Auswahl.getName());
    LabelCWert.setValue(LocalDate.parse(Auswahl.getGebDatum())); // TODO exception
    LabelDWert.setText(Auswahl.getNation());
    if (!Auswahl.getTodDatum().isEmpty()) {
      LabelFWert.setValue(LocalDate.parse(Auswahl.getTodDatum())); // TODO exception
    }
    LabelGWert.setText(Auswahl.getDienstgrad());

    Button ButtonFort = new Button("Fortfahren");
    Button ButtonAbb = new Button("Abbrechen");

    ButtonFort.defaultButtonProperty();
    ButtonAbb.cancelButtonProperty();

    ButtonFort.setMaxWidth(Double.MAX_VALUE);
    ButtonAbb.setMaxWidth(Double.MAX_VALUE);

    Gitter.addColumn(0, LabelA, LabelB, LabelC, LabelD, LabelE, LabelF, LabelG);
    Gitter.addColumn(
        1, LabelAWert, LabelBWert, LabelCWert, LabelDWert, LabelEWert, LabelFWert, LabelGWert);

    VBox AussenBox = new VBox(10);
    HBox InnenBox = new HBox();

    AussenBox.setSpacing(10);
    AussenBox.setPadding(new Insets(10));
    InnenBox.setSpacing(10);

    AussenBox.setAlignment(Pos.CENTER);
    InnenBox.setAlignment(Pos.BOTTOM_CENTER);

    AussenBox.getChildren().addAll(Gitter, InnenBox);
    InnenBox.getChildren().addAll(ButtonFort, ButtonAbb);

    ButtonAbb.setOnAction(event -> PopUp.close());
    ButtonFort.setOnAction(
        event -> {
          String SQLString;
          if (LabelFWert.getEditor().getText().isEmpty()) {
            SQLString =
                "UPDATE PERSON SET Name=?, Geburtsdatum=?, Nationalität=?, Geschlecht=?, Todesdatum=NULL WHERE PersonenID = "
                    + Auswahl.getPersonenID();
          } else {
            SQLString =
                "UPDATE PERSON SET Name=?, Geburtsdatum=?, Nationalität=?, Geschlecht=?, Todesdatum=? WHERE PersonenID = "
                    + Auswahl.getPersonenID();
          }
          try {
            PreparedStatement InsertStatement = DH.prepareStatement(SQLString);
            InsertStatement.setString(1, LabelBWert.getText());
            InsertStatement.setString(2, LabelCWert.getValue().toString()); // TODO exception
            InsertStatement.setString(3, LabelDWert.getText());
            InsertStatement.setString(4, LabelEWert.getValue().toString());
            if (LabelFWert.getValue() != null && !LabelFWert.getEditor().getText().isEmpty()) {
              InsertStatement.setString(5, LabelFWert.getValue().toString());
            }
            InsertStatement.executeUpdate();
            SQLString =
                "UPDATE POLIZIST SET Dienstgrad = ? WHERE PersonenID = " + Auswahl.getPersonenID();
            InsertStatement = DH.prepareStatement(SQLString);
            InsertStatement.setString(1, LabelGWert.getText());
            InsertStatement.execute();
            IM.setInfoText("Änderung durchgeführt");
          } catch (SQLException e) {
            IM.setErrorText("Ändern Fehlgeschlagen", e);
          }
          refreshPolizistAnsicht();
          PopUp.close();
        });

    PopUp.setScene(new Scene(AussenBox));
    PopUp.showAndWait();
  }
コード例 #7
0
  private void insertNewEntry() {
    Stage PopUp = new Stage();
    PopUp.initModality(Modality.APPLICATION_MODAL);
    PopUp.setTitle("Neuer Eintrag");
    PopUp.setAlwaysOnTop(true);
    PopUp.setResizable(false);

    GridPane Gitter = new GridPane();
    Gitter.setHgap(10);
    Gitter.setVgap(10);

    Label LabelB = new Label("Name");
    TextField LabelBWert = new TextField();

    Label LabelC = new Label("Geburtsdatum");
    DatePicker LabelCWert = new DatePicker();

    Label LabelD = new Label("Nationalität");
    TextField LabelDWert = new TextField();

    Label LabelE = new Label("Geschlecht");
    ComboBox LabelEWert = new ComboBox();

    Label LabelF = new Label("Todesdatum");
    DatePicker LabelFWert = new DatePicker();

    Label LabelG = new Label("Dienstgrad");
    TextField LabelGWert = new TextField();

    final Callback<DatePicker, DateCell> TagesZellenFabtrik =
        new Callback<DatePicker, DateCell>() {
          @Override
          public DateCell call(final DatePicker DP) {
            return new DateCell() {
              @Override
              public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if (item.isBefore(LabelCWert.getValue().plusDays(1))) {
                  setDisable(true);
                  setStyle("-fx-background-color: #ffc0cb;");
                }
              }
            };
          }
        };
    LabelFWert.setDayCellFactory(TagesZellenFabtrik);

    LabelEWert.getItems().addAll("m", "w");
    LabelEWert.setValue("m");

    Button ButtonFort = new Button("Fortfahren");
    Button ButtonAbb = new Button("Abbrechen");

    ButtonFort.defaultButtonProperty();
    ButtonAbb.cancelButtonProperty();

    ButtonFort.setMaxWidth(Double.MAX_VALUE);
    ButtonAbb.setMaxWidth(Double.MAX_VALUE);

    Gitter.addColumn(0, LabelB, LabelC, LabelD, LabelE, LabelF, LabelG);
    Gitter.addColumn(1, LabelBWert, LabelCWert, LabelDWert, LabelEWert, LabelFWert, LabelGWert);

    VBox AussenBox = new VBox(10);
    HBox InnenBox = new HBox();

    AussenBox.setSpacing(10);
    AussenBox.setPadding(new Insets(10));
    InnenBox.setSpacing(10);

    AussenBox.setAlignment(Pos.CENTER);
    InnenBox.setAlignment(Pos.BOTTOM_CENTER);

    AussenBox.getChildren().addAll(Gitter, InnenBox);
    InnenBox.getChildren().addAll(ButtonFort, ButtonAbb);

    ButtonAbb.setOnAction(event -> PopUp.close());
    ButtonFort.setOnAction(
        event -> {
          String SQLString;
          if (LabelFWert.getValue() != null) {
            SQLString =
                "INSERT INTO PERSON (Name, Geburtsdatum, Nationalität, Geschlecht, Todesdatum) VALUES (?, ?, ?, ?, ?)";
          } else {
            SQLString =
                "INSERT INTO PERSON (Name, Geburtsdatum, Nationalität, Geschlecht) VALUES (?, ?, ?, ?)";
          }
          try {
            PreparedStatement InsertStatement = DH.prepareStatement(SQLString);
            InsertStatement.setString(1, LabelBWert.getText());
            InsertStatement.setString(2, LabelCWert.getValue().toString()); // TODO exception
            InsertStatement.setString(3, LabelDWert.getText());
            InsertStatement.setString(4, LabelEWert.getValue().toString());
            if (LabelFWert.getValue() != null) {
              InsertStatement.setString(5, LabelFWert.getValue().toString()); // TODO exception
            }
            InsertStatement.executeUpdate();
            ResultSet PersID = DH.getAnfrageObjekt().executeQuery("SELECT last_insert_rowid();");
            if (!PersID.next()) {
              IM.setErrorText("Konnte Primärschlüssel nicht mehr bestimmen.");
            }
            SQLString = "INSERT INTO POLIZIST (PersonenID, Dienstgrad) VALUES (?, ?)";
            InsertStatement = DH.prepareStatement(SQLString);
            InsertStatement.setInt(1, PersID.getInt(1)); // TODO das hier verifizieren
            InsertStatement.setString(2, LabelGWert.getText());
            InsertStatement.executeUpdate();
            IM.setInfoText("Einfügen durchgeführt");
          } catch (SQLException e) {
            IM.setErrorText("Einfügen Fehlgeschlagen", e);
          }
          refreshPolizistAnsicht();
          PopUp.close();
        });

    PopUp.setScene(new Scene(AussenBox));
    PopUp.showAndWait();
  }
コード例 #8
0
ファイル: View.java プロジェクト: dejure14/hop
  @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();
  }
コード例 #9
0
ファイル: Main.java プロジェクト: Team13Avengers/PubFinder
  /* ADMIN SCENE */
  public void start(Stage primaryStage) throws Exception {
    /** Done by Marco */
    primaryStage.setTitle("PubFinder");
    primaryStage.setResizable(false);
    PubDataAccessor.PubDataAccessor();

    /*Welcome scene*/
    WelcomeScene.welcomeScene();
    welcomeScene = WelcomeScene.welcomeScene;
    /*Welcome scene*/
    /** End of Marcos Work */
    /** Done by Shafiq and Anotnino */
    /* Admin add scene*/
    AdminAddScene.adminAddscene();
    adminAddScene = AdminAddScene.adminAddScene;
    /* Admin add scene*/

    /*Admin login scene*/
    AdminLoginScene.adminloginscene();
    adminLoginScene = AdminLoginScene.adminLoginScene;
    /*Admin login scene*/

    /*Admin choice scene*/
    AdminChoiceScene.adminchoicescene();
    adminChoiceScene = AdminChoiceScene.adminChoiceScene;
    /*Admin choice scene*/

    /* Admin Edit Scene*/
    adminEditScene = AdminEditScene.editScene;
    /* Admin Edit Scene*/
    /** End of Shafiq and Anotonino's Work */

    /*Pub button scene*/
    pubLayout = new StackPane();
    /** Done by Ahmad */
    searchNameInput = new TextField();
    searchNameInput.setId("search-field");
    searchNameInput.setPromptText("NAME");
    /** End of Ahmad's Work */
    searchStreetInput = new TextField();
    searchStreetInput.setId("search-field");
    searchStreetInput.setPromptText("STREET");
    searchAgeInput = new TextField();
    searchAgeInput.setId("search-field");
    searchAgeInput.setPromptText("AGE");
    /** Done by Aseel */
    CheckBox searchStudentDiscount = new CheckBox("DISCOUNTS");
    CheckBox searchBySpecialEvents = new CheckBox("EVENTS");
    CheckBox searchWithoutFees = new CheckBox("NO FEES");
    searchStudentDiscount.setId("check-search");
    searchBySpecialEvents.setId("check-search");
    searchWithoutFees.setId("check-search");
    ComboBox searchByRating =
        new ComboBox(
            FXCollections.observableArrayList(
                "\uF005",
                "\uF005\uF005",
                "\uF005\uF005\uF005",
                "\uF005\uF005\uF005\uF005",
                "\uF005\uF005\uF005\uF005\uF005"));
    searchByRating.setTooltip(new Tooltip("RATING"));
    searchByRating.setPromptText("RATING");
    searchByRating.setId("combo-search");
    ComboBox searchByArea =
        new ComboBox(
            FXCollections.observableArrayList(
                "All",
                "Avenyn",
                "Linné",
                "Haga",
                "Järntorget",
                "Magasinsgatan",
                "Vasastaden",
                "Gamlestaden",
                "Heden",
                "Masthugget",
                "Stigberget",
                "Other"));
    searchByArea.setTooltip(new Tooltip("AREA"));
    searchByArea.setPromptText("AREA");
    searchByArea.setId("combo-search");
    /** End of Aseel's Work */

    /** Done by Marco */
    pubLayout.setId("pubs");
    search = new Button("SEARCH");
    search.setId("button-search");
    GridPane inputGrid = new GridPane();
    inputGrid.setMaxHeight(100);
    inputGrid.setHgap(10);
    inputGrid.setVgap(10);
    inputGrid.setId("searchGrid");
    StackPane.setAlignment(inputGrid, Pos.TOP_LEFT);
    StackPane.setAlignment(search, Pos.TOP_RIGHT);
    /** End of Marco's Work */
    search.setOnAction(e -> searchForPubs());
    /** Done by Ahmad */
    searchNameInput.setOnKeyReleased(
        event1 -> {
          if (event1.getCode() == KeyCode.ENTER) {
            searchForPubs();
          }
        });
    /** End of Ahmad's Work */

    /** Done by Marco */
    searchStreetInput.setOnKeyReleased(
        event2 -> {
          if (event2.getCode() == KeyCode.ENTER) {
            searchForPubs();
          }
        });
    /** End of Marco's Work */

    /** Done by Ahmad */
    searchAgeInput.setOnKeyReleased(
        event3 -> {
          if (event3.getCode() == KeyCode.ENTER) {
            searchForPubs();
          }
        });
    /** End of Ahmad's Work */

    /** Done by Shafiq & Anotnino */
    searchStudentDiscount.setOnAction(
        event4 -> {
          if (searchStudentDiscount.isSelected()) {
            discount = 1;
          }
          if (!searchStudentDiscount.isSelected()) {
            discount = 0;
          }
        });

    searchWithoutFees.setOnAction(
        event5 -> {
          if (searchWithoutFees.isSelected()) {
            fee = 0;
          }
          if (!searchWithoutFees.isSelected()) {
            fee = 1;
          }
        });

    searchBySpecialEvents.setOnAction(
        event6 -> {
          if (searchBySpecialEvents.isSelected()) {

            searchEvent = true;
          }
          if (!searchBySpecialEvents.isSelected()) {
            searchEvent = false;
          }
        });

    searchByRating.setOnAction(
        event7 -> {
          if (searchByRating.getSelectionModel().isSelected(0)) {
            numberOfStars = 1;
          } else if (searchByRating.getSelectionModel().isSelected(1)) {
            numberOfStars = 2;
          } else if (searchByRating.getSelectionModel().isSelected(2)) {
            numberOfStars = 3;
          } else if (searchByRating.getSelectionModel().isSelected(3)) {
            numberOfStars = 4;
          } else if (searchByRating.getSelectionModel().isSelected(4)) {
            numberOfStars = 5;
          }
        });
    /** End of Shafiq and Anotino's Work */

    /** Done by Aseel and Antonino */
    searchByArea.setOnAction(
        event8 -> {
          if (searchByArea.getSelectionModel().isSelected(0)) {
            area_checker = 2;
          }
          if (searchByArea.getSelectionModel().isSelected(1)) {
            area = 0;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(2)) {
            area = 2;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(3)) {
            area = 3;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(4)) {
            area = 4;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(5)) {
            area = 5;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(6)) {
            area = 6;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(7)) {
            area = 7;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(8)) {
            area = 8;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(9)) {
            area = 9;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(10)) {
            area = 10;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(11)) {
            area = 11;
            area_checker = 1;
          }
        });
    /** End of Aeel and Antonino's Work */

    /** Done by marco */
    ScrollPane pubScroll = new ScrollPane();
    pubScroll.setId("scroll");
    pubScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    pubScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    pubs = new GridPane();
    pubScroll.setContent(pubs);
    pubs.setId("pub-grid");
    pubs.setAlignment(Pos.CENTER);
    pubLayout.getChildren().add(pubScroll);

    inputGrid.add(searchNameInput, 1, 1);
    inputGrid.add(searchStreetInput, 2, 1);
    inputGrid.add(searchAgeInput, 3, 1);

    inputGrid.add(searchByRating, 4, 1);
    inputGrid.add(searchByArea, 5, 1);
    inputGrid.add(searchStudentDiscount, 6, 1);
    inputGrid.add(searchBySpecialEvents, 7, 1);
    inputGrid.add(searchWithoutFees, 8, 1);

    pubLayout.getChildren().add(inputGrid);
    pubLayout.getChildren().add(search);
    noPub = new Label("No pubs found");
    searchForPubs();

    pubScene = new Scene(pubLayout, 1000, 600);
    pubScene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());
    /*Pub button scene*/

    /*Pub scene*/
    ScrollPane pubPageLayout = new ScrollPane();
    pubPageLayout.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    pubPageLayout.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    pubPageLayout.setFitToWidth(true);
    pubPageLayout.setContent(xPane);
    xPane.setId("pubScene");
    pubPageLayout.setId("gej");
    star.setId("starButton");
    eventLabel.setId("eventLabel");

    /*Items*/
    xPane.add(back, 1, 1);
    back.setId("button-logout");

    back.setOnAction(
        (event) -> {
          primaryStage.setScene(pubScene);
          xPane
              .getChildren()
              .removeAll(description, rating, overlay, pubName, map, star, rates, events);
          descriptionGrid
              .getChildren()
              .removeAll(age, open, address, type, discountForStudents, entranceFees);
          events.getChildren().removeAll(eventDescriptionGrid);
          eventDescriptionGrid.getChildren().removeAll(eventLabel, eventPane);
          eventPane.getChildren().removeAll(eventGrid);
          eventGrid.getChildren().removeAll(eventName, eventDescription);

          star.setText("0 \uF08A");
          star.setStyle(
              "#starButton{-fx-text-fill: #fff;}  #starButton:hover{-fx-text-fill: #fff;}");
        });
    /** End of Marco's work */

    /** Done by Shafiq & Antonino */
    star.setOnAction(
        event -> {
          int rate = PubDataAccessor.checkRate(this.id);
          int rateUpdate = rate + 1;
          /** End of Shafiq & Antonino's Work */

          /** Done by marco */
          star.setText((rateUpdate) + " \uF004");
          PubDataAccessor.updateRate(this.id);
          star.setStyle("-fx-text-fill: #731a2b;");
        });

    overlay.setHeight(header.getFitHeight());
    overlay.setWidth(header.getFitWidth() + 24);
    overlay.setX(0);
    overlay.setY(0);
    overlay.fillProperty().set(javafx.scene.paint.Color.rgb(115, 26, 43, 0.3));

    pubPage = new Scene(pubPageLayout, 1000, 600);
    pubPage.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());
    /*Pub scene*/

    primaryStage.setScene(welcomeScene);
    primaryStage.show();
    Main.primaryStage = primaryStage;
    /** End of Marcos work */
  }