Class CssElement

java.lang.Object
com.oorian.css.CssElement
Direct Known Subclasses:
CssMediaQuery, CssRule, KeyFrames

public abstract class CssElement extends Object
Abstract base class for all dynamic CSS elements in the stylesheet hierarchy.

CssElement provides the foundation for building CSS constructs programmatically. It defines a lifecycle for initialization and creation that subclasses can override to define their specific CSS content.

The initialization process follows this order:

  1. create() - Called first to set up the element's own CSS content
  2. initializeChildren() - Called to initialize any child elements
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • CssElement

      public CssElement()
      Constructs a new CSS element.
  • Method Details

    • create

      protected void create()
      Creates this element's CSS content.

      Subclasses should override this method to define CSS rules, properties, or other content. The default implementation does nothing.

    • addNewLine

      protected void addNewLine(boolean pretty, StringBuilder element)
      Appends a newline character to the output when pretty printing is enabled.
      Parameters:
      pretty - True to append a newline, false to skip.
      element - The StringBuilder to append to.
    • initializeChildren

      protected void initializeChildren()
      Initializes any child CSS elements.

      Subclasses that contain child elements should override this method to call initialize() on each child. The default implementation does nothing.