eu.webtoolkit.jwt
Class WItemDelegate

java.lang.Object
  extended by eu.webtoolkit.jwt.WObject
      extended by eu.webtoolkit.jwt.WAbstractItemDelegate
          extended by eu.webtoolkit.jwt.WItemDelegate

public class WItemDelegate
extends WAbstractItemDelegate

Standard delegate class for rendering a view item.

This class provides the standard implementation for rendering an item in a WTreeView.


Constructor Summary
WItemDelegate()
          Create an item delegate.
WItemDelegate(WObject parent)
          Create an item delegate.
 
Method Summary
 java.lang.String getTextFormat()
          Returns the text format string.
 void setTextFormat(java.lang.String format)
          Sets the text format string.
 WWidget update(WWidget widget, WModelIndex index, java.util.EnumSet<ViewItemRenderFlag> flags)
          Creates or updates a widget that renders an item.
 void updateModelIndex(WWidget widget, WModelIndex index)
          Updates the model index of a widget.
 
Methods inherited from class eu.webtoolkit.jwt.WAbstractItemDelegate
update
 
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

WItemDelegate

public WItemDelegate(WObject parent)
Create an item delegate.


WItemDelegate

public WItemDelegate()
Create an item delegate.

Calls this((WObject)null)

Method Detail

update

public WWidget update(WWidget widget,
                      WModelIndex index,
                      java.util.EnumSet<ViewItemRenderFlag> flags)
Description copied from class: WAbstractItemDelegate
Creates or updates a widget that renders an item.

The item is specified by its model index, which also indicates the model. If an existing widget already renders the item, but needs to be updated, it is passed as the widget parameter. You may decide to create a new widget, in which case you are responsible to delete the previous widget if it is not reused.

When widget is null, a new widget needs to be created.

The flags parameter indicates options for rendering the item.

Specified by:
update in class WAbstractItemDelegate

updateModelIndex

public void updateModelIndex(WWidget widget,
                             WModelIndex index)
Description copied from class: WAbstractItemDelegate
Updates the model index of a widget.

This method is invoked by the view when due to row/column insertions or removals, an index was modified for a widget.

You should reimplement this method if you are storing the model index (e.g. for editing purposes) in the widget, which you should update to the new index.

The default implementation does nothing.

Overrides:
updateModelIndex in class WAbstractItemDelegate

setTextFormat

public void setTextFormat(java.lang.String format)
Sets the text format string.

The DisplayRole data is converted to a string using StringUtils.asString(Object) by passing the given format.

The default value is "".


getTextFormat

public java.lang.String getTextFormat()
Returns the text format string.

See Also:
setTextFormat(String format)