Search in sources :

Example 16 with PropPanel

use of limelight.ui.model.PropPanel 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 17 with PropPanel

use of limelight.ui.model.PropPanel 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 18 with PropPanel

use of limelight.ui.model.PropPanel in project limelight by slagyr.

the class DropDownPopup method createListItems.

private void createListItems() {
    EventAction itemChosenAction = new EventAction() {

        public void invoke(Event e) {
            PanelEvent event = (PanelEvent) e;
            choose((PropPanel) event.getRecipient());
        }
    };
    EventAction itemSelectedAction = new EventAction() {

        public void invoke(Event e) {
            PanelEvent event = (PanelEvent) e;
            select((PropPanel) event.getRecipient());
        }
    };
    for (Object option : dropDown.getChoices()) {
        PropPanel listItem = new PropPanel(new SimplePropProxy(), Util.toMap("name", "limelight_builtin_drop_down_popup_list_item"));
        listItem.getStyle().addExtension(stylesStore.get("limelight_builtin_drop_down_popup_list_item"));
        listItem.getEventHandler().add(MouseClickedEvent.class, itemChosenAction);
        listItem.getEventHandler().add(MouseEnteredEvent.class, itemSelectedAction);
        listItem.setText(option.toString());
        if (option.equals(dropDown.getSelectedChoice()))
            select(listItem);
        popupList.add(listItem);
    }
}
Also used : PanelEvent(limelight.ui.events.panel.PanelEvent) PropPanel(limelight.ui.model.PropPanel) SimplePropProxy(limelight.ui.SimplePropProxy) EventAction(limelight.events.EventAction) PanelEvent(limelight.ui.events.panel.PanelEvent) Event(limelight.events.Event) MouseEnteredEvent(limelight.ui.events.panel.MouseEnteredEvent) MouseClickedEvent(limelight.ui.events.panel.MouseClickedEvent)

Example 19 with PropPanel

use of limelight.ui.model.PropPanel in project limelight by slagyr.

the class TextArea method install.

public void install(PanelEvent event) {
    TextAreaPanel input = new TextAreaPanel();
    final PropPanel panel = (PropPanel) event.getRecipient();
    panel.add(input);
}
Also used : PropPanel(limelight.ui.model.PropPanel) TextAreaPanel(limelight.ui.model.inputs.TextAreaPanel)

Example 20 with PropPanel

use of limelight.ui.model.PropPanel in project limelight by slagyr.

the class DropDownPopup method createCurtains.

private void createCurtains() {
    curtains = new PropPanel(new SimplePropProxy(), Util.toMap("name", "limelight_builtin_curtains"));
    curtains.getStyle().addExtension(stylesStore.get("limelight_builtin_curtains"));
    curtains.getEventHandler().add(MouseClickedEvent.class, new EventAction() {

        public void invoke(Event event) {
            close();
        }
    });
}
Also used : PropPanel(limelight.ui.model.PropPanel) SimplePropProxy(limelight.ui.SimplePropProxy) EventAction(limelight.events.EventAction) PanelEvent(limelight.ui.events.panel.PanelEvent) Event(limelight.events.Event) MouseEnteredEvent(limelight.ui.events.panel.MouseEnteredEvent) MouseClickedEvent(limelight.ui.events.panel.MouseClickedEvent)

Aggregations

PropPanel (limelight.ui.model.PropPanel)34 FakePropProxy (limelight.model.api.FakePropProxy)22 FakeScene (limelight.ui.model.FakeScene)17 Before (org.junit.Before)16 Test (org.junit.Test)9 CastEvent (limelight.ui.events.panel.CastEvent)7 MouseClickedEvent (limelight.ui.events.panel.MouseClickedEvent)4 Event (limelight.events.Event)3 EventAction (limelight.events.EventAction)3 MockGraphics (limelight.ui.MockGraphics)3 SimplePropProxy (limelight.ui.SimplePropProxy)3 MouseEnteredEvent (limelight.ui.events.panel.MouseEnteredEvent)3 PanelEvent (limelight.ui.events.panel.PanelEvent)3 MockStage (limelight.ui.model.MockStage)3 RadioButtonGroup (limelight.ui.RadioButtonGroup)2 Scene (limelight.ui.model.Scene)2 ScenePanel (limelight.ui.model.ScenePanel)2 FakeFileSystem (limelight.io.FakeFileSystem)1 FakeProduction (limelight.model.FakeProduction)1 PropProxy (limelight.model.api.PropProxy)1