|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gnu.glib.Struct
org.gnu.glib.GObject
org.gnu.gtk.TreeModel
org.gnu.gtk.TreeStore
public class TreeStore
The TreeStore is a Model used for storing data which will be displayed in any
number of TreeView
widgets. For an overview of how the tree and list
objects fit together, see the TreeView
description.
Data is stored within this object in DataColumn
s. This data is
displayed in the widgets via CellRenderer
's; the mapping between
this data and the cell renderers of each treeview column is done in the
TreeViewColumn
class.
Constructor Summary | |
---|---|
TreeStore(DataColumn[] dataColumns)
Constructs a new TreeStore, defining the types for each datablock. |
Method Summary | |
---|---|
void |
addRow(DataRow aRow)
Adds a row to the tree. |
void |
addRow(DataRow aRow,
TreeIter aParent)
Adds a row to the tree. |
void |
addRowAt(DataRow aRow,
int aPosition)
Adds a row to the tree, at the specified position. |
void |
addRowAt(DataRow aRow,
TreeIter aParent,
int aPosition)
Adds a row to the tree, at the specified position. |
TreeIter |
appendRow(TreeIter parent)
Appends a new row to tree_store. |
void |
clear()
Removes all items from the treestore. |
java.util.List |
getAllDataColumns()
Returns a List with the types for every column as a
DataColumn object. |
DataColumn |
getDataColumn(int aCol)
Returns the type of the column aCol as a
DataColumn . |
int |
getIteratorDepth(TreeIter iter)
Returns the depth of the iterator. |
DataRow |
getRowAt(TreeIter aIter)
Gets all the values in the row indicated by aIter . |
DataColumn |
getSortColumn()
Get a DataColumn object representing the currently sorted column. |
SortType |
getSortOrder()
Get the current sorting order of the store. |
static Type |
getType()
Retrieve the runtime type used by the GLib library. |
int |
handleCompareFunc(org.gnu.glib.Handle model,
org.gnu.glib.Handle aIter,
org.gnu.glib.Handle bIter,
int col)
Call-back method invoked by the JNI code when sorting is required. |
TreeIter |
insertRow(TreeIter parent,
int position)
Creates a new row at position. |
TreeIter |
insertRowAfter(TreeIter sibling,
TreeIter parent)
Inserts a new row after sibling. |
TreeIter |
insertRowBefore(TreeIter sibling,
TreeIter parent)
Inserts a new row before sibling. |
boolean |
isAncestor(TreeIter iter,
TreeIter descendant)
Returns TRUE if iter is an ancestor of descendant. |
boolean |
isIterValid(TreeIter iter)
|
void |
moveRowAfter(TreeIter iter,
TreeIter position)
Moves iter in this store to the position after position. |
void |
moveRowBefore(TreeIter iter,
TreeIter position)
Moves iter in tree_store to the position before position. |
void |
moveRowToEnd(TreeIter iter)
Moves iter to the end of the model |
void |
moveRowToStart(TreeIter iter)
Moves iter in this store to the start of the store. |
TreeIter |
prependRow(TreeIter parent)
Prepends a new row to the store. |
void |
removeRow(TreeIter iter)
Removes a row from the tree store. |
void |
reorder(TreeIter iter,
int[] newOrder)
|
void |
setColumnTypes(DataColumn[] dataColumns)
|
void |
setDragDestListener(TreeDragDestListener listener)
This method has not yet been implemented. |
void |
setDragSourceListener(TreeDragSourceListener listener)
This method has not yet been implemented. |
void |
setRowAt(DataRow aRow,
TreeIter aIter)
Sets all columns pointed by aIter to the values stored in
aRow . |
void |
setSortColumn(DataColumn column,
SortType order)
Set the column in the list to sort on. |
void |
setSortMethod(TreeIterComparison method,
DataColumn column)
Set the class used to sort the list according to the values stored in the given DataColumn. |
void |
setValue(TreeIter iter,
DataColumnBoolean dataBlock,
boolean value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnDouble dataBlock,
double value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnIconSize dataBlock,
IconSize value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnInt dataBlock,
int value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnLong dataBlock,
long value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnObject dataBlock,
java.lang.Object value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnPixbuf dataBlock,
Pixbuf value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnStockItem dataBlock,
GtkStockItem value)
Sets a value in the dataStore. |
void |
setValue(TreeIter iter,
DataColumnString dataBlock,
java.lang.String value)
Sets a value in the dataStore. |
void |
swapRows(TreeIter a,
TreeIter b)
Swaps a and b in the same level of tree_store. |
Methods inherited from class org.gnu.gtk.TreeModel |
---|
addListener, getColumnCount, getDataBlockCount, getEventListenerClass, getEventType, getFirstIter, getIter, getIter, getType, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, removeListener |
Methods inherited from class org.gnu.glib.Struct |
---|
equals, getHandle, getNullHandle, hashCode |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.gnu.gtk.TreeSortable |
---|
getHandle |
Constructor Detail |
---|
public TreeStore(DataColumn[] dataColumns)
dataColumns
- Types for the data to be stored in the TreeStore.Method Detail |
---|
public void setColumnTypes(DataColumn[] dataColumns)
public DataColumn getDataColumn(int aCol)
aCol
as a
DataColumn
. This is similar to calling
getType(int)
; the difference is that this method returns
the type as a DataColumn, which is a more high-level structure.
aCol
- the column index
public java.util.List getAllDataColumns()
List
with the types for every column as a
DataColumn
object.
DataColumn
'spublic void setValue(TreeIter iter, DataColumnString dataBlock, java.lang.String value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void setValue(TreeIter iter, DataColumnStockItem dataBlock, GtkStockItem value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void setValue(TreeIter iter, DataColumnIconSize dataBlock, IconSize value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void setValue(TreeIter iter, DataColumnInt dataBlock, int value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void setValue(TreeIter iter, DataColumnLong dataBlock, long value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The long
value to set into this row.public void setValue(TreeIter iter, DataColumnBoolean dataBlock, boolean value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void setValue(TreeIter iter, DataColumnDouble dataBlock, double value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The datablock in which the data should be stored.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void setValue(TreeIter iter, DataColumnObject dataBlock, java.lang.Object value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The data block in which to store the data, starting at 0.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set. This must match the type for
that dataBlock, as set in the constructor.public void setValue(TreeIter iter, DataColumnPixbuf dataBlock, Pixbuf value)
This does not make the data visible in any of the widgets which use the
class - to do that, you have to construct a TreeViewColumn
and
add it to the TreeView
; construct and add a CellRenderer
to that; and finally associate the properties of the CellRenderer with
the dataBlocks, using the
TreeViewColumn.addAttributeMapping(CellRenderer, CellRendererAttribute,
DataColumn)
method.
dataBlock
- The data block in which to store the data, starting at 0.iter
- Valid iterator for the data row in which the value is to be
set. These can be gotten using methods such as
appendRow(TreeIter)
.value
- The value to be set.public void addRow(DataRow aRow)
DataColumn
type
specified in the constructor of TreeStore. For example, if it was passed
{new DataColumnBoolean(), new DataColumnString()}
to the
constructor, then the DataRow must contain a Boolean and a String object,
respectively.
aRow
- a row to be added to the listpublic void addRowAt(DataRow aRow, int aPosition)
DataColumn
type specified in the constructor of TreeStore.
For example, if it was passed
{new DataColumnBoolean(), new DataColumnString()}
to the
constructor, then the DataRow must contain a Boolean and a String object,
respectively.
aRow
- a row to be added to the listpublic void addRow(DataRow aRow, TreeIter aParent)
DataColumn
type
specified in the constructor of TreeStore. For example, if it was passed
{new DataColumnBoolean(), new DataColumnString()}
to the
constructor, then the DataRow must contain a Boolean and a String object,
respectively.
aRow
- a row to be added to the listaParent
- a TreeIter
pointing to a parent row.public void addRowAt(DataRow aRow, TreeIter aParent, int aPosition)
DataColumn
type specified in the constructor of TreeStore.
For example, if it was passed
{new DataColumnBoolean(), new DataColumnString()}
to the
constructor, then the DataRow must contain a Boolean and a String object,
respectively.
aRow
- a row to be added to the listaParent
- a TreeIter
pointing to a parent row.public DataRow getRowAt(TreeIter aIter)
aIter
. There
are several ways you can get a TreeIter
to pass; for
example: using methods like getIter
and
getFirstIter()
, or from a TreeSelection
.
aIter
- the iter pointing to the row
DataRow
filled with the values of the row.TreeModel.getIter(String)
,
TreeModel.getIter(TreePath)
,
TreeModel.getFirstIter()
,
TreeSelection
public void setRowAt(DataRow aRow, TreeIter aIter)
aIter
to the values stored in
aRow
.
aRow
- a row with itemsaIter
- a TreeIter
pointing to a row in the tree.getRowAt(TreeIter)
public void removeRow(TreeIter iter)
iter
- TreeIter representing the row.public TreeIter insertRow(TreeIter parent, int position)
parent
- A valid TreeIter, or NULLposition
- Position to insert the new row
public TreeIter insertRowBefore(TreeIter sibling, TreeIter parent)
parent
- A valid TreeIter, or NULLsibling
- A valid TreeIter, or NULL
public TreeIter insertRowAfter(TreeIter sibling, TreeIter parent)
parent
- A valid TreeIter, or NULLsibling
- A valid GtkTreeIter, or NULL
public TreeIter prependRow(TreeIter parent)
parent
- A valid TreeIter, or NULL
public TreeIter appendRow(TreeIter parent)
parent
- A valid TreeIter, or NULL
public boolean isAncestor(TreeIter iter, TreeIter descendant)
iter
- Row to be tested.descendant
- Descendant row for testing
public int getIteratorDepth(TreeIter iter)
iter
- The iterator to test the depth of
public void clear()
public static Type getType()
public void setSortColumn(DataColumn column, SortType order)
setSortColumn
in interface TreeSortable
public DataColumn getSortColumn()
DataColumn.equals(org.gnu.gtk.DataColumn)
method.
getSortColumn
in interface TreeSortable
public SortType getSortOrder()
getSortOrder
in interface TreeSortable
public void setSortMethod(TreeIterComparison method, DataColumn column)
setSortMethod
in interface TreeSortable
public int handleCompareFunc(org.gnu.glib.Handle model, org.gnu.glib.Handle aIter, org.gnu.glib.Handle bIter, int col)
handleCompareFunc
in interface TreeSortable
public void setDragDestListener(TreeDragDestListener listener)
setDragDestListener
in interface TreeDragDest
public void setDragSourceListener(TreeDragSourceListener listener)
setDragSourceListener
in interface TreeDragSource
public void swapRows(TreeIter a, TreeIter b)
public void moveRowToEnd(TreeIter iter)
public void moveRowAfter(TreeIter iter, TreeIter position)
public void moveRowToStart(TreeIter iter)
public void moveRowBefore(TreeIter iter, TreeIter position)
public boolean isIterValid(TreeIter iter)
public void reorder(TreeIter iter, int[] newOrder)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |