public abstract class Component<L extends ComponentLifecycle> extends Object implements HasEventDispatcher, HasEventTrigger
ComponentLifecycle
. To create new Component
instances, use the
create()
method in the generated ComponentLifecycle
subclass which
returns a builder that allows you to set values for individual props. Component
instances are immutable after creation.Modifier and Type | Class and Description |
---|---|
static class |
Component.Builder<L extends ComponentLifecycle,T extends Component.Builder<L,T>> |
Modifier | Constructor and Description |
---|---|
protected |
Component(L lifecycle) |
Modifier and Type | Method and Description |
---|---|
protected void |
clearCachedLayout() |
protected void |
copyInterStageImpl(Component<L> component) |
EventDispatcher |
getEventDispatcher() |
EventTriggerTarget |
getEventTriggerTarget() |
protected int |
getId() |
L |
getLifecycle() |
ComponentContext |
getScopedContext() |
abstract String |
getSimpleName()
Mostly used by logging to provide more readable messages.
|
protected ComponentLifecycle.StateContainer |
getStateContainer() |
boolean |
isEquivalentTo(Component<?> other)
Compares this component to a different one to check if they are the same
This is used to be able to skip rendering a component again.
|
Component<L> |
makeShallowCopy() |
void |
measure(ComponentContext c,
int widthSpec,
int heightSpec,
Size outputSize)
Measure a component with the given
SizeSpec constrain. |
protected void |
releaseCachedLayout() |
void |
setScopedContext(ComponentContext scopedContext) |
static boolean |
willRender(ComponentLayout componentLayout) |
protected Component(L lifecycle)
public abstract String getSimpleName()
public boolean isEquivalentTo(Component<?> other)
Object.equals(Object)
so we can optimize the code better over time since we don't have
to adhere to the contract required for a equals method.other
- the component to compare toprotected ComponentLifecycle.StateContainer getStateContainer()
public ComponentContext getScopedContext()
public void setScopedContext(ComponentContext scopedContext)
protected int getId()
protected void releaseCachedLayout()
protected void clearCachedLayout()
public L getLifecycle()
public void measure(ComponentContext c, int widthSpec, int heightSpec, Size outputSize)
SizeSpec
constrain.c
- ComponentContext
.widthSpec
- Width SizeSpec
constrain.heightSpec
- Height SizeSpec
constrain.outputSize
- Size object that will be set with the measured dimensions.public static boolean willRender(ComponentLayout componentLayout)
public EventDispatcher getEventDispatcher()
getEventDispatcher
in interface HasEventDispatcher
public EventTriggerTarget getEventTriggerTarget()
getEventTriggerTarget
in interface HasEventTrigger