Exemple #1
0
  public void setPubScene() {
    /** Done by Marco */
    xPane.setStyle(
        "-fx-background-image: url("
            + "\""
            + Pub.getImage(Pub.getIndexById(this.id))
            + "\""
            + "); ");
    description = new StackPane();
    events = new StackPane();
    rating = new StackPane();
    rating.setId("rating");
    description.setId("description");
    descriptionGrid.setId("description-text");
    pubName = new Label("- " + Pub.getName(Pub.getIndexById(this.id)) + " -");
    age = new Label(Pub.getAge(Pub.getIndexById(this.id)) + " years \uF000");
    age.setId("infoLabel");
    open = new Label(Pub.getOpening(Pub.getIndexById(this.id)) + " \uF017");
    open.setId("infoLabel");
    address = new Label(Pub.getAddress(Pub.getIndexById(this.id)) + " \uF124");
    address.setId("infoLabel");
    type = new Label(Pub.getType(Pub.getIndexById(this.id)) + " \uF005");
    type.setId("infoLabel");
    /** End of Marco's work */

    /** Done by Aseel */
    discountForStudents =
        new Label(Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) + " \uF02D");
    if (Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) == 1) {
      discountForStudents = new Label("Discounts " + " \uF02D");
    } else if (Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) == 0) {
      discountForStudents = new Label("No Discounts " + "\uF02D");
    }
    discountForStudents.setId("infoLabel");

    entranceFees = new Label(Pub.getHasFee(Pub.getIndexById(this.id)) + "\uf153");
    if (Pub.getHasFee(Pub.getIndexById(this.id)) == 1) {
      entranceFees = new Label("Fees " + " \uF153");
    } else if (Pub.getHasFee(Pub.getIndexById(this.id)) == 0) {
      entranceFees = new Label("No Fees " + "\uF153");
    }
    entranceFees.setId("infoLabel");
    /** End of Aseel's work */

    /** Done by Marco */
    map.setMinWidth(1000);
    map.setMaxHeight(250);
    browser.load(
        "http://locateme.marcokoivisto.me/?lat="
            + Pub.getLat(Pub.getIndexById(this.id))
            + "&lon="
            + Pub.getLon(Pub.getIndexById(this.id)));

    int nrStars = Pub.getNrStars(Pub.getIndexById(this.id));
    String stars = "";

    for (int i = 0; i < nrStars; i++) {
      stars += "\uF005 ";
    }
    rates = new Label(stars);
    rates.setId("ratingOfStars");

    rating.getChildren().add(rates);
    rating.setAlignment(Pos.CENTER);
    xPane.add(pubName, 1, 1);
    descriptionGrid.add(discountForStudents, 1, 1);
    descriptionGrid.add(entranceFees, 2, 1);
    descriptionGrid.add(age, 3, 1);
    descriptionGrid.add(open, 4, 1);
    descriptionGrid.add(type, 5, 1);
    descriptionGrid.add(address, 6, 1);
    /** End of Marco's work */

    /** Done by Marco */
    descriptionGrid.setAlignment(Pos.CENTER);
    description.getChildren().addAll(descriptionGrid);
    eventDescriptionGrid.add(eventLabel, 1, 1);
    eventDescriptionGrid.add(eventPane, 1, 2);
    GridPane.setHalignment(eventLabel, HPos.CENTER);
    eventDescriptionGrid.setAlignment(Pos.CENTER);

    events.getChildren().addAll(eventDescriptionGrid);

    eventName = new Label(Pub.getEventName(Pub.getIndexById(this.id)));
    eventDescription = new Label(Pub.getEventDescription(Pub.getIndexById(this.id)));
    eventGrid.add(eventName, 1, 1);
    eventGrid.add(eventDescription, 1, 2);
    eventName.setId("eventName");
    eventDescription.setId("eventDescription");
    eventPane.getChildren().add(eventGrid);
    eventGrid.setId("event");

    events.setId("eventField");
    xPane.add(rating, 1, 2);
    xPane.add(description, 1, 3);

    xPane.add(map, 1, 4);
    if (Pub.getEventName(Pub.getIndexById(this.id)) != "") {
      xPane.add(events, 1, 5);
    }

    pubName.setId("pub_name");
    GridPane.setHalignment(pubName, HPos.CENTER);
    GridPane.setValignment(pubName, VPos.TOP);
    GridPane.setValignment(back, VPos.TOP);
    GridPane.setHalignment(star, HPos.RIGHT);
    GridPane.setValignment(star, VPos.TOP);

    xPane.add(star, 1, 1);
    header.setFitWidth(1000);
    header.setPreserveRatio(true);
    /** End of Marco's work */

    /** Done by Shafiq & Antonino */
    int rate = PubDataAccessor.checkRate(this.id);
    star.setText(rate + " \uF08A");
    /** End of Shafiq & Antonino's WORK */
  }