Class TreeListModel<T extends GObject>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,SequencedCollection<T>,ListModel<T>,Proxy,ListModelJavaList<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTreeListModel.Builder<B extends TreeListModel.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classTreeListModel.TreeListModelClass<T extends GObject>Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gio.ListModel
ListModel.ItemsChangedCallback, ListModel.ListModel$Impl, ListModel.ListModelInterfaceNested classes/interfaces inherited from interface org.javagi.gio.ListModelJavaList
ListModelJavaList.SubList<E extends GObject,List extends ListModelJavaList<E>> -
Field Summary
Fields inherited from class org.javagi.base.ProxyInstance
address -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TreeListModel.TreeListModel(MemorySegment address) Create a TreeListModel proxy instance for the provided memory address.TreeListModel(ListModel root, boolean passthrough, boolean autoexpand, TreeListModelCreateModelFunc createFunc) Creates a new emptyGtkTreeListModeldisplayingrootwith all rows collapsed. -
Method Summary
Modifier and TypeMethodDescriptionprotected TreeListModelasParent()Returns this instance as if it were its parent type.static TreeListModel.Builder<? extends TreeListModel.Builder> builder()ATreeListModel.Builderobject constructs aTreeListModelwith the specified properties.booleanGets 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 indexpositionfor this TreeListModel's root model.getModel()Gets the root model that this TreeListModel was created with.booleanGets whether the model is passing through original row items.getRow(int position) Gets the row object for the given row.static TypegetType()Get the GType of the TreeListModel classvoidsetAutoexpand(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, 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, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliteratorMethods inherited from interface org.gnome.gio.ListModel
emitItemsChanged, getItem, getItemType, getNItems, itemsChanged, onItemsChangedMethods inherited from interface org.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 emptyGtkTreeListModeldisplayingrootwith all rows collapsed.- Parameters:
root- TheGListModelto use as rootpassthrough-trueto pass through items from the modelsautoexpand-trueto set the autoexpand property and expand therootmodelcreateFunc- function to call to create theGListModelfor the children of an item
-
TreeListModel
public TreeListModel()Creates a new TreeListModel.
-
-
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. -
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:
trueif the model is set to autoexpand
-
getChildRow
Gets the row item corresponding to the child at indexpositionfor this TreeListModel's root model.If
positionis greater than the number of children in the root model,nullis 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, theGListModelfunctions for this TreeListModel return customGtkTreeListRowobjects. 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 customGtkTreeListRows.- Returns:
trueif the model is passing through original row items
-
getRow
Gets the row object for the given row.If
positionis greater than the number of items in this TreeListModel,nullis 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-trueto make the model autoexpand its rows
-
builder
ATreeListModel.Builderobject constructs aTreeListModelwith the specified properties. Use the variousset...()methods to set properties, and finish construction withTreeListModel.Builder.build().
-