/** * This will install an {@link EventHandler} that monitors the * {@link KeyEvent} events to enable the "prefix selection" feature. * * @param choiceBox * The {@link ChoiceBox} that should be customized * * @see PrefixSelectionCustomizer */ public static void customize(ChoiceBox<?> choiceBox) { choiceBox.addEventHandler(KeyEvent.KEY_PRESSED, handler); }
/** * Initializes all ChoiceBoxes by defining the String converters. ChoiceBoxes with fixed values * (SportType, Intensity) will be filled with possible values. */ private void setupChoiceBoxes() { cbSportType.setConverter(new NameableStringConverter<>()); cbSportSubtype.setConverter(new NameableStringConverter<>()); cbEquipment.setConverter(new NameableStringConverter<>()); document.getSportTypeList().forEach(sportType -> cbSportType.getItems().add(sportType)); cbIntensity.setConverter(new IntensityToStringConverter()); cbIntensity.getItems().addAll(List.of(IntensityType.values())); // update the sport type dependent choiceboxes on each sport type selection change cbSportType.addEventHandler(ActionEvent.ACTION, event -> fillSportTypeDependentChoiceBoxes()); // reset the previous exercise index for copying the comment on sport type / subtype changes cbSportSubtype.addEventHandler(ActionEvent.ACTION, event -> previousExerciseIndex = null); }
cbSportType.addEventHandler(ActionEvent.ACTION, event -> fillSportTypeDependentChoiceBoxes());
cbTimeRange.addEventHandler(ActionEvent.ACTION, event -> updateDiagram()); spYear.valueProperty().addListener((observable, oldValue, newValue) -> updateDiagram()); cbDisplay.addEventHandler(ActionEvent.ACTION, event -> updateDiagram()); cbSportTypeMode.addEventHandler(ActionEvent.ACTION, event -> updateDiagram()); cbSportTypeList.addEventHandler(ActionEvent.ACTION, event -> updateDiagram());