Top Description Inners Fields Constructors Methods
javafx.scene.web

public final Class WebHistory

extends Object
Class Inheritance
Imports
com.sun.webkit.BackForwardList, .WebPage, java.net.URL, java.util.Date, javafx.beans.property.IntegerProperty, .ReadOnlyIntegerProperty, .ReadOnlyIntegerWrapper, .ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, .SimpleIntegerProperty, javafx.collections.FXCollections, .ObservableList

The WebHistory class represents a session history associated with a WebEngine instance. A single instance of WebHistory for a particular web engine can be obtained through the WebEngine#getHistory() method. The history is basically a list of entries. Each entry represents a visited page and it provides access to relevant page info, such as URL, title, and the date the page was last visited. Entries in the list are arranged in the order in which the corresponding pages were visited from oldest to newest. The list can be obtained by using the getEntries() method. The history and the corresponding list of entries change as WebEngine navigates across the web. The list may expand or shrink depending on browser actions. These changes can be listened to by the javafx.collections.ObservableList API that the list exposes. The index of the history entry associated with the currently visited page is represented by the currentIndexProperty. The current index can be used to navigate to any entry in the history by using the go(int) method. The maxSizeProperty() sets the maximum history size, which is the size of the history list.
Since
JavaFX 2.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
WebHistory.Entry

The Entry class represents a single entry in the session history.

Field Summary

Modifier and TypeField and Description
private final BackForwardList
private final ReadOnlyIntegerWrapper
private final ObservableList<WebHistory.Entry>
private IntegerProperty
private final ObservableList<WebHistory.Entry>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ReadOnlyIntegerProperty

Returns:

the currentIndex property
currentIndexProperty
()

Defines the index of the current Entry in the history.

public int
public ObservableList<WebHistory.Entry>

Returns:

list of all history entries
getEntries
()

Returns an unmodifiable observable list of all entries in the history.

public int
public void
go(int
a negative value specifies a position preceding the current entry, a positive value specifies a position following the current entry, zero value causes no effect
offset
)

Navigates the web engine to the URL defined by the Entry object within the specified position relative to the current entry.

public IntegerProperty

Returns:

the maxSize property
maxSizeProperty
()

Defines the maximum size of the history list.

private void
setCurrentIndex(int value)

public void
setMaxSize(int value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bflback to summary
private final BackForwardList bfl
currentIndexback to summary
private final ReadOnlyIntegerWrapper currentIndex
listback to summary
private final ObservableList<WebHistory.Entry> list
maxSizeback to summary
private IntegerProperty maxSize
ulistback to summary
private final ObservableList<WebHistory.Entry> ulist

Constructor Detail

WebHistoryback to summary
pack-priv WebHistory(WebPage page)

Method Detail

currentIndexPropertyback to summary
public ReadOnlyIntegerProperty currentIndexProperty()

Defines the index of the current Entry in the history. The current entry is the entry associated with the currently loaded page. The index belongs to the range of (index >= 0 && index < getEntries().size()).

Returns:ReadOnlyIntegerProperty

the currentIndex property

getCurrentIndexback to summary
public int getCurrentIndex()
getEntriesback to summary
public ObservableList<WebHistory.Entry> getEntries()

Returns an unmodifiable observable list of all entries in the history.

Returns:ObservableList<WebHistory.Entry>

list of all history entries

getMaxSizeback to summary
public int getMaxSize()
goback to summary
public void go(int offset) throws IndexOutOfBoundsException

Navigates the web engine to the URL defined by the Entry object within the specified position relative to the current entry. A negative offset value specifies the position preceding to the current entry, and a positive offset value specifies the position following the current entry. For example, -1 points to the previous entry, and 1 points to the next entry, corresponding to pressing a web browser's 'back' and 'forward' buttons, respectively. The zero offset value is silently ignored (no-op). The effective entry position should belong to the rage of [0..size-1]. Otherwise, IndexOutOfBoundsException is thrown.

Parameters
offset:int

a negative value specifies a position preceding the current entry, a positive value specifies a position following the current entry, zero value causes no effect

Exceptions
IndexOutOfBoundsException:
if the effective entry position is out of range
maxSizePropertyback to summary
public IntegerProperty maxSizeProperty()

Defines the maximum size of the history list. If the list reaches its maximum and a new entry is added, the first entry is removed from the history.

The value specified for this property can not be negative, otherwise IllegalArgumentException is thrown.

Returns:IntegerProperty

the maxSize property

Default Value
100
setCurrentIndexback to summary
private void setCurrentIndex(int value)
setMaxSizeback to summary
public void setMaxSize(int value)
javafx.scene.web back to summary

public final Class WebHistory.Entry

extends Object
Class Inheritance

The Entry class represents a single entry in the session history. An entry instance is associated with the visited page.
Since
JavaFX 2.2

Field Summary

Modifier and TypeField and Description
private final ReadOnlyObjectWrapper<Date>
private final BackForwardList.Entry
private final ReadOnlyObjectWrapper<String>
private final URL

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Date
public String
public String

Returns:

the url of the page
getUrl
()

Returns the URL of the page.

pack-priv boolean
public ReadOnlyObjectProperty<Date>

Returns:

the lastVisitedDate property
lastVisitedDateProperty
()

Defines the java.util.Date the page was last visited.

public ReadOnlyObjectProperty<String>

Returns:

the title property
titleProperty
()

Defines the title of the page.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

lastVisitedDateback to summary
private final ReadOnlyObjectWrapper<Date> lastVisitedDate
peerback to summary
private final BackForwardList.Entry peer
titleback to summary
private final ReadOnlyObjectWrapper<String> title
urlback to summary
private final URL url

Constructor Detail

Entryback to summary
private Entry(final BackForwardList.Entry entry)

Method Detail

getLastVisitedDateback to summary
public Date getLastVisitedDate()
getTitleback to summary
public String getTitle()
getUrlback to summary
public String getUrl()

Returns the URL of the page.

Returns:String

the url of the page

isPeerback to summary
pack-priv boolean isPeer(BackForwardList.Entry entry)
lastVisitedDatePropertyback to summary
public ReadOnlyObjectProperty<Date> lastVisitedDateProperty()

Defines the java.util.Date the page was last visited.

Returns:ReadOnlyObjectProperty<Date>

the lastVisitedDate property

titlePropertyback to summary
public ReadOnlyObjectProperty<String> titleProperty()

Defines the title of the page.

Returns:ReadOnlyObjectProperty<String>

the title property

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override