Package com.day.cq.wcm.api.components
Interface EditContext
-
public interface EditContextThe edit context is used to define the edit behaviour of components. There is a context opened for every included component that can be edited (or designed). A component can be edited if it provides aEditConfig.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.String name)Returns the context attribute for the given nameComponentgetComponent()Returns the primary edit component for this context.ComponentContextgetComponentContext()Returns the primary component context that is bound to this edit context.EditConfiggetEditConfig()Retrieves the edit config for the current component respecting the context hierarchy.EditContextgetParent()Returns the parent edit context ornullif this context is the root context.EditContextgetRoot()Returns the root edit context.voidincludeEpilog(SlingHttpServletRequest req, SlingHttpServletResponse resp, WCMMode mode)Includes the html epilog of this context into the response.voidincludeProlog(SlingHttpServletRequest req, SlingHttpServletResponse resp, WCMMode mode)Includes the html prolog needed for editingbooleanisRoot()Checks if this is the root edit context.java.lang.ObjectsetAttribute(java.lang.String name, java.lang.Object value)Sets a context attribute with the given name.voidsetContentPath(java.lang.String path)Sets the content path that is used when including the java script call for the edit bars.
-
-
-
Method Detail
-
isRoot
boolean isRoot()
Checks if this is the root edit context.- Returns:
trueif this is the root edit context
-
getParent
EditContext getParent()
Returns the parent edit context ornullif this context is the root context.- Returns:
- the parent context or
null
-
getRoot
EditContext getRoot()
Returns the root edit context.- Returns:
- the root edit context.
-
getComponentContext
ComponentContext getComponentContext()
Returns the primary component context that is bound to this edit context. Note that en edit context can span several component context if components are included that do not need editing.- Returns:
- the component context.
-
getComponent
Component getComponent()
Returns the primary edit component for this context.- Returns:
- the edit component.
-
getEditConfig
EditConfig getEditConfig()
Retrieves the edit config for the current component respecting the context hierarchy. This might not be the same as the one returned bygetComponent().getEditConfig()since it can be merged with the child configs of its parents.- Returns:
- the edit config
-
getAttribute
java.lang.Object getAttribute(java.lang.String name)
Returns the context attribute for the given name- Parameters:
name- the name of the attribute- Returns:
- the attribute or
nullif not defined.
-
setContentPath
void setContentPath(java.lang.String path)
Sets the content path that is used when including the java script call for the edit bars. defaults to the path of the resource in edit mode or to the path of the style in design mode.- Parameters:
path- content path
-
setAttribute
java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)Sets a context attribute with the given name. If the given attribute isnullit is removed from the attribute map.- Parameters:
name- the name of the attributevalue- the attribute value- Returns:
- the old attribute or
null
-
includeProlog
void includeProlog(SlingHttpServletRequest req, SlingHttpServletResponse resp, WCMMode mode) throws java.io.IOException, ServletException
Includes the html prolog needed for editing- Parameters:
req- the requestresp- the responsemode- the wcm mode- Throws:
java.io.IOException- if an I/O error occursServletException- if a servlet error occurs
-
includeEpilog
void includeEpilog(SlingHttpServletRequest req, SlingHttpServletResponse resp, WCMMode mode) throws java.io.IOException, ServletException
Includes the html epilog of this context into the response.- Parameters:
req- the requestresp- the responsemode- the wcm mode- Throws:
java.io.IOException- if an I/O error occursServletException- if a servlet error occurs
-
-