Search in sources :

Example 16 with EventAction

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

the class DropDownPopup method createList.

private void createList() {
    popupList = new PropPanel(new SimplePropProxy(), Util.toMap("name", "limelight_builtin_drop_down_popup_list"));
    popupList.getStyle().addExtension(stylesStore.get("limelight_builtin_drop_down_popup_list"));
    popupList.getStyle().setX(dropDown.getParent().getAbsoluteLocation().x - dropDown.getRoot().getX());
    popupList.getStyle().setY(dropDown.getParent().getAbsoluteLocation().y - dropDown.getRoot().getY());
    popupList.getStyle().setWidth(dropDown.getParent().getWidth());
    popupList.getEventHandler().add(MouseClickedEvent.class, new EventAction() {

        public void invoke(Event event) {
        // eat the event so the curtains won't get it
        }
    });
}
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)

Example 17 with EventAction

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

the class PanelEventTest method theRecipientIsSetOnlyDuringDispatchAndThenRestored.

@Test
public void theRecipientIsSetOnlyDuringDispatchAndThenRestored() throws Exception {
    TestablePanelBase recipient = new TestablePanelBase();
    recipient.getEventHandler().add(TestableEvent.class, new EventAction() {

        public void invoke(Event event) {
            dispatchedRecipient = ((PanelEvent) event).getRecipient();
        }
    });
    event.dispatch(recipient);
    assertEquals(recipient, dispatchedRecipient);
    assertEquals(source, event.getRecipient());
}
Also used : MockEventAction(limelight.ui.model.inputs.MockEventAction) EventAction(limelight.events.EventAction) Event(limelight.events.Event) TestablePanelBase(limelight.ui.model.TestablePanelBase) Test(org.junit.Test)

Example 18 with EventAction

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

the class EventActionMulticasterTest method removingFirstOfThree.

@Test
public void removingFirstOfThree() throws Exception {
    EventAction action = EventActionMulticaster.add(action1, action2);
    action = EventActionMulticaster.add(action, action3);
    EventAction result = EventActionMulticaster.remove(action, action1);
    assertEquals(EventActionMulticaster.class, result.getClass());
    EventActionMulticaster multicaster = (EventActionMulticaster) result;
    assertSame(action2, multicaster.getFirst());
    assertSame(action3, multicaster.getSecond());
}
Also used : EventAction(limelight.events.EventAction) Test(org.junit.Test)

Example 19 with EventAction

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

the class EventActionMulticasterTest method chainingMulticasters.

@Test
public void chainingMulticasters() throws Exception {
    EventAction action = EventActionMulticaster.add(action1, action2);
    action = EventActionMulticaster.add(action, action3);
    action = EventActionMulticaster.add(action, action4);
    action = EventActionMulticaster.add(action, action5);
    action.invoke(null);
    assertEquals(action1, invokations.get(0));
    assertEquals(action2, invokations.get(1));
    assertEquals(action3, invokations.get(2));
    assertEquals(action4, invokations.get(3));
    assertEquals(action5, invokations.get(4));
}
Also used : EventAction(limelight.events.EventAction) Test(org.junit.Test)

Example 20 with EventAction

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

the class EventActionMulticasterTest method collectingTwoActions.

@Test
public void collectingTwoActions() throws Exception {
    EventAction action = EventActionMulticaster.add(action1, action2);
    List<EventAction> actions = EventActionMulticaster.collect(action);
    assertEquals(2, actions.size());
    assertSame(action1, actions.get(0));
    assertSame(action2, actions.get(1));
}
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