public class Section extends com.yahoo.component.provider.FreezableClass implements PageElement
Modifier and Type | Field and Description |
---|---|
private List<PageElement> |
elements
The elements of this - sources, subsections etc.
|
private String |
id |
private Layout |
layout |
private int |
max |
private int |
min |
private static AtomicInteger |
nextId |
private Sorting |
order |
private String |
region |
private List<PageElement> |
renderers
Filtered versions of elements pre-calculated at freeze time
|
private List<PageElement> |
sections
Filtered versions of elements pre-calculated at freeze time
|
private List<PageElement> |
sources
Filtered versions of elements pre-calculated at freeze time
|
Constructor and Description |
---|
Section() |
Section(String id)
Creates a section with an id (or null if no id)
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PageTemplateVisitor visitor)
Accepts a visitor to this structure
|
private List<PageElement> |
createElementList(Class pageTemplateModelElementClass) |
List<PageElement> |
elements()
Returns the elements of this - sources, subsections and presentations and/or choices of these,
as a live reference which can be modified to change the content of this (unless this is frozen).
|
List<PageElement> |
elements(Class pageTemplateModelElementClass)
Convenience method which returns the elements and choices of the given type in elements as a
read-only list.
|
void |
freeze() |
String |
getId()
Returns a unique id of this section within the page.
|
Layout |
getLayout()
Returns the layout identifier describing the kind of layout which should be used by the rendering engine to
lay out the content of this section.
|
int |
getMax()
Returns max number of (immediate) elements/sections permissible within this, -1 means unrestricted.
|
int |
getMin()
Returns min number of (immediate) elements/sections desired within this, -1 means unrestricted.
|
Sorting |
getOrder()
Returns the choice of ways to sort immediate children in this, or empty meaning sort by default order (relevance)
|
String |
getRegion()
Returns the identifier telling the layout of the containing section where this section should be placed.
|
void |
setLayout(Layout layout)
Sets the layout.
|
void |
setMax(int max) |
void |
setMin(int min) |
void |
setOrder(Sorting order) |
void |
setRegion(String region) |
String |
toString() |
clone, ensureNotFrozen, isFrozen
private final String id
private Layout layout
private String region
private List<PageElement> elements
private List<PageElement> sections
private List<PageElement> sources
private List<PageElement> renderers
private int max
private int min
private Sorting order
private static AtomicInteger nextId
public Section()
public Section(String id)
public String getId()
public Layout getLayout()
public void setLayout(Layout layout)
public String getRegion()
public void setRegion(String region)
public List<PageElement> elements()
All elements are kept in a single list to allow multiple elements of each type to be nested within separate choices, and to maintain the internal order of elements of various types, which is sometimes significant. To extract a certain kind of elements (say, sources), the element list must be traversed to collect all source elements as well as all choices of sources.
This list is never null but may be empty.
public List<PageElement> elements(Class pageTemplateModelElementClass)
pageTemplateModelElementClass
- type to returns elements and choices of, a subtype of PageElementprivate List<PageElement> createElementList(Class pageTemplateModelElementClass)
public Sorting getOrder()
public void setOrder(Sorting order)
public int getMax()
public void setMax(int max)
public int getMin()
public void setMin(int min)
public void freeze()
freeze
in interface com.yahoo.component.provider.Freezable
freeze
in class com.yahoo.component.provider.FreezableClass
public void accept(PageTemplateVisitor visitor)
accept
in interface PageElement
Copyright © 2018. All rights reserved.