Class Separator

java.lang.Object
limn.scene.Widget<Separator>
limn.components.Separator

public final class Separator extends Widget<Separator>
A thin divider line drawn in the theme's Theme.outline color. A horizontal separator stretches across the available width (with a thin height); a vertical one stretches down the available height (thin width). Use it to divide groups in a Column/Row or inside a ToolBar.

Size axis

Separator participates by inheritance only and exposes no size setter: what a reader perceives is a 1 pt hairline, pixel-locked at every ControlSize step. Only the box around the line moves. A "large separator" is either the same line with more air (the container's job) or a thicker rule, which is a different visual element.

The box is odd at every step on purpose: a 1 pt line can only sit exactly centred inside an odd box, and the snap relies on that parity. setInset(float) is the one dimension a caller controls.

  • Method Details

    • horizontal

      public static Separator horizontal()
      A rule stretching across the available width.
    • vertical

      public static Separator vertical()
      A rule stretching down the available height.
    • setInset

      public Separator setInset(float margin)
      Trims margin points off both ends of the line.
    • onMeasure

      protected Size onMeasure(Constraints constraints)
      Description copied from class: Widget
      Reports the size this widget wants within constraints. Called once per layout pass, and the result is cached against the constraints and the resolved axes (size step, layout direction, locale), so it must be a pure function of them and of this widget's own state.

      Resolve the ControlSize and the LayoutDirection once each here and thread them down; never read either in a constructor. The locale needs no threading: it is in scope, and I18n.locale() answers it wherever text is resolved.

      Specified by:
      onMeasure in class Widget<Separator>
    • onPaint

      protected void onPaint(Canvas canvas)
      Description copied from class: Widget
      Widget's own background/content, in local coordinates.
      Overrides:
      onPaint in class Widget<Separator>
    • onAccessibility

      protected void onAccessibility(Accessibility a)
      Publishes this rule as one Accessible.Role.SEPARATOR node carrying exactly one orientation bit and nothing else.

      The role is the whole announcement, and it is the reason the widget describes itself at all: a rule between groups of items is information a reader needs to hear, and a leaf that paints, declares nothing and is deleted by the walk is warned about once per class, in every application that draws one. No name is declared on purpose. The widget holds no string, a declared name would be spoken on top of the role, and the two ways a rule does get one stay where they belong: a tooltip through the walk's free default, or the application through setAccessibleName. Striking a purely decorative rule out is likewise the application's call through setAccessibleIgnored(true), never this class's.

      The orientation is read from the field the factory fixed at construction and never inferred from the laid-out box. Accessible.State defines the pair by the axis a node's value runs along; a separator has no value, so the bit names the axis the rule runs along, which is also the picture. The two cannot come apart here the way they do on a splitter's divider, so no inversion applies and a bridge maps the bit straight onto the platform's orientation. Inferring it from width against height would tie the fact to layout and lie whenever a parent squeezes the box: a horizontal rule handed a tight, tall constraint would announce as vertical.

      The published box is the widget's own, separatorBox thick on the cross axis, not the hairline: setInset(float) trims ink only and changes nothing a reader is told. Two primitive writes and no string, so a damaged frame that changed nothing costs no memory.

      Overrides:
      onAccessibility in class Widget<Separator>
      Parameters:
      a - the node being described; write into it, and never keep it