Search in sources :

Example 1 with EventHub

use of io.jmix.core.common.event.EventHub in project jmix by jmix-framework.

the class Window method removeCloseListener.

/**
 * Removes a previously registered CloseListener.
 *
 * @param listener the listener to remove
 * @deprecated Use {@link Screen#addAfterCloseListener(Consumer)} instead.
 */
@Deprecated
default void removeCloseListener(CloseListener listener) {
    EventHub eventHub = UiControllerUtils.getEventHub(getFrameOwner());
    eventHub.unsubscribe(Screen.AfterCloseEvent.class, new AfterCloseListenerAdapter(listener));
}
Also used : EventHub(io.jmix.core.common.event.EventHub)

Example 2 with EventHub

use of io.jmix.core.common.event.EventHub in project jmix by jmix-framework.

the class Window method removeListener.

/**
 * Removes a previously registered CloseListener.
 *
 * @param listener the listener to remove
 * @deprecated Use {@link Screen#addAfterCloseListener(Consumer)} instead.
 */
@Deprecated
default void removeListener(CloseListener listener) {
    EventHub eventHub = UiControllerUtils.getEventHub(getFrameOwner());
    eventHub.unsubscribe(Screen.AfterCloseEvent.class, new AfterCloseListenerAdapter(listener));
}
Also used : EventHub(io.jmix.core.common.event.EventHub)

Example 3 with EventHub

use of io.jmix.core.common.event.EventHub in project jmix by jmix-framework.

the class DynAttrFacetImpl method subscribe.

private void subscribe() {
    Frame frame = getOwner();
    if (frame == null) {
        throw new IllegalStateException("DynAttrFacet is not attached to Frame");
    }
    Screen screen = UiControllerUtils.getScreen(frame.getFrameOwner());
    if (screen instanceof StandardEditor) {
        EventHub screenEvents = UiControllerUtils.getEventHub(screen);
        screenEvents.subscribe(StandardEditor.InitEntityEvent.class, this::initEntityInStandardEditor);
    } else if (screen instanceof MasterDetailScreen) {
        EventHub screenEvents = UiControllerUtils.getEventHub(screen);
        screenEvents.subscribe(MasterDetailScreen.InitEntityEvent.class, this::initEntityInMasterDetailScreen);
    }
}
Also used : Frame(io.jmix.ui.component.Frame) MasterDetailScreen(io.jmix.ui.screen.MasterDetailScreen) Screen(io.jmix.ui.screen.Screen) EventHub(io.jmix.core.common.event.EventHub) StandardEditor(io.jmix.ui.screen.StandardEditor) MasterDetailScreen(io.jmix.ui.screen.MasterDetailScreen)

Example 4 with EventHub

use of io.jmix.core.common.event.EventHub in project jmix by jmix-framework.

the class PresentationsFacetImpl method subscribe.

protected void subscribe() {
    checkAttachedFrame();
    // noinspection ConstantConditions
    EventHub screenEvents = UiControllerUtils.getEventHub(getScreenOwner());
    afterShowSubscription = screenEvents.subscribe(Screen.AfterShowEvent.class, settingsFacetResolver::resolveAfterShowEvent);
    afterDetachedSubscription = screenEvents.subscribe(Screen.AfterDetachEvent.class, this::onAfterDetachEvent);
}
Also used : EventHub(io.jmix.core.common.event.EventHub)

Example 5 with EventHub

use of io.jmix.core.common.event.EventHub in project jmix by jmix-framework.

the class Window method removeBeforeWindowCloseListener.

/**
 * Removes a previously added listener.
 *
 * @param listener the listener to remove
 * @deprecated Use {@link Subscription} instead
 */
@Deprecated
default void removeBeforeWindowCloseListener(Consumer<BeforeCloseEvent> listener) {
    EventHub eventHub = UiControllerUtils.getEventHub(getFrameOwner());
    eventHub.unsubscribe(BeforeCloseEvent.class, listener);
}
Also used : EventHub(io.jmix.core.common.event.EventHub)

Aggregations

EventHub (io.jmix.core.common.event.EventHub)7 Frame (io.jmix.ui.component.Frame)1 MasterDetailScreen (io.jmix.ui.screen.MasterDetailScreen)1 Screen (io.jmix.ui.screen.Screen)1 AfterDetachEvent (io.jmix.ui.screen.Screen.AfterDetachEvent)1 AfterShowEvent (io.jmix.ui.screen.Screen.AfterShowEvent)1 BeforeShowEvent (io.jmix.ui.screen.Screen.BeforeShowEvent)1 StandardEditor (io.jmix.ui.screen.StandardEditor)1