Exemplo n.º 1
0
  public static Tuple2<Label, RadioButton> addLabelRadioButton(
      GridPane gridPane,
      int rowIndex,
      ToggleGroup toggleGroup,
      String title,
      String radioButtonTitle) {
    Label label = addLabel(gridPane, rowIndex, title, 0);

    RadioButton radioButton = new RadioButton(radioButtonTitle);
    radioButton.setToggleGroup(toggleGroup);
    radioButton.setPadding(new Insets(6, 0, 0, 0));
    GridPane.setRowIndex(radioButton, rowIndex);
    GridPane.setColumnIndex(radioButton, 1);
    gridPane.getChildren().add(radioButton);

    return new Tuple2<>(label, radioButton);
  }
  public ConfigurationsDialogBuilder addConfigurations(List<Configuration> configurations) {
    dialog.setTitle("Choose a configuration to graph");
    dialog.configurations = configurations;
    dialog.borderPanel.setCenter(dialog.scrollPane);

    ObservableList<Node> children = dialog.configurationsBox.getChildren();
    ToggleGroup toggleGroup = new ToggleGroup();

    for (Configuration configuration : configurations) {
      String name = configuration.getName();
      RadioButton configurationRadioButton = new RadioButton(name);

      configurationRadioButton.setToggleGroup(toggleGroup);

      if (name.equals("compile")) {
        configurationRadioButton.setSelected(true); // todo select default from prefs
      }

      children.add(configurationRadioButton);
    }

    return this;
  }