Class Section
java.lang.Object
com.yahoo.component.provider.FreezableClass
com.yahoo.search.pagetemplates.model.Section
- All Implemented Interfaces:
com.yahoo.component.provider.Freezable
,PageElement
An element of a page template corresponding to a physical area of the layout of the final physical page.
Pages are freezable - once frozen calling a setter will cause an IllegalStateException, and returned
live collection references are unmodifiable
- Author:
- bratseth
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(PageTemplateVisitor visitor) Accepts a visitor to this structureelements()
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).Convenience method which returns the elements and choices of the given type in elements as a read-only list.void
freeze()
getId()
Returns a unique id of this section within the page.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.getOrder()
Returns the choice of ways to sort immediate children in this, or empty meaning sort by default order (relevance)Returns the identifier telling the layout of the containing section where this section should be placed.void
Sets the layout.void
setMax
(int max) void
setMin
(int min) void
void
toString()
Methods inherited from class com.yahoo.component.provider.FreezableClass
clone, ensureNotFrozen, isFrozen
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.yahoo.component.provider.Freezable
isFrozen
-
Constructor Details
-
Section
public Section() -
Section
Creates a section with an id (or null if no id)
-
-
Method Details
-
getId
Returns a unique id of this section within the page. Used for referencing and identification. Never null. -
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. This is never null. Default: "column". -
setLayout
Sets the layout. If the layout is set to null it will become Layout.column -
getRegion
Returns the identifier telling the layout of the containing section where this section should be placed. Permissible values, and whether this is mandatory is determined by the particular layout identifier of the parent. May be null if a placement is not required by the containing layout, or if this is the top-level section. This is null by default. -
setRegion
-
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).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.
-
elements
Convenience method which returns the elements and choices of the given type in elements as a read-only list. Not that as this returns both concrete elements and choices betwen them, the list element cannot be case to the given class - this must be used in conjunction with a resolve which contains the resolution to the choices.- Parameters:
pageTemplateModelElementClass
- type to returns elements and choices of, a subtype of PageElement
-
getOrder
Returns the choice of ways to sort immediate children in this, or empty meaning sort by default order (relevance) -
setOrder
-
getMax
public int getMax()Returns max number of (immediate) elements/sections permissible within this, -1 means unrestricted. Default: -1. -
setMax
public void setMax(int max) -
getMin
public int getMin()Returns min number of (immediate) elements/sections desired within this, -1 means unrestricted. Default: -1. -
setMin
public void setMin(int min) -
freeze
public void freeze()- Specified by:
freeze
in interfacecom.yahoo.component.provider.Freezable
- Overrides:
freeze
in classcom.yahoo.component.provider.FreezableClass
-
accept
Accepts a visitor to this structure- Specified by:
accept
in interfacePageElement
-
toString
-