Class BrowsingHistoryBase
java.lang.Object
dev.webfx.platform.windowhistory.spi.impl.BrowsingHistoryBase
- All Implemented Interfaces:
BrowsingHistory
- Direct Known Subclasses:
MemoryBrowsingHistory,SubBrowsingHistory
- Author:
- Bruno Salmon
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckBeforeAsync(BrowsingHistoryLocation location) protected Future<BrowsingHistoryLocationImpl>checkBeforeThenTransit(PathStateLocation location, BrowsingHistoryEvent event) protected booleancheckBeforeUnload(BrowsingHistoryLocation location) protected Future<BrowsingHistoryLocationImpl>createHistoryLocation(PathStateLocation pathStateLocation, BrowsingHistoryEvent event) createHistoryLocation(String path, ReadOnlyAstObject state) protected StringcreatePathStateLocation(String path, ReadOnlyAstObject state) protected voiddoAcceptedPop(BrowsingHistoryLocationImpl historyLocation) protected abstract voiddoAcceptedPush(BrowsingHistoryLocationImpl historyLocation) protected abstract voiddoAcceptedReplace(BrowsingHistoryLocationImpl historyLocation) protected voidfireLocationChanged(BrowsingHistoryLocation location) protected StringfullToMountPath(String fullPath) protected StringgetPath(PathStateLocation location) Creating URLs ******************************************************* Additionally, history objects can be used to create URL paths and/or hrefs for<a>tags that link to various places in your app.booleanvoidlisten(Handler<BrowsingHistoryLocation> listener) Listen for changes to the current location.voidlistenBeforeAsync(Function<BrowsingHistoryLocation, Future<Boolean>> transitionHook) If your transition hook needs to execute asynchronously, you can return a future boolean.voidlistenBeforeUnload(Function<BrowsingHistoryLocation, Boolean> transitionHook) A before unload hook is a function that is used in web browsers to prevent the user from navigating away from the page or closing the window.protected StringmountToFullPath(String mountPath) voidpush(PathStateLocation location) Push a new entry onto the history stack.voidreplace(PathStateLocation location) Replace the current entry on the history stack.protected voidsetGoingBackward(boolean goingBackward) voidsetMountPoint(String mountPoint) protected voidtransit(BrowsingHistoryLocationImpl newHistoryLocation) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.webfx.platform.windowhistory.spi.BrowsingHistory
getCurrentLocation, go, goBack, goForward, listenBefore, push, push, replace, replace, transitionTo
-
Constructor Details
-
BrowsingHistoryBase
public BrowsingHistoryBase()
-
-
Method Details
-
setMountPoint
-
getMountPoint
-
mountToFullPath
-
fullToMountPath
-
push
Description copied from interface:BrowsingHistoryPush a new entry onto the history stack.- Specified by:
pushin interfaceBrowsingHistory- Parameters:
location- A location descriptor object that uses a combination of pathname, search, hash, and state properties
-
replace
Description copied from interface:BrowsingHistoryReplace the current entry on the history stack.- Specified by:
replacein interfaceBrowsingHistory- Parameters:
location- A location descriptor object that uses a combination of pathname, search, hash, and state properties
-
checkBeforeUnloadThenCheckBeforeThenTransit
protected Future<BrowsingHistoryLocationImpl> checkBeforeUnloadThenCheckBeforeThenTransit(PathStateLocation location, BrowsingHistoryEvent event) -
checkBeforeThenTransit
protected Future<BrowsingHistoryLocationImpl> checkBeforeThenTransit(PathStateLocation location, BrowsingHistoryEvent event) -
setGoingBackward
protected void setGoingBackward(boolean goingBackward) -
isGoingBackward
public boolean isGoingBackward()- Specified by:
isGoingBackwardin interfaceBrowsingHistory
-
transit
-
doAcceptedPush
-
doAcceptedReplace
-
doAcceptedPop
-
createLocationKey
-
getPath
Description copied from interface:BrowsingHistoryCreating URLs ******************************************************* Additionally, history objects can be used to create URL paths and/or hrefs for<a>tags that link to various places in your app. This is useful when using hash history to prefix URLs with a # or when using query support to automatically build query strings. String href = history.createHref('/the/path')- Specified by:
getPathin interfaceBrowsingHistory
-
createPathStateLocation
- Specified by:
createPathStateLocationin interfaceBrowsingHistory
-
createHistoryLocation
- Specified by:
createHistoryLocationin interfaceBrowsingHistory
-
createHistoryLocation
public BrowsingHistoryLocationImpl createHistoryLocation(PathStateLocation pathStateLocation, BrowsingHistoryEvent event) -
listen
Description copied from interface:BrowsingHistoryListen for changes to the current location.- Specified by:
listenin interfaceBrowsingHistory
-
listenBeforeAsync
Description copied from interface:BrowsingHistoryIf your transition hook needs to execute asynchronously, you can return a future boolean. Note: If you do provide a callback argument, the transition will not proceed until you call it (i.e. listeners will not be notified of the new location)! If your app is slow for some reason, this could lead to a non-responsive UI.- Specified by:
listenBeforeAsyncin interfaceBrowsingHistory- Parameters:
transitionHook- a hook asynchronous function that takes the location and returns a future boolean that will tell if the transition accepted (true) or prevented (false)
-
listenBeforeUnload
Description copied from interface:BrowsingHistoryA before unload hook is a function that is used in web browsers to prevent the user from navigating away from the page or closing the window. history.listenBeforeUnload(() -> 'Are you sure you want to leave this page?'); Note that because of the nature of the beforeunload event all hooks must return synchronously. BrowsingHistory runs all hooks in the order they were registered and displays the first message that is returned.- Specified by:
listenBeforeUnloadin interfaceBrowsingHistory
-
checkBeforeUnload
-
checkBeforeAsync
-
fireLocationChanged
-