本文整理汇总了Java中javafx.scene.control.SingleSelectionModel.select方法的典型用法代码示例。如果您正苦于以下问题:Java SingleSelectionModel.select方法的具体用法?Java SingleSelectionModel.select怎么用?Java SingleSelectionModel.select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.SingleSelectionModel
的用法示例。
在下文中一共展示了SingleSelectionModel.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePathSizeValues
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
/**
* Update a list of available path sizes.
*/
@FXThread
private void updatePathSizeValues() {
final ComboBox<Integer> pathSizeComboBox = getPatchSizeComboBox();
final SingleSelectionModel<Integer> selectionModel = pathSizeComboBox.getSelectionModel();
final Integer current = selectionModel.getSelectedItem();
final ObservableList<Integer> items = pathSizeComboBox.getItems();
items.clear();
final ComboBox<Integer> totalSizeComboBox = getTotalSizeComboBox();
final Integer naxValue = totalSizeComboBox.getSelectionModel().getSelectedItem();
for (final Integer value : PATCH_SIZE_VARIANTS) {
if (value >= naxValue) break;
items.add(value);
}
if (items.contains(current)) {
selectionModel.select(current);
} else {
selectionModel.select(items.get(items.size() - 1));
}
}
示例2: processOpenFile
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
/**
* Handle the request to open a file.
*/
@FXThread
private void processOpenFile(@NotNull final RequestedOpenFileEvent event) {
final Path file = event.getFile();
final ConcurrentObjectDictionary<Path, Tab> openedEditors = getOpenedEditors();
final Tab tab = DictionaryUtils.getInReadLock(openedEditors, file, ObjectDictionary::get);
if (tab != null) {
final SingleSelectionModel<Tab> selectionModel = getSelectionModel();
selectionModel.select(tab);
return;
}
EditorUtil.incrementLoading();
EXECUTOR_MANAGER.addBackgroundTask(() -> processOpenFileImpl(event, file));
}
示例3: applyValues
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
private void applyValues() {
inConnectionPortField.setText(String.valueOf(ApplicationPreferences.getProperty(
NetworkProperties.INCOMING_CONNECTION_PORT, ClientProperties.TCP_PORT)));
final boolean randomizePortOnStart = ApplicationPreferences.getProperty(
NetworkProperties.RANDOMIZE_CONNECTION_PORT, false);
randomPortEachStartCheck.setSelected(randomizePortOnStart);
final boolean upnpPortMappingEnabled = ApplicationPreferences.getProperty(
NetworkProperties.ENABLE_UPNP_PORT_MAPPING, false);
upnpPortMappingCheck.setSelected(upnpPortMappingEnabled);
final String interfaceName = ApplicationPreferences.getProperty(
NetworkProperties.NETWORK_INTERFACE_NAME, NetworkUtilities.DEFAULT_NETWORK_INTERFACE);
final SingleSelectionModel<String> comboSelectionModel = networkInterfaceSelectionCombo.getSelectionModel();
if(networkInterfaceSelectionCombo.getItems().contains(interfaceName)) {
comboSelectionModel.select(interfaceName);
}
else {
comboSelectionModel.select(NetworkUtilities.DEFAULT_NETWORK_INTERFACE);
}
}
示例4: handleFilterChanged
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
private void handleFilterChanged(String newValue) {
if (filteredItems != null) {
Predicate<T> p = filter.get().isEmpty() ? null :
s -> comparator.matches(filter.get(), s);
filteredItems.setPredicate(p);
}
if (!StringUtils.isBlank(newValue)) {
comboBox.show();
if (StringUtils.isBlank(filter.get())) {
restoreOriginalItems();
}
else {
showTooltip();
SingleSelectionModel<T> selectionModel = comboBox.getSelectionModel();
if (filteredItems.isEmpty()) {
selectionModel.clearSelection();
}
else {
selectionModel.select(0);
}
}
}
else {
comboBox.getTooltip().hide();
restoreOriginalItems();
}
}
示例5: validate
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@Override
@FXThread
protected void validate(@NotNull final Label warningLabel, @Nullable final ResourceElement element) {
final ComboBox<String> comboBox = getTextureParamNameComboBox();
final ObservableList<String> items = comboBox.getItems();
items.clear();
final Path file = element == null ? null : element.getFile();
if (file != null && !Files.isDirectory(file)) {
final AssetManager assetManager = EDITOR.getAssetManager();
final Path assetFile = getAssetFile(file);
if (assetFile == null) {
throw new RuntimeException("AssetFile can't be null.");
}
final MaterialKey materialKey = new MaterialKey(toAssetPath(assetFile));
final Material material = assetManager.loadAsset(materialKey);
final MaterialDef materialDef = material.getMaterialDef();
final Collection<MatParam> materialParams = materialDef.getMaterialParams();
materialParams.stream()
.filter(param -> param.getVarType() == VarType.Texture2D)
.filter(matParam -> material.getTextureParam(matParam.getName()) != null)
.forEach(filtred -> items.add(filtred.getName()));
final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel();
if (!items.isEmpty()) {
selectionModel.select(0);
} else {
selectionModel.select(null);
}
}
super.validate(warningLabel, element);
}
示例6: reload
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
final E element = getPropertyValue();
final ComboBox<E> enumComboBox = getEnumComboBox();
final SingleSelectionModel<E> selectionModel = enumComboBox.getSelectionModel();
selectionModel.select(element);
}
示例7: createContent
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@Override
@FXThread
protected void createContent(@NotNull final GridPane root) {
super.createContent(root);
final Label algorithmTypeLabel = new Label(Messages.GENERATE_TANGENTS_DIALOG_ALGORITHM_LABEL + ":");
algorithmTypeLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT3));
algorithmTypeComboBox = new ComboBox<>(GenerateTangentsDialog.ALGORITHM_TYPES);
algorithmTypeComboBox.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT3));
final SingleSelectionModel<AlgorithmType> selectionModel = algorithmTypeComboBox.getSelectionModel();
selectionModel.select(AlgorithmType.MIKKTSPACE);
final Label splitMirroredLabel = new Label(Messages.GENERATE_TANGENTS_DIALOG_SPLIT_MIRRORED + ":");
splitMirroredLabel.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_LABEL_W_PERCENT3));
splitMirroredCheckBox = new CheckBox();
splitMirroredCheckBox.disableProperty().bind(selectionModel.selectedItemProperty().isNotEqualTo(AlgorithmType.STANDARD));
splitMirroredCheckBox.prefWidthProperty().bind(root.widthProperty().multiply(DEFAULT_FIELD_W_PERCENT3));
root.add(algorithmTypeLabel, 0, 0);
root.add(algorithmTypeComboBox, 1, 0);
root.add(splitMirroredLabel, 0, 1);
root.add(splitMirroredCheckBox, 1, 1);
FXUtils.addClassTo(algorithmTypeLabel, splitMirroredLabel, CSSClasses.DIALOG_DYNAMIC_LABEL);
FXUtils.addClassTo(algorithmTypeComboBox, splitMirroredCheckBox, CSSClasses.DIALOG_FIELD);
}
示例8: addEditor
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
/**
* Add and open the new file editor.
*
* @param editor the editor
* @param needShow the need show
*/
@FXThread
private void addEditor(@NotNull final FileEditor editor, final boolean needShow) {
final Path editFile = editor.getEditFile();
final Tab tab = new Tab(editor.getFileName());
tab.setGraphic(new ImageView(ICON_MANAGER.getIcon(editFile, DEFAULT_FILE_ICON_SIZE)));
tab.setContent(editor.getPage());
tab.setOnCloseRequest(event -> handleRequestToCloseEditor(editor, tab, event));
final ObservableMap<Object, Object> properties = tab.getProperties();
properties.put(KEY_EDITOR, editor);
editor.dirtyProperty().addListener((observable, oldValue, newValue) -> {
tab.setText(newValue == Boolean.TRUE ? "*" + editor.getFileName() : editor.getFileName());
});
final ObservableList<Tab> tabs = getTabs();
tabs.add(tab);
if (needShow) {
final SingleSelectionModel<Tab> selectionModel = getSelectionModel();
selectionModel.select(tab);
}
DictionaryUtils.runInWriteLock(getOpenedEditors(), editFile, tab, ObjectDictionary::put);
EditorUtil.decrementLoading();
if (isIgnoreOpenedFiles()) {
return;
}
final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();
if (workspace != null) {
workspace.addOpenedFile(editFile, editor);
}
}
示例9: updateTabPane
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
private void updateTabPane(TabPackage tabPack) {
View v = tabPack.getController().getView();
VBox vbox = new VBox();
Tab tab = new Tab("Workspace " + this.views.size());
vbox.getChildren().addAll(v.getToolPanel(), v.getGrid());
tab.setContent(vbox);
tabPane.getTabs().add(tab);
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
selectionModel.select(tab);
tab.setOnClosed(e -> {
this.views.remove(v);
if(this.views.size() == 0) {
System.exit(0);
}
});
tab.setOnSelectionChanged(e -> {
if(tab.isSelected()) {
tabPack.getController().getModel().updateCurrentTab(tabPack.getId());
internalEditor.setId(tabPack.getId());
}
});
v.setCenter(tabPane);
}
示例10: retrain
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@FXML
private void retrain(ActionEvent event) throws Exception{
//ADD retrain the model
System.out.println("Retraining the model");
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
selectionModel.select(tab2);
}
示例11: processSave
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@FXML
private void processSave(ActionEvent event) {
System.out.println("Steping to next step saving file...");
String path = outFolder.textProperty().getValue().toString();
at.saveChanges(path, personData, predicted.isSelected());
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
selectionModel.select(tab5);
}
示例12: btnHomeClicked
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@FXML
public void btnHomeClicked(ActionEvent event) {
System.out.println("Back to Accounts button clicked");
System.out.println(paneRslt.getParent().getParent().getId());
TabPane main = (TabPane) paneRslt.getParent().getParent();
SingleSelectionModel<Tab> tb = main.getSelectionModel();
tb.select(0);
}
示例13: setTab
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
public void setTab(int i) {
SingleSelectionModel<Tab> tb = tbMain.getSelectionModel();
tb.select(i);
if (i == 2)
resultsViewController.LoadLists();
}
示例14: handleRunAllButton
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@FXML
private void handleRunAllButton(ActionEvent event) {
SingleSelectionModel<Tab> selectionModel = tabs.getSelectionModel();
selectionModel.select(controlConsole);
modelFacade.getJsConsole().start();
modelFacade.getSoyConsole().start();
modelFacade.getGssConsole().start();
}
示例15: handleRunAllButton
import javafx.scene.control.SingleSelectionModel; //导入方法依赖的package包/类
@FXML
private void handleRunAllButton(ActionEvent event) {
SingleSelectionModel<Tab> selectionModel = tabs.getSelectionModel();
selectionModel.select(controlConsole);
modelFacade.getJsConsole().start();
modelFacade.getSoyConsole().start();
modelFacade.getGssConsole().start();
}