Interface ComponentContext

  • public interface ComponentContext
    A component context is opened for each component include that provides a new cell on the cell stack. this is usually the case if the cell name is not empty. The component context is independent from the WCM mode and is always available to the scripts. If the WCM is in edit mode and if the components are editable it also provides an EditContext. Note that an edit context can span several component contexts if not all of the components that are included provide editing. for example pure general purpose scripts.
    • Field Detail


        static final String CONTEXT_ATTR_NAME
        Request attribute name for retrieving the current context
        See Also:
        Constant Field Values

        name of the request attribute to bypass component handling.
    • Method Detail

      • getParent

        ComponentContext getParent()
        Returns the parent context or null if this context is the root context.
        the parent context or null
      • getRoot

        ComponentContext getRoot()
        Returns the root context.
        the root context.
      • isRoot

        boolean isRoot()
        Checks if this is the root context.
        true if this is the root context
      • getResource

        Resource getResource()
        Returns the top most resource that is associated with this context. it can occur that a component context spans several resources if a resource of a sub include does not define a new cell.
        the resource or null if not bound.
      • getCell

        Cell getCell()
        Returns the design cell.
        the design cell.
      • getEditContext

        EditContext getEditContext()
        Returns the edit context for this include. If the respective component is not editable/designable or if the WCM is not in WCMMode.EDIT or WCMMode.DESIGN null is returned. Please note that for different component contexts, the same edit context can be returned, if the respective component spans several includes.
        edit context or null
      • getAnalyzeContext

        AnalyzeContext getAnalyzeContext()
        Returns the analyze context for this include. If the respective component is not analyzable or if the WCM is not in WCMMode.ANALYTICS, null is returned.
        analyze context or null
      • getComponent

        Component getComponent()
        Returns the top most component that is associated with this context.
        the component or null if not bound.
      • getPage

        Page getPage()
        Returns the page this component context is operating on.
        the page.
      • getAttribute

        Object getAttribute​(String name)
        Returns the context attribute for the given name
        name - the name of the attribute
        the attribute or null if not defined.
      • setAttribute

        Object setAttribute​(String name,
                            Object value)
        Sets a context attribute with the given name. If the given attribute is null it is removed from the attribute map.
        name - the name of the attribute
        value - the attribute value
        the old attribute or null
      • getCssClassNames

        Set<String> getCssClassNames()
        Returns the set of css class names to be added to the html tag. note that the names from the include options are only added when the context is included.
        the set of css class names
      • hasDecoration

        boolean hasDecoration()
        Checks if this contexts needs decoration at all.
        true if this context needs decoration
      • setDecorate

        void setDecorate​(boolean decorate)
        Sets if this context needs decoration.
        decorate - true if decoration should be drawn
      • getDefaultDecorationTagName

        String getDefaultDecorationTagName()
        Returns the default decoration tag name.
        the default decoration tag name
        See Also:
      • setDefaultDecorationTagName

        void setDefaultDecorationTagName​(String decorationTagName)
        Sets the default decoration tag name. if set to null it will be inherited from the parent context, if set to an empty string, no decoration tag is rendered. the default tag name is used if non is provided by the component or set via include options. it defaults to div.
        decorationTagName - the name of the decoration tag.
        See Also:
        setDecorationTagName(String), Component.getHtmlTagAttributes(), IncludeOptions.setDecorationTagName(String)