Class PreeditEvent

java.lang.Object
limn.scene.event.InputEvent
limn.scene.event.PreeditEvent

public final class PreeditEvent extends InputEvent
In-progress IME composition ("preedit"): the text an input method is still composing, shown inline with an underline but not committed to the editing model. The committed result arrives later as ordinary CharEvents; preedit is purely the transient overlay shown while the user is composing (e.g. typing romaji/pinyin before picking a candidate).

An empty event clears the composition (the user committed or cancelled it). Routed to the focused widget only; a preedit with nothing focused is dropped.

The composing text is split into styled blocks (clauses the IME draws differently); blockSizes() gives each block's length in code points, tiling text() in order, and focusedBlock() marks the one currently being converted. Indices carried here (caret, block sizes) are in code points, matching the platform IME.

  • Constructor Details

    • PreeditEvent

      public PreeditEvent(String text, int[] blockSizes, int focusedBlock, int caret)
      An IME composition update. blockSizes splits text into conversion blocks, focusedBlock is the one being converted, and the caret is a char offset into text. Empty text ends the composition.
  • Method Details

    • text

      public String text()
      The composing text; empty when the composition ends (commit or cancel).
    • blockSizes

      public int[] blockSizes()
      Length in code points of each styled block; blocks tile text() in order.
    • focusedBlock

      public int focusedBlock()
      Index into blockSizes() of the block being converted, or -1 if none.
    • caret

      public int caret()
      Caret position within text(), in code points.
    • isEmpty

      public boolean isEmpty()
      Returns:
      whether the composition is empty (i.e. this event clears the preedit)
    • toString

      public String toString()
      Overrides:
      toString in class Object