Search in sources :

Example 1 with RadioButtonGroup

use of limelight.ui.RadioButtonGroup in project limelight by slagyr.

the class RadioButtonPanelTest method settingTheGroupName.

@Test
public void settingTheGroupName() throws Exception {
    Scene scene = new FakeScene();
    PropPanel parent1 = new PropPanel(new FakePropProxy("parent1"));
    RadioButtonPanel radio1 = new RadioButtonPanel();
    parent1.add(radio1);
    PropPanel parent2 = new PropPanel(new FakePropProxy("parent2"));
    RadioButtonPanel radio2 = new RadioButtonPanel();
    parent2.add(radio2);
    scene.add(parent1);
    scene.add(parent2);
    final RadioButtonGroup group = scene.getButtonGroups().get("test_group");
    assertEquals(0, group.getButtons().size());
    radio1.setGroup("test_group");
    assertEquals(1, group.getButtons().size());
    radio2.setGroup("test_group");
    assertEquals(2, group.getButtons().size());
    assertEquals(true, group.getButtons().contains(radio1));
    assertEquals(true, group.getButtons().contains(radio2));
}
Also used : PropPanel(limelight.ui.model.PropPanel) RadioButtonGroup(limelight.ui.RadioButtonGroup) FakeScene(limelight.ui.model.FakeScene) Scene(limelight.ui.model.Scene) FakeScene(limelight.ui.model.FakeScene) FakePropProxy(limelight.model.api.FakePropProxy) Test(org.junit.Test)

Example 2 with RadioButtonGroup

use of limelight.ui.RadioButtonGroup in project limelight by slagyr.

the class RadioButtonPanelTest method changingGroupName.

@Test
public void changingGroupName() throws Exception {
    Scene scene = new FakeScene();
    PropPanel parent1 = new PropPanel(new FakePropProxy("parent1"));
    RadioButtonPanel radio1 = new RadioButtonPanel();
    parent1.add(radio1);
    scene.add(parent1);
    final RadioButtonGroup group1 = scene.getButtonGroups().get("group1");
    final RadioButtonGroup group2 = scene.getButtonGroups().get("group2");
    radio1.setGroup("group1");
    radio1.setGroup("group2");
    assertEquals(0, group1.getButtons().size());
    assertEquals(1, group2.getButtons().size());
}
Also used : PropPanel(limelight.ui.model.PropPanel) RadioButtonGroup(limelight.ui.RadioButtonGroup) FakeScene(limelight.ui.model.FakeScene) Scene(limelight.ui.model.Scene) FakeScene(limelight.ui.model.FakeScene) FakePropProxy(limelight.model.api.FakePropProxy) Test(org.junit.Test)

Example 3 with RadioButtonGroup

use of limelight.ui.RadioButtonGroup in project limelight by slagyr.

the class RadioButtonPanel method establishButtonGroup.

private void establishButtonGroup(String name) {
    if (radioButtonGroup != null)
        radioButtonGroup.remove(this);
    final Scene scene = getRoot();
    if (scene != null) {
        final RadioButtonGroup group = scene.getButtonGroups().get(name);
        group.add(this);
    }
}
Also used : RadioButtonGroup(limelight.ui.RadioButtonGroup) Scene(limelight.ui.model.Scene)

Example 4 with RadioButtonGroup

use of limelight.ui.RadioButtonGroup in project limelight by slagyr.

the class RadioButtonPanelTest method multipleRadioButtonsInTheSameGroup.

@Test
public void multipleRadioButtonsInTheSameGroup() throws Exception {
    RadioButtonPanel radio1 = new RadioButtonPanel();
    RadioButtonPanel radio2 = new RadioButtonPanel();
    RadioButtonPanel radio3 = new RadioButtonPanel();
    RadioButtonGroup group = new RadioButtonGroup();
    group.add(radio1);
    group.add(radio2);
    group.add(radio3);
    radio1.setSelected(true);
    checkSelectedRadioButton(group, radio1, radio2, radio3);
    radio2.setSelected(true);
    checkSelectedRadioButton(group, radio2, radio1, radio3);
    radio3.setSelected(true);
    checkSelectedRadioButton(group, radio3, radio2, radio1);
}
Also used : RadioButtonGroup(limelight.ui.RadioButtonGroup) Test(org.junit.Test)

Aggregations

RadioButtonGroup (limelight.ui.RadioButtonGroup)4 Scene (limelight.ui.model.Scene)3 Test (org.junit.Test)3 FakePropProxy (limelight.model.api.FakePropProxy)2 FakeScene (limelight.ui.model.FakeScene)2 PropPanel (limelight.ui.model.PropPanel)2