Record Class ParagraphStyle

java.lang.Object
java.lang.Record
io.leandev.appfuse.report.node.ParagraphStyle
Record Components:
text - 文字樣式覆寫
align - 水平對齊
lineHeight - 行高(字級的倍數)
spaceBefore - 段前間距
spaceAfter - 段後間距
firstLineIndent - 首行縮排
keepWithNext - 是否與下一個區塊保持同頁
orphans - 段落在頁尾至少保留的行數
widows - 段落在頁首至少保留的行數
textFlow - 選填的空白、Tab 與換行策略;null 沿用原有排版
repeatSpaceBefore - 是否在頁頂與每個續頁片段重複段前距;null 繼承,預設 false
repeatSpaceAfter - 是否在每頁片段(含最後片段)的容量計算及末端預留 spaceAfter;null 繼承,預設 false

public record ParagraphStyle(TextStyle text, Align align, Double lineHeight, Length spaceBefore, Length spaceAfter, Length firstLineIndent, Boolean keepWithNext, Integer orphans, Integer widows, TextFlow textFlow, Boolean repeatSpaceBefore, Boolean repeatSpaceAfter) extends Record

段落樣式覆寫值

每個欄位為 null 時繼承上一層;Boolean.FALSE 等是明確覆寫。巢狀的 text() 逐欄位合併。

Since:
4.0.0
  • Constructor Details

    • ParagraphStyle

      public ParagraphStyle(TextStyle text, Align align, Double lineHeight, Length spaceBefore, Length spaceAfter, Length firstLineIndent, Boolean keepWithNext, Integer orphans, Integer widows, TextFlow textFlow, Boolean repeatSpaceBefore)
      保留 alpha.31 的十一參數建構器;未設定時沿用原有段後距行為。
    • ParagraphStyle

      public ParagraphStyle(TextStyle text, Align align, Double lineHeight, Length spaceBefore, Length spaceAfter, Length firstLineIndent, Boolean keepWithNext, Integer orphans, Integer widows)
      保留既有九參數建構器;未指定新策略時使用原有排版。
    • ParagraphStyle

      public ParagraphStyle(TextStyle text, Align align, Double lineHeight, Length spaceBefore, Length spaceAfter, Length firstLineIndent, Boolean keepWithNext, Integer orphans, Integer widows, TextFlow textFlow, Boolean repeatSpaceBefore, Boolean repeatSpaceAfter)
      Creates an instance of a ParagraphStyle record class.
      Parameters:
      text - the value for the text record component
      align - the value for the align record component
      lineHeight - the value for the lineHeight record component
      spaceBefore - the value for the spaceBefore record component
      spaceAfter - the value for the spaceAfter record component
      firstLineIndent - the value for the firstLineIndent record component
      keepWithNext - the value for the keepWithNext record component
      orphans - the value for the orphans record component
      widows - the value for the widows record component
      textFlow - the value for the textFlow record component
      repeatSpaceBefore - the value for the repeatSpaceBefore record component
      repeatSpaceAfter - the value for the repeatSpaceAfter record component
  • Method Details

    • inherit

      public static ParagraphStyle inherit()
      全部欄位繼承的空覆寫
      Returns:
      空覆寫
    • withText

      public ParagraphStyle withText(TextStyle text)
    • withAlign

      public ParagraphStyle withAlign(Align align)
    • withLineHeight

      public ParagraphStyle withLineHeight(Double lineHeight)
    • withSpaceBefore

      public ParagraphStyle withSpaceBefore(Length spaceBefore)
    • withSpaceAfter

      public ParagraphStyle withSpaceAfter(Length spaceAfter)
    • withFirstLineIndent

      public ParagraphStyle withFirstLineIndent(Length firstLineIndent)
    • withKeepWithNext

      public ParagraphStyle withKeepWithNext(Boolean keepWithNext)
    • withOrphans

      public ParagraphStyle withOrphans(Integer orphans)
    • withWidows

      public ParagraphStyle withWidows(Integer widows)
    • withTextFlow

      public ParagraphStyle withTextFlow(TextFlow textFlow)
      明確啟用新的文字流策略;null 表示繼承。
    • withRepeatSpaceBefore

      public ParagraphStyle withRepeatSpaceBefore(Boolean repeatSpaceBefore)
      在段落的頁頂與所有續頁片段重複 spaceBefore;未設定時保持既有行為。
    • withRepeatSpaceAfter

      public ParagraphStyle withRepeatSpaceAfter(Boolean repeat)
      在每頁內文段落片段預留 spaceAfter,再計算可容納行數;包含單頁段落與最後片段。 續頁前保留該段後距,最後片段只套用一次;不改變文字、空白與原始換行策略。 不套用於表格儲存格或固定頁首頁尾區域;那些區域由外層容器決定分頁與容量。
      Parameters:
      repeat - null 繼承;true 啟用,false(預設)沿用原有行為
      Returns:
      新樣式
    • overlay

      public ParagraphStyle overlay(ParagraphStyle override)
      以 override 的非 null 欄位覆寫本樣式;文字樣式逐欄位合併
      Parameters:
      override - 覆寫值;null 視同空覆寫
      Returns:
      合併後的新樣式
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • text

      public TextStyle text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • align

      public Align align()
      Returns the value of the align record component.
      Returns:
      the value of the align record component
    • lineHeight

      public Double lineHeight()
      Returns the value of the lineHeight record component.
      Returns:
      the value of the lineHeight record component
    • spaceBefore

      public Length spaceBefore()
      Returns the value of the spaceBefore record component.
      Returns:
      the value of the spaceBefore record component
    • spaceAfter

      public Length spaceAfter()
      Returns the value of the spaceAfter record component.
      Returns:
      the value of the spaceAfter record component
    • firstLineIndent

      public Length firstLineIndent()
      Returns the value of the firstLineIndent record component.
      Returns:
      the value of the firstLineIndent record component
    • keepWithNext

      public Boolean keepWithNext()
      Returns the value of the keepWithNext record component.
      Returns:
      the value of the keepWithNext record component
    • orphans

      public Integer orphans()
      Returns the value of the orphans record component.
      Returns:
      the value of the orphans record component
    • widows

      public Integer widows()
      Returns the value of the widows record component.
      Returns:
      the value of the widows record component
    • textFlow

      public TextFlow textFlow()
      Returns the value of the textFlow record component.
      Returns:
      the value of the textFlow record component
    • repeatSpaceBefore

      public Boolean repeatSpaceBefore()
      Returns the value of the repeatSpaceBefore record component.
      Returns:
      the value of the repeatSpaceBefore record component
    • repeatSpaceAfter

      public Boolean repeatSpaceAfter()
      Returns the value of the repeatSpaceAfter record component.
      Returns:
      the value of the repeatSpaceAfter record component