|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WStandardItem
public class WStandardItem
An item in a WStandardItemModel.
The item provides access to various data properties:
text,
icon,
CSS style class,
tool tip, and
check state, and data flags
(setFlags() and
setCheckable()).
An item may contain a table of children items: the initial geometry may be
specified in the constructor, or using the methods
setRowCount() and
setModelCount(). Unspecified items are 0. You can set or inspect children
items using the
setChild() and getChild() methods.
It is possible to reimplement this class and specialize the methods for data
acess (setData() and
getData()), or provide custom sorting
functionality by reimplementing
| Constructor Summary | |
|---|---|
WStandardItem()
Creates an empty standard item. |
|
WStandardItem(java.lang.CharSequence text)
Creates an item with a text. |
|
WStandardItem(int rows)
Creates an item with an initial geometry. |
|
WStandardItem(int rows,
int columns)
Creates an item with an initial geometry. |
|
WStandardItem(java.lang.String iconUri,
java.lang.CharSequence text)
Creates an item with an icon and a text. |
|
| Method Summary | |
|---|---|
void |
appendColumn(java.util.List<WStandardItem> items)
Add a single column of items. |
void |
appendRow(java.util.List<WStandardItem> items)
Add a single row of items. |
void |
appendRow(WStandardItem item)
Appends a row containing one item. |
void |
appendRows(java.util.List<WStandardItem> items)
Appends multiple rows containing one item. |
WStandardItem |
clone()
Returns a clone of this item. |
CheckState |
getCheckState()
Returns the item's check state. |
WStandardItem |
getChild(int row)
Returns a child item. |
WStandardItem |
getChild(int row,
int column)
Returns a child item. |
int |
getColumn()
Returns the column index. |
int |
getColumnCount()
Returns the column count. |
java.lang.Object |
getData()
Returns item data. |
java.lang.Object |
getData(int role)
Returns item data. |
java.util.EnumSet<ItemFlag> |
getFlags()
Returns the flags. |
java.lang.String |
getIcon()
Returns the icon url. |
WModelIndex |
getIndex()
Returns the model index for this item. |
java.lang.String |
getInternalPath()
Returns the anchor to an internal path. |
WStandardItemModel |
getModel()
Returns the model. |
WStandardItem |
getParent()
Returns the parent item. |
int |
getRow()
Returns the row index. |
int |
getRowCount()
Returns the row count. |
WString |
getStyleClass()
Returns the item style class. |
WString |
getText()
Returns the text. |
WString |
getToolTip()
Returns the tool tip. |
java.lang.String |
getUrl()
Returns the url referenced by this item. |
boolean |
hasChildren()
Returns whether the item has any children. |
void |
insertColumn(int column,
java.util.List<WStandardItem> items)
Inserts a single column of items. |
void |
insertColumns(int column,
int count)
Inserts a number of empty columns. |
void |
insertRow(int row,
java.util.List<WStandardItem> items)
Inserts a single row of items. |
void |
insertRow(int row,
WStandardItem item)
Inserts a row containing one item. |
void |
insertRows(int row,
int count)
Inserts a number of empty rows. |
void |
insertRows(int row,
java.util.List<WStandardItem> items)
Inserts multiple rows containing one item. |
boolean |
isCheckable()
Returns whether the item is checkable. |
boolean |
isChecked()
Returns whether the item is checked. |
boolean |
isTristate()
Returns whether the item is tri-state checkable. |
void |
removeColumn(int column)
Removes a single column. |
void |
removeColumns(int column,
int count)
Removes a number of columns. |
void |
removeRow(int row)
Removes a single row. |
void |
removeRows(int row,
int count)
Removes a number of rows. |
void |
setCheckable(boolean checkable)
Makes the item checkable. |
void |
setChecked(boolean checked)
Checks or unchecks the item. |
void |
setCheckState(CheckState state)
Sets the check state. |
void |
setChild(int row,
int column,
WStandardItem item)
Sets a child item. |
void |
setChild(int row,
WStandardItem item)
Sets a child item. |
void |
setColumnCount(int columns)
Sets the column count. |
void |
setData(java.lang.Object d)
Sets item data. |
void |
setData(java.lang.Object d,
int role)
Sets item data. |
void |
setFlags(java.util.EnumSet<ItemFlag> flags)
Sets the flags. |
void |
setFlags(ItemFlag flag,
ItemFlag... flags)
Sets the flags. |
void |
setIcon(java.lang.String uri)
Sets the icon url. |
void |
setInternalPath(java.lang.String internalpath)
Sets an anchor to an internal path. |
void |
setRowCount(int rows)
Sets the row count. |
void |
setStyleClass(java.lang.CharSequence styleClass)
Sets the CSS style class. |
void |
setText(java.lang.CharSequence text)
Sets the text. |
void |
setToolTip(java.lang.CharSequence toolTip)
Sets a tool tip. |
void |
setTristate(boolean tristate)
Makes the item tri-state checkable. |
void |
setUrl(java.lang.String url)
Sets an anchor to an external URL. |
void |
sortChildren(int column,
SortOrder order)
Sorts the children according to a given column and sort order. |
WStandardItem |
takeChild(int row,
int column)
Takes a child out of the item. |
java.util.List<WStandardItem> |
takeColumn(int column)
Takes a column of children out of the item. |
java.util.List<WStandardItem> |
takeRow(int row)
Takes a row of children out of the item. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WStandardItem()
public WStandardItem(java.lang.CharSequence text)
setText(CharSequence text)
public WStandardItem(java.lang.String iconUri,
java.lang.CharSequence text)
setText(CharSequence text),
setIcon(String uri)
public WStandardItem(int rows,
int columns)
setRowCount(int rows),
setColumnCount(int columns)public WStandardItem(int rows)
Calls this(rows, 1)
| Method Detail |
|---|
public void setText(java.lang.CharSequence text)
The text is stored as DisplayRole data.
The default text is empty ("").
getText(),
setData(Object d, int role)public WString getText()
setText(CharSequence text)public void setIcon(java.lang.String uri)
The icon is stored as DecorationRole
data.
The default icon url is empty ("").
getIcon(),
setData(Object d, int role)public java.lang.String getIcon()
setIcon(String uri)public void setStyleClass(java.lang.CharSequence styleClass)
The style class is stored as StyleClassRole data.
The default style class is empty ("").
getStyleClass(),
setData(Object d, int role)public WString getStyleClass()
setStyleClass(CharSequence styleClass)public void setToolTip(java.lang.CharSequence toolTip)
The tool tip is stored as ToolTipRole
data.
The default tool tip is empty ("").
getToolTip(),
setData(Object d, int role)public WString getToolTip()
setToolTip(CharSequence toolTip)public void setInternalPath(java.lang.String internalpath)
The internal path is stored as InternalPathRole data.
getInternalPath(),
setData(Object d, int role)public java.lang.String getInternalPath()
setInternalPath(String internalpath),
setData(Object d, int role)public void setUrl(java.lang.String url)
The anchor Url is stored as UrlRole data.
setInternalPath(String internalpath),
setData(Object d, int role)public java.lang.String getUrl()
setUrl(String url),
setData(Object d, int role)public void setChecked(boolean checked)
The value is stored as CheckStateRole
data.
By default, an item is not checked.
Note: this requires that the item is checkable (see
setCheckable()).
If the item is tri-state, you may consider using
setCheckState()
instead which supports also setting the third
CheckState.PartiallyChecked state.
setCheckable(boolean checkable),
setCheckState(CheckState state)public boolean isChecked()
setChecked(boolean checked)public void setCheckState(CheckState state)
Like setChecked(), this
sets the check state, but allows also setting the
CheckState.PartiallyChecked state when the item is tri-state
checkable.
The value is stored as CheckStateRole
data.
setCheckable(boolean checkable),
setData(Object d, int role)public CheckState getCheckState()
setCheckState(CheckState state)public void setFlags(java.util.EnumSet<ItemFlag> flags)
The default flag value is ItemIsSelectable.
ItemFlag,
getFlags(),
setCheckable(boolean checkable)
public final void setFlags(ItemFlag flag,
ItemFlag... flags)
Calls setFlags(EnumSet.of(flag, flags))
public java.util.EnumSet<ItemFlag> getFlags()
setFlags(EnumSet flags)public void setCheckable(boolean checkable)
Adds ItemIsUserCheckable to the
item's flags.
setFlags(EnumSet flags),
setChecked(boolean checked)public boolean isCheckable()
setCheckable(boolean checkable)public void setTristate(boolean tristate)
When tristate is true, the item is checkable
with three states: CheckState.Unchecked,
CheckState.Checked, and CheckState.PartiallyChecked.
This requires that the item is also checkable (see
setCheckable())
setCheckable(boolean checkable)public boolean isTristate()
setTristate(boolean tristate)
public void setData(java.lang.Object d,
int role)
Sets item data for the given role.
getData(int role)public final void setData(java.lang.Object d)
Calls setData(d,
ItemDataRole.UserRole)
public java.lang.Object getData(int role)
Returns item data for the given role.
getData(int role)public final java.lang.Object getData()
Returns getData(ItemDataRole.UserRole)
public boolean hasChildren()
This is a convenience method and checks whether
getRowCount() and
getColumnCount() differ both from
0.
getRowCount(),
getColumnCount()public void setRowCount(int rows)
If rows is bigger than the current row count, empty rows are
appended.
If rows is smaller than the current row count, rows are
deleted at the end.
Note: If rows > 0, and
getColumnCount() == 0, columnCount
is first increased to 1 using setColumnCount(1).
setColumnCount(int columns),
getRowCount()public int getRowCount()
setRowCount(int rows)public void setColumnCount(int columns)
If columns is bigger than the current column count, empty
columns are appended.
If columns is smaller than the current column count, columns
are deleted at the end.
setRowCount(int rows),
getColumnCount()public int getColumnCount()
setRowCount(int rows)public void appendColumn(java.util.List<WStandardItem> items)
Appends a single column of items. If necessary, the row
count is increased.
Equivalent to:
insertColumn(columnCount(), items);
insertColumn(int column, List items),
appendRow(List items)
public void insertColumn(int column,
java.util.List<WStandardItem> items)
Inserts a single column of items at column
column. If necessary, the row count is increased.
insertRow(int row, List items)public void appendRow(java.util.List<WStandardItem> items)
Appends a single row of items. If necessary, the column
count is increased.
Equivalent to:
insertRow(rowCount(), items);
insertRow(int row, List items),
appendColumn(List items)
public void insertRow(int row,
java.util.List<WStandardItem> items)
Inserts a single row of items at row row. If
necessary, the column count is increased.
insertColumn(int column, List items)
public void insertColumns(int column,
int count)
Inserts count empty columns at position column.
insertRows(int row, int count)
public void insertRows(int row,
int count)
Inserts count empty rows at position row.
insertColumns(int column, int count)public void appendRow(WStandardItem item)
This is a convenience method for nodes with a single column (for example for tree nodes). This adds a row with a single item, and is equivalent to:
insertRow(rowCount(), item);
insertRow(int row, WStandardItem item)
public void insertRow(int row,
WStandardItem item)
This is a convenience method for nodes with a single column (for example for tree nodes). This inserts a row with a single item, and is equivalent to:
List<WStandardItem> r; r.add(item); insertRow(row, r);
insertRow(int row, List items)public void appendRows(java.util.List<WStandardItem> items)
This is a convenience method for nodes with a single column (for example for tree nodes). This adds a number of rows, each containing a single item, and is equivalent to:
insertRows(rowCount(), items);
insertRows(int row, List items)
public void insertRows(int row,
java.util.List<WStandardItem> items)
This is a convenience method for nodes with a single column (for example
for tree nodes). This inserts a number of rows at row row,
each containing a single item, and is equivalent to:
insertRow(int row, WStandardItem item)
public void setChild(int row,
int column,
WStandardItem item)
Sets a child item item at position (row,
column). If an item was previously set, it is deleted first.
If necessary, the getRowCount()
and/or the getColumnCount() is
increased.
getChild(int row, int column)
public void setChild(int row,
WStandardItem item)
This is a convenience method for nodes with a single column (e.g. tree nodes), and is equivalent to:
setChild(row, 0, item);
setChild(int row, int column, WStandardItem item)
public WStandardItem getChild(int row,
int column)
Returns the child item at position (row, column).
This may be null if an item was not previously set, or if
the position is out of bounds.
setChild(int row, int column, WStandardItem item)public final WStandardItem getChild(int row)
Returns getChild(row, 0)
public WStandardItem takeChild(int row,
int column)
Returns the child item at position (row, column), and
removes it (by setting null instead). Ownership of the item
is transferred to the caller.
getChild(int row, int column),
setChild(int row, int column, WStandardItem item)public java.util.List<WStandardItem> takeColumn(int column)
Returns the column column, and removes the column from the
model (reducing the column count by one). Ownership of all items is
transferred to the caller.
takeRow(int row),
removeColumn(int column)public java.util.List<WStandardItem> takeRow(int row)
Returns the row row, and removes the row from the model
(reducing the row count by one). Ownership of all items is transferred to
the caller.
takeColumn(int column),
removeRow(int row)public void removeColumn(int column)
Removes the column column from the model (reducing the
column count by one). Is equivalent to:
removeColumns(column, 1);
removeColumns(int column, int count),
takeColumn(int column)
public void removeColumns(int column,
int count)
Removes count columns from the model (reducing the column
count by count).
removeColumn(int column),
removeRows(int row, int count)public void removeRow(int row)
Removes the row row from the model (reducing the row count
by one). Is equivalent to:
removeRows(row, 1);
removeRows(int row, int count),
takeRow(int row)
public void removeRows(int row,
int count)
Removes count rows from the model (reducing the row count by
count).
removeRow(int row),
removeColumns(int column, int count)public WModelIndex getIndex()
WStandardItemModel.indexFromItem(WStandardItem item)public WStandardItemModel getModel()
This is the model that this item belongs to, or 0 if the item is not associated with a model.
public WStandardItem getParent()
Returns the parent item.
setChild(int row, int column, WStandardItem item)public int getRow()
Returns the row index of this item in the parent.
getColumn()public int getColumn()
Returns the column index of this item in the parent.
getColumn()public WStandardItem clone()
clone in class java.lang.ObjectWStandardItemModel.setItemPrototype(WStandardItem item)
public void sortChildren(int column,
SortOrder order)
Children of this item, and all children items are sorted recursively. Existing model indexes will be invalidated by the operation (will point to other items).
The WAbstractItemModel#layoutAboutToBeChanged() and
WAbstractItemModel#layoutChanged() signals are emitted before and after
the operation so that you get a chance to invalidate or update model
indexes.
compare(WStandardItem other),
WStandardItemModel.setSortRole(int role)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||