|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.repeater.AbstractRepeater
org.apache.wicket.markup.repeater.RepeatingView
org.apache.wicket.markup.repeater.RefreshingView<T>
T
- Model object typepublic abstract class RefreshingView<T>
An abstract repeater view that provides refreshing functionality to its subclasses. The view is refreshed every request, making it well suited for displaying dynamic data.
The view is populated by implementing getItemModels()
and
populateItem(Item)
methods. RefreshingView builds the items that will be
rendered by looping over the models retrieved from getItemModels()
and
calling the newItem(String, int, IModel)
to generate the child item
container followed by a call to populateItem(Item)
to let the user
populate the newly created item container with custom components.
The provided ModelIteratorAdapter
can make implementing
getItemModels()
easier if you have an iterator over item objects.
RepeatingView
,
ModelIteratorAdapter
,
Serialized FormField Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
RefreshingView(String id)
Constructor |
|
RefreshingView(String id,
IModel<?> model)
Constructor |
Method Summary | |
---|---|
protected void |
addItems(Iterator<Item<T>> items)
Add items to the view. |
protected abstract Iterator<IModel<T>> |
getItemModels()
Returns an iterator over models for items that will be added to this view |
IItemReuseStrategy |
getItemReuseStrategy()
|
Iterator<Item<T>> |
getItems()
|
protected Item<T> |
newItem(String id,
int index,
IModel<T> model)
Factory method for Item container. |
protected IItemFactory<T> |
newItemFactory()
Create a new IItemFactory based upon the RefreshingView |
protected void |
onPopulate()
Refresh the items in the view. |
protected abstract void |
populateItem(Item<T> item)
Populate the given Item container. |
RefreshingView<T> |
setItemReuseStrategy(IItemReuseStrategy strategy)
Sets the item reuse strategy. |
Methods inherited from class org.apache.wicket.markup.repeater.RepeatingView |
---|
newChildId, renderIterator |
Methods inherited from class org.apache.wicket.markup.repeater.AbstractRepeater |
---|
getMarkup, onBeforeRender, onRender, renderChild |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkupStream, getMarkupType, hasAssociatedMarkup, internalAdd, iterator, iterator, onComponentTagBody, onMarkupAttached, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RefreshingView(String id)
id
- component idpublic RefreshingView(String id, IModel<?> model)
id
- component idmodel
- modelMethod Detail |
---|
protected final void onPopulate()
onPopulate
in class RepeatingView
AbstractRepeater.onPopulate()
protected IItemFactory<T> newItemFactory()
protected abstract Iterator<IModel<T>> getItemModels()
protected abstract void populateItem(Item<T> item)
be carefull to add any components to the item and not the view itself. So, don't do:
add(new Label("foo", "bar"));but:
item.add(new Label("foo", "bar"));
item
- The item to populateprotected Item<T> newItem(String id, int index, IModel<T> model)
id
- component id for the new data itemindex
- the index of the new data itemmodel
- the model for the new data item
Item
public Iterator<Item<T>> getItems()
protected void addItems(Iterator<Item<T>> items)
items
- item instances to be added to this viewpublic IItemReuseStrategy getItemReuseStrategy()
DefaultItemReuseStrategy
if none was set.DefaultItemReuseStrategy
public RefreshingView<T> setItemReuseStrategy(IItemReuseStrategy strategy)
Item
s.
strategy
- item reuse strategy
IItemReuseStrategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |