Class Style

java.lang.Object
io.mindspice.simplypages.core.Style

public class Style extends Object
Mutable builder for CSS utility classes and inline declarations.

This type stores tokens only; it does not validate CSS semantics and does not escape values. Consumers are responsible for supplying trusted class and style input.

Mutability/thread-safety: mutable and not thread-safe. Use per component/request and do not share across concurrent renders.

  • Constructor Details

    • Style

      public Style()
  • Method Details

    • create

      public static Style create()
      Creates a new empty style builder.
    • padding

      public Style padding(String value)
      Adds a utility class token in the form p-{value}.
    • margin

      public Style margin(String value)
      Adds a utility class token in the form m-{value}.
    • textAlign

      public Style textAlign(String alignment)
      Adds a utility class token in the form text-{alignment}.
    • fontSize

      public Style fontSize(String size)
      Adds a utility class token in the form text-{size}.
    • fontWeight

      public Style fontWeight(String weight)
      Adds a utility class token in the form font-{weight}.
    • color

      public Style color(String color)
      Adds a utility class token in the form text-{color}.
    • backgroundColor

      public Style backgroundColor(String color)
      Adds a utility class token in the form bg-{color}.
    • border

      public Style border(String value)
      Adds a utility class token in the form border-{value}.
    • rounded

      public Style rounded(String value)
      Adds a utility class token in the form rounded-{value}.
    • width

      public Style width(String value)
      Adds a utility class token in the form w-{value}.
    • height

      public Style height(String value)
      Adds a utility class token in the form h-{value}.
    • flex

      public Style flex()
      Adds the flex utility class.
    • flexDirection

      public Style flexDirection(String direction)
      Adds a utility class token in the form flex-{direction}.
    • justifyContent

      public Style justifyContent(String value)
      Adds a utility class token in the form justify-{value}.
    • alignItems

      public Style alignItems(String value)
      Adds a utility class token in the form items-{value}.
    • gap

      public Style gap(String value)
      Adds a utility class token in the form gap-{value}.
    • shadow

      public Style shadow(String value)
      Adds a utility class token in the form shadow-{value}.
    • addClass

      public Style addClass(String className)
      Adds a raw class token without transformation.
    • addClasses

      public Style addClasses(String... classNames)
      Adds raw class tokens without transformation.
    • addInlineStyle

      public Style addInlineStyle(String property, String value)
      Appends an inline style fragment in the form property: value.

      Both arguments must be application-controlled or separately validated for their CSS context. No property-name, declaration-breakout, semantic CSS, or URL validation is performed; separators are retained. Attribute encoding by a later tag does not supply these checks. Unlike HtmlTag.addStyle(String, String), this is a raw fragment path.

    • getClassString

      public String getClassString()
      Returns class tokens joined by a single space.
    • getStyleString

      public String getStyleString()
      Returns inline style fragments joined by ; .
    • hasClasses

      public boolean hasClasses()
      Returns whether at least one class token has been added.
    • hasInlineStyles

      public boolean hasInlineStyles()
      Returns whether at least one inline style fragment has been added.