Class Navigator

java.lang.Object
nl.siegmann.epublib.browsersupport.Navigator
All Implemented Interfaces:
Serializable

public class Navigator extends Object implements Serializable
A helper class for epub browser applications. It helps moving from one resource to the other, from one resource to the other and keeping other elements of the application up-to-date by calling the NavigationEventListeners.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • book

      private Book book
    • currentSpinePos

      private int currentSpinePos
    • currentResource

      private Resource currentResource
    • currentPagePos

      private int currentPagePos
    • currentFragmentId

      private String currentFragmentId
    • eventListeners

      private List<NavigationEventListener> eventListeners
  • Constructor Details

    • Navigator

      public Navigator()
    • Navigator

      public Navigator(Book book)
  • Method Details

    • handleEventListeners

      private void handleEventListeners(NavigationEvent navigationEvent)
    • addNavigationEventListener

      public boolean addNavigationEventListener(NavigationEventListener navigationEventListener)
    • removeNavigationEventListener

      public boolean removeNavigationEventListener(NavigationEventListener navigationEventListener)
    • gotoFirstSpineSection

      public int gotoFirstSpineSection(Object source)
    • gotoPreviousSpineSection

      public int gotoPreviousSpineSection(Object source)
    • gotoPreviousSpineSection

      public int gotoPreviousSpineSection(int pagePos, Object source)
    • hasNextSpineSection

      public boolean hasNextSpineSection()
    • hasPreviousSpineSection

      public boolean hasPreviousSpineSection()
    • gotoNextSpineSection

      public int gotoNextSpineSection(Object source)
    • gotoResource

      public int gotoResource(String resourceHref, Object source)
    • gotoResource

      public int gotoResource(Resource resource, Object source)
    • gotoResource

      public int gotoResource(Resource resource, String fragmentId, Object source)
    • gotoResource

      public int gotoResource(Resource resource, int pagePos, Object source)
    • gotoResource

      public int gotoResource(Resource resource, int pagePos, String fragmentId, Object source)
    • gotoResourceId

      public int gotoResourceId(String resourceId, Object source)
    • gotoSpineSection

      public int gotoSpineSection(int newSpinePos, Object source)
    • gotoSpineSection

      public int gotoSpineSection(int newSpinePos, int newPagePos, Object source)
      Go to a specific section. Illegal spine positions are silently ignored.
      Parameters:
      newSpinePos -
      source -
      Returns:
      The current position within the spine
    • gotoLastSpineSection

      public int gotoLastSpineSection(Object source)
    • gotoBook

      public void gotoBook(Book book, Object source)
    • getCurrentSpinePos

      public int getCurrentSpinePos()
      The current position within the spine.
      Returns:
      something invalid input: '<' 0 if the current position is not within the spine.
    • getCurrentResource

      public Resource getCurrentResource()
    • setCurrentSpinePos

      public void setCurrentSpinePos(int currentIndex)
      Sets the current index and resource without calling the eventlisteners. If you want the eventListeners called use gotoSection(index);
      Parameters:
      currentIndex -
    • getBook

      public Book getBook()
    • setCurrentResource

      public int setCurrentResource(Resource currentResource)
      Sets the current index and resource without calling the eventlisteners. If you want the eventListeners called use gotoSection(index);
    • getCurrentFragmentId

      public String getCurrentFragmentId()
    • getCurrentSectionPos

      public int getCurrentSectionPos()