Package com.day.cq.wcm.api.designer
Interface Design
-
public interface DesignProvides methods to access design information.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNN_STYLESName of the node that holds special component stylesstatic java.lang.StringPN_DOCTYPEName of the property that defines the doctype of a designstatic java.lang.StringPN_STYLE_EXCLUDED_COMPONENTSName of the property that defines components that are included when the style is generated via thegetStyle(Resource, boolean)call
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Map<java.lang.String,ComponentStyle>getComponentStyles(Cell cell)Returns the component styles for the given cell.ResourcegetContentResource()Returns the resource of the design content ornullif this design has no content.java.lang.StringgetCssPath()Returns the path of the css file for this designDoctypegetDoctype(Style currentStyle)Returns the doctype of the current style, as defined in the "cq:doctype" property.java.lang.StringgetId()Returns the id of the design.java.lang.StringgetJSON()Returns a json representation of this designjava.util.CalendargetLastModified()Returns the time when the design was last modified ornullif this information is not available or if the design has no content.java.lang.StringgetPath()Returns the path of the designjava.lang.StringgetStaticCssPath()Returns the path of the static css file for this design ornullif no such file exists.StylegetStyle(Cell cell)Returns the style for the given cell.StylegetStyle(java.lang.String path)Returns the style for the given cell path.StylegetStyle(Resource res)Returns the style for the given resource.StylegetStyle(Resource res, boolean ignoreExcludedComponents)Returns the style for the given resourcebooleanhasContent()Checks if this design has content attached.voidwriteCSS(java.io.Writer out, boolean includeCustom)Writes the dynamic CSS of this design to the given writer.voidwriteCssIncludes(java.io.Writer out)Convenience method that writes the CSS include strings to the given writer.voidwriteCssIncludes(java.io.Writer out, Doctype doctype)Convenience method that writes the CSS include strings to the given writer.voidwriteCssIncludes(javax.servlet.jsp.PageContext page)Convenience method that writes the CSS include strings to the response.
-
-
-
Field Detail
-
PN_DOCTYPE
static final java.lang.String PN_DOCTYPE
Name of the property that defines the doctype of a design- Since:
- 5.4
- See Also:
- Constant Field Values
-
NN_STYLES
static final java.lang.String NN_STYLES
Name of the node that holds special component styles- Since:
- 5.4
- See Also:
- Constant Field Values
-
PN_STYLE_EXCLUDED_COMPONENTS
static final java.lang.String PN_STYLE_EXCLUDED_COMPONENTS
Name of the property that defines components that are included when the style is generated via thegetStyle(Resource, boolean)call- See Also:
- Constant Field Values
-
-
Method Detail
-
getPath
java.lang.String getPath()
Returns the path of the design- Returns:
- the path of the design
-
getId
java.lang.String getId()
Returns the id of the design.- Returns:
- the id of the design.
-
getContentResource
Resource getContentResource()
Returns the resource of the design content ornullif this design has no content.- Returns:
- resource or
null - See Also:
hasContent()
-
hasContent
boolean hasContent()
Checks if this design has content attached.- Returns:
trueif this design has content;falseotherwise.
-
getStyle
Style getStyle(java.lang.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 resourceNote 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 resourceignoreExcludedComponents- whether to ignore excluded components- Returns:
- the style
- Since:
- 6.2
- See Also:
PN_STYLE_EXCLUDED_COMPONENTS
-
getCssPath
java.lang.String getCssPath()
Returns the path of the css file for this design- Returns:
- the path of the css file.
-
getStaticCssPath
java.lang.String getStaticCssPath()
Returns the path of the static css file for this design ornullif no such file exists.- Returns:
- the path of the static css file or
null
-
writeCssIncludes
void writeCssIncludes(java.io.Writer out) throws java.io.IOExceptionConvenience method that writes the CSS include strings to the given writer. This assumes a non XHTML doctype.- Parameters:
out- the writer- Throws:
java.io.IOException- if an I/O error occurs
-
writeCssIncludes
void writeCssIncludes(java.io.Writer out, Doctype doctype) throws java.io.IOExceptionConvenience method that writes the CSS include strings to the given writer. The specified doctype ensures proper empty elements for XHTML types. Ifdoctypeisnull,Doctype.HTML_401_STRICTis used.- Parameters:
out- the writerdoctype- doctype of the document the include is written to.- Throws:
java.io.IOException- if an I/O error occurs
-
writeCssIncludes
void writeCssIncludes(javax.servlet.jsp.PageContext page) throws java.io.IOExceptionConvenience method that writes the CSS include strings to the response. It uses theDoctypedefined in the request or defaults toDoctype.HTML_401_STRICTif non defined.- Parameters:
page- the jsp page context- Throws:
java.io.IOException- if an I/O error occurs- Since:
- 5.3
-
writeCSS
void writeCSS(java.io.Writer out, boolean includeCustom) throws java.io.IOException, javax.jcr.RepositoryExceptionWrites the dynamic CSS of this design to the given writer.- Parameters:
out- writer to write toincludeCustom- iftruenon-CSS rules are included as comments- Throws:
javax.jcr.RepositoryException- if a repository error occursjava.io.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 ifcurrentStyleisnull, the property is searched on the toplevel node. the value of the property needs to be a name of aDoctypeenum. if any of the above fails,Doctype.XHTML_10_STRICTis returned.- Parameters:
currentStyle- current style ornull- Returns:
- the doctype
- Since:
- 5.4
-
getComponentStyles
java.util.Map<java.lang.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
java.lang.String getJSON()
Returns a json representation of this design- Returns:
- a json string
- Since:
- 5.4
-
getLastModified
java.util.Calendar getLastModified()
Returns the time when the design was last modified ornullif this information is not available or if the design has no content.- Returns:
- last modification date or
null - Since:
- 5.4
-
-