Class ParagraphSystem


  • public class ParagraphSystem
    extends Object
    Provides helper methods for drawing a paragraph system. It detects columns control resources and adds the respective paragraph type and columns control information to the paragraphs.
    • Field Detail

      • log

        public static final Logger log
        default logger
      • PARAMETER_VERSION_DIFF

        public static final String PARAMETER_VERSION_DIFF
        Request parameter for the version diff.
        See Also:
        Constant Field Values
      • PARAMETER_VERSION_VIEW

        public static final String PARAMETER_VERSION_VIEW
        Request parameter for the version view.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ParagraphSystem

        public ParagraphSystem​(Resource resource)
        Creates a new paragraph system based on the given resource
        Parameters:
        resource - underlying resource
      • ParagraphSystem

        public ParagraphSystem​(Resource resource,
                               String versionLabel)
        Creates a new paragraph system based on the given resource and sets up the paragraph system to compare itself to a versioned resource. If the specified version does not exists, the paragraph system is displayed as if no version has been specified.
        Parameters:
        resource - underlying resource
        versionLabel - optional version label for comparing.
        Since:
        5.2
      • ParagraphSystem

        public ParagraphSystem​(Resource resource,
                               String versionLabel,
                               boolean isVersionDiff)
        Creates a new paragraph system based on the given resource and sets up the paragraph system to compare itself to a versioned resource. If the specified version does not exists, the paragraph system is displayed as if no version has been specified.
        Parameters:
        resource - underlying resource
        versionLabel - optional version label for comparing.
        isVersionDiff - true if this parsys is used for version diffing
        Since:
        5.2
    • Method Detail

      • create

        public static ParagraphSystem create​(Resource resource,
                                             SlingHttpServletRequest req)
        Create the paragraph system based on the given request. This method takes the current resource from the request and evaluates possible request parameters (for version diff etc.
        Parameters:
        resource - resource
        req - request
        Returns:
        paragraph system
      • setColCtrlResourceType

        public void setColCtrlResourceType​(String colCtrlResourceType)
        Sets the columns control resource type used when fixing the structure
        Parameters:
        colCtrlResourceType - the resource type
      • getDefaultLayout

        public String getDefaultLayout()
        Returns the default layout
        Returns:
        the default layout
      • setDefaultLayout

        public void setDefaultLayout​(String defaultLayout)
        Sets the default layout in the format: numCols;cssClass
        Parameters:
        defaultLayout - default layout
      • paragraphs

        public List<Paragraph> paragraphs()
        Returns the list of paragraphs of this system
        Returns:
        the list of paragraphs
      • repair

        public void repair()
        Checks the structure of this paragraph system and fixes it. note that the changes are not saved.