Example usage for javafx.scene.control ToggleGroup getToggles

List of usage examples for javafx.scene.control ToggleGroup getToggles

Introduction

In this page you can find the example usage for javafx.scene.control ToggleGroup getToggles.

Prototype

public final ObservableList<Toggle> getToggles() 

Source Link

Document

The list of toggles within the ToggleGroup.

Usage

From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java

/**
 * Called when the selected project is changed.
 *///from   w  w w.  j  a v a 2  s. co m
private void changeSelectedProject(final FXICCWrapper pWrapper) {
    projectDatasetAccordion.setExpandedPane(tpDatasets);

    RoddyUITask.runTask(new RoddyUITask<Void>(UIConstants.UITASK_CHANGE_PROJECT) {
        List<String> analysesList = null;

        @Override
        public Void _call() throws Exception {
            long t1 = ExecutionService.measureStart();
            currentProjectWrapper = pWrapper;
            currentProject = pWrapper.getID();
            long t2 = ExecutionService.measureStart();

            ExecutionService.measureStop(t2, UIConstants.UITASK_MP_LOADCONFIGURATION);

            analysesList = currentProjectWrapper.getICC().getListOfAnalyses();

            cleanRMIPool();

            ExecutionService.measureStop(t2, UIConstants.UITASK_MP_LOAD_ANALYSIS_LIST);
            return null;
        }

        @Override
        public void _succeeded() {

            vboxAvailableAnalyses.getChildren().clear();
            ToggleGroup tgAnalyses = new ToggleGroup();

            for (String analysis : analysesList) {
                List fullAnalysisID = ProjectFactory.dissectFullAnalysisID(analysis);
                String id = analysis.split("[:][:]")[0];
                String plugin = fullAnalysisID.size() > 0 ? "\n - " + fullAnalysisID.get(0).toString() : "";

                RadioButton rb = new RadioButton(id + plugin);
                rb.setUserData(analysis);
                rb.setToggleGroup(tgAnalyses);
                vboxAvailableAnalyses.getChildren().add(rb);
            }
            tgAnalyses.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
                @Override
                public void changed(ObservableValue<? extends Toggle> observableValue, Toggle toggle,
                        Toggle toggle2) {
                    changeSelectedAnalysis((String) toggle2.getUserData());
                }
            });

            if (analysesList.size() == 1) {
                tgAnalyses.getToggles().get(0).setSelected(true);
            }
        }
    });
}