Search in sources :

Example 1 with EventAction

use of limelight.events.EventAction 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 2 with EventAction

use of limelight.events.EventAction in project limelight by slagyr.

the class EventActionMulticasterTest method collectingLotsOfActions.

@Test
public void collectingLotsOfActions() throws Exception {
    EventAction action = EventActionMulticaster.add(action1, action2);
    action = EventActionMulticaster.add(action, action3);
    action = EventActionMulticaster.add(action, action4);
    action = EventActionMulticaster.add(action, action5);
    List<EventAction> actions = EventActionMulticaster.collect(action);
    assertEquals(5, actions.size());
    assertSame(action1, actions.get(0));
    assertSame(action2, actions.get(1));
    assertSame(action3, actions.get(2));
    assertSame(action4, actions.get(3));
    assertSame(action5, actions.get(4));
}
Also used : EventAction(limelight.events.EventAction) Test(org.junit.Test)

Example 3 with EventAction

use of limelight.events.EventAction in project limelight by slagyr.

the class EventActionMulticasterTest method removingNeitherOfTwo.

@Test
public void removingNeitherOfTwo() throws Exception {
    EventAction action = EventActionMulticaster.add(action1, action2);
    EventAction result = EventActionMulticaster.remove(action, action3);
    assertSame(action, result);
}
Also used : EventAction(limelight.events.EventAction) Test(org.junit.Test)

Example 4 with EventAction

use of limelight.events.EventAction in project limelight by slagyr.

the class EventActionMulticasterTest method removingFirstOfTwo.

@Test
public void removingFirstOfTwo() throws Exception {
    EventAction action = EventActionMulticaster.add(action1, action2);
    EventAction result = EventActionMulticaster.remove(action, action1);
    assertSame(result, action2);
}
Also used : EventAction(limelight.events.EventAction) Test(org.junit.Test)

Example 5 with EventAction

use of limelight.events.EventAction in project limelight by slagyr.

the class EventActionMulticasterTest method removingOnlyAction.

@Test
public void removingOnlyAction() throws Exception {
    EventAction action = EventActionMulticaster.remove(action1, action1);
    assertEquals(null, action);
}
Also used : EventAction(limelight.events.EventAction) Test(org.junit.Test)

Aggregations

EventAction (limelight.events.EventAction)22 Test (org.junit.Test)18 Event (limelight.events.Event)4 SimplePropProxy (limelight.ui.SimplePropProxy)3 MouseClickedEvent (limelight.ui.events.panel.MouseClickedEvent)3 MouseEnteredEvent (limelight.ui.events.panel.MouseEnteredEvent)3 PanelEvent (limelight.ui.events.panel.PanelEvent)3 PropPanel (limelight.ui.model.PropPanel)3 ProductionCreatedEvent (limelight.model.events.ProductionCreatedEvent)1 TestablePanelBase (limelight.ui.model.TestablePanelBase)1 MockEventAction (limelight.ui.model.inputs.MockEventAction)1