T
- the type of the items supported by the list@Tag(value="iron-list") @NpmPackage(value="@polymer/iron-list", version="3.1.0") @JsModule(value="@polymer/iron-list/iron-list.js") @JsModule(value="./flow-component-renderer.js") @JsModule(value="./ironListConnector.js") @JsModule(value="./ironListStyles.js") public class IronList<T> extends Component implements HasDataProvider<T>, HasStyle, HasSize, Focusable<IronList<T>>
<iron-list>
webcomponent.
It supports DataProvider
s to load data asynchronously and
TemplateRenderer
s to render the markup for each item.
For this component to work properly, it needs to have a well defined
height
. It can be an absolute height, like 100px
, or a
relative height inside a container with well defined height.
For list rendered in grid layout (setting setGridLayout(boolean)
with true
), the width
of the component also needs to be
well defined.
BlurNotifier.BlurEvent<C extends Component>
FocusNotifier.FocusEvent<C extends Component>
Constructor and Description |
---|
IronList()
Creates an empty list.
|
Modifier and Type | Method and Description |
---|---|
DataCommunicator<T> |
getDataCommunicator()
Returns the data communicator of this list.
|
DataProvider<T,?> |
getDataProvider()
Returns the data provider of this list.
|
T |
getPlaceholderItem()
Gets the placeholder item of this list, or
null if none has
been set. |
boolean |
isGridLayout()
Gets whether this list is rendered in a grid layout instead of a linear
list.
|
void |
onEnabledStateChanged(boolean enabled)
Handle component enable state when the enabled state changes.
|
void |
setDataProvider(DataProvider<T,?> dataProvider)
Sets the data provider for this listing.
|
void |
setGridLayout(boolean gridLayout)
Sets this list to be rendered as a grid.
|
void |
setPlaceholderItem(T placeholderItem)
Sets an item to be shown as placeholder in the list while the real data
in being fetched from the server.
|
void |
setRenderer(Renderer<T> renderer)
Sets a renderer for the items in the list, by using a
TemplateRenderer . |
void |
setRenderer(ValueProvider<T,String> valueProvider)
Sets a renderer for the items in the list, by using a
ValueProvider . |
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setItems
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
getCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
addBlurListener
addFocusListener
isEnabled, setEnabled
getElement
addAttachListener
addDetachListener
public void setDataProvider(DataProvider<T,?> dataProvider)
HasDataProvider
setDataProvider
in interface HasDataProvider<T>
dataProvider
- the data provider, not nullpublic DataProvider<T,?> getDataProvider()
null
public DataCommunicator<T> getDataCommunicator()
null
public void setRenderer(ValueProvider<T,String> valueProvider)
ValueProvider
. The String returned by the provider is used to
render each item.valueProvider
- a provider for the label string for each item in the list, not
null
public void setRenderer(Renderer<T> renderer)
TemplateRenderer
. The template returned by the renderer is used
to render each item.
When set, a same renderer is used for the placeholder item. See
setPlaceholderItem(Object)
for details.
renderer
- a renderer for the items in the list, not null
public void setPlaceholderItem(T placeholderItem)
Setting a placeholder item improves the user experience of the list while
scrolling, since the placeholder uses the same renderer set with
#setRenderer(TemplateRenderer)
, maintaining the same height for
placeholders and actual items.
When no placeholder item is set (or when set to null
), an
empty placeholder element is created with 100px
of width and
18px
of height.
Note: when using ComponentTemplateRenderer
s, the component used
for the placeholder is statically stamped in the list. It can not be
modified, nor receives any events.
placeholderItem
- the item used as placeholder in the list, while the real data
is being fetched from the serverpublic T getPlaceholderItem()
null
if none has
been set.public boolean isGridLayout()
true
if the list renders itself as a grid,
false
otherwisepublic void setGridLayout(boolean gridLayout)
width
and height
.gridLayout
- true
to make the list renders itself as a grid,
false
to make it render as a linear listpublic void onEnabledStateChanged(boolean enabled)
Component
By default this sets or removes the 'disabled' attribute from the element. This can be overridden to have custom handling.
onEnabledStateChanged
in class Component
enabled
- the new enabled state of the componentCopyright © 2021. All rights reserved.