@Override protected Node createUndecoratedEditor() { final ChoiceBox<T> box = new ChoiceBox<>(alternatives); final T val = currentValue.getValue(); if (alternatives.contains(val)) { box.setValue(val); } else { box.setValue(alternatives.get(0)); } currentValue.bindBidirectional(box.valueProperty()); return box; } }
@Override protected Node createUndecoratedEditor() { final CheckBox cbNull = new CheckBox(); final Node wrappedCb = ItemUtil.lockDecorator(cbNull, document, ItemUtil.DATABASE_RELATION_TOOLTIP); final Label label = new Label(IMPLEMENTATION_TITLE); final ChoiceBox<ImplementAs> cbImpl = new ChoiceBox<>( observableArrayList(ImplementAs.values()) ); cbImpl.setTooltip(new Tooltip(IMPLEMENTATION_TOOLTIP)); final HBox right = new HBox(label, cbImpl); final HBox left = new HBox(wrappedCb, right); left.setSpacing(16); right.setSpacing(8); right.setAlignment(Pos.CENTER); cbNull.selectedProperty().bindBidirectional(nullable); cbImpl.valueProperty().bindBidirectional(implementation); right.visibleProperty().bind(nullable); right.disableProperty().bind(nullable.not()); return left; }
@Override protected Node createUndecoratedEditor() { final ChoiceBox<T> box = new ChoiceBox<>(alternatives); final T val = currentValue.getValue(); if (alternatives.contains(val)) { box.setValue(val); } else { box.setValue(alternatives.get(0)); } currentValue.bindBidirectional(box.valueProperty()); return box; } }
/** * Setup of the binding between view model and the UI controls. */ private void setupBinding() { dpStart.valueProperty().bindBidirectional(filterViewModel.dateStart); dpEnd.valueProperty().bindBidirectional(filterViewModel.dateEnd); cbSportType.valueProperty().bindBidirectional(filterViewModel.sportType); cbSportSubtype.valueProperty().bindBidirectional(filterViewModel.sportSubtype); cbIntensity.valueProperty().bindBidirectional(filterViewModel.intensity); cbEquipment.valueProperty().bindBidirectional(filterViewModel.equipment); tfComment.textProperty().bindBidirectional(filterViewModel.commentSubString); cbRegExpression.selectedProperty().bindBidirectional(filterViewModel.regularExpressionMode); rbTypeExercise.setUserData(EntryFilter.EntryType.EXERCISE); rbTypeNote.setUserData(EntryFilter.EntryType.NOTE); rbTypeWeight.setUserData(EntryFilter.EntryType.WEIGHT); BindingUtils.bindToggleGroupToProperty(tgEntryType, filterViewModel.entryType); BooleanBinding entryTypeSelectionDisabled = Bindings.not(filterViewModel.entryTypeSelectable); rbTypeExercise.disableProperty().bind(entryTypeSelectionDisabled); rbTypeNote.disableProperty().bind(entryTypeSelectionDisabled); rbTypeWeight.disableProperty().bind(entryTypeSelectionDisabled); }
/** * Setup of the binding between view model and the UI controls. */ private void setupBinding() { dpDate.valueProperty().bindBidirectional(exerciseViewModel.date); // use comment formatter for time values => makes sure that the value is also valid final TextFormatter<LocalTime> timeTextFormatter = new TextFormatter<>(new TimeToStringConverter()); timeTextFormatter.valueProperty().bindBidirectional(exerciseViewModel.time); tfTime.setTextFormatter(timeTextFormatter); cbSportType.valueProperty().bindBidirectional(exerciseViewModel.sportType); cbSportSubtype.valueProperty().bindBidirectional(exerciseViewModel.sportSubType); cbIntensity.valueProperty().bindBidirectional(exerciseViewModel.intensity); tfDistance.textProperty().bindBidirectional(exerciseViewModel.distance, new NumberStringConverter()); tfAvgSpeed.textProperty().bindBidirectional(exerciseViewModel.avgSpeed); tfDuration.textProperty().bindBidirectional(exerciseViewModel.duration, new TimeInSecondsToStringConverter()); tfAscent.textProperty().bindBidirectional(exerciseViewModel.ascent, new NumberStringConverter()); tfDescent.textProperty().bindBidirectional(exerciseViewModel.descent, new NumberStringConverter()); tfAvgHeartrate.textProperty().bindBidirectional(exerciseViewModel.avgHeartRate, new NumberStringConverter()); tfCalories.textProperty().bindBidirectional(exerciseViewModel.calories, new NumberStringConverter()); cbEquipment.valueProperty().bindBidirectional(exerciseViewModel.equipment); tfHrmFile.textProperty().bindBidirectional(exerciseViewModel.hrmFile); taComment.textProperty().bindBidirectional(exerciseViewModel.comment); }
@Override protected Node createUndecoratedEditor() { final CheckBox cbNull = new CheckBox(); final Node wrappedCb = ItemUtil.lockDecorator(cbNull, document, ItemUtil.DATABASE_RELATION_TOOLTIP); final Label label = new Label(IMPLEMENTATION_TITLE); final ChoiceBox<ImplementAs> cbImpl = new ChoiceBox<>( observableArrayList(ImplementAs.values()) ); cbImpl.setTooltip(new Tooltip(IMPLEMENTATION_TOOLTIP)); final HBox right = new HBox(label, cbImpl); final HBox left = new HBox(wrappedCb, right); left.setSpacing(16); right.setSpacing(8); right.setAlignment(Pos.CENTER); cbNull.selectedProperty().bindBidirectional(nullable); cbImpl.valueProperty().bindBidirectional(implementation); right.visibleProperty().bind(nullable); right.disableProperty().bind(nullable.not()); return left; }
/** * https://github.com/AlmasB/FXGL/issues/493 * * @return menu content with video settings */ protected final MenuContent createContentVideo() { log.debug("createContentVideo()"); ChoiceBox<Language> languageBox = getUIFactory().newChoiceBox(FXCollections.observableArrayList(Language.values())); languageBox.setValue(Language.ENGLISH); getSettings().getLanguage().bind(languageBox.valueProperty()); VBox vbox = new VBox(); if (getSettings().isManualResizeEnabled()) { Button btnFixRatio = getUIFactory().newButton(localizedStringProperty("menu.fixRatio")); btnFixRatio.setOnAction(e -> { listener.fixAspectRatio(); }); vbox.getChildren().add(btnFixRatio); } if (getSettings().isFullScreenAllowed()) { CheckBox cbFullScreen = getUIFactory().newCheckBox(); cbFullScreen.setSelected(false); cbFullScreen.selectedProperty().bindBidirectional(getSettings().getFullScreen()); vbox.getChildren().add(new HBox(25, getUIFactory().newText(getLocalizedString("menu.fullscreen")+": "), cbFullScreen)); } return new MenuContent( new HBox(25, getUIFactory().newText(localizedStringProperty("menu.language").concat(":")), languageBox), vbox ); }
@Override protected void setupDialogControls() { setupSelectionControls(); // setup binding between view model and the UI controls // (validation is not needed here) BindingUtils.bindToggleGroupToProperty(tgInitialView, preferencesViewModel.initialView); cbAutomaticCalculation.valueProperty().bindBidirectional(preferencesViewModel.defaultAutoCalculation); cbSaveOnExit.selectedProperty().bindBidirectional(preferencesViewModel.saveOnExit); BindingUtils.bindToggleGroupToProperty(tgUnitSystem, preferencesViewModel.unitSystem); BindingUtils.bindToggleGroupToProperty(tgSpeedMode, preferencesViewModel.preferredSpeedMode); BindingUtils.bindToggleGroupToProperty(tgWeekStart, preferencesViewModel.weekStart); cbOptionalAvgHeartrate.selectedProperty().bindBidirectional(preferencesViewModel.listViewShowAvgHeartrate); cbOptionalAscent.selectedProperty().bindBidirectional(preferencesViewModel.listViewShowAscent); cbOptionalDescent.selectedProperty().bindBidirectional(preferencesViewModel.listViewShowDescent); cbOptionalEnergy.selectedProperty().bindBidirectional(preferencesViewModel.listViewShowEnergy); cbOptionalEquipment.selectedProperty().bindBidirectional(preferencesViewModel.listViewShowEquipment); cbOptionalComment.selectedProperty().bindBidirectional(preferencesViewModel.listViewShowComment); cbDiagramTwoGraphs.selectedProperty().bindBidirectional(preferencesViewModel.evDisplaySecondChart); cbDiagramSmoothedCharts.selectedProperty().bindBidirectional(preferencesViewModel.evDisplaySmoothedCharts); }
spYear.visibleProperty().bind(Bindings.notEqual(cbTimeRange.valueProperty(), TimeRangeType.LAST_12_MONTHS));