public final class DataDiffSection<T> extends SectionLifecycle
DiffSectionSpec
that creates a changeSet diffing a generic List
of data.
This Section
emits the following events:
RenderEvent
whenever it needs a Component
to render a model T from the list of
data. Providing an handler for this OnEvent
is mandatory.
OnCheckIsSameItemEvent
whenever during a diffing it wants to check whether two items
represent the same piece of data.
OnCheckIsSameContentEvent
whenever during a diffing it wants to check whether two items
that represent the same piece of data have exactly the same content.
For example:
{@code
com.facebook.litho.sections.common.DataDiffSectionSpec
Modifier and Type | Class and Description |
---|---|
static class |
DataDiffSection.Builder<T> |
SectionLifecycle.StateContainer, SectionLifecycle.StateUpdate
Modifier and Type | Method and Description |
---|---|
static <T> DataDiffSection.Builder<T> |
create(SectionContext context) |
protected void |
generateChangeSet(SectionContext c,
ChangeSet changeSet,
Section _prevAbstractImpl,
Section _nextAbstractImpl)
This method will delegate to the
DiffSectionSpec
method annotated with OnDiff |
static EventHandler |
getOnCheckIsSameContentEventHandler(SectionContext context) |
static EventHandler |
getOnCheckIsSameItemEventHandler(SectionContext context) |
static EventHandler |
getRenderEventHandler(SectionContext context) |
protected boolean |
isDiffSectionSpec() |
acquireDiff, acquireOutput, bindService, createChildren, createInitialState, createService, dataBound, dispatchLoadingEvent, dispatchOnEvent, getLoadingEventHandler, getService, getTreePropsForChildren, newEventHandler, newEventHandler, populateTreeProps, refresh, releaseDiff, releaseOutput, requestFocus, requestFocus, requestFocus, requestFocusWithOffset, requestFocusWithOffset, shouldUpdate, transferService, transferState, unbindService, viewportChanged
public static <T> DataDiffSection.Builder<T> create(SectionContext context)
public static EventHandler getOnCheckIsSameContentEventHandler(SectionContext context)
public static EventHandler getOnCheckIsSameItemEventHandler(SectionContext context)
public static EventHandler getRenderEventHandler(SectionContext context)
protected void generateChangeSet(SectionContext c, ChangeSet changeSet, Section _prevAbstractImpl, Section _nextAbstractImpl)
SectionLifecycle
DiffSectionSpec
method annotated with OnDiff
generateChangeSet
in class SectionLifecycle
protected boolean isDiffSectionSpec()
isDiffSectionSpec
in class SectionLifecycle