Search in sources :

Example 1 with GridTimer

use of org.ovirt.engine.ui.uicommonweb.models.GridTimer in project ovirt-engine by oVirt.

the class AbstractRefreshManager method onWindowFocusChange.

/**
 * Callback fired when the application window gains or looses its focus.
 */
void onWindowFocusChange(boolean inFocus) {
    GridTimer modelTimer = getModelTimer();
    // Change refresh rate only when the model timer is currently active and not paused
    if (modelTimer.isActive() && !modelTimer.isPaused()) {
        modelTimer.stop();
        if (inFocus) {
            modelTimer.setRefreshRate(readRefreshRate());
        } else {
            modelTimer.setRefreshRate(OUT_OF_FOCUS_REFRESH_RATE);
        }
        modelTimer.start();
    }
}
Also used : GridTimer(org.ovirt.engine.ui.uicommonweb.models.GridTimer)

Example 2 with GridTimer

use of org.ovirt.engine.ui.uicommonweb.models.GridTimer in project ovirt-engine by oVirt.

the class AbstractRefreshManager method updateTimer.

private void updateTimer() {
    final GridTimer modelTimer = getModelTimer();
    modelTimer.setRefreshRate(readRefreshRate());
    if (statusUpdateHandlerRegistration != null) {
        statusUpdateHandlerRegistration.removeHandler();
    }
    statusUpdateHandlerRegistration = modelTimer.addGridTimerStateChangeEventHandler(event -> onRefresh(modelTimer.getTimerRefreshStatus()));
    modelTimer.resume();
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) ModelProvider(org.ovirt.engine.ui.common.uicommon.model.ModelProvider) EventBus(com.google.gwt.event.shared.EventBus) GridTimer(org.ovirt.engine.ui.uicommonweb.models.GridTimer) ApplicationFocusChangeEvent(org.ovirt.engine.ui.common.system.ApplicationFocusChangeEvent) GwtEvent(com.google.gwt.event.shared.GwtEvent) HasHandlers(com.google.gwt.event.shared.HasHandlers) Set(java.util.Set) Collections(java.util.Collections) LinkedHashSet(java.util.LinkedHashSet) ClientStorage(org.ovirt.engine.ui.common.system.ClientStorage) GridController(org.ovirt.engine.ui.uicommonweb.models.GridController) GridTimer(org.ovirt.engine.ui.uicommonweb.models.GridTimer)

Aggregations

GridTimer (org.ovirt.engine.ui.uicommonweb.models.GridTimer)2 EventBus (com.google.gwt.event.shared.EventBus)1 GwtEvent (com.google.gwt.event.shared.GwtEvent)1 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 HasHandlers (com.google.gwt.event.shared.HasHandlers)1 Collections (java.util.Collections)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 ApplicationFocusChangeEvent (org.ovirt.engine.ui.common.system.ApplicationFocusChangeEvent)1 ClientStorage (org.ovirt.engine.ui.common.system.ClientStorage)1 ModelProvider (org.ovirt.engine.ui.common.uicommon.model.ModelProvider)1 GridController (org.ovirt.engine.ui.uicommonweb.models.GridController)1