Search in sources :

Example 1 with SlideIndexChangedEvent

use of org.rstudio.studio.client.common.presentation.events.SlideIndexChangedEvent in project rstudio by rstudio.

the class Presentation method onPresentationSlideChanged.

private void onPresentationSlideChanged(final int index, final JavaScriptObject jsCmds) {
    // note the slide index and save it
    currentState_.setSlideIndex(index);
    indexPersister_.setIndex(index);
    handlerManager_.fireEvent(new SlideIndexChangedEvent(index));
    // execute commands if we stay on the slide for > 500ms
    new Timer() {

        @Override
        public void run() {
            // execute commands if we're still on the same slide
            if (index == currentState_.getSlideIndex()) {
                JsArray<JavaScriptObject> cmds = jsCmds.cast();
                for (int i = 0; i < cmds.length(); i++) dispatchCommand(cmds.get(i));
            }
        }
    }.schedule(500);
}
Also used : JsArray(com.google.gwt.core.client.JsArray) Timer(com.google.gwt.user.client.Timer) SlideIndexChangedEvent(org.rstudio.studio.client.common.presentation.events.SlideIndexChangedEvent)

Aggregations

JsArray (com.google.gwt.core.client.JsArray)1 Timer (com.google.gwt.user.client.Timer)1 SlideIndexChangedEvent (org.rstudio.studio.client.common.presentation.events.SlideIndexChangedEvent)1