当前位置: 首页>>代码示例>>Java>>正文


Java FxTimer.createPeriodic方法代码示例

本文整理汇总了Java中org.reactfx.util.FxTimer.createPeriodic方法的典型用法代码示例。如果您正苦于以下问题:Java FxTimer.createPeriodic方法的具体用法?Java FxTimer.createPeriodic怎么用?Java FxTimer.createPeriodic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.reactfx.util.FxTimer的用法示例。


在下文中一共展示了FxTimer.createPeriodic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupNvidiaListener

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
private void setupNvidiaListener() {
    log.log(Level.FINER, "Setting nvidia ram listener.");
    EventStreams.nonNullValuesOf(nvidiaService.progressProperty())
            .filter(vramUsage -> vramUsage.doubleValue() > 0)
            .subscribe(vramUsage -> vramBar.setProgress(vramUsage.doubleValue()));

    log.log(Level.FINER, "Setting nvidia timer.");
    nvidiaTimer = FxTimer.createPeriodic(Duration.ofMillis(1000), () -> {
        log.log(Level.FINER, "Timer: checking service");
        if (nvidiaService == null || nvidiaService.isRunning())
            return;

        log.log(Level.FINER, "Timer: starting service");
        nvidiaService.restart();
        nvidiaTimer.restart();
    });
    nvidiaTimer.restart();
}
 
开发者ID:cameronleger,项目名称:neural-style-gui,代码行数:19,代码来源:MainController.java

示例2: restartableTicks

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
/**
 * Returns a {@link #ticks(Duration)} EventStream whose timer restarts whenever
 * impulse emits an event.
 * @param interval - the amount of time that passes until this stream emits its next tick
 * @param impulse - the EventStream that resets this EventStream's internal timer
 */
public static EventStream<?> restartableTicks(Duration interval, EventStream<?> impulse) {
    return new EventStreamBase<Void>() {
        private final Timer timer = FxTimer.createPeriodic(
                interval, () -> emit(null));

        @Override
        protected Subscription observeInputs() {
            timer.restart();
            return Subscription.multi(
                    impulse.subscribe(x -> timer.restart()),
                    timer::stop
            );
        }
    };
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:22,代码来源:EventStreams.java

示例3: setupOutputImageListeners

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
private void setupOutputImageListeners() {
    imageView.fitWidthProperty().bind(imageViewSizer.widthProperty());
    imageView.fitHeightProperty().bind(imageViewSizer.heightProperty());

    log.log(Level.FINER, "Setting image timer.");
    imageOutputTimer = FxTimer.createPeriodic(Duration.ofMillis(250), () -> {
        log.log(Level.FINER, "Timer: checking service");

        if (imageOutputService != null && !imageOutputService.isRunning()) {
            imageOutputService.reset();
            imageOutputService.start();
        }
    });
}
 
开发者ID:cameronleger,项目名称:neural-style-gui,代码行数:15,代码来源:MainController.java

示例4: runPeriodically

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
@Override
public Timer runPeriodically(Duration interval, Runnable runnable) {
    if (timer == null) {
        timer = FxTimer.createPeriodic(interval, runnable);
        timer.restart();
    } else {
        log.warn("runPeriodically called on an already running timer.");
    }
    return this;
}
 
开发者ID:bisq-network,项目名称:exchange,代码行数:11,代码来源:UITimer.java

示例5: ticks

import org.reactfx.util.FxTimer; //导入方法依赖的package包/类
/**
 * Returns an event stream that emits periodic <i>ticks</i>. The first tick
 * is emitted after {@code interval} amount of time has passed.
 * The returned stream may only be used on the JavaFX application thread.
 *
 * <p>As with all lazily bound streams, ticks are emitted only when there
 * is at least one subscriber to the returned stream. This means that to
 * release associated resources, it suffices to unsubscribe from the
 * returned stream.
 */
public static EventStream<?> ticks(Duration interval) {
    return new EventStreamBase<Void>() {
        private final Timer timer = FxTimer.createPeriodic(
                interval, () -> emit(null));

        @Override
        protected Subscription observeInputs() {
            timer.restart();
            return timer::stop;
        }
    };
}
 
开发者ID:TomasMikula,项目名称:ReactFX,代码行数:23,代码来源:EventStreams.java


注:本文中的org.reactfx.util.FxTimer.createPeriodic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。