1 package fi.jyu.mit.fxgui;
3 import java.util.ArrayList;
5 import javafx.beans.property.BooleanProperty;
6 import javafx.beans.property.SimpleBooleanProperty;
7 import javafx.beans.value.ChangeListener;
8 import javafx.scene.control.RadioButton;
9 import javafx.scene.control.ToggleGroup;
17 public class RadioButtonChooser<T>
extends BaseBoxChooser<T, RadioButton> {
19 private ToggleGroup group =
new ToggleGroup();
23 protected BooleanProperty multipleSelectionsAllowed =
new SimpleBooleanProperty(
false);
27 box.selectedProperty().addListener(listener);
32 RadioButton button =
new RadioButton(name);
33 if(!multipleSelectionsAllowed.get())
34 button.setToggleGroup(group);
35 button.setMnemonicParsing(
true);
42 protected void removeListener(RadioButton node, ArrayList<ChangeListener<Boolean>> list) {
43 for (ChangeListener<Boolean> changeListener : list) {
44 node.selectedProperty().removeListener(changeListener);
54 this.multipleSelectionsAllowed.set(allowMultiples);
55 UpdateComponents(getItems());
63 return this.multipleSelectionsAllowed.get();
69 return component.selectedProperty().get();
75 boolean oldSelect = isComponentSelected(component);
76 component.selectedProperty().set(value);