Class TreeListModel<T extends GObject>
- All Implemented Interfaces:
Proxy
,ListModelJavaList<T>
,Iterable<T>
,Collection<T>
,List<T>
,SequencedCollection<T>
,ListModel<T>
GtkTreeListModel
is a list model that can create child models on demand.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TreeListModel.Builder<B extends TreeListModel.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
TreeListModel.TreeListModelClass<T extends GObject>
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gio.ListModel
ListModel.ItemsChangedCallback, ListModel.ListModelImpl, ListModel.ListModelInterface
-
Constructor Summary
ConstructorDescriptionTreeListModel
(MemorySegment address) Create a TreeListModel proxy instance for the provided memory address.TreeListModel
(ListModel root, boolean passthrough, boolean autoexpand, TreeListModelCreateModelFunc createFunc) Creates a new emptyGtkTreeListModel
displayingroot
with all rows collapsed. -
Method Summary
Modifier and TypeMethodDescriptionprotected TreeListModel
asParent()
Returns this instance as if it were its parent type.static TreeListModel.Builder
<? extends TreeListModel.Builder> builder()
ATreeListModel.Builder
object constructs aTreeListModel
with the specified properties.boolean
Gets whether the model is set to automatically expand new rows that get added.getChildRow
(int position) Gets the row item corresponding to the child at indexposition
for this TreeListModel's root model.getModel()
Gets the root model that this TreeListModel was created with.boolean
Gets whether the model is passing through original row items.getRow
(int position) Gets the row object for the given row.static Type
getType()
Get the GType of the TreeListModel classvoid
setAutoexpand
(boolean autoexpand) Sets whether the model should autoexpand.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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
Methods inherited from interface org.gnome.gio.ListModel
emitItemsChanged, getItem, getItemType, getNItems, itemsChanged, onItemsChanged
Methods inherited from interface io.github.jwharm.javagi.gio.ListModelJavaList
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
-
Constructor Details
-
TreeListModel
Create a TreeListModel proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
TreeListModel
public TreeListModel(ListModel root, boolean passthrough, boolean autoexpand, TreeListModelCreateModelFunc createFunc) Creates a new emptyGtkTreeListModel
displayingroot
with all rows collapsed.- Parameters:
root
- TheGListModel
to use as rootpassthrough
-true
to pass through items from the modelsautoexpand
-true
to set the autoexpand property and expand theroot
modelcreateFunc
- function to call to create theGListModel
for the children of an item
-
-
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. -
getAutoexpand
public boolean getAutoexpand()Gets whether the model is set to automatically expand new rows that get added.This can be either rows added by changes to the underlying models or via
TreeListRow.setExpanded(boolean)
.- Returns:
true
if the model is set to autoexpand
-
getChildRow
Gets the row item corresponding to the child at indexposition
for this TreeListModel's root model.If
position
is greater than the number of children in the root model,null
is returned.Do not confuse this function with
getRow(int)
.- Parameters:
position
- position of the child to get- Returns:
- the child in
position
-
getModel
Gets the root model that this TreeListModel was created with.- Returns:
- the root model
-
getPassthrough
public boolean getPassthrough()Gets whether the model is passing through original row items.If this function returns
false
, theGListModel
functions for this TreeListModel return customGtkTreeListRow
objects. You need to callTreeListRow.getItem()
on these objects to get the original item.If
true
, the values of the child models are passed through in their original state. You then need to callgetRow(int)
to get the customGtkTreeListRow
s.- Returns:
true
if the model is passing through original row items
-
getRow
Gets the row object for the given row.If
position
is greater than the number of items in this TreeListModel,null
is returned.The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current item as long as the row is present in this TreeListModel, independent of other rows being added or removed.
If this TreeListModel is set to not be passthrough, this function is equivalent to calling g_list_model_get_item().
Do not confuse this function with
getChildRow(int)
.- Parameters:
position
- the position of the row to fetch- Returns:
- The row item
-
setAutoexpand
public void setAutoexpand(boolean autoexpand) Sets whether the model should autoexpand.If set to
true
, the model will recursively expand all rows that get added to the model. This can be either rows added by changes to the underlying models or viaTreeListRow.setExpanded(boolean)
.- Parameters:
autoexpand
-true
to make the model autoexpand its rows
-
builder
ATreeListModel.Builder
object constructs aTreeListModel
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withTreeListModel.Builder.build()
.
-