public abstract class RenderUnit<MOUNT_CONTENT>
extends java.lang.Object
ContentAllocator
it returns from getContentAllocator method. That content will be
automatically recycled by RenderCore based on their concrete type.
A RenderUnit should in most cases declare how it intends to bind data returning Binders from its mountUnmountFunctions callback or from the attachDetachFunctions callback.
Immutability: RenderUnits should be immutable! Continuing to change them after they are built and given to RenderCore (e.g. via RenderState) is not safe.
Modifier and Type | Class and Description |
---|---|
static interface |
RenderUnit.Binder<MODEL,CONTENT>
Represents a single bind function.
|
static class |
RenderUnit.DelegateBinder<MODEL,CONTENT>
A binder is a pair of data Model and
RenderUnit.Binder . |
static class |
RenderUnit.RenderType |
Constructor and Description |
---|
RenderUnit(RenderUnit.RenderType renderType) |
RenderUnit(RenderUnit.RenderType renderType,
java.util.List<RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>> mountBinders) |
RenderUnit(RenderUnit.RenderType type,
java.util.List<RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>> mountBinders,
java.util.List<RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>> attachBinders) |
Modifier and Type | Method and Description |
---|---|
void |
addAttachBinder(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT> binder)
Adds an
RenderUnit.DelegateBinder that will be invoked with the other attach/detach binders. |
void |
addAttachBinders(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>... binders)
Adds an
RenderUnit.DelegateBinder s that will be invoked with the other attach/detach binders. |
void |
addMountBinder(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT> binder)
Adds an
RenderUnit.DelegateBinder that will be invoked with the other mount/unmount binders. |
void |
addMountBinders(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>... binders)
Adds
RenderUnit.DelegateBinder s that will be invoked with the other mount/unmount binders. |
protected void |
attachBinders(Context context,
MOUNT_CONTENT content,
java.lang.Object layoutData,
Systracer tracer)
Bind all attachDetach binder functions.
|
protected void |
detachBinders(Context context,
MOUNT_CONTENT content,
java.lang.Object layoutData,
Systracer tracer)
Unbind all attachDetach binder functions.
|
boolean |
doesMountRenderTreeHosts()
Override this method to indicate if a
RenderUnit has nested RenderTreeHost s, it
will ensure that they are notified when this RenderUnit 's bounds change and visibility
events are processed correctly for them. |
protected java.util.List<RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> |
getAttachBinders() |
protected java.util.Map<java.lang.Class<?>,RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> |
getAttachBinderTypeToDelegateMap() |
abstract ContentAllocator<MOUNT_CONTENT> |
getContentAllocator() |
java.lang.String |
getDescription() |
abstract long |
getId() |
protected java.util.List<RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> |
getMountBinders() |
protected java.util.Map<java.lang.Class<?>,RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> |
getMountBinderTypeToDelegateMap() |
java.lang.Class<?> |
getRenderContentType() |
RenderUnit.RenderType |
getRenderType() |
protected void |
mountBinders(Context context,
MOUNT_CONTENT content,
java.lang.Object layoutData,
Systracer tracer)
Bind all mountUnmount binder functions.
|
protected void |
onEndUpdateRenderUnit() |
protected void |
onStartUpdateRenderUnit() |
protected void |
unmountBinders(Context context,
MOUNT_CONTENT content,
java.lang.Object layoutData,
Systracer tracer)
Unbind all mountUnmount binder functions.
|
public RenderUnit(RenderUnit.RenderType renderType)
public RenderUnit(RenderUnit.RenderType renderType, java.util.List<RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>> mountBinders)
public RenderUnit(RenderUnit.RenderType type, java.util.List<RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>> mountBinders, java.util.List<RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>> attachBinders)
public RenderUnit.RenderType getRenderType()
public abstract ContentAllocator<MOUNT_CONTENT> getContentAllocator()
public abstract long getId()
protected java.util.Map<java.lang.Class<?>,RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> getMountBinderTypeToDelegateMap()
protected java.util.List<RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> getMountBinders()
protected java.util.Map<java.lang.Class<?>,RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> getAttachBinderTypeToDelegateMap()
protected java.util.List<RenderUnit.DelegateBinder<?,MOUNT_CONTENT>> getAttachBinders()
public java.lang.Class<?> getRenderContentType()
protected void onStartUpdateRenderUnit()
protected void onEndUpdateRenderUnit()
public java.lang.String getDescription()
public void addMountBinder(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT> binder)
RenderUnit.DelegateBinder
that will be invoked with the other mount/unmount binders. Can
be used to add generic functionality (e.g. accessibility) to a RenderUnit.
NB: This method should only be called while initially configuring the RenderUnit. See the class-level javadocs about immutability.
@SafeVarargs public final void addMountBinders(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>... binders)
RenderUnit.DelegateBinder
s that will be invoked with the other mount/unmount binders. Can be
used to add generic functionality (e.g. accessibility) to a RenderUnit.
NB: This method should only be called while initially configuring the RenderUnit. See the class-level javadocs about immutability.
public void addAttachBinder(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT> binder)
RenderUnit.DelegateBinder
that will be invoked with the other attach/detach binders. Can
be used to add generic functionality (e.g. Dynamic Props) to a RenderUnit
NB: This method should only be called while initially configuring the RenderUnit. See the class-level javadocs about immutability.
@SafeVarargs public final void addAttachBinders(RenderUnit.DelegateBinder<?,? super MOUNT_CONTENT>... binders)
RenderUnit.DelegateBinder
s that will be invoked with the other attach/detach binders. Can
be used to add generic functionality (e.g. Dynamic Props) to a RenderUnit
NB: This method should only be called while initially configuring the RenderUnit. See the class-level javadocs about immutability.
public boolean doesMountRenderTreeHosts()
RenderUnit
has nested RenderTreeHost
s, it
will ensure that they are notified when this RenderUnit
's bounds change and visibility
events are processed correctly for them.true
to ensure nested RenderTreeHost
s are notified about parent's
bounds change, otherwise false
protected void mountBinders(Context context, MOUNT_CONTENT content, java.lang.Object layoutData, Systracer tracer)
protected void unmountBinders(Context context, MOUNT_CONTENT content, java.lang.Object layoutData, Systracer tracer)
protected void attachBinders(Context context, MOUNT_CONTENT content, java.lang.Object layoutData, Systracer tracer)
protected void detachBinders(Context context, MOUNT_CONTENT content, java.lang.Object layoutData, Systracer tracer)