Class Style.Builder

java.lang.Object
com.nsdev.lettergenerator.model.style.Style.Builder
Enclosing class:
Style

public static final class Style.Builder extends Object
Mutable accumulator for an immutable Style. Omitted properties remain null, so they inherit rather than resetting enclosing defaults. Setters store values without validation; build() takes a snapshot that later setter calls do not change.
  • Method Details

    • named

      public Style.Builder named(String value)
      References a named style below this builder's explicit overrides.
      Parameters:
      value - registered theme name, or null to clear the reference
      Returns:
      this builder
    • fontFamily

      public Style.Builder fontFamily(String value)
      Sets the font-family override.
      Parameters:
      value - built-in or registered family name; null clears the override
      Returns:
      this builder
    • fontSizePt

      public Style.Builder fontSizePt(double value)
      Sets the font size in points (1/72 inch). Generation requires a positive finite size.
      Parameters:
      value - font size in points
      Returns:
      this builder
    • color

      public Style.Builder color(String value)
      Sets the text-color override. Generation requires six hexadecimal RGB digits prefixed by # when a color is supplied.
      Parameters:
      value - RGB color such as #123ABC; null clears the override
      Returns:
      this builder
    • bold

      public Style.Builder bold()
      Enables bold, overriding an inherited regular weight.
      Returns:
      this builder
    • bold

      public Style.Builder bold(boolean value)
      Overrides the inherited bold flag, including explicitly disabling it.
      Parameters:
      value - whether to render bold text
      Returns:
      this builder
    • italic

      public Style.Builder italic()
      Enables italic, overriding an inherited upright style.
      Returns:
      this builder
    • italic

      public Style.Builder italic(boolean value)
      Overrides the inherited italic flag, including explicitly disabling it.
      Parameters:
      value - whether to render italic text
      Returns:
      this builder
    • underline

      public Style.Builder underline()
      Enables underlining for text.
      Returns:
      this builder
    • underline

      public Style.Builder underline(boolean value)
      Overrides the inherited underline flag, including explicitly disabling it.
      Parameters:
      value - whether to underline text
      Returns:
      this builder
    • textAlign

      public Style.Builder textAlign(TextAlign value)
      Sets horizontal paragraph alignment.
      Parameters:
      value - alignment override; null clears the override
      Returns:
      this builder
    • lineHeight

      public Style.Builder lineHeight(double value)
      Sets the dimensionless line-height multiplier, applied to font size. Generation requires a positive finite value. Text layout accommodates the largest run line box.
      Parameters:
      value - font-size multiplier, such as 1.2
      Returns:
      this builder
    • spaceBeforeMm

      public Style.Builder spaceBeforeMm(double value)
      Sets spacing before a block. Generation requires a finite nonnegative value; cell text always uses zero paragraph spacing.
      Parameters:
      value - spacing in millimeters
      Returns:
      this builder
    • spaceAfterMm

      public Style.Builder spaceAfterMm(double value)
      Sets spacing after a block. Generation requires a finite nonnegative value; cell text always uses zero paragraph spacing.
      Parameters:
      value - spacing in millimeters
      Returns:
      this builder
    • keepTogether

      public Style.Builder keepTogether(Keep value)
      Sets the current block's page-keep strength.
      Parameters:
      value - keep policy, or null for the ordinary policy
      Returns:
      this builder
    • keepTogether

      public Style.Builder keepTogether()
      Returns:
      this builder with an ALWAYS keep for the current block
    • keepWithNext

      public Style.Builder keepWithNext(Keep value)
      Sets the keep strength between this block and its successor.
      Parameters:
      value - keep policy, or null for the ordinary policy
      Returns:
      this builder
    • keepWithNext

      public Style.Builder keepWithNext()
      Returns:
      this builder with an ALWAYS keep with the next block
    • widows

      public Style.Builder widows(int value)
      Sets the minimum trailing paragraph lines on a page; generation requires a positive value.
      Parameters:
      value - minimum trailing line count
      Returns:
      this builder
    • orphans

      public Style.Builder orphans(int value)
      Sets the minimum opening paragraph lines on a page; generation requires a positive value.
      Parameters:
      value - minimum opening line count
      Returns:
      this builder
    • build

      public Style build()
      Snapshots the accumulated overrides without validating them or replacing nulls. The builder can be changed and reused after this call.
      Returns:
      a new immutable style with the current overrides