Class SlideShow

All Implemented Interfaces:
Animation, Editable, StyleListener, Iterable<Component>

public class SlideShow extends Container

Plays a presentation: slide transitions, builds, and charts that animate in as their slide appears.

Tap the right two thirds, swipe left, or press right, down, space or fire to advance; tap the left third, swipe right, or press left or up to go back. Hidden slides are skipped. In presenter mode the slide shares the screen with the next slide, the speaker notes and the elapsed time, for a second display or a rehearsal.

void play(byte[] bytes) throws IOException {
    Form f = new Form("Deck", new BorderLayout());
    SlideShow show = new SlideShow(Presentation.read(bytes));
    show.addSlideListener(e -> Log.p("now on slide " + show.getSlideIndex()));
    f.add(BorderLayout.CENTER, show);
    f.show();
}

Transitions and builds move on com.codename1.ui.animations.Motion against AnimationTime, and the frames are painted by SlideAnimation, so a frame at any progress can be rendered exactly. Charts on screen are live com.codename1.ui.chart.Chart components that play their own entrance animation.

  • Constructor Details

    • SlideShow

      public SlideShow(Presentation presentation)

      A slide show of a presentation, on its first visible slide.

      Parameters
      • presentation: the presentation
  • Method Details

    • setPresentation

      public final void setPresentation(Presentation value)

      Shows another presentation from its first visible slide.

      Parameters
      • value: the presentation
    • getPresentation

      public Presentation getPresentation()

      The presentation.

      Returns

      the presentation

    • getSlideIndex

      public int getSlideIndex()

      The index of the slide showing.

      Returns

      the index into Presentation.getSlides()

    • getBuildStep

      public int getBuildStep()

      How many click steps of the current slide's builds have played.

      Returns

      the step

    • getRenderer

      public SlideRenderer getRenderer()

      The renderer slides are painted with.

      Returns

      the renderer

    • setPresenterMode

      public void setPresenterMode(boolean value)

      Turns presenter mode on or off: the next slide, the notes and a timer beside the slide.

      Parameters
      • value: true for presenter mode
    • isPresenterMode

      public boolean isPresenterMode()

      True in presenter mode.

      Returns

      true when presenting

    • setLiveCharts

      public void setLiveCharts(boolean value)

      Chooses whether charts are live components that animate in, the default, or painted as still pictures.

      Parameters
      • value: false for still charts
    • addSlideListener

      public void addSlideListener(ActionListener<ActionEvent> l)

      Adds a listener told after every change of slide or build step.

      Parameters
      • l: the listener
    • removeSlideListener

      public void removeSlideListener(ActionListener<ActionEvent> l)

      Removes a listener.

      Parameters
      • l: the listener
    • next

      public boolean next()

      Plays the next build step, or moves to the next slide when every build has played.

      Returns

      false at the end of the presentation

    • previous

      public boolean previous()

      Undoes the last build step, or moves to the previous slide with all of its builds played.

      Returns

      false at the start of the presentation

    • goTo

      public void goTo(int slideIndex)

      Jumps to a slide with no transition and none of its click builds played.

      Parameters
      • slideIndex: the slide
    • paintBackground

      public void paintBackground(Graphics g)
      Description copied from class: Component

      This method paints the Component background, it should be overriden by subclasses to perform custom background drawing.

      Parameters
      • g: the component graphics
      Overrides:
      paintBackground in class Component
    • paint

      public void paint(Graphics g)
      Description copied from class: Container

      This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

      Parameters
      • g: the component graphics
      Specified by:
      paint in interface Animation
      Overrides:
      paint in class Container
    • initComponent

      protected void initComponent()
      Description copied from class: Component
      Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
      Overrides:
      initComponent in class Component
    • deinitialize

      protected void deinitialize()
      Description copied from class: Component
      Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.
      Overrides:
      deinitialize in class Component
    • animate

      public boolean animate()
      Description copied from class: Component

      Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the com.codename1.ui.Display class.

      Returns

      true if a repaint is desired or false if no repaint is necessary

      Specified by:
      animate in interface Animation
      Overrides:
      animate in class Component
    • keyReleased

      public void keyReleased(int keyCode)
      Description copied from class: Container

      If this Component is focused, the key released event will call this method

      Parameters
      • keyCode: the key code value to indicate a physical key.
      Overrides:
      keyReleased in class Container
    • pointerPressed

      public void pointerPressed(int x, int y)
      Description copied from class: Container

      If this Component is focused, the pointer pressed event will call this method

      Parameters
      • x: the pointer x coordinate

      • y: the pointer y coordinate

      Overrides:
      pointerPressed in class Container
    • pointerReleased

      public void pointerReleased(int x, int y)
      Description copied from class: Component

      If this Component is focused, the pointer released event will call this method

      Parameters
      • x: the pointer x coordinate

      • y: the pointer y coordinate

      Overrides:
      pointerReleased in class Component