|
||||||||||
| 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
eu.webtoolkit.jwt.WAbstractProxyModel
eu.webtoolkit.jwt.WAggregateProxyModel
public class WAggregateProxyModel
A proxy model for Wt's item models that provides column aggregation.
This proxy model does not store data itself, but presents data from a source model, and presents methods to organize columns using aggregation, through which a user may navigate (usually to obtain more detailed results related to a single aggregate quantity).
To use this proxy model, you should provide a source model using
setSourceModel(), and define column ranges that can be aggregated using
addAggregate().
This example would render like this:
A WTreeView using a WAggregateProxyModel
Note: This model does not support dynamic changes to the column definition of the source model (i.e. insertions or deletions of source model columns).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WAbstractProxyModel |
|---|
WAbstractProxyModel.BaseItem |
| Constructor Summary | |
|---|---|
WAggregateProxyModel()
Constructor. |
|
WAggregateProxyModel(WObject parent)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addAggregate(int parentColumn,
int firstColumn,
int lastColumn)
Adds a new column aggregation definition. |
void |
collapseColumn(int column)
Collapses a column. |
void |
expandColumn(int column)
Expands a column. |
int |
getColumnCount(WModelIndex parent)
Returns the number of columns. |
java.lang.Object |
getHeaderData(int section,
Orientation orientation,
int role)
Returns the row or column header data. |
java.util.EnumSet<HeaderFlag> |
getHeaderFlags(int section,
Orientation orientation)
Returns the flags for a header. |
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. |
int |
getRowCount(WModelIndex parent)
Returns the number of rows. |
WModelIndex |
mapFromSource(WModelIndex sourceIndex)
Maps a source model index to the proxy model. |
WModelIndex |
mapToSource(WModelIndex proxyIndex)
Maps a proxy model index to the source model. |
boolean |
setHeaderData(int section,
Orientation orientation,
java.lang.Object value,
int role)
Sets header data for a column or row. |
void |
setSourceModel(WAbstractItemModel model)
Sets the source model. |
void |
sort(int column,
SortOrder order)
Sorts the model according to a particular column. |
| Methods inherited from class eu.webtoolkit.jwt.WAbstractProxyModel |
|---|
createSourceIndex, dropEvent, fromRawIndex, getAcceptDropMimeTypes, getData, getFlags, getMimeType, getSourceModel, insertColumns, removeColumns, setData, shiftModelIndexes, 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 |
|---|
public WAggregateProxyModel(WObject parent)
Sets up the proxy without aggregation functionality.
public WAggregateProxyModel()
Calls this((WObject)null)
| Method Detail |
|---|
public void addAggregate(int parentColumn,
int firstColumn,
int lastColumn)
The parentColumn is the column index in the source model
that acts as an aggregate for columns firstColumn to
lastColumn. parentColumn must border the range
defined by firstColumn to lastColumn:
parentColumn == firstColumn - 1 || parentColumn == lastColumn + 1
Note that column parameters reference column indexes in the source model.
Aggregation definitions can be nested, but should be strictly hierarchical.
The aggregate column will initially be collapsed.
Only one aggregate can be defined per parentColumn.
public WModelIndex mapFromSource(WModelIndex sourceIndex)
WAbstractProxyModel
This method returns a model index in the proxy model that corresponds to
the model index sourceIndex in the source model. This method
must only be implemented for source model indexes that are mapped and
thus are the result of
mapToSource().
mapFromSource in class WAbstractProxyModelWAbstractProxyModel.mapToSource(WModelIndex proxyIndex)public WModelIndex mapToSource(WModelIndex proxyIndex)
WAbstractProxyModel
This method returns a model index in the source model that corresponds to
the proxy model index proxyIndex.
mapToSource in class WAbstractProxyModelWAbstractProxyModel.mapFromSource(WModelIndex sourceIndex)public void setSourceModel(WAbstractItemModel model)
WAbstractProxyModelThe source model provides the actual data for the proxy model.
Ownership of the source model is not transferred.
setSourceModel in class WAbstractProxyModelpublic void expandColumn(int column)
WAbstractItemModel
Expands a column. This may only be called by a view when the
HeaderFlag.ColumnIsCollapsed flag is set.
The default implementation does nothing.
expandColumn in class WAbstractItemModelWAggregateProxyModelpublic void collapseColumn(int column)
WAbstractItemModel
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.
collapseColumn in class WAbstractItemModelWAggregateProxyModelpublic int getColumnCount(WModelIndex parent)
WAbstractItemModel
This returns the number of columns at index parent.
getColumnCount in class WAbstractItemModelWAbstractItemModel.getRowCount(WModelIndex parent)public int getRowCount(WModelIndex parent)
WAbstractItemModel
This returns the number of rows at index parent.
getRowCount in class WAbstractItemModelWAbstractItemModel.getColumnCount(WModelIndex parent)
public java.util.EnumSet<HeaderFlag> getHeaderFlags(int section,
Orientation orientation)
WAbstractItemModelThe default implementation returns no flags set.
getHeaderFlags in class WAbstractItemModelHeaderFlag
public boolean setHeaderData(int section,
Orientation orientation,
java.lang.Object value,
int role)
WAbstractItemModel
Returns true if the operation was successful.
setHeaderData in class WAbstractItemModelWAbstractItemModel.getHeaderData(int section, Orientation
orientation, int role)
public java.lang.Object getHeaderData(int section,
Orientation orientation,
int role)
WAbstractItemModel
When orientation is Horizontal, section is a column number, when
orientation is Vertical,
section is a row number.
getHeaderData in class WAbstractItemModelWAbstractItemModel.getData(WModelIndex index, int role),
WAbstractItemModel.setHeaderData(int section, Orientation
orientation, Object value, int role)public WModelIndex getParent(WModelIndex index)
WAbstractItemModel
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.
getParent in class WAbstractItemModelWAbstractItemModel.getIndex(int row, int column, WModelIndex parent)
public WModelIndex getIndex(int row,
int column,
WModelIndex parent)
WAbstractItemModel
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.
getIndex in class WAbstractItemModelWAbstractItemModel.getParent(WModelIndex index)
public void sort(int column,
SortOrder order)
WAbstractItemModel
If the model supports sorting, then it should emit the
layoutAboutToBeChanged() signal, rearrange its items, and afterwards
emit the layoutChanged()
signal.
sort in class WAbstractItemModelWAbstractItemModel.layoutAboutToBeChanged(),
WAbstractItemModel.layoutChanged()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||