|
||||||||||
| 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.WAbstractListModel
eu.webtoolkit.jwt.WStringListModel
public class WStringListModel
An model that manages a list of strings.
This model only manages a unidimensional list of strings. It is used as the default model for view classes that show a list.
The model only presents DisplayRole data of
a single column of data, but otherwise provides support for all standard
features of a model, including editing and addition and removal of data rows.
You can populate the model by passing a list of strings to its consructor, or
by using the setStringList() method. You can set or retrieve data using the
setData() and getData() methods, and add or remove data using the
insertRows() and
removeRows() methods.
WComboBox,
WSelectionBox| Constructor Summary | |
|---|---|
WStringListModel()
Creates a new empty string list model. |
|
WStringListModel(java.util.List<WString> strings)
Creates a new string list model. |
|
WStringListModel(java.util.List<WString> strings,
WObject parent)
Creates a new string list model. |
|
WStringListModel(WObject parent)
Creates a new empty string list model. |
|
| Method Summary | |
|---|---|
void |
addString(java.lang.CharSequence string)
Adds a string. |
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. |
int |
getRowCount(WModelIndex parent)
Returns the number of rows. |
java.util.List<WString> |
getStringList()
Returns the string list. |
boolean |
insertRows(int row,
int count,
WModelIndex parent)
Inserts one or more rows. |
void |
insertString(int row,
java.lang.CharSequence string)
Inserts a string. |
boolean |
removeRows(int row,
int count,
WModelIndex parent)
Removes rows. |
boolean |
setData(WModelIndex index,
java.lang.Object value,
int role)
Sets data at the given model index. |
void |
setStringList(java.util.List<WString> strings)
Sets a new string list. |
void |
sort(int column,
SortOrder order)
Sorts the model according to a particular column. |
| Methods inherited from class eu.webtoolkit.jwt.WAbstractListModel |
|---|
getColumnCount, getIndex, getParent |
| 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 WStringListModel(WObject parent)
public WStringListModel()
Calls this((WObject)null)
public WStringListModel(java.util.List<WString> strings,
WObject parent)
public WStringListModel(java.util.List<WString> strings)
Calls this(strings, (WObject)null)
| Method Detail |
|---|
public void setStringList(java.util.List<WString> strings)
Replaces the current string list with a new list.
WAbstractItemModel.dataChanged(),
addString(CharSequence string)
public void insertString(int row,
java.lang.CharSequence string)
setStringList(List strings)public void addString(java.lang.CharSequence string)
setStringList(List strings)public java.util.List<WString> getStringList()
setStringList(List strings)public java.util.EnumSet<ItemFlag> getFlags(WModelIndex index)
This method is reimplemented to return ItemIsSelectable | ItemIsEditable.
getFlags in class WAbstractItemModelItemFlag
public boolean setData(WModelIndex index,
java.lang.Object value,
int role)
WAbstractItemModel
Returns true if the operation was successful.
The default implementation returns false.
The model implementation must emit the
dataChanged() signal after data
was changed.
setData in class WAbstractItemModelWAbstractItemModel.getData(WModelIndex index, int role)
public java.lang.Object getData(WModelIndex index,
int role)
WAbstractItemModelReturn 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().
getData in class WAbstractItemModelWAbstractItemModel.getFlags(WModelIndex index),
WAbstractItemModel.getHeaderData(int section, Orientation
orientation, int role),
WAbstractItemModel.setData(WModelIndex index, Object value, int
role)public int getRowCount(WModelIndex parent)
WAbstractItemModel
This returns the number of rows at index parent.
getRowCount in class WAbstractItemModelWAbstractItemModel.getColumnCount(WModelIndex parent)
public boolean insertRows(int row,
int count,
WModelIndex parent)
WAbstractItemModel
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.
insertRows in class WAbstractItemModelWAbstractItemModel.insertColumns(int column, int count, WModelIndex
parent),
WAbstractItemModel.removeRows(int row, int count, WModelIndex
parent),
WAbstractItemModel.beginInsertRows(WModelIndex parent, int first,
int last),
WAbstractItemModel.endInsertRows()
public boolean removeRows(int row,
int count,
WModelIndex parent)
WAbstractItemModel
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.
removeRows in class WAbstractItemModelWAbstractItemModel.removeColumns(int column, int count, WModelIndex
parent),
WAbstractItemModel.insertRows(int row, int count, WModelIndex
parent),
WAbstractItemModel.beginRemoveRows(WModelIndex parent, int first,
int last),
WAbstractItemModel.endRemoveRows()
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 | |||||||||