public interface Navigation extends Advisable<NavigationCallback>, Observable<NavigationEvent>
Modifier and Type | Field and Description |
---|---|
static Timestamp |
DEFAULT_TIMEOUT_IN_SECONDS
The default timeout for resource loading is 45 seconds.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 a resource of a frame on the web page is being loaded. |
void |
loadUrl(LoadUrlParams params)
Navigates to a resource identified by the given
params . |
void |
loadUrl(java.lang.String url)
Navigates to a resource identified by a URL.
|
void |
loadUrlAndWait(LoadUrlParams params)
Loads a resource identified by the given
params and blocks current thread execution
until the main frame of the resource is loaded completely or a timeout is reached. |
void |
loadUrlAndWait(LoadUrlParams params,
Timestamp timeout)
Loads a resource identified by the given
params and blocks current thread execution
until the main frame of the resource is loaded completely or the given timeoutInSeconds is reached. |
void |
loadUrlAndWait(java.lang.String url)
Loads a resource identified by the given
url and blocks current thread execution
until the main frame of the resource is loaded completely or a timeout is reached. |
void |
loadUrlAndWait(java.lang.String url,
Timestamp timeout)
Loads a resource identified by the given
url and blocks current thread execution
until the main frame of the resource is loaded completely or the given timeoutInSeconds 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 final Timestamp DEFAULT_TIMEOUT_IN_SECONDS
void loadUrl(java.lang.String url)
url
- URL of the resource to loadjava.lang.IllegalArgumentException
- when url
is empty or blankjava.lang.IllegalStateException
- when the browser is already closedvoid loadUrlAndWait(java.lang.String url)
url
and blocks current thread execution
until the main frame of the resource is loaded completely or a timeout is reached.url
- URL of the resource to loadjava.lang.IllegalArgumentException
- when url
is empty or blankTimeoutException
- when the resource hasn't been loaded within a default timeout
NavigationException
- when navigation failedjava.lang.IllegalStateException
- when the browser is already closedvoid loadUrlAndWait(java.lang.String url, Timestamp timeout)
url
and blocks current thread execution
until the main frame of the resource is loaded completely or the given timeoutInSeconds
is reached.url
- URL of the resource to loadtimeout
- a timeout in secondsjava.lang.IllegalArgumentException
- when url
is empty or blankjava.lang.IllegalArgumentException
- when timeoutInSeconds
is 0 or negativeTimeoutException
- when the resource hasn't been loaded within a timeoutNavigationException
- when navigation failedjava.lang.IllegalStateException
- 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 headersjava.lang.IllegalStateException
- when the browser is already closedvoid loadUrlAndWait(LoadUrlParams params)
params
and blocks current thread execution
until the main frame of the resource is loaded completely or a timeout is reached.params
- parameters such as URL, POST data, and HTTP headersTimeoutException
- when the resource hasn't been loaded within a default timeout
NavigationException
- when navigation failedjava.lang.IllegalStateException
- when the browser is already closedvoid loadUrlAndWait(LoadUrlParams params, Timestamp timeout)
params
and blocks current thread execution
until the main frame of the resource is loaded completely or the given timeoutInSeconds
is reached.params
- parameters such as URL, POST data and HTTP headerstimeout
- a timeout in secondsjava.lang.IllegalArgumentException
- when timeoutInSeconds
is 0 or negativeTimeoutException
- when the resource hasn't been loaded within a timeoutNavigationException
- when navigation failedjava.lang.IllegalStateException
- when the browser is already closedboolean isLoading()
true
if a resource of a frame on the web page is being loaded.void goBack()
java.lang.IllegalStateException
- when the browser is already closedboolean canGoBack()
true
if the previous location in the back-forward list can be loadedjava.lang.IllegalStateException
- when the browser is already closedvoid goForward()
java.lang.IllegalStateException
- when the browser is already closedboolean canGoForward()
true
if the next location in the back-forward list can be loadedjava.lang.IllegalStateException
- when the browser is already closedvoid stop()
java.lang.IllegalStateException
- when the browser is already closedvoid reload()
java.lang.IllegalStateException
- when the browser is already closedvoid reloadAndCheckForRepost()
java.lang.IllegalStateException
- when the browser is already closedBeforeFormRepostCallback
void reloadIgnoringCache()
java.lang.IllegalStateException
- when the browser is already closedvoid reloadIgnoringCacheAndCheckForRepost()
java.lang.IllegalStateException
- 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 listjava.lang.IllegalStateException
- when the browser is already closedentryCount()
int entryCount()
java.lang.IllegalStateException
- when the browser is already closedint currentEntryIndex()
java.lang.IllegalStateException
- 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 listjava.lang.IllegalStateException
- 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 listjava.lang.IllegalStateException
- when the browser is already closed