|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.jboss.errai.ui.client.widget.ListWidget<M,W>
M
- the model typeW
- the item widget type, needs to implement HasModel
for associating the widget
instance with the corresponding model instance.public abstract class ListWidget<M,W extends HasModel<M> & com.google.gwt.user.client.ui.IsWidget>
A type of widget that displays and manages a child widget for each item in a list of model
objects. The widget instances are managed by Errai's IOC container and are arranged in a
ComplexPanel
. By default, a FlowPanel
is used, but an alternative can be
specified using ListWidget(ComplexPanel)
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
protected |
ListWidget()
|
protected |
ListWidget(com.google.gwt.user.client.ui.ComplexPanel panel)
|
Method Summary | |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<List<M>> handler)
|
protected abstract Class<W> |
getItemWidgetType()
Returns the class object for the item widget type |
protected com.google.gwt.user.client.ui.ComplexPanel |
getPanel()
Returns the panel that contains all item widgets. |
List<M> |
getValue()
|
W |
getWidget(int index)
Returns the widget at the specified index. |
W |
getWidget(M model)
Returns the widget currently displaying the provided model. |
void |
onItemAdded(List<M> oldList,
M item)
Called when a single item has been appended to the list. |
void |
onItemAddedAt(List<M> oldList,
int index,
M item)
Called when a single item has been added to the list at the provided index. |
void |
onItemChanged(List<M> oldList,
int index,
M item)
Called when a single item has been changed. |
void |
onItemRemovedAt(List<M> oldList,
int index)
Called when a single item has been removed from the list at the provided index. |
void |
onItemsAdded(List<M> oldList,
Collection<? extends M> items)
Called when multiple items have been appended to the list. |
void |
onItemsAddedAt(List<M> oldList,
int index,
Collection<? extends M> item)
Called when multiple items have been added to the list starting at the provided index. |
void |
onItemsCleared(List<M> oldList)
Called when all items have been removed from the list. |
void |
onItemsRemovedAt(List<M> oldList,
List<Integer> indexes)
Called when multiple items have been removed from the list. |
protected void |
onItemsRendered(List<M> items)
Called after all item widgets have been rendered. |
void |
setItems(List<M> items)
Sets the list of model objects. |
void |
setValue(List<M> value)
|
void |
setValue(List<M> value,
boolean fireEvents)
|
Methods inherited from class com.google.gwt.user.client.ui.Composite |
---|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Constructor Detail |
---|
protected ListWidget()
protected ListWidget(com.google.gwt.user.client.ui.ComplexPanel panel)
Method Detail |
---|
protected abstract Class<W> getItemWidgetType()
protected void onItemsRendered(List<M> items)
Using the standard synchronous bean manager this method is invoked before
setItems(List)
returns. However, when using the asynchronous bean manager and
declaring @LoadAsync on the item widget, this method might be called after
setItems(List)
returns and after the corresponding JavaScript code has been
downloaded.
items
- the rendered item list. Every change to this list will update the corresponding
rendered item widgets.protected com.google.gwt.user.client.ui.ComplexPanel getPanel()
public void setItems(List<M> items)
BindableListWrapper
to make
direct changes to the list observable.
If the standard synchronous bean manager is used it is guaranteed that all widgets have been
added to the panel when this method returns. In case the asynchronous bean manager is used this
method might return before the widgets have been added to the panel. See
onItemsRendered(List)
.
items
- The list of model objects. If null or empty all existing child widgets will be
removed.public W getWidget(int index)
index
- the index to be retrieved
IndexOutOfBoundsException
- if the index is out of rangepublic W getWidget(M model)
model
- the model displayed by the widget
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<List<M>> handler)
addValueChangeHandler
in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<List<M>>
public List<M> getValue()
getValue
in interface com.google.gwt.user.client.TakesValue<List<M>>
getValue
in interface com.google.gwt.user.client.ui.HasValue<List<M>>
public void setValue(List<M> value)
setValue
in interface com.google.gwt.user.client.TakesValue<List<M>>
setValue
in interface com.google.gwt.user.client.ui.HasValue<List<M>>
public void setValue(List<M> value, boolean fireEvents)
setValue
in interface com.google.gwt.user.client.ui.HasValue<List<M>>
public void onItemAdded(List<M> oldList, M item)
BindableListChangeHandler
onItemAdded
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the item was appended (equal to the old value of the
list). Never null.item
- the added item. May be null.public void onItemAddedAt(List<M> oldList, int index, M item)
BindableListChangeHandler
onItemAddedAt
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the item was added (equal to the old value of the
list). Never null.index
- the index at which the item has been added.item
- the added item. May be null.public void onItemsAdded(List<M> oldList, Collection<? extends M> items)
BindableListChangeHandler
onItemsAdded
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the items were appended (equal to the old value of
the list). Never null.items
- the added items. May contain null elements.public void onItemsAddedAt(List<M> oldList, int index, Collection<? extends M> item)
BindableListChangeHandler
onItemsAddedAt
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the items were added (equal to the old value of
the list). Never null.index
- the index at which the items have been added.public void onItemsCleared(List<M> oldList)
BindableListChangeHandler
onItemsCleared
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before all items were removed (equal to the old value of
the list). Never null.public void onItemRemovedAt(List<M> oldList, int index)
BindableListChangeHandler
onItemRemovedAt
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the item was removed (equal to the old value of
the list). Never null.index
- the index at which the item has been removed.public void onItemsRemovedAt(List<M> oldList, List<Integer> indexes)
BindableListChangeHandler
onItemsRemovedAt
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the items were removed (equal to the old value of
the list). Never null.public void onItemChanged(List<M> oldList, int index, M item)
BindableListChangeHandler
onItemChanged
in interface BindableListChangeHandler<M>
oldList
- a list representing the state before the item was changed (equal to the old value of
the list). Never null.index
- the index of the item that has changed.item
- the new value of the item at the provided index.
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |