|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WAbstractItemModel
public abstract class WAbstractItemModel
An abstract model for use with Wt's view classes.
This abstract model is used by several JWt view widgets as data models.
It may model data for both tree-like and table-like view widgets. Data is
therefore organized in a hierarchical structure of tables, where every item
stores data and items in column 0 can be the parent of a nested table of
data. Every data item is uniquely identified by their row, column and parent
index, and items may be referenced using the helper class WModelIndex.
Each item may provide data for one or more roles, and
indicate options using flags. The different roles can be
used to model different aspects of an item (its text value, an icon, style
class), or to hold auxiliary custom information. The flags provide
information to the View on possible interactivity.
Top level data have a null parent WModelIndex.
The data itself is of type Object, which can either be null, or
be any type of data. Depending on the role however, view classes may expect
certain types of data (e.g. numerical types for charts) or will convert the
data to a string (e.g. for ItemDataRole.DisplayRole).
To implement a custom model, you need to reimplement the following methods:
getIndex() and getParent() methods that allow one to navigate the modelgetColumnCount() and
getRowCount() to
specify the top level geometry and the nested geometry at every itemgetData()
to return the data for an itemgetHeaderData() to return row and column header datagetFlags() to indicate data options
A crucial point in implementing a hierarchical model is to decide how to
reference an index in terms of an internal pointer (
WModelIndex#getInternalPointer()).
Other than the top-level index, which is special since it is referenced using
an invalid index, every index with children must be identifiable using this
object. For example, in the WStandardItemModel, the internal pointer
points to the parent WStandardItem. For table models, the internal
pointer plays no role, since only the toplevel index has children.
If you want to support editing of the model, then you need to indicate this
support using a ItemFlag.ItemIsEditable flag, and reimplement
setData(). View classes will use the EditRole
to read and update the data for the editor.
When the model's data has been changed, the model must emit the
dataChanged() signal.
Finally, there is a generic interface for insertion of new data or removal of data (changing the geometry), although this interface is not yet used by any View class:
Alternatively, you can provide your own API for changing the model. In either case it is important that you call the corresponding protected member functions which will emit the relevant signals so that views can adapt themselves to the new geometry.
| Constructor Summary | |
|---|---|
WAbstractItemModel()
Creates a new data model. |
|
WAbstractItemModel(WObject parent)
Creates a new data model. |
|
| Method Summary | |
|---|---|
protected void |
beginInsertColumns(WModelIndex parent,
int first,
int last)
Method to be called before inserting columns. |
protected void |
beginInsertRows(WModelIndex parent,
int first,
int last)
Method to be called before inserting rows. |
protected void |
beginRemoveColumns(WModelIndex parent,
int first,
int last)
Method to be called before removing columns. |
protected void |
beginRemoveRows(WModelIndex parent,
int first,
int last)
Method to be called before removing rows. |
void |
collapseColumn(int column)
Collapses a column. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
columnsAboutToBeInserted()
Signal emitted before a number of columns will be inserted. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
columnsAboutToBeRemoved()
Signal emitted before a number of columns will be removed. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
columnsInserted()
Signal emitted after a number of columns were inserted. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
columnsRemoved()
Signal emitted after a number of columns were removed. |
protected WModelIndex |
createIndex(int row,
int column,
java.lang.Object ptr)
Creates a model index for the given row and column. |
Signal2<WModelIndex,WModelIndex> |
dataChanged()
Signal emitted when some data was changed. |
void |
dropEvent(WDropEvent e,
DropAction action,
int row,
int column,
WModelIndex parent)
Handles a drop event. |
protected void |
endInsertColumns()
Method to be called after inserting columns. |
protected void |
endInsertRows()
Method to be called after inserting rows. |
protected void |
endRemoveColumns()
Method to be called after removing columns. |
protected void |
endRemoveRows()
Method to be called after removing rows. |
void |
expandColumn(int column)
Expands a column. |
WModelIndex |
fromRawIndex(java.lang.Object rawIndex)
Converts a raw pointer to a model index. |
java.util.List<java.lang.String> |
getAcceptDropMimeTypes()
Returns a list of mime-types that could be accepted for a drop event. |
int |
getColumnCount()
Returns the number of columns. |
abstract int |
getColumnCount(WModelIndex parent)
Returns the number of columns. |
java.lang.Object |
getData(int row,
int column)
Returns the data item at the given column and row. |
java.lang.Object |
getData(int row,
int column,
int role)
Returns the data item at the given column and row. |
java.lang.Object |
getData(int row,
int column,
int role,
WModelIndex parent)
Returns the data item at the given column and row. |
java.lang.Object |
getData(WModelIndex index)
Returns data at a specific model index. |
abstract java.lang.Object |
getData(WModelIndex index,
int role)
Returns data at a specific model index. |
java.util.EnumSet<ItemFlag> |
getFlags(WModelIndex index)
Returns the flags for an item. |
java.lang.Object |
getHeaderData(int section)
Returns the row or column header data. |
java.lang.Object |
getHeaderData(int section,
Orientation orientation)
Returns the row or column header data. |
java.lang.Object |
getHeaderData(int section,
Orientation orientation,
int role)
Returns the row or column header data. |
java.util.EnumSet<HeaderFlag> |
getHeaderFlags(int section)
Returns the flags for a header. |
java.util.EnumSet<HeaderFlag> |
getHeaderFlags(int section,
Orientation orientation)
Returns the flags for a header. |
WModelIndex |
getIndex(int row,
int column)
Returns the child index for the given row and column. |
abstract WModelIndex |
getIndex(int row,
int column,
WModelIndex parent)
Returns the child index for the given row and column. |
java.util.SortedMap<java.lang.Integer,java.lang.Object> |
getItemData(WModelIndex index)
Returns all data at a specific index. |
java.lang.String |
getMimeType()
Returns a mime-type for dragging a set of indexes. |
abstract WModelIndex |
getParent(WModelIndex index)
Returns the parent for a model index. |
int |
getRowCount()
Returns the number of rows. |
abstract int |
getRowCount(WModelIndex parent)
Returns the number of rows. |
boolean |
hasChildren(WModelIndex index)
Returns if there are children at an index. |
boolean |
hasIndex(int row,
int column)
Returns if an index at the given position is valid (i.e. |
boolean |
hasIndex(int row,
int column,
WModelIndex parent)
Returns if an index at the given position is valid (i.e. |
Signal3<Orientation,java.lang.Integer,java.lang.Integer> |
headerDataChanged()
Signal emitted when some header data was changed. |
boolean |
insertColumn(int column)
Inserts one column. |
boolean |
insertColumn(int column,
WModelIndex parent)
Inserts one column. |
boolean |
insertColumns(int column,
int count)
Inserts one or more columns. |
boolean |
insertColumns(int column,
int count,
WModelIndex parent)
Inserts one or more columns. |
boolean |
insertRow(int row)
Inserts one row. |
boolean |
insertRow(int row,
WModelIndex parent)
Inserts one row. |
boolean |
insertRows(int row,
int count)
Inserts one or more rows. |
boolean |
insertRows(int row,
int count,
WModelIndex parent)
Inserts one or more rows. |
Signal |
layoutAboutToBeChanged()
Signal emitted when the layout is about to be changed. |
Signal |
layoutChanged()
Signal emitted when the layout is changed. |
java.util.List<WModelIndex> |
match(WModelIndex start,
int role,
java.lang.Object value,
int hits,
MatchOptions flags)
Returns an index list for data items that match. |
Signal |
modelReset()
Signal emitted when the model was reset. |
boolean |
removeColumn(int column)
Removes one column. |
boolean |
removeColumn(int column,
WModelIndex parent)
Removes one column. |
boolean |
removeColumns(int column,
int count)
Removes columns. |
boolean |
removeColumns(int column,
int count,
WModelIndex parent)
Removes columns. |
boolean |
removeRow(int row)
Removes one row. |
boolean |
removeRow(int row,
WModelIndex parent)
Removes one row. |
boolean |
removeRows(int row,
int count)
Removes rows. |
boolean |
removeRows(int row,
int count,
WModelIndex parent)
Removes rows. |
protected void |
reset()
Resets the model and invalidate any data. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
rowsAboutToBeInserted()
Signal emitted before a number of rows will be inserted. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
rowsAboutToBeRemoved()
Signal emitted before a number of rows will be removed. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
rowsInserted()
Signal emitted after a number of rows were inserted. |
Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> |
rowsRemoved()
Signal emitted after a number of rows were removed. |
boolean |
setData(int row,
int column,
java.lang.Object value)
Sets data at the given row and column. |
boolean |
setData(int row,
int column,
java.lang.Object value,
int role)
Sets data at the given row and column. |
boolean |
setData(int row,
int column,
java.lang.Object value,
int role,
WModelIndex parent)
Sets data at the given row and column. |
boolean |
setData(WModelIndex index,
java.lang.Object value)
Sets data at the given model index. |
boolean |
setData(WModelIndex index,
java.lang.Object value,
int role)
Sets data at the given model index. |
boolean |
setHeaderData(int section,
java.lang.Object value)
Sets column header data. |
boolean |
setHeaderData(int section,
Orientation orientation,
java.lang.Object value)
Sets header data for a column or row. |
boolean |
setHeaderData(int section,
Orientation orientation,
java.lang.Object value,
int role)
Sets header data for a column or row. |
boolean |
setItemData(WModelIndex index,
java.util.SortedMap<java.lang.Integer,java.lang.Object> values)
Sets data at the given model index. |
void |
sort(int column)
Sorts the model according to a particular column. |
void |
sort(int column,
SortOrder order)
Sorts the model according to a particular column. |
java.lang.Object |
toRawIndex(WModelIndex index)
Converts a model index to a raw pointer that remains valid while the model's layout is changed. |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
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 |
|---|
public WAbstractItemModel(WObject parent)
public WAbstractItemModel()
Calls this((WObject)null)
| Method Detail |
|---|
public abstract int getColumnCount(WModelIndex parent)
This returns the number of columns at index parent.
getRowCount(WModelIndex parent)public final int getColumnCount()
Returns getColumnCount(null)
public abstract int getRowCount(WModelIndex parent)
This returns the number of rows at index parent.
getColumnCount(WModelIndex parent)public final int getRowCount()
Returns getRowCount(null)
public java.util.EnumSet<ItemFlag> getFlags(WModelIndex index)
The default implementation returns ItemIsSelectable.
ItemFlag
public java.util.EnumSet<HeaderFlag> getHeaderFlags(int section,
Orientation orientation)
The default implementation returns no flags set.
HeaderFlagpublic final java.util.EnumSet<HeaderFlag> getHeaderFlags(int section)
Returns getHeaderFlags(section, Orientation.Horizontal)
public boolean hasChildren(WModelIndex index)
Returns true when rowCount(index) > 0 and
columnCount(index) > 0.
getRowCount(WModelIndex parent),
getColumnCount(WModelIndex parent)public abstract WModelIndex getParent(WModelIndex 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.
getIndex(int row, int column, WModelIndex parent)
public abstract java.lang.Object getData(WModelIndex index,
int role)
Return data for a given role at a given index.
You should check the role to decide what data to return.
Usually a View class will ask for data for several roles which affect not
only the contents (ItemDataRole.DisplayRole) but also icons (
ItemDataRole.DecorationRole), URLs (ItemDataRole.LinkRole
), and other visual aspects. If your item does not specify data for a
particular role, it should simply return a boost::any().
getFlags(WModelIndex index),
getHeaderData(int section, Orientation
orientation, int role),
setData(WModelIndex index, Object value, int
role)public final java.lang.Object getData(WModelIndex index)
Returns getData(index,
ItemDataRole.DisplayRole)
public java.util.SortedMap<java.lang.Integer,java.lang.Object> getItemData(WModelIndex index)
This is a convenience function that returns a map with data corresponding to all standard roles.
getData(WModelIndex index, int role)
public java.lang.Object getHeaderData(int section,
Orientation orientation,
int role)
When orientation is Horizontal, section is a column number, when
orientation is Vertical,
section is a row number.
getData(WModelIndex index, int role),
setHeaderData(int section, Orientation
orientation, Object value, int role)public final java.lang.Object getHeaderData(int section)
Returns
getHeaderData(section, Orientation.Horizontal, ItemDataRole.DisplayRole)
public final java.lang.Object getHeaderData(int section,
Orientation orientation)
Returns
getHeaderData(section, orientation, ItemDataRole.DisplayRole)
public abstract WModelIndex getIndex(int row,
int column,
WModelIndex parent)
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.
getParent(WModelIndex index)
public final WModelIndex getIndex(int row,
int column)
Returns getIndex(row, column, null)
public java.util.List<WModelIndex> match(WModelIndex start,
int role,
java.lang.Object value,
int hits,
MatchOptions flags)
Returns an index list of data items that match, starting at start, and
searching further in that column. If flags specifies
MatchWrap then the search wraps
around from the start. If hits is not -1, then at most that number of
hits are returned.
public java.lang.Object getData(int row,
int column,
int role,
WModelIndex parent)
This is a convenience method, and is equivalent to:
index(row, column, parent).data(role)
getIndex(int row, int column, WModelIndex parent),
getData(WModelIndex index, int role)
public final java.lang.Object getData(int row,
int column)
Returns getData(row, column, ItemDataRole.DisplayRole, null)
public final java.lang.Object getData(int row,
int column,
int role)
Returns getData(row, column, role, null)
public boolean hasIndex(int row,
int column,
WModelIndex parent)
Equivalent to:
return row >= 0 && column >= 0 && row < rowCount(parent)
&& column < columnCount(parent);
getRowCount(WModelIndex parent),
getColumnCount(WModelIndex parent)
public final boolean hasIndex(int row,
int column)
Returns hasIndex(row, column, null)
public boolean insertColumns(int column,
int count,
WModelIndex parent)
In models that support column insertion, this inserts count
columns, starting at column, and returns true
if the operation was successful. The new columns are inserted under
parent.
The default implementation returns false.
The model implementation must call
beginInsertColumns() and endInsertColumns() before and after the operation whenever its geometry
is changed by inserting columns. This emits signals for views to properly
react to these changes.
insertRows(int row, int count, WModelIndex
parent),
removeColumns(int column, int count, WModelIndex
parent),
beginInsertColumns(WModelIndex parent, int first,
int last),
endInsertColumns()
public final boolean insertColumns(int column,
int count)
Returns insertColumns(column, count, null)
public boolean insertRows(int row,
int count,
WModelIndex parent)
In models that support row insertion, this inserts count
rows, starting at row, and returns true if the
operation was successful. The new rows are inserted under
parent.
If parent had no children, then a single column is added with
count rows.
The default implementation returns false.
The model implementation must call
beginInsertRows() and endInsertRows() before and after the operation whenever its geometry is
changed by inserting rows. This emits signals for views to properly react
to these changes.
insertColumns(int column, int count, WModelIndex
parent),
removeRows(int row, int count, WModelIndex
parent),
beginInsertRows(WModelIndex parent, int first,
int last),
endInsertRows()
public final boolean insertRows(int row,
int count)
Returns insertRows(row, count, null)
public boolean removeColumns(int column,
int count,
WModelIndex parent)
Returns true if the operation was successful.
The default implementation returns false.
The model implementation must call
beginRemoveColumns() and endRemoveColumns() before and after the operation whenever its geometry
is changed by removing columns. This emits signals for views to properly
react to these changes.
removeRows(int row, int count, WModelIndex
parent),
insertColumns(int column, int count, WModelIndex
parent),
beginRemoveColumns(WModelIndex parent, int first,
int last),
endRemoveColumns()
public final boolean removeColumns(int column,
int count)
Returns removeColumns(column, count, null)
public boolean removeRows(int row,
int count,
WModelIndex parent)
Returns true if the operation was successful.
The default implementation returns false.
The model implementation must call
beginRemoveRows() and endRemoveRows() before and after the operation whenever its geometry is
changed by removing rows. This emits signals for views to properly react
to these changes.
removeColumns(int column, int count, WModelIndex
parent),
insertRows(int row, int count, WModelIndex
parent),
beginRemoveRows(WModelIndex parent, int first,
int last),
endRemoveRows()
public final boolean removeRows(int row,
int count)
Returns removeRows(row, count, null)
public boolean setData(WModelIndex index,
java.lang.Object value,
int role)
Returns true if the operation was successful.
The default implementation returns false.
The model implementation must emit the
dataChanged() signal after data
was changed.
getData(WModelIndex index, int role)
public final boolean setData(WModelIndex index,
java.lang.Object value)
Returns setData(index, value, ItemDataRole.EditRole)
public boolean setItemData(WModelIndex index,
java.util.SortedMap<java.lang.Integer,java.lang.Object> values)
This is a convenience function that sets data for all roles at once.
setData(WModelIndex index, Object value, int
role)
public boolean setHeaderData(int section,
Orientation orientation,
java.lang.Object value,
int role)
Returns true if the operation was successful.
getHeaderData(int section, Orientation
orientation, int role)
public final boolean setHeaderData(int section,
Orientation orientation,
java.lang.Object value)
Returns
setHeaderData(section, orientation, value, ItemDataRole.EditRole)
public boolean setHeaderData(int section,
java.lang.Object value)
Returns true if the operation was successful.
setHeaderData(int section, Orientation
orientation, Object value, int role)
public void sort(int column,
SortOrder order)
If the model supports sorting, then it should emit the
layoutAboutToBeChanged() signal, rearrange its items, and afterwards
emit the layoutChanged()
signal.
layoutAboutToBeChanged(),
layoutChanged()public final void sort(int column)
Calls sort(column,
SortOrder.AscendingOrder)
public void expandColumn(int column)
Expands a column. This may only be called by a view when the
HeaderFlag.ColumnIsCollapsed flag is set.
The default implementation does nothing.
WAggregateProxyModelpublic void collapseColumn(int column)
Collapses a column. This may only be called by a view when the
HeaderFlag.ColumnIsExpandedLeft or
HeaderFlag.ColumnIsExpandedRight flag is set.
The default implementation does nothing.
WAggregateProxyModelpublic java.lang.Object toRawIndex(WModelIndex index)
Use this method to temporarily save model indexes while the model's layout is changed by for example a sorting operation.
The default implementation returns null, which indicates
that the index cannot be converted to a raw pointer. If you reimplement
this method, you also need to reimplemnt
fromRawIndex().
layoutAboutToBeChanged(),
sort(int column, SortOrder order),
fromRawIndex(Object rawIndex)public WModelIndex fromRawIndex(java.lang.Object rawIndex)
Use this method to create model index from temporary raw pointers. It is
the reciproce method of
toRawIndex().
You can return an invalid modelindex if the rawIndex no longer points to a valid item because of the layout change.
toRawIndex(WModelIndex index)public java.lang.String getMimeType()
This method returns a mime-type that describes dragging of a selection of items.
The drop event will indicate a selection
model for this abstract item model as source.
The default implementation returns a mime-type for generic drag&drop support between abstract item models.
getAcceptDropMimeTypes()public java.util.List<java.lang.String> getAcceptDropMimeTypes()
The default implementation only accepts drag&drop support between abstract item models.
getMimeType()
public void dropEvent(WDropEvent e,
DropAction action,
int row,
int column,
WModelIndex parent)
The default implementation only handles generic drag&drop between abstract item models. Source item data is copied (but not the source item's flags).
The location in the model is indicated by the row and
column within the parent index. If
row is -1, then the item is appended to the
parent. Otherwise, the item is inserted at or copied over
the indicated item (and subsequent rows). When action is a
MoveAction, the original items are deleted
from the source model.
You may want to reimplement this method if you want to handle other mime-type data, or if you want to refine how the drop event of an item selection must be interpreted.
Note: Currently, only row selections are handled by the default implementation.
getMimeType(),
WItemSelectionModel
public boolean insertColumn(int column,
WModelIndex parent)
This is a convenience method that adds a single column, and is equivalent to:
insertColumns(column, 1, parent);
Returns true if the operation was successful.
insertColumns(int column, int count, WModelIndex
parent)public final boolean insertColumn(int column)
Returns insertColumn(column, null)
public boolean insertRow(int row,
WModelIndex parent)
This is a convenience method that adds a single row, and is equivalent to:
insertRows(row, 1, parent);
Returns true if the operation was successful.
insertRows(int row, int count, WModelIndex
parent)public final boolean insertRow(int row)
Returns insertRow(row,
null)
public boolean removeColumn(int column,
WModelIndex parent)
This is a convenience method that removes a single column, and is equivalent to:
removeColumns(column, 1, parent);
Returns true if the operation was successful.
removeColumns(int column, int count, WModelIndex
parent)public final boolean removeColumn(int column)
Returns removeColumn(column, null)
public boolean removeRow(int row,
WModelIndex parent)
This is a convenience method that removes a single row, and is equivalent to:
removeRows(row, 1, parent);
Returns true if the operation was successful.
removeRows(int row, int count, WModelIndex
parent)public final boolean removeRow(int row)
Returns removeRow(row,
null)
public boolean setData(int row,
int column,
java.lang.Object value,
int role,
WModelIndex parent)
This is a convience method, and is equivalent to:
setData(index(row, column, parent), value, role);
Returns true if the operation was successful.
setData(WModelIndex index, Object value, int
role),
getIndex(int row, int column, WModelIndex parent)
public final boolean setData(int row,
int column,
java.lang.Object value)
Returns
setData(row, column, value, ItemDataRole.EditRole, null)
public final boolean setData(int row,
int column,
java.lang.Object value,
int role)
Returns
setData(row, column, value, role, null)
public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> columnsAboutToBeInserted()
The first argument is the parent index. The two integer arguments are the column numbers that the first and last column will have when inserted.
columnsInserted(),
beginInsertColumns(WModelIndex parent, int first,
int last)public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> columnsAboutToBeRemoved()
The first argument is the parent index. The two integer arguments are the column numbers of the first and last column that will be removed.
columnsRemoved(),
beginRemoveColumns(WModelIndex parent, int first,
int last)public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> columnsInserted()
The first argument is the parent index. The two integer arguments are the column numbers of the first and last column that were inserted.
columnsAboutToBeInserted(),
endInsertColumns()public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> columnsRemoved()
The first argument is the parent index. The two integer arguments are the column numbers of the first and last column that were removed.
columnsAboutToBeRemoved(),
endRemoveColumns()public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> rowsAboutToBeInserted()
The first argument is the parent index. The two integer arguments are the row numbers that the first and last row will have when inserted.
rowsInserted(),
beginInsertRows(WModelIndex parent, int first,
int last)public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> rowsAboutToBeRemoved()
The first argument is the parent index. The two integer arguments are the row numbers of the first and last row that will be removed.
rowsRemoved(),
beginRemoveRows(WModelIndex parent, int first,
int last)public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> rowsInserted()
The first argument is the parent index. The two integer arguments are the row numbers of the first and last row that were inserted.
rowsAboutToBeInserted(),
endInsertRows()public Signal3<WModelIndex,java.lang.Integer,java.lang.Integer> rowsRemoved()
The first argument is the parent index. The two integer arguments are the row numbers of the first and last row that were removed.
rowsAboutToBeRemoved(),
endRemoveRows()public Signal2<WModelIndex,WModelIndex> dataChanged()
The two arguments are the model indexes of the top-left and bottom-right data items that span the rectangle of changed data items.
setData(WModelIndex index, Object value, int
role)public Signal3<Orientation,java.lang.Integer,java.lang.Integer> headerDataChanged()
The first argument indicates the orientation of the header, and the two integer arguments are the row or column numbers of the first and last header item of which the value was changed.
setHeaderData(int section, Orientation
orientation, Object value, int role)public Signal layoutAboutToBeChanged()
A layout change reorders the data in the model, but columns are
preserved. Model indexes are invalidated by a layout change, but indexes
may be ported across a layout change by using the
toRawIndex() and
fromRawIndex()
methods.
layoutChanged(),
toRawIndex(WModelIndex index),
fromRawIndex(Object rawIndex)public Signal layoutChanged()
layoutAboutToBeChanged()public Signal modelReset()
A model reset invalidates all existing data, and the model may change its entire geometry (column count, row count).
reset()protected void reset()
Informs any attached view that all data in the model was invalidated, and the model's data should be reread.
This causes the modelReset()
signal to be emitted.
protected WModelIndex createIndex(int row,
int column,
java.lang.Object ptr)
Use this method to create a model index. ptr is an internal
pointer that may be used to identify the parent of the
corresponding item. For a flat table model, ptr can thus
always be 0.
WModelIndex.getInternalPointer()
protected void beginInsertColumns(WModelIndex parent,
int first,
int last)
If your model supports insertion of columns, then you should call this
method before inserting one or more columns, and
endInsertColumns()
afterwards. These methods emit the necessary signals to allow view
classes to update themselves.
endInsertColumns(),
insertColumns(int column, int count, WModelIndex
parent),
columnsAboutToBeInserted()
protected void beginInsertRows(WModelIndex parent,
int first,
int last)
If your model supports insertion of rows, then you should call this
method before inserting one or more rows, and
endInsertRows() afterwards.
These methods emit the necessary signals to allow view classes to update
themselves.
endInsertRows(),
insertRows(int row, int count, WModelIndex
parent),
rowsAboutToBeInserted()
protected void beginRemoveColumns(WModelIndex parent,
int first,
int last)
If your model supports removal of columns, then you should call this
method before removing one or more columns, and
endRemoveColumns()
afterwards. These methods emit the necessary signals to allow view
classes to update themselves.
endRemoveColumns(),
removeColumns(int column, int count, WModelIndex
parent),
columnsAboutToBeRemoved()
protected void beginRemoveRows(WModelIndex parent,
int first,
int last)
If your model supports removal of rows, then you should call this method
before removing one or more rows, and
endRemoveRows() afterwards.
These methods emit the necessary signals to allow view classes to update
themselves.
endRemoveRows(),
removeRows(int row, int count, WModelIndex
parent),
rowsAboutToBeRemoved()protected void endInsertColumns()
beginInsertColumns(WModelIndex parent, int first,
int last)protected void endInsertRows()
beginInsertRows(WModelIndex parent, int first,
int last)protected void endRemoveColumns()
beginRemoveColumns(WModelIndex parent, int first,
int last)protected void endRemoveRows()
beginRemoveRows(WModelIndex parent, int first,
int last)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||