public void setTypeId(PropertyTypeId typeId) { typeChoiceBox.getSelectionModel().select(typeId); }
languageChoiceBox.getSelectionModel().getSelectedItem().getTerseName(), messageField.getText(), "TODO",
@Override public void initialize(URL location, ResourceBundle resources) { languageChoiceBox.getItems().addAll(DesignerUtil.getSupportedLanguageVersions() .stream() .map(LanguageVersion::getLanguage) .distinct() .collect(Collectors.toList())); languageChoiceBox.setConverter(new StringConverter<Language>() { @Override public String toString(Language object) { return object.getTerseName(); } @Override public Language fromString(String string) { return LanguageRegistry.findLanguageByTerseName(string); } }); languageChoiceBox.getSelectionModel().select(LanguageRegistry.getDefaultLanguage()); exportResultArea.setSyntaxHighlighter(new XmlSyntaxHighlighter()); registerListener(nameField.textProperty(), updateResultListener()); registerListener(messageField.textProperty(), updateResultListener()); registerListener(descriptionField.textProperty(), updateResultListener()); registerListener(prioritySlider.valueProperty(), updateResultListener()); registerListener(languageChoiceBox.getSelectionModel().selectedItemProperty(), updateResultListener()); registerListener(xpathExpression, updateResultListener()); updateResultListener().changed(null, null, null); }
@Override public void initialize(URL location, ResourceBundle resources) { commitButton.setOnAction(e -> { commitHandler.ifPresent(Runnable::run); getStage().close(); this.free(); }); commitButton.disableProperty().bind(validationSupport.invalidProperty()); Platform.runLater(() -> { typeId.bind(typeChoiceBox.getSelectionModel().selectedItemProperty()); typeChoiceBox.setConverter(DesignerUtil.stringConverter(PropertyTypeId::getStringId, PropertyTypeId::lookupMnemonic)); typeChoiceBox.getItems().addAll(PropertyTypeId.typeIdsToConstants().values()); FXCollections.sort(typeChoiceBox.getItems()); }); Platform.runLater(this::registerBasicValidators); typeIdProperty().values() .filter(Objects::nonNull) .subscribe(this::registerTypeDependentValidators); }
public T getSelection() { return choice.getSelectionModel().getSelectedItem(); }
private void updateEngineChoicebox(final ChoiceBox<ProcessingEngineInfo> engineChoicebox, ProcessingEngineInfo newValue) { if (newValue != null) { for (ProcessingEngineInfo processingEngineInfo : engineChoicebox.getItems()) { if (processingEngineInfo.getId() != null && processingEngineInfo.getId().equals(newValue.getId())) { engineChoicebox.getSelectionModel().select(processingEngineInfo); } } } else { engineChoicebox.getSelectionModel().clearSelection(); } }
private void updatePoolChoicebox(final ChoiceBox<ProcessorPoolInfo> poolChoicebox, ProcessorPoolInfo newValue) { if (newValue != null) { for (ProcessorPoolInfo pool : poolChoicebox.getItems()) { if (pool != null && pool.getId() != null && pool.getId().equals(newValue.getId())) { poolChoicebox.getSelectionModel().select(pool); } } } else { poolChoicebox.getSelectionModel().clearSelection(); } }
/** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { proxyType.setItems(FXCollections.observableArrayList(proxyTypes)); proxyType.getSelectionModel().selectedIndexProperty().addListener(this::alterView); final String currentManualProxy = System.getProperty("http.proxyHost"); if (currentManualProxy != null) { final String joined = currentManualProxy + ':' + System.getProperty("http.proxyPort"); } manualProxy.setVisible(currentManualProxy != null); }
/** * animate Selections * * @param imageSelector * @param showTime * @throws Exception */ @SuppressWarnings("rawtypes") public void animateSelections(ImageSelector imageSelector, int showTime) throws Exception { Object[] selections = imageSelector.getSelections(); for (int i = 0; i < selections.length; i++) { final int index = i; Platform.runLater( () -> imageSelector.getChoice().getSelectionModel().select(index)); Thread.sleep(showTime / selections.length); } }
@SuppressWarnings("rawtypes") private Object _getContent(Node control) { if (control instanceof TextInputControl) { return ((TextInputControl) control).getText(); } else if (control instanceof ChoiceBox) { return ((ChoiceBox) control).getSelectionModel().getSelectedItem(); } else if (control instanceof ComboBox) { return ((ComboBox) control).getSelectionModel().getSelectedItem(); } return null; }
/** * */ public void initialize() { this.backBtn.setText(RESOURCES.getString("back")); this.finishBtn.setText(RESOURCES.getString("finish")); this.finishBtn.setDisable(true); this.select.setText(RESOURCES.getString("select")); this.choiceTempl.setItems(TEMPLATES); this.choiceTempl.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { selectedTemplate = newValue; finishBtn.setDisable(false); }); }
@Override public void run() { for (Node n : heightTest.lookupAll(".choice-box")) { ((ChoiceBox) n).getSelectionModel().selectFirst(); } for (Node n : heightTest.lookupAll(".combo-box")) { ((ComboBox) n).getSelectionModel().selectFirst(); } } });
@Override public Node createContent() { HBox pane = new HBox(); pane.setAlignment(Pos.CENTER_LEFT); pane.setSpacing(3); final ChoiceBox<ProcessingEngineInfo> engineChoicebox = createEngineChoicebox(); final ChoiceBox<ProcessorPoolInfo> poolChoicebox = createPoolChoicebox(); pane.getChildren().add(new Label("Engine")); pane.getChildren().add(engineChoicebox); pane.getChildren().add(new Label("Pool")); pane.getChildren().add(poolChoicebox); engineChoicebox.getSelectionModel().selectFirst(); return pane; }
@SuppressWarnings("rawtypes") private boolean _hasContent(Node input) { if (input instanceof TextInputControl) { return !StringUtils.isEmpty(((TextInputControl) input).getText()); } else if (input instanceof ChoiceBox) { return ((ChoiceBox) input).getSelectionModel().getSelectedItem() != null; } else if (input instanceof ComboBox) { return ((ComboBox) input).getSelectionModel().getSelectedItem() != null; } return false; }
imageViewMap.put(selections[index++], imageView); choice.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldValue, Number newValue) { choice.getSelectionModel().select(0); add(choice, 0, 1); add(imageFrame, 0,2);
return getCheckBox().isSelected(); } else if (control instanceof ChoiceBox) { String selection=choiceBox.getSelectionModel().getSelectedItem(); return selection;
@Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (!isLocalChange) { isLocalChange = true; // calc scroll position relative to scroll pane content double posPixels = samplePage.getLayoutBounds().getHeight() * newValue.doubleValue(); // move to top of view port posPixels -= scrollPane.getLayoutBounds().getHeight() * newValue.doubleValue(); // move to center of view port posPixels += scrollPane.getLayoutBounds().getHeight() * 0.5; // find section that contains view port center currentSection = null; for (SamplePage.Section section: samplePage.getSections()) { if (section.box.getBoundsInParent().getMaxY() > posPixels ) { currentSection = section; break; } } sectionChoiceBox.getSelectionModel().select(currentSection); isLocalChange = false; } } });
@Override public void configure(T control) { super.configure(control); // make change visible immediately (not only after focus lost) control.setOnAction(e -> updateModelAndView((FxControl) control)); control.getProperties().put(PrefixSelectionFeature.ENABLED, ""); new PrefixSelectionFeature<>(control, () -> true, control::getItems, control.getConverter(), index -> control.getSelectionModel().select(index)) .configure(); }
engineChoicebox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ProcessingEngineInfo>() { @Override public void changed(ObservableValue<? extends ProcessingEngineInfo> observable, ProcessingEngineInfo oldValue,
cbTimeRange.getSelectionModel().select(TimeRangeType.LAST_12_MONTHS); cbDisplay.getSelectionModel().select(ValueType.DISTANCE); cbSportTypeMode.getSelectionModel().select(OverviewType.EACH_SPLITTED); cbSportTypeList.getSelectionModel().select(0);