- java.lang.Object
-
- com.semanticcms.core.model.Node
-
- com.semanticcms.core.model.Element
-
-
Constructor Summary
Constructors Constructor Description Element()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Long
addChildElement(Element childElement, ElementWriter elementWriter)
Adds a child element to this element.boolean
equals(Object obj)
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.Please useXmlUtils.generateId(java.lang.String, java.lang.String)
directly.protected abstract String
getDefaultIdPrefix()
Gets the default element ID prefix for this type of element.protected String
getElementIdTemplate()
Gets the element ID template for generating IDs.ElementRef
getElementRef()
Gets an ElementRef for this element.String
getId()
When inside a page, every element must have a per-page unique ID, when one is not provided, it will be generated.Page
getPage()
Every element may (and usually will) exist within a page.Element
getParentElement()
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
isValidId(String id)
Deprecated, for removal: This API element is subject to removal in a future version.Please useXmlUtils.isValidId(java.lang.String)
directly.void
setId(String id)
-
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
-
-
-
-
Method Detail
-
isValidId
@Deprecated(forRemoval=true) public static boolean isValidId(String id)
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
public boolean equals(Object obj)
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.
-
getElementIdTemplate
protected String getElementIdTemplate()
Gets the element ID template for generating IDs.- See Also:
Defaults to getLabel()
-
getDefaultIdPrefix
protected abstract String getDefaultIdPrefix()
Gets the default element ID prefix for this type of element.
-
getPage
public Page getPage()
Every element may (and usually will) exist within a page.
-
getId
public String 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
public void setId(String id)
-
getElementRef
public ElementRef getElementRef() throws IllegalStateException
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
public Element 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
public Long addChildElement(Element childElement, ElementWriter elementWriter)
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.
-
-