Record Class ElementLayout

java.lang.Object
java.lang.Record
net.ixdarklord.folios.internal.client.page.ElementLayout
Record Components:
minHeight - the least room worth setting a box in, below which the element starts on the next page

public record ElementLayout(@Nullable ElementLayout.Overflow overflow, @Nullable ElementLayout.Height height, @Nullable ElementLayout.Height minHeight, @Nullable FoliosAlign alignment, @Nullable FoliosAlign titleAlignment, @Nullable ElementLayout.Anchor anchor) extends Record
How an element is set on its page, beside what it shows: what happens when it doesn't fit ("overflow"), where its parts sit across the page ("alignment", "title_alignment") and down a box taller than they are ("anchor"). Written on an element, on a page (for its elements) or in book.json (for the whole book): the nearest that says wins, and what none says keeps how pages have always been set. Each field is null where the JSON doesn't say.
  • Field Details

    • NONE

      public static final ElementLayout NONE
    • MIN_HEIGHT

      public static final int MIN_HEIGHT
      The least room a box is set in when nothing says: about three lines of text.
      See Also:
  • Constructor Details

    • ElementLayout

      public ElementLayout(@Nullable ElementLayout.Overflow overflow, @Nullable ElementLayout.Height height, @Nullable ElementLayout.Height minHeight, @Nullable FoliosAlign alignment, @Nullable FoliosAlign titleAlignment, @Nullable ElementLayout.Anchor anchor)
      Creates an instance of a ElementLayout record class.
      Parameters:
      overflow - the value for the overflow record component
      height - the value for the height record component
      minHeight - the value for the minHeight record component
      alignment - the value for the alignment record component
      titleAlignment - the value for the titleAlignment record component
      anchor - the value for the anchor record component
  • Method Details

    • read

      public static ElementLayout read(@Nullable com.google.gson.JsonObject json, String where)
      What an object of JSON (an element, a page or a book) says, warning of what it says that can't be read.
    • or

      public ElementLayout or(ElementLayout outer)
      This, with what it leaves unsaid taken from outer (the page's for an element, the book's for a page).
    • leastHeight

      public int leastHeight(int full)
      The least room worth setting a box in, on a page whose content is full pixels tall.
    • overflowOrFlow

      public ElementLayout.Overflow overflowOrFlow()
      The overflow to use: ElementLayout.Overflow.FLOW when none is said.
    • titleAlign

      public @Nullable FoliosAlign titleAlign()
      How the title is aligned: its own, else the body's (justified text keeps a left title).
    • 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.
    • overflow

      public @Nullable ElementLayout.Overflow overflow()
      Returns the value of the overflow record component.
      Returns:
      the value of the overflow record component
    • height

      public @Nullable ElementLayout.Height height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • minHeight

      public @Nullable ElementLayout.Height minHeight()
      Returns the value of the minHeight record component.
      Returns:
      the value of the minHeight record component
    • alignment

      public @Nullable FoliosAlign alignment()
      Returns the value of the alignment record component.
      Returns:
      the value of the alignment record component
    • titleAlignment

      public @Nullable FoliosAlign titleAlignment()
      Returns the value of the titleAlignment record component.
      Returns:
      the value of the titleAlignment record component
    • anchor

      public @Nullable ElementLayout.Anchor anchor()
      Returns the value of the anchor record component.
      Returns:
      the value of the anchor record component