Record Class DocumentStyles

java.lang.Object
java.lang.Record
io.leandev.appfuse.report.node.DocumentStyles
Record Components:
text - 內文文字樣式
paragraph - 段落樣式
headings - 標題層級(1–4)對段落樣式的覆寫
table - 表格樣式
box - 區塊框樣式

public record DocumentStyles(TextStyle text, ParagraphStyle paragraph, Map<Integer, ParagraphStyle> headings, TableStyle table, BoxStyle box) extends Record

文件層級的完整樣式,是所有覆寫值的合併基底

text()、paragraph()、table()、box() 的每個欄位都必須有值(paragraph.text 與 table.text 可為 null,代表沿用 text());headings() 是疊在段落樣式上的各層級覆寫。 一般以 standard() 為基準,透過 builder() 或 ReportDocument.Builder#styles 覆寫需要的欄位。

Since:
4.0.0
  • Constructor Details

    • DocumentStyles

      public DocumentStyles(TextStyle text, ParagraphStyle paragraph, Map<Integer, ParagraphStyle> headings, TableStyle table, BoxStyle box)
      Creates an instance of a DocumentStyles record class.
      Parameters:
      text - the value for the text record component
      paragraph - the value for the paragraph record component
      headings - the value for the headings record component
      table - the value for the table record component
      box - the value for the box record component
  • Method Details

    • standard

      public static DocumentStyles standard()
      框架基準樣式
      Returns:
      每個欄位都有值的基準
    • builder

      public static DocumentStyles.Builder builder()
      以 standard() 為基準的建構器
      Returns:
      建構器
    • toBuilder

      public DocumentStyles.Builder toBuilder()
      以本樣式為基準的建構器
      Returns:
      建構器
    • with

      public DocumentStyles with(Consumer<DocumentStyles.Builder> customizer)
      以本樣式為基準,套用覆寫後產生新樣式
      Parameters:
      customizer - 覆寫設定
      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
    • paragraph

      public ParagraphStyle paragraph()
      Returns the value of the paragraph record component.
      Returns:
      the value of the paragraph record component
    • headings

      public Map<Integer, ParagraphStyle> headings()
      Returns the value of the headings record component.
      Returns:
      the value of the headings record component
    • table

      public TableStyle table()
      Returns the value of the table record component.
      Returns:
      the value of the table record component
    • box

      public BoxStyle box()
      Returns the value of the box record component.
      Returns:
      the value of the box record component