Interface Design


  • @ProviderType
    public interface Design
    Provides methods to access design information.
    • Method Detail

      • getPath

        String getPath()
        Returns the path of the design
        Returns:
        the path of the design
      • getId

        String getId()
        Returns the id of the design.
        Returns:
        the id of the design.
      • getContentResource

        Resource getContentResource()
        Returns the resource of the design content or null if this design has no content.
        Returns:
        resource or null
        See Also:
        hasContent()
      • hasContent

        boolean hasContent()
        Checks if this design has content attached.
        Returns:
        true if this design has content; false otherwise.
      • getStyle

        Style getStyle​(String path)
        Returns the style for the given cell path. If the style is not defined and empty style is returned. Please note that this form of addressing does not respect style inheritance via the cell stack.
        Parameters:
        path - the path of the cell
        Returns:
        the style
      • getStyle

        Style getStyle​(Cell cell)
        Returns the style for the given cell. The returned style will respect cell stack inheritance.
        Parameters:
        cell - the cell
        Returns:
        the style
      • getStyle

        Style getStyle​(Resource res)
        Returns the style for the given resource. Note that only the content structure of the resource is respected and not the component include hierarchy.
        Parameters:
        res - resource
        Returns:
        the style
        Since:
        5.4
      • getStyle

        Style getStyle​(Resource res,
                       boolean ignoreExcludedComponents)
        Returns the style for the given resource

        Note that only the content structure of the resource is respected and not the component include hierarchy.

        The hierarchy may be modified by removing certain components based on the information from the request if the ignoreExcludedComponents parameter is set to true. Excluded components are defined in the design with the "cq:styleExcludedComponents" property.

        Parameters:
        res - the resource
        ignoreExcludedComponents - whether to ignore excluded components
        Returns:
        the style
        Since:
        6.2
        See Also:
        PN_STYLE_EXCLUDED_COMPONENTS
      • getCssPath

        String getCssPath()
        Returns the path of the css file for this design
        Returns:
        the path of the css file.
      • getStaticCssPath

        String getStaticCssPath()
        Returns the path of the static css file for this design or null if no such file exists.
        Returns:
        the path of the static css file or null
      • writeCssIncludes

        void writeCssIncludes​(Writer out)
                       throws IOException
        Convenience method that writes the CSS include strings to the given writer. This assumes a non XHTML doctype.
        Parameters:
        out - the writer
        Throws:
        IOException - if an I/O error occurs
      • writeCssIncludes

        void writeCssIncludes​(Writer out,
                              Doctype doctype)
                       throws IOException
        Convenience method that writes the CSS include strings to the given writer. The specified doctype ensures proper empty elements for XHTML types. If doctype is null, Doctype.HTML_401_STRICT is used.
        Parameters:
        out - the writer
        doctype - doctype of the document the include is written to.
        Throws:
        IOException - if an I/O error occurs
      • writeCssIncludes

        void writeCssIncludes​(PageContext page)
                       throws IOException
        Convenience method that writes the CSS include strings to the response. It uses the Doctype defined in the request or defaults to Doctype.HTML_401_STRICT if non defined.
        Parameters:
        page - the jsp page context
        Throws:
        IOException - if an I/O error occurs
        Since:
        5.3
      • writeCSS

        void writeCSS​(Writer out,
                      boolean includeCustom)
               throws IOException,
                      RepositoryException
        Writes the dynamic CSS of this design to the given writer.
        Parameters:
        out - writer to write to
        includeCustom - if true non-CSS rules are included as comments
        Throws:
        RepositoryException - if a repository error occurs
        IOException - if an I/O error occurs
      • getDoctype

        Doctype getDoctype​(Style currentStyle)
        Returns the doctype of the current style, as defined in the "cq:doctype" property. If the property does not exist or if currentStyle is null, the property is searched on the toplevel node. the value of the property needs to be a name of a Doctype enum. if any of the above fails, Doctype.XHTML_10_STRICT is returned.
        Parameters:
        currentStyle - current style or null
        Returns:
        the doctype
        Since:
        5.4
      • getComponentStyles

        Map<String,​ComponentStyle> getComponentStyles​(Cell cell)
        Returns the component styles for the given cell.
        Parameters:
        cell - the cell
        Returns:
        the map of component styles
        Since:
        5.4
      • getJSON

        String getJSON()
        Returns a json representation of this design
        Returns:
        a json string
        Since:
        5.4
      • getLastModified

        Calendar getLastModified()
        Returns the time when the design was last modified or null if this information is not available or if the design has no content.
        Returns:
        last modification date or null
        Since:
        5.4