當前位置: 首頁>>代碼示例>>Java>>正文


Java OnEvent.REMOVE屬性代碼示例

本文整理匯總了Java中com.github.czyzby.autumn.annotation.OnEvent.REMOVE屬性的典型用法代碼示例。如果您正苦於以下問題:Java OnEvent.REMOVE屬性的具體用法?Java OnEvent.REMOVE怎麽用?Java OnEvent.REMOVE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.github.czyzby.autumn.annotation.OnEvent的用法示例。


在下文中一共展示了OnEvent.REMOVE屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onEvent

@OnEvent(VersionUpdateCheckEvent.class) boolean onEvent(VersionUpdateCheckEvent event) {
        switch (event.getAction()) {
            case CHECK_STARTED:
            case CHECK_FINISHED:
                return OnEvent.KEEP;
            case FINISHED_ERROR:
            case FINISHED_UP_TO_DATE:
                return OnEvent.REMOVE;
            case FINISHED_UPDATE_AVAILABLE:
//                toastManager.show
                return OnEvent.REMOVE;
            default:
                // Should never happen
                throw new IllegalStateException("Unexpected version check event: " + event.getAction());
        }
    }
 
開發者ID:crashinvaders,項目名稱:gdx-texture-packer-gui,代碼行數:16,代碼來源:MainController.java

示例2: processEvent

@Override
public boolean processEvent(final Object event) {
    replaceParameters(event);
    try {
        final Object result = invoke();
        if (removeAfterInvocation) {
            return OnEvent.REMOVE;
        } else if (result instanceof Boolean) {
            return ((Boolean) result).booleanValue();
        }
        return OnEvent.KEEP;
    } catch (final Exception exception) {
        if (strict) {
            // Gdx applications seem to ignore exceptions in posted runnables. This is bad.
            Gdx.app.error("ERROR", "Exception occured on event listener.", exception);
            throw new GdxRuntimeException("Unable to invoke event listener.", exception);
        }
        return OnEvent.KEEP;
    }
}
 
開發者ID:gdx-libs,項目名稱:gdx-autumn,代碼行數:20,代碼來源:ReflectionEventListener.java

示例3: processMessage

@Override
public boolean processMessage() {
    replaceParameters();
    try {
        final Object result = invoke();
        if (removeAfterInvocation) {
            return OnEvent.REMOVE;
        } else if (result instanceof Boolean) {
            return ((Boolean) result).booleanValue();
        }
        return OnEvent.KEEP;
    } catch (final Exception exception) {
        if (strict) {
            // Gdx applications seem to ignore exceptions in posted runnables. This is bad.
            Gdx.app.error("ERROR", "Exception occured on message listener.", exception);
            throw new GdxRuntimeException("Unable to invoke message listener.", exception);
        }
        return OnEvent.KEEP;
    }
}
 
開發者ID:gdx-libs,項目名稱:gdx-autumn,代碼行數:20,代碼來源:ReflectionMessageListener.java

示例4: onEvent

@OnEvent(VersionUpdateCheckEvent.class) boolean onEvent(VersionUpdateCheckEvent event) {
    switch (event.getAction()) {
        case FINISHED_ERROR:
        case FINISHED_UP_TO_DATE:
            // Everything appears to be fine, stop listening for updates
            return OnEvent.REMOVE;
        case FINISHED_UPDATE_AVAILABLE:
            showUpdateNotification(event.getLatestVersion());
            return OnEvent.REMOVE;
    }
    return OnEvent.KEEP;
}
 
開發者ID:crashinvaders,項目名稱:gdx-texture-packer-gui,代碼行數:12,代碼來源:InitialUpdateCheckService.java

示例5: onEvent

/** Will be invoked any time {@link MyEvent} instance is posted using {@link EventDispatcher}. Note that annotated
 * listener methods can contain any injectable parameters, using the same mechanism as {@link Inject} or
 * {@link Initiate} annotations, as well as {@link MyEvent} parameter.
 * <p>
 * By returning a boolean result, you can decide whether the event listener should be kept or removed. This allows
 * you to easily removed no longer needed listeners. (Note that same applies to OnMessage methods.)
 *
 * @param event will be injected.
 * @return see {@link OnEvent#KEEP} and {@link OnEvent#REMOVE}. */
@OnEvent(MyEvent.class)
public boolean onEvent(final MyEvent event) {
    LOGGER.info("I detected a MyEvent: {0}. Removing this listener.", event.getMessage());
    return OnEvent.REMOVE;
}
 
開發者ID:czyzby,項目名稱:gdx-lml,代碼行數:14,代碼來源:MyHandler.java


注:本文中的com.github.czyzby.autumn.annotation.OnEvent.REMOVE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。