Class ParagraphSystem


  • public class ParagraphSystem
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String COL_CTL_LAYOUT
      name of the layout property
      static java.lang.String COL_CTL_TYPE
      name of the column control type property
      static Logger log
      default logger
      static java.lang.String PARAMETER_VERSION_DIFF
      Request parameter for the version diff.
      static java.lang.String PARAMETER_VERSION_VIEW
      Request parameter for the version view.
    • Constructor Summary

      Constructors 
      Constructor Description
      ParagraphSystem​(Resource resource)
      Creates a new paragraph system based on the given resource
      ParagraphSystem​(Resource resource, java.lang.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.
      ParagraphSystem​(Resource resource, java.lang.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.
    • Field Detail

      • log

        public static final Logger log
        default logger
      • PARAMETER_VERSION_DIFF

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

        public static final java.lang.String PARAMETER_VERSION_VIEW
        Request parameter for the version view.
        See Also:
        Constant Field Values
      • COL_CTL_TYPE

        public static final java.lang.String COL_CTL_TYPE
        name of the column control type property
        See Also:
        Constant Field Values
      • COL_CTL_LAYOUT

        public static final java.lang.String COL_CTL_LAYOUT
        name of the layout property
        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,
                               java.lang.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,
                               java.lang.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​(java.lang.String colCtrlResourceType)
        Sets the columns control resource type used when fixing the structure
        Parameters:
        colCtrlResourceType - the resource type
      • getDefaultLayout

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

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

        public java.util.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.