Record Class DayMark

java.lang.Object
java.lang.Record
limn.components.date.DayMark
Record Components:
dot - the dot's colour; never null
description - what a reader is told about the day, or null for a mark that is decoration

public record DayMark(Color dot, @Nullable I18nString description) extends Record
What is true of one day beyond its number: a holiday, a deadline, a day with appointments.

A dot under the day's number and, optionally, a phrase that joins what a screen reader says about that cell. Both halves matter and the second is the one that is usually forgotten: a coloured dot is invisible to a reader and to anyone who cannot tell the colours apart, so a mark that carries no description is a mark half the users of a form cannot perceive at all. It is still allowed — a dot that only repeats what the surrounding screen already says is decoration, and naming it would be noise — but it is the caller's decision rather than the default.

The colour is the application's. A holiday is red in a payroll screen and green in a booking one, and the toolkit has no opinion about which; what it does have is Theme, so Theme.of(this).danger and its neighbours are the colours a mark should normally be built from rather than a literal that will not follow a palette.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DayMark(Color dot, @Nullable I18nString description)
    Creates an instance of a DayMark record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable I18nString
    Returns the value of the description record component.
    dot()
    Returns the value of the dot record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static DayMark
    of(Color dot)
    A mark that is only a dot: nothing is added to what a reader hears.
    static DayMark
    of(Color dot, I18nString description)
    A mark with a phrase a reader hears after the date.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DayMark

      public DayMark(Color dot, @Nullable I18nString description)
      Creates an instance of a DayMark record class.
      Parameters:
      dot - the value for the dot record component
      description - the value for the description record component
  • Method Details

    • of

      public static DayMark of(Color dot)
      A mark that is only a dot: nothing is added to what a reader hears.
      Parameters:
      dot - the dot's colour
      Returns:
      the mark
    • of

      public static DayMark of(Color dot, I18nString description)
      A mark with a phrase a reader hears after the date.
      Parameters:
      dot - the dot's colour
      description - what the day is; resolved in the calendar's own language, like every other name in the accessible tree
      Returns:
      the mark
    • 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.
    • dot

      public Color dot()
      Returns the value of the dot record component.
      Returns:
      the value of the dot record component
    • description

      public @Nullable I18nString description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component