Class BackForwardList

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class BackForwardList extends GObject

List of visited pages.

WebKitBackForwardList maintains a list of visited pages used to navigate to recent pages. Items are inserted in the list in the order they are visited.

WebKitBackForwardList also maintains the notion of the current item (which is always at index 0), the preceding item (which is at index -1), and the following item (which is at index 1). Methods webkit_web_view_go_back() and webkit_web_view_go_forward() move the current item backward or forward by one. Method webkit_web_view_go_to_back_forward_list_item() sets the current item to the specified item. All other methods returning WebKitBackForwardListItems do not change the value of the current item, they just return the requested item or items.

  • Constructor Details

    • BackForwardList

      public BackForwardList(MemorySegment address)
      Create a BackForwardList instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • BackForwardList

      public BackForwardList()
      Create a new BackForwardList.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the BackForwardList class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected BackForwardList asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getBackItem

      public @Nullable BackForwardListItem getBackItem()
      Returns the item that precedes the current item.
      Returns:
      the WebKitBackForwardListItem preceding the current item or null.
    • getBackList

      public List<BackForwardListItem> getBackList()
      Obtain the list of items preceding the current one.
      Returns:
      a GList of items preceding the current item.
    • getBackListWithLimit

      public List<BackForwardListItem> getBackListWithLimit(int limit)
      Obtain a list up to some number of items preceding the current one.
      Parameters:
      limit - the number of items to retrieve
      Returns:
      a GList of items preceding the current item limited by limit.
    • getCurrentItem

      public @Nullable BackForwardListItem getCurrentItem()
      Returns the current item in backForwardList.
      Returns:
      a WebKitBackForwardListItem or null if this BackForwardList is empty.
    • getForwardItem

      public @Nullable BackForwardListItem getForwardItem()
      Returns the item that follows the current item.
      Returns:
      the WebKitBackForwardListItem following the current item or null.
    • getForwardList

      public List<BackForwardListItem> getForwardList()
      Obtain the list of items following the current one.
      Returns:
      a GList of items following the current item.
    • getForwardListWithLimit

      public List<BackForwardListItem> getForwardListWithLimit(int limit)
      Obtain a list up to some number of items following the current one.
      Parameters:
      limit - the number of items to retrieve
      Returns:
      a GList of items following the current item limited by limit.
    • getLength

      public int getLength()
      Obtain the amount of items in the list.
      Returns:
      the length of backForwardList.
    • getNthItem

      public @Nullable BackForwardListItem getNthItem(int index)
      Returns the item at a given index relative to the current item.
      Parameters:
      index - the index of the item
      Returns:
      the WebKitBackForwardListItem located at the specified index relative to the current item or null.
    • onChanged

      This signal is emitted when backForwardList changes. This happens when the current item is updated, a new item is added or one or more items are removed. Note that both itemAdded and itemsRemoved can null when only the current item is updated. Items are only removed when the list is cleared or the maximum items limit is reached.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitChanged

      public void emitChanged(@Nullable BackForwardListItem itemAdded, @Nullable MemorySegment itemsRemoved)
      Emits the "changed" signal. See onChanged(BackForwardList.ChangedCallback).
    • builder

      public static BackForwardList.Builder<? extends BackForwardList.Builder> builder()
      A BackForwardList.Builder object constructs a BackForwardList with the specified properties. Use the various set...() methods to set properties, and finish construction with BackForwardList.Builder.build().
      Returns:
      the builder object