Class 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-level doc node is allowed to include layoutSection nodes. These in turn contain exactly 2 or 3 layoutColumn nodes that wrap other content. The effect is similar to declaring a table table with exactly one tableRow and containing that number of tableCells 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

    Hello world Hello world again
    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.
    • 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 layoutSection​(LayoutColumn col1,
                                                  LayoutColumn col2)
        Creates a layout section with the given two layout columns as content. A third column can be added later using ContentNode.content(Node) if desired.
        Parameters:
        col1 - the first column
        col2 - 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 column
        col2 - the second column
        col3 - the third column
        Returns:
        the newly constructed layout section
      • copy

        public LayoutSection copy()
        Description copied from interface: Element
        Returns 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, a text node that is used inside a codeBlock will 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 this if the element is immutable. The @Immutable annotation 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 parse and toMap methods already have to be updated in these circumstances, so it makes sense to take advantage of that.
        Specified by:
        copy in interface ContentNode<LayoutSection,​LayoutColumn>
        Specified by:
        copy in interface Element
        Specified by:
        copy in interface Marked<LayoutSection,​LayoutSectionMark>
        Specified by:
        copy in interface Node
        Returns:
        a copy of this element, or this if the element is immutable anyway
      • elementType

        public String elementType()
        Description copied from interface: Element
        The type value that identifies this element, such as "paragraph" or "strong".
        Specified by:
        elementType in interface Element
      • toMap

        public Map<String,​?> toMap()
        Description copied from interface: Element
        Transforms this element to a map of String values to various basic object types suitable for direct rendering as JSON content.
        Specified by:
        toMap in interface Element
        Returns:
        the map representation of this ADF element