Class Navigator
java.lang.Object
nl.siegmann.epublib.browsersupport.Navigator
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate Bookprivate Stringprivate intprivate Resourceprivate intprivate List<NavigationEventListener> private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddNavigationEventListener(NavigationEventListener navigationEventListener) getBook()intintThe current position within the spine.voidintgotoFirstSpineSection(Object source) intgotoLastSpineSection(Object source) intgotoNextSpineSection(Object source) intgotoPreviousSpineSection(int pagePos, Object source) intgotoPreviousSpineSection(Object source) intgotoResource(String resourceHref, Object source) intgotoResource(Resource resource, int pagePos, Object source) intgotoResource(Resource resource, int pagePos, String fragmentId, Object source) intgotoResource(Resource resource, Object source) intgotoResource(Resource resource, String fragmentId, Object source) intgotoResourceId(String resourceId, Object source) intgotoSpineSection(int newSpinePos, int newPagePos, Object source) Go to a specific section.intgotoSpineSection(int newSpinePos, Object source) private voidhandleEventListeners(NavigationEvent navigationEvent) booleanbooleanbooleanremoveNavigationEventListener(NavigationEventListener navigationEventListener) intsetCurrentResource(Resource currentResource) Sets the current index and resource without calling the eventlisteners.voidsetCurrentSpinePos(int currentIndex) Sets the current index and resource without calling the eventlisteners.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
book
-
currentSpinePos
private int currentSpinePos -
currentResource
-
currentPagePos
private int currentPagePos -
currentFragmentId
-
eventListeners
-
-
Constructor Details
-
Navigator
public Navigator() -
Navigator
-
-
Method Details
-
gotoFirstSpineSection
-
gotoPreviousSpineSection
-
gotoPreviousSpineSection
-
hasNextSpineSection
public boolean hasNextSpineSection() -
hasPreviousSpineSection
public boolean hasPreviousSpineSection() -
gotoNextSpineSection
-
gotoResource
-
gotoResource
-
gotoResource
-
gotoResource
-
gotoResource
-
gotoResourceId
-
gotoSpineSection
-
gotoSpineSection
Go to a specific section. Illegal spine positions are silently ignored.- Parameters:
newSpinePos-source-- Returns:
- The current position within the spine
-
gotoLastSpineSection
-
gotoBook
-
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
-
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
-
setCurrentResource
Sets the current index and resource without calling the eventlisteners. If you want the eventListeners called use gotoSection(index); -
getCurrentFragmentId
-
getCurrentSectionPos
public int getCurrentSectionPos()