public abstract class Section<L extends SectionLifecycle> extends Object implements Cloneable, HasEventDispatcher
Section
that is driven by its matching
SectionLifecycle
. To create new Section
instances, use the
create()
method in the generated SectionLifecycle
subclass which
returns a Section.Builder
that allows you to set values for individual props.
Section
instances are immutable after creation.Modifier and Type | Class and Description |
---|---|
static class |
Section.Builder<L extends SectionLifecycle,T extends Section.Builder<L,T>>
A builder to build a Section with a
SectionLifecycle L. |
Modifier | Constructor and Description |
---|---|
protected |
Section(L lifecycle) |
Modifier and Type | Method and Description |
---|---|
List<Section> |
getChildren() |
EventDispatcher |
getEventDispatcher() |
String |
getGlobalKey() |
L |
getLifecycle() |
abstract String |
getSimpleName()
Mostly used by logging to provide more readable messages.
|
protected SectionLifecycle.StateContainer |
getStateContainer() |
boolean |
isEquivalentTo(Section<?> other)
Compares this section to a different one to check if they are the same
|
Section<L> |
makeShallowCopy() |
Section<L> |
makeShallowCopy(boolean deepCopy) |
void |
setChildren(Children children) |
void |
setCount(int count)
|
void |
setGlobalKey(String key)
Set a unique key for this
Section within its tree. |
void |
setKey(String key)
Sets the key for this Section.
|
protected Section(L lifecycle)
public EventDispatcher getEventDispatcher()
getEventDispatcher
in interface HasEventDispatcher
public void setGlobalKey(String key)
Section
within its tree.public void setKey(String key)
Section.Builder
public void setCount(int count)
public final L getLifecycle()
SectionLifecycle
for this Section
.public Section<L> makeShallowCopy(boolean deepCopy)
Section
.
if deepCopy is false the clone won't contain any children or count as it will
be returned in a pre - ChangeSet generation state.public void setChildren(Children children)
public abstract String getSimpleName()
public boolean isEquivalentTo(Section<?> other)
This is used to be able to skip rendering a section again. We avoid using the 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 SectionLifecycle.StateContainer getStateContainer()