Class Filter
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
BoolFilter,CustomFilter,FileFilter,MultiFilter,StringFilter
FilterListModel.
The model will use the filter to determine if it should include items
or not by calling match(org.gnome.gobject.GObject) for each item and only
keeping the ones that the function returns true for.
Filters may change what items they match through their lifetime. In that
case, they will emit the Gtk.Filter::changed signal to notify
that previous filter results are no longer valid and that items should
be checked again via match(org.gnome.gobject.GObject).
GTK provides various pre-made filter implementations for common filtering operations. These filters often include properties that can be linked to various widgets to easily allow searches.
However, in particular for large lists or complex search methods, it is
also possible to subclass GtkFilter and provide one's own filter.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFilter.Builder<B extends Filter.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theChangedCallbackcallback.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionFilter()Creates a new Filter.Filter(MemorySegment address) Create a Filter proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FilterasParent()Returns this instance as if it were its parent type.static Filter.Builder<? extends Filter.Builder> builder()AFilter.Builderobject constructs aFilterwith the specified properties.voidchanged(FilterChange change) Notifies all users of the filter that it has changed.voidemitChanged(FilterChange change) Emits the "changed" signal.static MemoryLayoutThe memory layout of the native struct.Gets the known strictness of a filter.static @Nullable TypegetType()Get the GType of the Filter classbooleanChecks if the givenitemis matched by the filter or not.onChanged(Filter.ChangedCallback handler) Emitted whenever the filter changed.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, 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
-
Filter
Create a Filter proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Filter
public Filter()Creates a new Filter.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
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. -
changed
Notifies all users of the filter that it has changed.This emits the
Gtk.Filter::changedsignal. Users of the filter should then check items again viamatch(org.gnome.gobject.GObject).Depending on the
changeparameter, not all items need to be changed, but only some. Refer to theGtk.FilterChangedocumentation for details.This function is intended for implementers of
GtkFiltersubclasses and should not be called from other functions.- Parameters:
change- how the filter changed
-
getStrictness
Gets the known strictness of a filter.If the strictness is not known,
Gtk.FilterMatch.someis returned.This value may change after emission of the
Gtk.Filter::changedsignal.This function is meant purely for optimization purposes. Filters can choose to omit implementing it, but
GtkFilterListModeluses it.- Returns:
- the strictness of this Filter
-
match
Checks if the givenitemis matched by the filter or not.- Parameters:
item- The item to check- Returns:
- true if the filter matches the item
-
onChanged
Emitted whenever the filter changed.Users of the filter should then check items again via
match(org.gnome.gobject.GObject).GtkFilterListModelhandles this signal automatically.Depending on the
changeparameter, not all items need to be checked, but only some. Refer to theGtk.FilterChangedocumentation for details.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitChanged
Emits the "changed" signal. SeeonChanged(org.gnome.gtk.Filter.ChangedCallback). -
builder
AFilter.Builderobject constructs aFilterwith the specified properties. Use the variousset...()methods to set properties, and finish construction withFilter.Builder.build().- Returns:
- the builder object
-