eu.webtoolkit.jwt
Class WAbstractListModel

java.lang.Object
  extended by eu.webtoolkit.jwt.WObject
      extended by eu.webtoolkit.jwt.WAbstractItemModel
          extended by eu.webtoolkit.jwt.WAbstractListModel
Direct Known Subclasses:
WStringListModel

public abstract class WAbstractListModel
extends WAbstractItemModel

An abstract list model for use with Wt's view classes.

An abstract list model specializes WAbstractItemModel for one-dimensional lists (i.e. a model with 1 column and no children).

It cannot be used directly but must be subclassed. Subclassed models must at least reimplement WAbstractItemModel#getRowCount() to return the number of rows, and WAbstractItemModel#getData() to return data.


Constructor Summary
WAbstractListModel()
          Create a new abstract list model.
WAbstractListModel(WObject parent)
          Create a new abstract list model.
 
Method Summary
 int getColumnCount(WModelIndex parent)
          Returns the number of columns.
 WModelIndex getIndex(int row, int column, WModelIndex parent)
          Returns the child index for the given row and column.
 WModelIndex getParent(WModelIndex index)
          Returns the parent for a model index.
 
Methods inherited from class eu.webtoolkit.jwt.WAbstractItemModel
beginInsertColumns, beginInsertRows, beginRemoveColumns, beginRemoveRows, collapseColumn, columnsAboutToBeInserted, columnsAboutToBeRemoved, columnsInserted, columnsRemoved, createIndex, dataChanged, dropEvent, endInsertColumns, endInsertRows, endRemoveColumns, endRemoveRows, expandColumn, fromRawIndex, getAcceptDropMimeTypes, getColumnCount, getData, getData, getData, getData, getData, getFlags, getHeaderData, getHeaderData, getHeaderData, getHeaderFlags, getHeaderFlags, getIndex, getItemData, getMimeType, getRowCount, getRowCount, hasChildren, hasIndex, hasIndex, headerDataChanged, insertColumn, insertColumn, insertColumns, insertColumns, insertRow, insertRow, insertRows, insertRows, layoutAboutToBeChanged, layoutChanged, match, modelReset, removeColumn, removeColumn, removeColumns, removeColumns, removeRow, removeRow, removeRows, removeRows, reset, rowsAboutToBeInserted, rowsAboutToBeRemoved, rowsInserted, rowsRemoved, setData, setData, setData, setData, setData, setHeaderData, setHeaderData, setHeaderData, setItemData, sort, sort, toRawIndex
 
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getId, getObjectName, remove, setObjectName, tr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WAbstractListModel

public WAbstractListModel(WObject parent)
Create a new abstract list model.


WAbstractListModel

public WAbstractListModel()
Create a new abstract list model.

Calls this((WObject)null)

Method Detail

getParent

public WModelIndex getParent(WModelIndex index)
Description copied from class: WAbstractItemModel
Returns the parent for a model index.

An implementation should use createIndex() to create a model index that corresponds to the parent of a given index.

Note that the index itself may be stale (referencing a row/column within the parent that is outside the model geometry), but its parent (identified by the WModelIndex#getInternalPointer()) is referencing an existing parent. A stale index can only be used while the model geometry is being updated, i.e. during the emission of the corresponding [rows/columns](Being)[Removed/Inserted]() signals.

Specified by:
getParent in class WAbstractItemModel
See Also:
WAbstractItemModel.getIndex(int row, int column, WModelIndex parent)

getIndex

public WModelIndex getIndex(int row,
                            int column,
                            WModelIndex parent)
Description copied from class: WAbstractItemModel
Returns the child index for the given row and column.

When implementing this method, you can use createIndex() to create an index that corresponds to the item at row and column within parent.

If the location is invalid (out of bounds at the parent), then an invalid index must be returned.

Specified by:
getIndex in class WAbstractItemModel
See Also:
WAbstractItemModel.getParent(WModelIndex index)

getColumnCount

public int getColumnCount(WModelIndex parent)
Description copied from class: WAbstractItemModel
Returns the number of columns.

This returns the number of columns at index parent.

Specified by:
getColumnCount in class WAbstractItemModel
See Also:
WAbstractItemModel.getRowCount(WModelIndex parent)