Record Class LineStyle

java.lang.Object
java.lang.Record
io.leandev.appfuse.report.node.LineStyle
Record Components:
width - 線寬
color - 顏色
dashPattern - 交替的線段與空白長度;空清單為實線,奇數個元素重複兩次形成週期
dashPhase - 週期起點偏移;預設 0,實線必須為 0

public record LineStyle(Length width, ReportColor color, List<Length> dashPattern, Length dashPhase) extends Record
框線或分隔線;線型不占排版空間。
Since:
4.0.0
  • Constructor Details

    • LineStyle

      public LineStyle(Length width, ReportColor color)
      保留既有雙參數建構器,預設實線。
    • LineStyle

      public LineStyle(Length width, ReportColor color, List<Length> dashPattern, Length dashPhase)
      Creates an instance of a LineStyle record class.
      Parameters:
      width - the value for the width record component
      color - the value for the color record component
      dashPattern - the value for the dashPattern record component
      dashPhase - the value for the dashPhase record component
  • Method Details

    • withDash

      public LineStyle withDash(List<Length> pattern, Length phase)
      長度均以 Length 指定,renderer 轉換為 PDF pt(1/72 inch);不是線寬倍數。 phase 可大於週期,由 PDF 依週期循環;空 pattern 只接受零 phase。
      Parameters:
      pattern - 交替的線段/空白;元素不可 null,非空時不能全部為零
      phase - 非負起點偏移
      Returns:
      新線型
    • dashed

      public LineStyle dashed()
      Returns:
      2pt 線段、2pt 空白、零 phase 的虛線
    • solid

      public LineStyle solid()
      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.
    • width

      public Length width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • color

      public ReportColor color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • dashPattern

      public List<Length> dashPattern()
      Returns the value of the dashPattern record component.
      Returns:
      the value of the dashPattern record component
    • dashPhase

      public Length dashPhase()
      Returns the value of the dashPhase record component.
      Returns:
      the value of the dashPhase record component