Package com.atlassian.adf.model.node
Class LayoutSection
- java.lang.Object
-
- com.atlassian.adf.model.node.AbstractNode<C>
-
- com.atlassian.adf.model.node.AbstractContentNode<C,N>
-
- com.atlassian.adf.model.node.AbstractMarkedContentNode<LayoutSection,LayoutColumn,LayoutSectionMark>
-
- com.atlassian.adf.model.node.LayoutSection
-
- All Implemented Interfaces:
Element,Node,ContentNode<LayoutSection,LayoutColumn>,DocContent,Marked<LayoutSection,LayoutSectionMark>
@Documentation(state=UNDOCUMENTED, date="2023-07-26") public class LayoutSection extends AbstractMarkedContentNode<LayoutSection,LayoutColumn,LayoutSectionMark> implements DocContent
In Confluence, the top-leveldocnode is allowed to includelayoutSectionnodes. These in turn contain exactly2or3layoutColumnnodes that wrap other content. The effect is similar to declaring atabletable with exactly onetableRowand containing that number oftableCells within that row. Layout sections cannot be nested and are only permitted at the top-level of the document.Note: Jira does not currently support layout sections.
Example
Java
layoutSection(layoutColumn(40).content(p("Hello world") ),layoutColumn(60).content(p("Hello world again") ) );ADF
{ "type": "layoutSection", "content": [ { "type": "layoutColumn", "attrs": { "width": 40 }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Hello world" } ] } ] }, { "type": "layoutColumn", "attrs": { "width": 60 }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Hello world again" } ] } ] } ] }Result
Note: This example output is not using AtlasKit to render the layout section, so while it gives a vague impression of what a "layout section" is, it does not faithfully reproduce the actual presentation in Atlassian products.Hello world Hello world again
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLayoutSection.PartialTypes that represent a partially constructedlayoutSection.-
Nested classes/interfaces inherited from class com.atlassian.adf.model.node.AbstractNode
AbstractNode.ToStringHelper
-
-
Field Summary
Fields Modifier and Type Field Description static intMAXIMUM_LAYOUT_COLUMN_COUNTstatic intMINIMUM_LAYOUT_COLUMN_COUNT-
Fields inherited from class com.atlassian.adf.model.node.AbstractMarkedContentNode
marks
-
Fields inherited from class com.atlassian.adf.model.node.AbstractContentNode
content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Breakout>breakout()LayoutSectionbreakout(Breakout breakout)Class<LayoutColumn>contentClass()ReturnsClass<N>, the class representing the type of items held by this node.LayoutSectioncopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.LayoutSectiondefaultWidth()StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".LayoutSectionfullWidth()static LayoutSection.Partial.NeedsFirstColumnlayoutSection()Creates a partially constructed layout section that will only be complete once exactly2or3layout caloumnshave been added to it.static LayoutSectionlayoutSection(LayoutColumn col1, LayoutColumn col2)Creates a layout section with the given two layout columns as content.static LayoutSectionlayoutSection(LayoutColumn col1, LayoutColumn col2, LayoutColumn col3)Creates a layout section with the given three layout columns as content.Class<LayoutSectionMark>markClass()Returns the type of marks that may be applied to this node.protected voidmarkedContentNodeValidate()Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.protected voidvalidateContentNodeForAppend(LayoutColumn node)Called on each content node before it is added to validate that the node can be accepted.LayoutSectionwide()-
Methods inherited from class com.atlassian.adf.model.node.AbstractMarkedContentNode
appendContentNodeFields, appendMarkedContentNodeFields, contentNodeEquals, contentNodeHashCode, contentNodeValidate, createMarkHolder, mark, mark, markedContentNodeEquals, markedContentNodeHashCode, marks, marks, markTypes, parseMarks, unsupportedMarkFactory
-
Methods inherited from class com.atlassian.adf.model.node.AbstractContentNode
addContent, addContentIfPresent, allNodes, appendNodeFields, appendPlainText, appendPlainTextContentJoinedWith, appendPlainTextInlineContent, clear, content, content, content, content, content, contentFieldMaps, isEmpty, nodeEquals, nodeHashCode, parseContentItem, parseContentItems, parseOptionalContent, parseRequiredContent, parseRequiredContentAllowEmpty, removeIf, replaceContent, requireNotEmpty, transformContent, transformDescendants, trim, validate, validateContentItems
-
Methods inherited from class com.atlassian.adf.model.node.AbstractNode
doubleEq, doubleHash, equals, hashCode, isSupported, mapWithType, numberEq, numberHash, self, toPlainText, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.node.type.ContentNode
allNodes, allNodesOfType, allNodesOfTypeAsList, clear, content, content, content, content, content, isEmpty, removeIf, replaceContent, transformContent, transformDescendants
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
Methods inherited from interface com.atlassian.adf.model.node.Node
appendPlainText, toPlainText
-
-
-
-
Field Detail
-
MINIMUM_LAYOUT_COLUMN_COUNT
public static final int MINIMUM_LAYOUT_COLUMN_COUNT
- See Also:
- Constant Field Values
-
MAXIMUM_LAYOUT_COLUMN_COUNT
public static final int MAXIMUM_LAYOUT_COLUMN_COUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
layoutSection
public static LayoutSection.Partial.NeedsFirstColumn layoutSection()
Creates a partially constructed layout section that will only be complete once exactly2or3layout caloumnshave been added to it.- Returns:
- the incomplete layout section node
-
layoutSection
public static LayoutSection layoutSection(LayoutColumn col1, LayoutColumn col2)
Creates a layout section with the given two layout columns as content. A third column can be added later usingContentNode.content(Node)if desired.- Parameters:
col1- the first columncol2- the second column- Returns:
- the newly constructed layout section
-
layoutSection
public static LayoutSection layoutSection(LayoutColumn col1, LayoutColumn col2, LayoutColumn col3)
Creates a layout section with the given three layout columns as content. This is the maximum number of columns that are permitted, so no more can be added thereafter.- Parameters:
col1- the first columncol2- the second columncol3- the third column- Returns:
- the newly constructed layout section
-
contentClass
public Class<LayoutColumn> contentClass()
Description copied from interface:ContentNodeReturnsClass<N>, the class representing the type of items held by this node.- Specified by:
contentClassin interfaceContentNode<LayoutSection,LayoutColumn>
-
copy
public LayoutSection copy()
Description copied from interface:ElementReturns a deep copy of this element, including copies of any nodes or marks that it contains. The copy will not necessarily be in exactly the same state as the original in some cases. For example, atextnode that is used inside acodeBlockwill have the ability to use marks on it disabled, but a copy made of the text node using this method will not similarly disallow marks unless it is also added to a content node with those same restrictions.Implementations notes:
- Implementations should narrow the return type.
- Implementations should
return thisif the element is immutable. The@Immutableannotation should be used on the class to offer additional confirmation of this intent. - Implementations should
return parse(toMap())if they have state. - While there may be cases where it is worthwhile to do something more efficient than
the conversion to a map and back, this is discouraged because it would add yet another
fragile piece of code that breaks when new data is added to the node. The
parseandtoMapmethods already have to be updated in these circumstances, so it makes sense to take advantage of that.
- Specified by:
copyin interfaceContentNode<LayoutSection,LayoutColumn>- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceMarked<LayoutSection,LayoutSectionMark>- Specified by:
copyin interfaceNode- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
breakout
public LayoutSection breakout(@Nullable Breakout breakout)
-
wide
public LayoutSection wide()
-
fullWidth
public LayoutSection fullWidth()
-
defaultWidth
public LayoutSection defaultWidth()
-
validateContentNodeForAppend
protected void validateContentNodeForAppend(LayoutColumn node)
Description copied from class:AbstractContentNodeCalled on each content node before it is added to validate that the node can be accepted.- Overrides:
validateContentNodeForAppendin classAbstractContentNode<LayoutSection,LayoutColumn>- Parameters:
node- the node that is about to be added
-
markClass
public Class<LayoutSectionMark> markClass()
Description copied from interface:MarkedReturns the type of marks that may be applied to this node.- Specified by:
markClassin interfaceMarked<LayoutSection,LayoutSectionMark>- Specified by:
markClassin classAbstractMarkedContentNode<LayoutSection,LayoutColumn,LayoutSectionMark>- Returns:
- the type of marks that may be applied to this node, which is the concrete type for the generic
type
<M>on this interface.
-
markedContentNodeValidate
protected void markedContentNodeValidate()
- Overrides:
markedContentNodeValidatein classAbstractMarkedContentNode<LayoutSection,LayoutColumn,LayoutSectionMark>
-
-