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
Nested ClassesModifier and TypeClassDescriptionstatic classFindController.Builder<B extends FindController.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theCountedMatchesCallbackcallback.static interfaceFunctional interface declaration of theFailedToFindTextCallbackcallback.static classstatic interfaceFunctional interface declaration of theFoundTextCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new FindController.FindController(MemorySegment address) Create a FindController proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FindControllerasParent()Returns this instance as if it were its parent type.static FindController.Builder<? extends FindController.Builder> builder()AFindController.Builderobject constructs aFindControllerwith the specified properties.voidcountMatches(String searchText, int findOptions, int maxMatchCount) Counts the number of matches forsearchText.voidemitCountedMatches(int matchCount) Emits the "counted-matches" signal.voidEmits the "failed-to-find-text" signal.voidemitFoundText(int matchCount) Emits the "found-text" signal.intGets the maximum number of matches to report.intGets theWebKitFindOptionsfor the current search.Gets the text that this FindController is searching for.static @Nullable TypegetType()Get the GType of the FindController classGets theWebKitWebViewthis find controller is associated to.This signal is emitted when theWebKitFindControllerhas 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.voidLooks forsearchTextassociated withfindController.voidFinishes a find operation.voidLooks for the next occurrence of the search text.voidLooks 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
FindController
public FindController()Creates a new FindController.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, 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
searchTextfound in theWebKitWebViewwith the providedfindOptions.The number of matches will be provided by theWebKitFindController::counted-matches signal.- Parameters:
searchText- the text to look forfindOptions- a bitmask with theWebKitFindOptionsused 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 theWebKitFindOptionsfor the current search.Gets a bitmask containing the
WebKitFindOptionsassociated with the current search.- Returns:
- a bitmask containing the
WebKitFindOptionsassociated 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 theWebKitWebViewthis find controller is associated to.Do not dereference the returned instance as it belongs to the
WebKitFindController.- Returns:
- the
WebKitWebView.
-
search
Looks forsearchTextassociated withfindController.Looks for
searchTextin theWebKitWebViewassociated with this FindController since the beginning of the document highlighting up tomaxMatchCountmatches. 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
WebKitFindControllerwill 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
maxMatchCountthenWebKitFindController::found-text will reportG_MAXUINTmatches 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 theWebKitFindOptionsused 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 theWebKitFindControllerhas 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.webkitgtk.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.webkitgtk.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.webkitgtk.FindController.FoundTextCallback). -
builder
AFindController.Builderobject constructs aFindControllerwith the specified properties. Use the variousset...()methods to set properties, and finish construction withFindController.Builder.build().- Returns:
- the builder object
-