public interface Navigation extends Advisable<NavigationCallback>, Observable<NavigationEvent>
Modifier and Type | Method and Description |
---|---|
Browser |
browser()
Returns the
Browser instance of this navigation. |
boolean |
canGoBack()
Indicates whether the previous location can be loaded.
|
boolean |
canGoForward()
Indicates whether the next location can be loaded.
|
int |
currentEntryIndex()
Returns the index of the current item in the back-forward list or -1 if the list is empty.
|
static java.time.Duration |
defaultTimeout()
Returns the default navigation timeout in seconds.
|
NavigationEntry |
entryAtIndex(int index)
Returns an
Optional that contains the NavigationEntry instance for the given
index in the back-forward list, otherwise an empty Optional . |
int |
entryCount()
Returns the number of items in the back-forward list.
|
void |
goBack()
Loads the previous location in the back-forward list.
|
void |
goForward()
Loads the next location in the back-forward list.
|
void |
goToIndex(int index)
Navigates to a specific location at the given
index from the back-forward list. |
boolean |
isLoading()
Returns
true if any of the browser frames is in the process of loading a document. |
void |
loadUrl(LoadUrlParams params)
Navigates to the resource identified by the given
params . |
void |
loadUrl(java.lang.String url)
Navigates to the resource identified by the given
url . |
void |
loadUrlAndWait(LoadUrlParams params)
Loads the resource identified by the given
params and blocks the current thread
execution until the main frame of the resource is loaded completely or the
defaultTimeout() is reached. |
void |
loadUrlAndWait(LoadUrlParams params,
java.time.Duration timeout)
Loads a resource identified by the given
params and blocks the current thread
execution until the main frame of the resource is loaded completely or the given timeout is reached. |
void |
loadUrlAndWait(java.lang.String url)
Loads the resource identified by the given
url and blocks the current thread
execution until the main frame of the resource is loaded completely or the
defaultTimeout() is reached. |
void |
loadUrlAndWait(java.lang.String url,
java.time.Duration timeout)
Loads the resource identified by the given
url and blocks the current thread
execution until the main frame of the resource is loaded completely or the given timeout is reached. |
void |
reload()
Reloads the currently loaded web page.
|
void |
reloadAndCheckForRepost()
Reloads the currently loaded web page, but if the current web page has POST data, the user is
prompted to see if they really want to reload the page.
|
void |
reloadIgnoringCache()
Reloads the currently loaded web page ignoring caches.
|
void |
reloadIgnoringCacheAndCheckForRepost()
Reloads the currently loaded web page ignoring caches, but if the current web page has POST
data, the user is prompted to see if they really want to reload the page.
|
boolean |
removeEntryAtIndex(int index)
Removes the item at the given
index in the back-forward list and returns true
if it was removed successfully. |
void |
stop()
Cancels any pending navigation or download operation and stops any dynamic page elements,
such as background sounds and animations.
|
on
static java.time.Duration defaultTimeout()
jxbrowser.navigation.timeout.seconds
system property.Browser browser()
Browser
instance of this navigation.void loadUrl(java.lang.String url)
url
. This method tells the browser
to start asynchronous loading and returns immediately.url
- the URL of the resource to loadjava.lang.IllegalArgumentException
- when the url
is empty or blankObjectClosedException
- when the browser is already closedvoid loadUrl(LoadUrlParams params)
params
. This method tells the
browser to start asynchronous loading and returns immediately.params
- parameters such as URL, POST data, and HTTP headersObjectClosedException
- when the browser is already closedvoid loadUrlAndWait(java.lang.String url)
url
and blocks the current thread
execution until the main frame of the resource is loaded completely or the
defaultTimeout()
is reached.url
- the URL of the resource to loadjava.lang.IllegalArgumentException
- when the url
is empty or blankTimeoutException
- when the resource hasn't been loaded within the
defaultTimeout()
NavigationException
- when the navigation failedObjectClosedException
- when the browser is already closedvoid loadUrlAndWait(LoadUrlParams params)
params
and blocks the current thread
execution until the main frame of the resource is loaded completely or the
defaultTimeout()
is reached.params
- parameters such as URL, POST data, and HTTP headersTimeoutException
- when the resource hasn't been loaded within the
defaultTimeout()
NavigationException
- when the navigation failedObjectClosedException
- when the browser is already closedvoid loadUrlAndWait(java.lang.String url, java.time.Duration timeout)
url
and blocks the current thread
execution until the main frame of the resource is loaded completely or the given timeout
is reached.url
- the URL of the resource to loadtimeout
- the maximum time to wait for the navigation to completejava.lang.IllegalArgumentException
- when the url
is empty or blankjava.lang.IllegalArgumentException
- when the timeout
is 0 or negativeTimeoutException
- when the resource hasn't been loaded within a timeoutNavigationException
- when the navigation failedObjectClosedException
- when the browser is already closedvoid loadUrlAndWait(LoadUrlParams params, java.time.Duration timeout)
params
and blocks the current thread
execution until the main frame of the resource is loaded completely or the given timeout
is reached.params
- parameters such as URL, POST data and HTTP headerstimeout
- the maximum time to wait for the navigation to completejava.lang.IllegalArgumentException
- when timeout
is 0 or negativeTimeoutException
- when the resource hasn't been loaded within a timeoutNavigationException
- when the navigation failedObjectClosedException
- when the browser is already closedboolean isLoading()
true
if any of the browser frames is in the process of loading a document.ObjectClosedException
- when the browser is already closedvoid goBack()
ObjectClosedException
- when the browser is already closedboolean canGoBack()
true
if the previous location in the back-forward list can be loadedObjectClosedException
- when the browser is already closedvoid goForward()
ObjectClosedException
- when the browser is already closedboolean canGoForward()
true
if the next location in the back-forward list can be loadedObjectClosedException
- when the browser is already closedvoid stop()
ObjectClosedException
- when the browser is already closedvoid reload()
ObjectClosedException
- when the browser is already closedvoid reloadAndCheckForRepost()
ObjectClosedException
- when the browser is already closedBeforeFormRepostCallback
void reloadIgnoringCache()
ObjectClosedException
- when the browser is already closedvoid reloadIgnoringCacheAndCheckForRepost()
ObjectClosedException
- when the browser is already closedBeforeFormRepostCallback
void goToIndex(int index)
index
from the back-forward list.index
- location of the item in the back-forward listjava.lang.IllegalArgumentException
- when index
is less than 0java.lang.IllegalArgumentException
- when index
is more than the number of items in the
back-forward listObjectClosedException
- when the browser is already closedentryCount()
int entryCount()
ObjectClosedException
- when the browser is already closedint currentEntryIndex()
ObjectClosedException
- when the browser is already closedNavigationEntry entryAtIndex(int index)
Optional
that contains the NavigationEntry
instance for the given
index
in the back-forward list, otherwise an empty Optional
.index
- location of the item to return in the back-forward listjava.lang.IllegalArgumentException
- when index
is less than 0java.lang.IllegalArgumentException
- when index
is more than the number of items in the
back-forward listObjectClosedException
- when the browser is already closedboolean removeEntryAtIndex(int index)
index
in the back-forward list and returns true
if it was removed successfully.index
- location of the item to remove in the back-forward listtrue
if the item was removed successfullyjava.lang.IllegalArgumentException
- when index
is less than 0java.lang.IllegalArgumentException
- when index
points to the current item in the
back-forward listjava.lang.IllegalArgumentException
- when index
is more than the number of items in the
back-forward listObjectClosedException
- when the browser is already closed