예제 #1
0
 @Override
 public void setupHelp() {
   Label helpText = new Label(help.get(Help.HelpKey.HOMEPAGE_HELP));
   helpText.setMaxWidth(300);
   helpText.setWrapText(true);
   helpText.setTextAlignment(TextAlignment.CENTER);
   setHelpPopupContent(helpText);
 }
예제 #2
0
    private BuddyCell() {
      iconLabel = new ImageView();
      iconLabel.setFitHeight(20);
      iconLabel.setFitWidth(20);
      getChildren().add(iconLabel);

      nameLabel = new Label();
      nameLabel.setMaxWidth(Double.MAX_VALUE);
      HBox.setHgrow(nameLabel, Priority.ALWAYS);
      getChildren().add(nameLabel);

      onlineCheckBox = new CheckBox();
      getChildren().add(onlineCheckBox);
    }
예제 #3
0
  /**
   * Builds the element that lets the user add this exercise
   *
   * @param screenWidth
   * @param screenHeight
   * @param sourceFile
   * @param workoutBuilder
   */
  public ExerciseContent(
      double screenWidth, double screenHeight, File sourceFile, CreateWorkout workoutBuilder) {

    // get the exercise details
    this.sourceFile = sourceFile;
    XMLParser parser = new XMLParser(sourceFile.getName());

    exerciseLabel = new Label(parser.getDocumentInfo().getTitle());
    exerciseLabel.setMinWidth(screenWidth * 0.1);
    exerciseLabel.setMinWidth(screenWidth * 0.075);

    descriptionLabel = new Label(parser.getDocumentInfo().getComment());
    descriptionLabel.setMinWidth(screenWidth * 0.2);
    descriptionLabel.setMaxWidth(screenWidth * 0.2);
    descriptionLabel.setWrapText(true);

    repAmount = new TextField();
    repAmount.setPrefWidth(screenWidth * 0.05);

    setAmount = new TextField();
    setAmount.setPrefWidth(screenWidth * 0.05);

    addExercise = new Button("ADD");
    addExercise.setPrefSize(screenWidth * 0.05, screenHeight * 0.025);

    setNodeCursor(addExercise);

    // add the exercise to the selected exercise list
    addExercise.setOnAction(
        new EventHandler<ActionEvent>() {

          public void handle(ActionEvent event) {

            if ((isInt(setAmount.getText())) && (isInt(repAmount.getText()))) {
              workoutBuilder.addToList(
                  sourceFile.getName(),
                  exerciseLabel.getText(),
                  Integer.parseInt(setAmount.getText()),
                  Integer.parseInt(repAmount.getText()));
            }
          }
        });

    getChildren().addAll(exerciseLabel, descriptionLabel, repAmount, setAmount, addExercise);
    setWidth(screenWidth * 0.4);
    setHeight(screenHeight * 0.2);
    setSpacing(screenWidth * 0.01);
    setPadding(new Insets(0, 0, 0, screenWidth * 0.01));
  }
예제 #4
0
  public static void rightVisuaalid() {
    rightVbox = new VBox();
    rightVbox.setSpacing(5);
    rightVbox.setPadding(new Insets(15, 0, 0, 10));

    jaatmejaamadeVastuvottLabel1 = new Label("Jäätmejaamades võetakse elanikelt tasuta vastu:");
    jaatmejaamadeVastuvottLabel1.setStyle("-fx-font: 12 helvetica;-fx-font-weight: bold");
    Label jaatmejaamadeVastuvottLabel2 =
        new Label(
            "* pakendeid "
                + "\n"
                + "* plaste"
                + "\n"
                + "* paberit ja pappi"
                + "\n"
                + "* immutamata/töötlemata puitu"
                + "\n"
                + "* betooni ja telliseid (va Rahumäe jäätmejaam, kus kehtib eraldi hinnakiri)"
                + "\n"
                + "* vanametalli"
                + "\n"
                + "* toiduõli"
                + "\n"
                + "* kasutuskõlblikku vanamööblit"
                + "\n"
                + "* sõiduauto rehve"
                + "\n"
                + "* elektri- ja elektroonikajäätmeid"
                + "\n"
                + "* klaasi"
                + "\n"
                + "* kasutatud riideid"
                + "\n"
                + "* biolagunevaid aia- ja haljastusjäätmeid"
                + "\n"
                + "* koduseid ohtlikke jäätmeid"
                + "\n");
    jaatmejaamadeVastuvottLabel2.setMaxWidth(250);
    jaatmejaamadeVastuvottLabel2.setWrapText(true);

    kaardiNupp = new Button("Jäätmejaamade kaart");
    nupuvajutus();

    rightVbox
        .getChildren()
        .addAll(jaatmejaamadeVastuvottLabel1, jaatmejaamadeVastuvottLabel2, kaardiNupp);
    Java_fx.border.setRight(rightVbox);
  }
예제 #5
0
 public static void nupuvajutus(Button sorteeriNupp, TextField kasutajaInput) {
   // "Sorteeri!" nupp ACTION!
   Pane sobivKonteinerLayout = new Pane();
   sorteeriNupp.setOnAction(
       event -> {
         voimalikPrygiList.getPrygi().clear();
         sobivKonteinerLayout.getChildren().clear();
         String input = kasutajaInput.getText().toLowerCase();
         String sobivKonteiner = "";
         if (input.isEmpty()) {
           sobivKonteiner = "Unustasid pürgi sisestada!";
         } else if (TopView.bio.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.bio.kuhuVisata(input);
         } else if (TopView.elektroonika.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.elektroonika.kuhuVisata(input);
         } else if (TopView.paberPapp.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.paberPapp.kuhuVisata(input);
         } else if (TopView.ohtlikud.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.ohtlikud.kuhuVisata(input);
         } else if (TopView.metallpakend.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.metallpakend.kuhuVisata(input);
         } else if (TopView.klaaspakend.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.klaaspakend.kuhuVisata(input);
         } else if (TopView.plastpakend.kuhuVisata(input) != "") {
           sobivKonteiner = TopView.plastpakend.kuhuVisata(input);
         } else if (voimalikPrygiList.getPrygi().isEmpty()) {
           sobivKonteiner =
               "Kahjuks ei leidnud hetkel sobivat konteinerit, vaata äkki leiad midagi sarnast pürgikonteineritele klikkides.";
         } else {
           sobivKonteiner =
               "Prügi "
                   + kasutajaInput.getText()
                   + " ei leitud, äkki mõtlesid hoopis midagi neist : "
                   + "\n"
                   + voimalikPrygiList.prindiKonteineriList();
         }
         kasutajaInput.clear();
         Label sobivKonteinerLabel = new Label(sobivKonteiner);
         sobivKonteinerLabel.setMaxWidth(180);
         sobivKonteinerLabel.setWrapText(true);
         sobivKonteinerLayout.getChildren().add(sobivKonteinerLabel);
       });
   leftVbox.getChildren().add(sobivKonteinerLayout);
 }
  public MusicSegmentController(final String name, float length, double width, String audioPath) {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/com/view/musicSegment.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    this.setId(Controller.userName + Controller.musicSegmentIndex);
    this.setPadding(InsetsBuilder.create().left(10).top(10).build());

    this.audioPath = audioPath;
    this.name = name;
    this.length = length;
    this.width = width;

    try {
      fxmlLoader.load();
    } catch (IOException exception) {
      throw new RuntimeException(exception);
    }
    // this.setId(name + "MusicSegmentComponent");
    if (name != null) {
      musicSegmentName.setText("(" + length + " ms)");
    }
    musicSegmentRectangle.widthProperty().bind(this.widthProperty());
    // musicSegmentRectangle.setWidth(width);
    musicSegmentName.setMinWidth(width);
    musicSegmentName.setMaxWidth(width);
    this.setWidth(width);
    this.setMaxWidth(width);
    this.setMinWidth(width);
    dragRectangle =
        new Rectangle(
            musicSegmentRectangle.getWidth(),
            musicSegmentRectangle.getHeight(),
            musicSegmentRectangle.getFill());
    // this.setPadding(InsetsBuilder.create().left(10).right(10).build());

    this.setOnMouseEntered(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            musicSegmentActions.setVisible(true);
            FadeTransition fadeTransition =
                new FadeTransition(Duration.millis(200), musicSegmentActions);
            fadeTransition.setFromValue(0.0);
            fadeTransition.setToValue(1.0);
            fadeTransition.play();
          }
        });

    this.setOnMouseExited(
        new EventHandler<MouseEvent>() {

          public void handle(MouseEvent mouseEvent) {
            FadeTransition fadeTransition =
                new FadeTransition(Duration.millis(200), musicSegmentActions);
            fadeTransition.setFromValue(1.0);
            fadeTransition.setToValue(0.0);
            fadeTransition.play();
          }
        });

    this.setOnDragDetected(
        new EventHandler<MouseEvent>() {
          public void handle(MouseEvent event) {
            System.out.println("Drag entered music segment");

            /* drag was detected, start a drag-and-drop gesture*/
            /* allow any transfer mode */
            Dragboard db = musicSegmentName.startDragAndDrop(TransferMode.COPY);

            /* Put a string on a dragboard */
            ClipboardContent content = new ClipboardContent();
            content.putString(musicSegmentName.getText());
            db.setContent(content);

            event.consume();
          }
        });

    Media media = new Media(new File(audioPath).toURI().toString());
    mediaPlayer = MediaPlayerBuilder.create().media(media).build();

    btnPlayMusicSegment.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            mediaPlayer.play();
          }
        });

    btnStopMusicSegment.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            mediaPlayer.pause();
          }
        });

    btnDeleteMusicSegment.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent mouseEvent) {
            // Group group = (Group) getController().getParent();
            // group.getChildren().remove(getController());
            if (Controller.getTracksArea().getChildren().remove(getController())) {
              System.out.println("Music segment deleted");
            } else {
              System.out.println("music segment could not be deleted");
            }
          }
        });
  }
  @FXML
  public void handleOk() {
    String tituloAux = titulo.getText().replaceAll(" ", "+").toLowerCase();
    String toJson = readUrl(BASE + tituloAux + "&type=series" + "&r=json");
    resultados.getChildren().clear();
    try {
      JSONObject busqueda = new JSONObject(toJson);
      if (busqueda.getString("Response").equals("True")) {
        JSONArray res = busqueda.getJSONArray("Search");
        resultados.setPrefRows(res.length());
        for (int i = 0; i < res.length(); i++) {
          JSONObject resActual = new JSONObject(res.get(i).toString());
          HBox resultadoActual = new HBox(50);
          resultadoActual.setMaxWidth(Double.MAX_VALUE);
          resultadoActual.setAlignment(Pos.CENTER_LEFT);
          ImageView posterActual = new ImageView();

          try {
            Image image = new Image(resActual.getString("Poster"));
            posterActual.setImage(image);
            posterActual.setFitHeight(240);
            posterActual.setFitWidth(180);
            posterActual.setPreserveRatio(false);
            resultadoActual.getChildren().add(posterActual);
          } catch (IllegalArgumentException e) {
            //                        System.out.println("Bad url");
            Image image =
                new Image(MainApp.class.getResource("resources/no-image.png").toExternalForm());
            posterActual.setImage(image);
            posterActual.setFitHeight(240);
            posterActual.setFitWidth(180);
            posterActual.setPreserveRatio(false);
            resultadoActual.getChildren().add(posterActual);
          }

          String details;
          String nomSerie = new String(resActual.getString("Title").getBytes(), "UTF-8");
          String anoSerie = new String(resActual.getString("Year").getBytes(), "UTF-8");
          if (nomSerie.length() > 15) {
            details = "%-12.12s...\t\t Año: %-10s";
          } else {
            details = "%-12s\t\t Año: %-10s";
          }
          details = String.format(details, nomSerie, anoSerie);
          Label elemento = new Label(details);
          elemento.setMaxWidth(Double.MAX_VALUE);
          elemento.setMaxHeight(Double.MAX_VALUE);
          resultadoActual.getChildren().add(elemento);

          posterActual.setId(resActual.getString("imdbID"));
          posterActual.setOnMouseClicked(
              new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                  ImageView clickedButton = (ImageView) event.getSource();
                  Stage stage = (Stage) clickedButton.getScene().getWindow();
                  Task task =
                      new Task() {
                        @Override
                        protected Object call() throws Exception {
                          mainController.mainApp.scene.setCursor(Cursor.WAIT);
                          Serie toAdd = new Serie(clickedButton.getId());
                          boolean possible = true;
                          for (Serie serie : mainController.getSeries()) {
                            if (serie.equals(toAdd)) possible = false;
                          }
                          if (possible) mainController.getSeries().add(toAdd);

                          try {
                            mainController.populateImagenes();
                            mainController.showDetallesMes(mainController.getMesActual());
                          } catch (Exception e) {
                            e.printStackTrace();
                          } finally {
                            mainController.mainApp.scene.setCursor(Cursor.DEFAULT);

                            return mainController.getSeries();
                          }
                        }
                      };
                  Thread th = new Thread(task);
                  th.setDaemon(true);
                  th.start();
                  stage.close();
                }
              });
          resultados.getChildren().add(resultadoActual);
        }
      } else {
        resultados.getChildren().add(new Label("La busqueda no obtuvo resultados"));
      }
    } catch (JSONException e) {
      e.printStackTrace();
    } catch (UnsupportedEncodingException ex) {
      Logger.getLogger(NewSerieController.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  /**
   * Creates the tab for displaying creator properties. This tab is constructed using the {@code
   * createPropertyBox} and {@code createGroupPropertySection} methods found below.
   *
   * @param artifact The popup artifact
   * @return content or null if nothing for user to do
   */
  private VBox createCreatorTab(final PackageArtifact artifact) {
    final VBox propertiesBox = new VBox(12);
    propertiesBox.getStyleClass().add(PACKAGE_TOOL_POPUP_PROPERTY_TAB);

    Label requiredLabel = new Label(labels.get(Labels.LabelKey.REQUIRED_FIELDS_LABEL));
    requiredLabel.setMaxWidth(300);
    requiredLabel.setWrapText(true);
    requiredLabel.setTextAlignment(TextAlignment.CENTER);

    propertiesBox.getChildren().add(requiredLabel);

    final Map<String, String> properties = packageOntologyService.getProperties(artifact);

    List<String> sortedProperties = new ArrayList<>();

    // Get the creator property set and then create a sorted list from it.
    sortedProperties.addAll(packageOntologyService.getCreatorProperties(artifact));
    sortProperties(sortedProperties, artifact, "");

    // Loop through all the creator properties as defined in the ontology.
    for (final String property : sortedProperties) {
      final PackageDescriptionViewImpl.ArtifactPropertyContainer container =
          new PackageDescriptionViewImpl.ArtifactPropertyContainer();

      // If the property is complex use the group property creation, otherwise use the simple
      // property set up.
      if (packageOntologyService.isPropertyComplex(properties.get(property))) {
        container.isComplex = true;
        VBox complexPropertyBox =
            createGroupPropertySection(
                artifact, property, properties.get(property), false, container);
        propertiesBox.getChildren().add(complexPropertyBox);
        int maxOccurances =
            packageOntologyService.getPropertyMaxOccurrences(artifact, property, "");

        // If the ontology allows for more than one of the property add a button which will add more
        // groups when pressed.
        if (maxOccurances > 1) {
          final Button addNewButton =
              new Button(labels.get(Labels.LabelKey.ADD_NEW_BUTTON) + " " + property);
          addNewButton.setMaxWidth(addNewButtonMaxWidth);
          propertiesBox.getChildren().add(addNewButton);
          addNewButton.setDisable(true);

          final GroupPropertyChangeListener listener =
              new GroupPropertyChangeListener(addNewButton, container);

          for (Node n : propertiesBox.getChildren()) {
            if (n instanceof VBox) {
              addChangeListenerToSectionFields((VBox) n, listener);
            }
          }

          listener.changed(null, "n/a", "n/a");

          addNewButton.setOnAction(
              arg0 -> {
                VBox complexPropertyBox1 =
                    createGroupPropertySection(
                        artifact, property, properties.get(property), true, container);
                int buttonIndex = propertiesBox.getChildren().indexOf(addNewButton);

                propertiesBox.getChildren().add(buttonIndex, complexPropertyBox1);

                addChangeListenerToSectionFields(complexPropertyBox1, listener);
                addNewButton.setDisable(true);
                requestFocusForNewGroup(complexPropertyBox1);
              });
        }
      } else {
        // Otherwise create just the simple property
        int maxOccurances =
            packageOntologyService.getPropertyMaxOccurrences(artifact, property, "");
        int minOccurances =
            packageOntologyService.getPropertyMinOccurrences(artifact, property, "");
        boolean systemGenerated =
            packageOntologyService.isSystemSuppliedProperty(artifact, property);

        Set<StringProperty> fields = new HashSet<>();

        propertiesBox
            .getChildren()
            .add(
                new TextPropertyBox(
                    artifact,
                    "",
                    ontologyLabels.get(property),
                    property,
                    artifact.getSimplePropertyValues(property),
                    maxOccurances,
                    fields,
                    minOccurances,
                    systemGenerated,
                    packageOntologyService,
                    labels,
                    messages,
                    applyButtonValidationListener));
        container.values = fields;
      }

      artifactPropertyFields.put(property, container);
    }

    // Return null if nothing to edit.
    if (propertiesBox.getChildren().size() == 1) {
      return null;
    }

    return propertiesBox;
  }
  /*
   * Creates the general properties tab, general properties are any properties that aren't defined to be creator properties,
   * by the ontology.
   * @param artifact
   * @return the VBox for the general tab
   */
  private VBox createGeneralTab(final PackageArtifact artifact) {
    final VBox propertiesBox = new VBox(12);

    propertiesBox.getStyleClass().add(PACKAGE_TOOL_POPUP_PROPERTY_TAB);
    Set<String> creatorProperties = packageOntologyService.getCreatorProperties(artifact);
    final Map<String, String> properties = packageOntologyService.getProperties(artifact);

    Label requiredLabel = new Label(labels.get(Labels.LabelKey.REQUIRED_FIELDS_LABEL));
    requiredLabel.setMaxWidth(400);
    requiredLabel.setWrapText(true);
    requiredLabel.setTextAlignment(TextAlignment.CENTER);

    propertiesBox.getChildren().add(requiredLabel);
    List<String> sortedProperties = new ArrayList<>();

    // Get the property name key set and then create a sorted list from it.
    sortedProperties.addAll(properties.keySet());
    sortProperties(sortedProperties, artifact, "");

    // Loop through all the available properties
    for (final String property : sortedProperties) {
      // If the property isn't a creator property we include it in this tab
      if (!creatorProperties.contains(property)) {
        final PackageDescriptionViewImpl.ArtifactPropertyContainer container =
            new PackageDescriptionViewImpl.ArtifactPropertyContainer();

        // If the property is complex use the group property creation.
        if (packageOntologyService.isPropertyComplex(properties.get(property))) {
          container.isComplex = true;
          VBox complexPropertyBox =
              createGroupPropertySection(
                  artifact, property, properties.get(property), false, container);
          propertiesBox.getChildren().add(complexPropertyBox);
          int maxOccurrences =
              packageOntologyService.getPropertyMaxOccurrences(artifact, property, "");

          // If the property allows for more than one value include a button to add more fields.
          if (maxOccurrences > 1) {
            final Button addNewButton =
                new Button(
                    labels.get(Labels.LabelKey.ADD_NEW_BUTTON)
                        + " "
                        + ontologyLabels.get(property));
            addNewButton.setMaxWidth(addNewButtonMaxWidth);
            addNewButton.setDisable(true);
            propertiesBox.getChildren().add(addNewButton);

            final GroupPropertyChangeListener listener =
                new GroupPropertyChangeListener(addNewButton, container);

            for (Node n : propertiesBox.getChildren()) {
              if (n instanceof VBox) {
                addChangeListenerToSectionFields((VBox) n, listener);
              }
            }

            listener.changed(null, "n/a", "n/a");

            addNewButton.setOnAction(
                arg0 -> {
                  VBox complexPropertyBox1 =
                      createGroupPropertySection(
                          artifact, property, properties.get(property), true, container);
                  int buttonIndex = propertiesBox.getChildren().indexOf(addNewButton);

                  propertiesBox.getChildren().add(buttonIndex, complexPropertyBox1);

                  addChangeListenerToSectionFields(complexPropertyBox1, listener);
                  addNewButton.setDisable(true);
                  requestFocusForNewGroup(complexPropertyBox1);
                });
            Separator groupSeparator = new Separator();
            propertiesBox.getChildren().add(groupSeparator);
          }

        } else {
          // If it's a simple property use the create property box.
          int maxOccurances =
              packageOntologyService.getPropertyMaxOccurrences(artifact, property, "");
          int minOccurances =
              packageOntologyService.getPropertyMinOccurrences(artifact, property, "");
          boolean systemGenerated =
              packageOntologyService.isSystemSuppliedProperty(artifact, property);

          Set<StringProperty> fieldProperties = new HashSet<>();
          if (packageOntologyService.isDisciplineProperty(artifact, property)) {
            propertiesBox
                .getChildren()
                .add(
                    new DisciplinePropertyBox(
                        ontologyLabels.get(property),
                        artifact.getSimplePropertyValues(property),
                        maxOccurances,
                        fieldProperties,
                        minOccurances,
                        systemGenerated,
                        availableDisciplines));
          } else {
            propertiesBox
                .getChildren()
                .add(
                    new TextPropertyBox(
                        artifact,
                        "",
                        ontologyLabels.get(property),
                        property,
                        artifact.getSimplePropertyValues(property),
                        maxOccurances,
                        fieldProperties,
                        minOccurances,
                        systemGenerated,
                        packageOntologyService,
                        labels,
                        messages,
                        applyButtonValidationListener));
          }
          container.values = fieldProperties;
        }

        artifactPropertyFields.put(property, container);
      }
    }
    return propertiesBox;
  }
예제 #10
0
  /** {@inheritDoc} */
  @Override
  public void buildContent() {
    Calendar calendar = calendarView.calendarProperty().get();

    // get the maximum number of days in a week for this calendar.
    numberOfDaysPerWeek = calendar.getMaximum(Calendar.DAY_OF_WEEK);

    // get the maximum number of days a month could have.
    int maxNumberOfDaysInMonth = calendar.getMaximum(Calendar.DAY_OF_MONTH);

    // assume the first row has only 1 day, then distribute the rest among the remaining weeks and
    // add the first week.
    int numberOfRows =
        (int) Math.ceil((maxNumberOfDaysInMonth - 1) / (double) numberOfDaysPerWeek) + 1;

    // remove all controls
    getChildren().clear();

    int colOffset = calendarView.getShowWeeks() ? 1 : 0;

    if (calendarView.getShowWeeks()) {
      Label empty = new Label();
      empty.setMaxWidth(Double.MAX_VALUE);
      empty.getStyleClass().add(CSS_CALENDAR_WEEKDAYS);
      add(empty, 0, 0);
    }
    // iterate through the columns
    for (int i = 0; i < numberOfDaysPerWeek; i++) {
      Label label = new Label();
      label.getStyleClass().add(CSS_CALENDAR_WEEKDAYS);
      label.setMaxWidth(Double.MAX_VALUE);
      label.setAlignment(Pos.CENTER);
      add(label, i + colOffset, 0);
    }

    // iterate through the rows
    for (int rowIndex = 0; rowIndex < numberOfRows; rowIndex++) {

      if (calendarView.getShowWeeks()) {
        Label label = new Label();
        label.setMaxWidth(Double.MAX_VALUE);
        label.setMaxHeight(Double.MAX_VALUE);
        label.getStyleClass().add(CSS_CALENDAR_WEEK_NUMBER);
        add(label, 0, rowIndex + 1);
      }

      // iterate through the columns
      for (int colIndex = 0; colIndex < numberOfDaysPerWeek; colIndex++) {
        final Button button = new Button();
        button.setMaxWidth(Double.MAX_VALUE);
        button.setMaxHeight(Double.MAX_VALUE);

        GridPane.setVgrow(button, Priority.ALWAYS);
        GridPane.setHgrow(button, Priority.ALWAYS);
        button.setOnAction(
            new EventHandler<ActionEvent>() {
              @Override
              public void handle(ActionEvent actionEvent) {

                calendarView.selectedDate.set((Date) button.getUserData());
              }
            });
        // add the button, starting at second row.
        add(button, colIndex + colOffset, rowIndex + 1);
      }
    }
  }