java.lang.Object
com.semanticcms.core.model.Node
com.semanticcms.core.model.Element
All Implemented Interfaces:
Freezable<Node>

public abstract class Element extends Node
A page may contain any number of elements (along with arbitrary textual data and other content). Each element may also contain other elements.
  • Constructor Details

    • Element

      public Element()
  • Method Details

    • isValidId

      @Deprecated(forRemoval=true) public static boolean isValidId(String id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.
      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.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getElementIdTemplate

      protected String getElementIdTemplate()
      Gets the element ID template for generating IDs.
      See Also:
    • 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 class Node
    • isHidden

      public boolean isHidden()
      When hidden, an element is not added to common elements like navigation trees. By default, elements are not hidden.