public class ComponentTree extends Object
ComponentTree
is:
ComponentTree component = ComponentTree.create(context, MyComponent.create());
myHostView.setRoot(component);
Modifier and Type | Class and Description |
---|---|
static class |
ComponentTree.Builder
A builder class that can be used to create a
ComponentTree . |
Modifier and Type | Field and Description |
---|---|
static int |
INVALID_ID |
Map<String,List<EventHandler>> |
mEventHandlers |
protected int |
mId |
Modifier | Constructor and Description |
---|---|
protected |
ComponentTree(ComponentTree.Builder builder) |
Modifier and Type | Method and Description |
---|---|
protected com.facebook.litho.LayoutState |
calculateLayoutState(Object lock,
ComponentContext context,
Component<?> root,
int widthSpec,
int heightSpec,
boolean diffingEnabled,
com.facebook.litho.DiffNode diffNode) |
RenderState |
consumePreviousRenderState()
Takes ownership of the
RenderState object from this ComponentTree - this allows the
RenderState to be persisted somewhere and then set back on another ComponentTree using the
ComponentTree.Builder . |
static ComponentTree.Builder |
create(ComponentContext context,
Component.Builder<?,?> root) |
static ComponentTree.Builder |
create(ComponentContext context,
Component<?> root) |
static int |
generateComponentTreeId() |
protected com.facebook.litho.LayoutState |
getBackgroundLayoutState() |
ComponentContext |
getContext() |
LithoView |
getLithoView() |
StateHandler |
getStateHandler()
Provides a new instance from the StateHandler pool that is initialized with the information
from the StateHandler currently held by the ComponentTree.
|
boolean |
isIncrementalMountEnabled()
Returns whether incremental mount is enabled or not in this component.
|
boolean |
isReleased() |
void |
release()
The contract is that in order to release a ComponentTree, you must do so from the main
thread, or guarantee that it will never be accessed from the main thread again.
|
void |
setRoot(Component<?> rootComponent)
Update the root component.
|
void |
setRootAndSizeSpec(Component<?> root,
int widthSpec,
int heightSpec)
Compute a new layout with the given component root and sizes
|
void |
setRootAndSizeSpec(Component<?> root,
int widthSpec,
int heightSpec,
Size output) |
void |
setRootAndSizeSpecAsync(Component<?> root,
int widthSpec,
int heightSpec)
Compute asynchronously a new layout with the given component root and sizes
|
void |
setRootAsync(Component<?> rootComponent) |
void |
setSizeSpec(int widthSpec,
int heightSpec)
Update the width/height spec.
|
void |
setSizeSpec(int widthSpec,
int heightSpec,
Size output)
Same as
setSizeSpec(int, int) but fetches the resulting width/height
in the given Size . |
void |
setSizeSpecAsync(int widthSpec,
int heightSpec) |
public static final int INVALID_ID
protected final int mId
public Map<String,List<EventHandler>> mEventHandlers
protected ComponentTree(ComponentTree.Builder builder)
public static ComponentTree.Builder create(ComponentContext context, Component.Builder<?,?> root)
public static ComponentTree.Builder create(ComponentContext context, Component<?> root)
protected com.facebook.litho.LayoutState getBackgroundLayoutState()
public boolean isIncrementalMountEnabled()
public void setRoot(Component<?> rootComponent)
public void setRootAsync(Component<?> rootComponent)
public void setSizeSpec(int widthSpec, int heightSpec)
public void setSizeSpec(int widthSpec, int heightSpec, Size output)
setSizeSpec(int, int)
but fetches the resulting width/height
in the given Size
.public void setSizeSpecAsync(int widthSpec, int heightSpec)
public void setRootAndSizeSpecAsync(Component<?> root, int widthSpec, int heightSpec)
public void setRootAndSizeSpec(Component<?> root, int widthSpec, int heightSpec)
public void setRootAndSizeSpec(Component<?> root, int widthSpec, int heightSpec, Size output)
@Nullable public LithoView getLithoView()
LithoView
associated with this ComponentTree if any.public StateHandler getStateHandler()
public RenderState consumePreviousRenderState()
RenderState
object from this ComponentTree - this allows the
RenderState to be persisted somewhere and then set back on another ComponentTree using the
ComponentTree.Builder
. See RenderState
for more information on the purpose of this object.public void release()
public boolean isReleased()
public ComponentContext getContext()
protected com.facebook.litho.LayoutState calculateLayoutState(@Nullable Object lock, ComponentContext context, Component<?> root, int widthSpec, int heightSpec, boolean diffingEnabled, @Nullable com.facebook.litho.DiffNode diffNode)
public static int generateComponentTreeId()