Package ch.bailu.gtk.gtk
Class FilterListModel
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.FilterListModel
- All Implemented Interfaces:
PointerInterface
`GtkFilterListModel` is a list model that filters the elements of
the underlying model according to a `GtkFilter`.
It hides some elements from the other model according to
criteria given by a `GtkFilter`.
The model can be set up to do incremental searching, so that
filtering long lists doesn't block the UI. See
[method@Gtk.FilterListModel.set_incremental] for details.
the underlying model according to a `GtkFilter`.
It hides some elements from the other model according to
criteria given by a `GtkFilter`.
The model can be set up to do incremental searching, so that
filtering long lists doesn't block the UI. See
[method@Gtk.FilterListModel.set_incremental] for details.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify -
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY -
Constructor Summary
ConstructorsConstructorDescriptionFilterListModel(ListModel model, Filter filter) Creates a new `GtkFilterListModel` that will filter @model using the given
@filter.FilterListModel(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceListModel.static ClassHandlerGets the `GtkFilter` currently set on @self.booleanReturns whether incremental filtering is enabled.static intgetModel()Gets the model currently filtered or %NULL if none.static longstatic TypeSystem.TypeSizeintReturns the number of items that have not been filtered yet.static longstatic TypeSystem.TypeSizevoidSets the filter used to filter items.voidsetIncremental(boolean incremental) Sets the filter model to do an incremental sort.voidSets the model to be filtered.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnrefMethods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacksMethods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNullMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
FilterListModel
-
FilterListModel
Creates a new `GtkFilterListModel` that will filter @model using the given
@filter.- Parameters:
model- the model to sortfilter- filter
-
-
Method Details
-
getClassHandler
-
getFilter
Gets the `GtkFilter` currently set on @self.- Returns:
- The filter currently in use
-
getIncremental
public boolean getIncremental()Returns whether incremental filtering is enabled.
See [method@Gtk.FilterListModel.set_incremental].- Returns:
- %TRUE if incremental filtering is enabled
-
getModel
Gets the model currently filtered or %NULL if none.- Returns:
- The model that gets filtered
-
getPending
public int getPending()Returns the number of items that have not been filtered yet.
You can use this value to check if @self is busy filtering by
comparing the return value to 0 or you can compute the percentage
of the filter remaining by dividing the return value by the total
number of items in the underlying model:
```c
pending = gtk_filter_list_model_get_pending (self);
model = gtk_filter_list_model_get_model (self);
percentage = pending / (double) g_list_model_get_n_items (model);
```
If no filter operation is ongoing - in particular when
[property@Gtk.FilterListModel:incremental] is %FALSE - this
function returns 0.- Returns:
- The number of items not yet filtered
-
setFilter
Sets the filter used to filter items.- Parameters:
filter- filter to use
-
setIncremental
public void setIncremental(boolean incremental) Sets the filter model to do an incremental sort.
When incremental filtering is enabled, the `GtkFilterListModel` will not
run filters immediately, but will instead queue an idle handler that
incrementally filters the items and adds them to the list. This of course
means that items are not instantly added to the list, but only appear
incrementally.
When your filter blocks the UI while filtering, you might consider
turning this on. Depending on your model and filters, this may become
interesting around 10,000 to 100,000 items.
By default, incremental filtering is disabled.
See [method@Gtk.FilterListModel.get_pending] for progress information
about an ongoing incremental filtering operation.- Parameters:
incremental- %TRUE to enable incremental filtering
-
setModel
Sets the model to be filtered.
Note that GTK makes no effort to ensure that @model conforms to
the item type of @self. It assumes that the caller knows what they
are doing and have set up an appropriate filter to ensure that item
types match.- Parameters:
model- The model to be filtered
-
asListModel
Implements interfaceListModel. Call this to get access to interface functions.- Returns:
ListModel
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-