Class FindController
- All Implemented Interfaces:
Proxy
WebKitWebView
.
A WebKitFindController
is used to search text in a WebKitWebView
. You
can get a WebKitWebView
<!-- -->'s WebKitFindController
with
webkit_web_view_get_find_controller(), and later use it to search
for text using webkit_find_controller_search(), or get the
number of matches using webkit_find_controller_count_matches(). The
operations are asynchronous and trigger signals when ready, such as
WebKitFindController
::found-text,
WebKitFindController
::failed-to-find-text or
WebKitFindController
::counted-matches<!-- -->.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
FindController.Builder<B extends FindController.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theCountedMatchesCallback
callback.static interface
Functional interface declaration of theFailedToFindTextCallback
callback.static class
static interface
Functional interface declaration of theFoundTextCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionFindController
(MemorySegment address) Create a FindController proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FindController
asParent()
Returns this instance as if it were its parent type.static FindController.Builder
<? extends FindController.Builder> builder()
AFindController.Builder
object constructs aFindController
with the specified properties.void
countMatches
(String searchText, int findOptions, int maxMatchCount) Counts the number of matches forsearchText
.void
emitCountedMatches
(int matchCount) Emits the "counted-matches" signal.void
Emits the "failed-to-find-text" signal.void
emitFoundText
(int matchCount) Emits the "found-text" signal.int
Gets the maximum number of matches to report.int
Gets theWebKitFindOptions
for the current search.Gets the text that this FindController is searching for.static Type
getType()
Get the GType of the FindController classGets theWebKitWebView
this find controller is associated to.This signal is emitted when theWebKitFindController
has counted the number of matches for a given text after a call to webkit_find_controller_count_matches().This signal is emitted when a search operation does not find any result for the given text.This signal is emitted when a given text is found in the web page text.void
Looks forsearchText
associated with this FindController.void
Finishes a find operation.void
Looks for the next occurrence of the search text.void
Looks for the previous occurrence of the search text.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
FindController
Create a FindController proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
countMatches
Counts the number of matches forsearchText
.Counts the number of matches for
searchText
found in theWebKitWebView
with the providedfindOptions
. The number of matches will be provided by theWebKitFindController
::counted-matches signal.- Parameters:
searchText
- the text to look forfindOptions
- a bitmask with theWebKitFindOptions
used in the searchmaxMatchCount
- the maximum number of matches allowed in the search
-
getMaxMatchCount
public int getMaxMatchCount()Gets the maximum number of matches to report.Gets the maximum number of matches to report during a text lookup. This number is passed as the last argument of webkit_find_controller_search() or webkit_find_controller_count_matches().
- Returns:
- the maximum number of matches to report.
-
getOptions
public int getOptions()Gets theWebKitFindOptions
for the current search.Gets a bitmask containing the
WebKitFindOptions
associated with the current search.- Returns:
- a bitmask containing the
WebKitFindOptions
associated with the current search.
-
getSearchText
Gets the text that this FindController is searching for.Gets the text that this FindController is currently searching for. This text is passed to either webkit_find_controller_search() or webkit_find_controller_count_matches().
- Returns:
- the text to look for in the
WebKitWebView
.
-
getWebView
Gets theWebKitWebView
this find controller is associated to.Do not dereference the returned instance as it belongs to the
WebKitFindController
.- Returns:
- the
WebKitWebView
.
-
search
Looks forsearchText
associated with this FindController.Looks for
searchText
in theWebKitWebView
associated with this FindController since the beginning of the document highlighting up tomaxMatchCount
matches. The outcome of the search will be asynchronously provided by theWebKitFindController
::found-text andWebKitFindController
::failed-to-find-text signals.To look for the next or previous occurrences of the same text with the same find options use webkit_find_controller_search_next() and/or webkit_find_controller_search_previous(). The
WebKitFindController
will use the same text and options for the following searches unless they are modified by another call to this method.Note that if the number of matches is higher than
maxMatchCount
thenWebKitFindController
::found-text will reportG_MAXUINT
matches instead of the actual number.Callers should call webkit_find_controller_search_finish() to finish the current search operation.
- Parameters:
searchText
- the text to look forfindOptions
- a bitmask with theWebKitFindOptions
used in the searchmaxMatchCount
- the maximum number of matches allowed in the search
-
searchFinish
public void searchFinish()Finishes a find operation.Finishes a find operation started by webkit_find_controller_search(). It will basically unhighlight every text match found.
This method will be typically called when the search UI is closed/hidden by the client application.
-
searchNext
public void searchNext()Looks for the next occurrence of the search text.Calling this method before webkit_find_controller_search() or webkit_find_controller_count_matches() is a programming error.
-
searchPrevious
public void searchPrevious()Looks for the previous occurrence of the search text.Calling this method before webkit_find_controller_search() or webkit_find_controller_count_matches() is a programming error.
-
onCountedMatches
public SignalConnection<FindController.CountedMatchesCallback> onCountedMatches(FindController.CountedMatchesCallback handler) This signal is emitted when theWebKitFindController
has counted the number of matches for a given text after a call to webkit_find_controller_count_matches().- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitCountedMatches
public void emitCountedMatches(int matchCount) Emits the "counted-matches" signal. SeeonCountedMatches(org.gnome.webkit.FindController.CountedMatchesCallback)
. -
onFailedToFindText
public SignalConnection<FindController.FailedToFindTextCallback> onFailedToFindText(FindController.FailedToFindTextCallback handler) This signal is emitted when a search operation does not find any result for the given text. It will be issued if the text is not found asynchronously after a call to webkit_find_controller_search(), webkit_find_controller_search_next() or webkit_find_controller_search_previous().- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFailedToFindText
public void emitFailedToFindText()Emits the "failed-to-find-text" signal. SeeonFailedToFindText(org.gnome.webkit.FindController.FailedToFindTextCallback)
. -
onFoundText
public SignalConnection<FindController.FoundTextCallback> onFoundText(FindController.FoundTextCallback handler) This signal is emitted when a given text is found in the web page text. It will be issued if the text is found asynchronously after a call to webkit_find_controller_search(), webkit_find_controller_search_next() or webkit_find_controller_search_previous().- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFoundText
public void emitFoundText(int matchCount) Emits the "found-text" signal. SeeonFoundText(org.gnome.webkit.FindController.FoundTextCallback)
. -
builder
AFindController.Builder
object constructs aFindController
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withFindController.Builder.build()
.
-