java.lang.Object
com.semanticcms.core.model.Node
com.semanticcms.core.model.Element
A page may contain any number of elements (along with arbitrary textual data
and other content). Each element may also contain other elements.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddChildElement
(Element childElement, ElementWriter elementWriter) Adds a child element to this element.boolean
Two elements are equal when they are the same object or when they are on the same page and have the same ID.static StringBuilder
generateIdPrefix
(String template, String prefix) Deprecated, for removal: This API element is subject to removal in a future version.protected abstract String
Gets the default element ID prefix for this type of element.protected String
Gets the element ID template for generating IDs.Gets an ElementRef for this element.getId()
When inside a page, every element must have a per-page unique ID, when one is not provided, it will be generated.getPage()
Every element may (and usually will) exist within a page.Elements may be nested, gets the parent Element above this element.int
hashCode()
boolean
isHidden()
When hidden, an element is not added to common elements like navigation trees.static boolean
Deprecated, for removal: This API element is subject to removal in a future version.Please useXmlUtils.isValidId(java.lang.String)
directly.void
Methods inherited from class com.semanticcms.core.model.Node
addPageLink, appendLabel, checkNotFrozen, findChildElement, findChildElement, findTopLevelElements, freeze, getBody, getChildElements, getLabel, getPageLinks, getProperty, requireChildElement, requireChildElement, setBody, setProperty, toString
-
Constructor Details
-
Element
public Element()
-
-
Method Details
-
isValidId
Deprecated, for removal: This API element is subject to removal in a future version.Please useXmlUtils.isValidId(java.lang.String)
directly.Makes sure an ID is valid. -
generateIdPrefix
@Deprecated(forRemoval=true) public static StringBuilder generateIdPrefix(String template, String prefix) Deprecated, for removal: This API element is subject to removal in a future version.Please useXmlUtils.generateId(java.lang.String, java.lang.String)
directly.Generates a valid ID from an arbitrary string. -
equals
Two elements are equal when they are the same object or when they are on the same page and have the same ID. If either one does not have a page or does not (yet) have an ID, they will not be equal. -
hashCode
public int hashCode() -
getElementIdTemplate
Gets the element ID template for generating IDs.- See Also:
-
getDefaultIdPrefix
Gets the default element ID prefix for this type of element. -
getPage
Every element may (and usually will) exist within a page. -
getId
When inside a page, every element must have a per-page unique ID, when one is not provided, it will be generated. When not inside a page, no missing ID is generated and it will remain null. -
setId
-
getElementRef
Gets an ElementRef for this element. Must have a page set. If id has not yet been set, one will be generated.- Throws:
IllegalStateException
- if page not set
-
getParentElement
Elements may be nested, gets the parent Element above this element. Top-level parents within a page, or standalone elements, will not have any parent. -
addChildElement
Adds a child element to this element.- Overrides:
addChildElement
in classNode
-
isHidden
public boolean isHidden()When hidden, an element is not added to common elements like navigation trees. By default, elements are not hidden.
-
XmlUtils.generateId(java.lang.String, java.lang.String)
directly.