Package org.opencms.ade.containerpage
Class CmsElementUtil
java.lang.Object
org.opencms.ade.containerpage.CmsElementUtil
Utility class to generate the element data objects used within the container-page editor.
- Since:
- 8.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum number of nested container levels. -
Constructor Summary
ConstructorDescriptionCmsElementUtil
(CmsObject cms, String currentPageUri, CmsUUID detailContentId, String requestParameters, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, Locale locale) Creates a new instance.CmsElementUtil
(CmsObject cms, String currentPageUri, CmsUUID detailContentId, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, Locale locale) Creates a new instance.CmsElementUtil
(CmsObject cms, String currentPageUri, CmsContainerPageBean containerPage, CmsUUID detailContentId, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean isDragMode, Locale locale) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkGroupAllowed
(String containerType, CmsGroupContainerBean groupContainer) Checks if a group element is allowed in a container with a given type.static CmsContainerBean
clientToServerContainer
(CmsContainer container, List<CmsContainerElementBean> elements) Converts a client container bean to a server container bean.createStringTemplateSource
(I_CmsFormatterBean formatter, com.google.common.base.Supplier<CmsXmlContent> contentSupplier) Helper method to create a string template source for a given formatter and content.getContentByContainer
(CmsFile elementFile, String elementId, CmsContainer container) Returns the HTML content for the given resource and container.getElementData
(CmsResource page, CmsContainerElementBean element, Collection<CmsContainer> containers) Returns the data for an element.getElementSettingsConfig
(CmsResource page, CmsContainerElementBean element, String containerId, Collection<CmsContainer> containers) Returns the formatter and settings config data for an element.static I_CmsFormatterBean
getFormatterForContainer
(CmsObject cms, CmsContainerElementBean element, CmsContainer container, CmsADEConfigData config, CmsADESessionCache cache) Returns the formatter bean for the given element and container.getPage()
Gets the container page.getPageAndDetailOnlyIds
(CmsObject cms, CmsUUID pageId, CmsResource detailContent) Gets the ids for the current page and potentially detail-only containers.static final boolean
isSystemSetting
(String name) Checks if the given setting name is a system setting.setElementInfo
(CmsContainerElementBean elementBean, CmsContainerElement result) Sets the data to the given container element.
-
Field Details
-
MAX_NESTING_LEVEL
The maximum number of nested container levels.- See Also:
-
-
Constructor Details
-
CmsElementUtil
public CmsElementUtil(CmsObject cms, String currentPageUri, CmsContainerPageBean containerPage, CmsUUID detailContentId, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean isDragMode, Locale locale) throws CmsException Creates a new instance.Use this constructor to set the current container page state.
- Parameters:
cms
- the cms contextcurrentPageUri
- the current page uricontainerPage
- the container page bean with the current container statedetailContentId
- the detail content structure idreq
- the http requestres
- the http responseisDragMode
- if the page is in drag modelocale
- the content locale- Throws:
CmsException
- if something goes wrong
-
CmsElementUtil
public CmsElementUtil(CmsObject cms, String currentPageUri, CmsUUID detailContentId, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, Locale locale) throws CmsException Creates a new instance.- Parameters:
cms
- the cms contextcurrentPageUri
- the current page uridetailContentId
- the detail content structure idreq
- the http requestres
- the http responselocale
- the content locale- Throws:
CmsException
- if something goes wrong
-
CmsElementUtil
public CmsElementUtil(CmsObject cms, String currentPageUri, CmsUUID detailContentId, String requestParameters, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, Locale locale) throws CmsException Creates a new instance.- Parameters:
cms
- the cms contextcurrentPageUri
- the current page uridetailContentId
- the detail content structure idrequestParameters
- the request parameters to use while rendering the elementsreq
- the http requestres
- the http responselocale
- the content locale- Throws:
CmsException
- if something goes wrong
-
-
Method Details
-
checkGroupAllowed
Checks if a group element is allowed in a container with a given type.- Parameters:
containerType
- the container type spec (comma separated)groupContainer
- the group- Returns:
- true if the group is allowed in the container
-
createStringTemplateSource
public static Function<String,String> createStringTemplateSource(I_CmsFormatterBean formatter, com.google.common.base.Supplier<CmsXmlContent> contentSupplier) Helper method to create a string template source for a given formatter and content.- Parameters:
formatter
- the formattercontentSupplier
- the content supplier- Returns:
- the string template provider
-
getPageAndDetailOnlyIds
public static Set<CmsUUID> getPageAndDetailOnlyIds(CmsObject cms, CmsUUID pageId, CmsResource detailContent) Gets the ids for the current page and potentially detail-only containers.- Parameters:
cms
- the CMS contextpageId
- the id for the current pagedetailContent
- the current detail content- Returns:
- the set of ids for the current page and detail-only containers
-
isSystemSetting
Checks if the given setting name is a system setting.- Parameters:
name
- the setting name- Returns:
- true if the name corresponds to a system setting
-
getElementData
public CmsContainerElementData getElementData(CmsResource page, CmsContainerElementBean element, Collection<CmsContainer> containers) throws CmsException Returns the data for an element.- Parameters:
page
- the current container pageelement
- the resourcecontainers
- the containers on the current container page- Returns:
- the data for an element
- Throws:
CmsException
- if something goes wrong
-
getElementSettingsConfig
public CmsElementSettingsConfig getElementSettingsConfig(CmsResource page, CmsContainerElementBean element, String containerId, Collection<CmsContainer> containers) throws CmsException Returns the formatter and settings config data for an element.- Parameters:
page
- the current container pageelement
- the resourcecontainerId
- the parent container idcontainers
- the containers on the current container page- Returns:
- the data for an element
- Throws:
CmsException
- if something goes wrong
-
getPage
Gets the container page.- Returns:
- the container page resource
-