org.gnu.gtk
Class ListStore

java.lang.Object
  |
  +--org.gnu.glib.GObject
        |
        +--org.gnu.gtk.TreeModel
              |
              +--org.gnu.gtk.ListStore

public class ListStore
extends TreeModel

The ListStore is the gtk Model used for constructing Lists and tables to be displayed within TreeView widgets. For full details of what objects are needed to construct lists and tables, please see the TreeView description.

The list store has a number of DataBlocks, or data 'columns' associated with it. These do not correspond to the organisation of the output into columns. The data store can in fact be used with any number of treeView widgets, each displaying a different part of the data. In these Java bindings, we will try to use the term dataBlock for the data in the ListStore and Column to refer to the columns to be displayed. The data to be displayed is set in the TreeViewColumn objects, by associating properties of CellRenderer's with the data block used in this object.

Author:
Mark Howard <mh@debian.org>

Constructor Summary
ListStore(DataBlock[] dataBlocks)
          Constructs a new ListStore object for storing data in a list style manner.
 
Method Summary
 TreeIter appendRow()
          Appends a new row to the store
 void clear()
          Removes all rows from the list store.
static Type getType()
          Retrieve the runtime type used by the GLib library.
 TreeIter insertRow(int position)
          Creates a new row at position.
 TreeIter insertRowAfter(TreeIter sibling)
          Inserts a new row after sibling.
 TreeIter insertRowBefore(TreeIter sibling)
          Inserts a new row before sibling.
 TreeIter prependRow()
          Prepends a new row to list_store.
 void removeRow(TreeIter iter)
          Removes the given row from the list store.
 void setValue(TreeIter iter, DataBlockBoolean dataBlock, boolean value)
          Sets a value in the data store.
 void setValue(TreeIter iter, DataBlockDouble dataBlock, double value)
          Sets a value in the data store.
 void setValue(TreeIter iter, DataBlockInt dataBlock, int value)
          Sets a value in the data store.
 void setValue(TreeIter iter, DataBlockObject dataBlock, java.lang.Object value)
          Sets a value in the dataStore.
 void setValue(TreeIter iter, DataBlockPixbuf dataBlock, Pixbuf value)
          Sets a value in the dataStore.
 void setValue(TreeIter iter, DataBlockString dataBlock, java.lang.String value)
          Sets a value in the data store.
 
Methods inherited from class org.gnu.gtk.TreeModel
getDataBlockCount, getFirstChild, getFirstIter, getIter, getIter, getIterChildCount, getNextIter, getPath, getType, getValue, getValue, getValue, getValue, getValue, iterHasChild
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, equals, getData, getHandle, removeEventHandler, setData
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListStore

public ListStore(DataBlock[] dataBlocks)
Constructs a new ListStore object for storing data in a list style manner. The data is stored in a set of numbered data blocks, each one of which can then be displayed in a column by setting the appropriate attribute mapping of the CellRenderers.

Parameters:
dataBlocks - a list of dataBlocs for the store. These should be created as private variables of the required type - they will be needed later.
Method Detail

setValue

public void setValue(TreeIter iter,
                     DataBlockString dataBlock,
                     java.lang.String value)
Sets a value in the data store. To display the data in the widget, you need to associate the datablock with the renderer, using methods of the TreeViewColumn.

Parameters:
iter - A valid iterator which specifies the row in which the data should be set. Iterators can be gained by using methods such as appendRow().
dataBlock - The data block to store the value in.
value - The value to store. This must be of the same type for the column as that set in the constructor to the ListStore.

setValue

public void setValue(TreeIter iter,
                     DataBlockInt dataBlock,
                     int value)
Sets a value in the data store. To display the data in the widget, you need to associate the datablock with the renderer, using methods of the TreeViewColumn.

Parameters:
iter - A valid iterator which specifies the row in which the data should be set. Iterators can be gained by using methods such as appendRow().
dataBlock - The data block to store the value in.
value - The value to store. This must be of the same type for the column as that set in the constructor to the ListStore.

setValue

public void setValue(TreeIter iter,
                     DataBlockBoolean dataBlock,
                     boolean value)
Sets a value in the data store. To display the data in the widget, you need to associate the datablock with the renderer, using methods of the TreeViewColumn.

Parameters:
iter - A valid iterator which specifies the row in which the data should be set. Iterators can be gained by using methods such as appendRow().
dataBlock - The data block to store the value in.
value - The value to store. This must be of the same type for the column as that set in the constructor to the ListStore.

setValue

public void setValue(TreeIter iter,
                     DataBlockDouble dataBlock,
                     double value)
Sets a value in the data store. To display the data in the widget, you need to associate the datablock with the renderer, using methods of the TreeViewColumn.

Parameters:
iter - A valid iterator which specifies the row in which the data should be set. Iterators can be gained by using methods such as appendRow().
dataBlock - The data block to store the value in.
value - The value to store.

setValue

public void setValue(TreeIter iter,
                     DataBlockObject dataBlock,
                     java.lang.Object value)
Sets a value in the dataStore. The type of the value must match the type set for that dataBlock in the constructor.

Parameters:
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.

setValue

public void setValue(TreeIter iter,
                     DataBlockPixbuf dataBlock,
                     Pixbuf value)
Sets a value in the dataStore. The type of the value must match the type set for that dataBlock in the constructor.

This does not make the data visible in any of the widgets which use the class

Parameters:
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. This must match the type for that dataBlock, as set in the constructor.

removeRow

public void removeRow(TreeIter iter)
Removes the given row from the list store. After being removed, iter is set to be the next valid row, or invalidated if it pointed to the last row in this store.

Parameters:
iter - Iterator for the row to be removed.

insertRow

public TreeIter insertRow(int position)
Creates a new row at position. If position is larger than the number of rows on the list, then the new row will be appended to the list.

Parameters:
position - The position to place the new row, starting at 0.
Returns:
Iterator for the new row

insertRowBefore

public TreeIter insertRowBefore(TreeIter sibling)
Inserts a new row before sibling. If sibling is NULL, then the row will be appended to the end of the list. iter will be changed to point to this new row.

Parameters:
sibling -
Returns:
Iterator for the new row

insertRowAfter

public TreeIter insertRowAfter(TreeIter sibling)
Inserts a new row after sibling. If sibling is NULL, then the row will be prepended to the beginning of the list. iter will be changed to point to this new row.

Parameters:
sibling -
Returns:
Iterator for the new row.

prependRow

public TreeIter prependRow()
Prepends a new row to list_store. iter will be changed to point to this new row. The row will be empty after this function is called.

Returns:
Iterator for the new row

appendRow

public TreeIter appendRow()
Appends a new row to the store

Returns:
Iterator for the new row

clear

public void clear()
Removes all rows from the list store.


getType

public static Type getType()
Retrieve the runtime type used by the GLib library.


Please send any bug reports, comments, or suggestions for the API or documentation to java-gnome-developer@lists.sf.net