public interface Navigation extends Advisable<NavigationCallback>, Observable<NavigationEvent>
Modifier and Type | Field and Description |
---|---|
static Timestamp |
DEFAULT_TIMEOUT_IN_SECONDS
Deprecated.
use
defaultTimeoutInSeconds() instead |
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 |
defaultTimeoutInSeconds()
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 a resource of a frame on the web page is being loaded. |
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 defaultTimeoutInSeconds() 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(LoadUrlParams params,
Timestamp timeout)
Deprecated.
use
loadUrlAndWait(LoadUrlParams, Duration) instead |
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 defaultTimeoutInSeconds() 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 |
loadUrlAndWait(java.lang.String url,
Timestamp timeout)
Deprecated.
use
loadUrlAndWait(String, Duration) instead |
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
@Deprecated static final Timestamp DEFAULT_TIMEOUT_IN_SECONDS
defaultTimeoutInSeconds()
insteadBrowser browser()
Browser
instance of this navigation.static java.time.Duration defaultTimeoutInSeconds()
jxbrowser.navigation.timeout.seconds
system
property.void loadUrlAndWait(java.lang.String url)
url
and blocks the current thread
execution until the main frame of the resource is loaded completely or the defaultTimeoutInSeconds()
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 defaultTimeoutInSeconds()
default timeout}NavigationException
- when the navigation failedjava.lang.IllegalStateException
- when the browser is already closedvoid 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 blankjava.lang.IllegalStateException
- when the browser is already closed@Deprecated void loadUrlAndWait(java.lang.String url, Timestamp timeout)
loadUrlAndWait(String, Duration)
insteadurl
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 url
is empty or blankjava.lang.IllegalArgumentException
- when timeout
is 0 or negativeTimeoutException
- when the resource hasn't been loaded within the timeoutNavigationException
- when the 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 the current thread
execution until the main frame of the resource is loaded completely or the defaultTimeoutInSeconds()
is reached.params
- parameters such as URL, POST data, and HTTP headersTimeoutException
- when the resource hasn't been loaded within the defaultTimeoutInSeconds()
default timeout}NavigationException
- when the navigation failedjava.lang.IllegalStateException
- 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 failedjava.lang.IllegalStateException
- when the browser is already closed@Deprecated void loadUrlAndWait(LoadUrlParams params, Timestamp timeout)
loadUrlAndWait(LoadUrlParams, Duration)
insteadparams
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 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 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 failedjava.lang.IllegalStateException
- when the browser is already closed