Package limn.scene

Interface ChangeObserver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ChangeObserver
A watcher: told about every change to a widget, whatever moved it.

Called on the UI thread, synchronously, from inside the call that made the change and after that widget's own state has settled — never from inside a paint. Any number of watchers may watch one widget, with no coordination between them, no ability to disturb each other or the application's handler, and no ability to be disturbed by them: each is invoked inside its own try, and a throw is contained and reported.

The source is a Widget because a watcher-channel source is a node in a widget tree. The five public types that are not widgets — ButtonGroup, Menu, MenuItem, PopupMenu and Dialog — are in no tree, so they announce nothing here and keep their handler slots; a radio group's change is fully recoverable from the two radio buttons, which are widgets.

What this channel does not say, by design and as part of the 1.0 contract:

  • A menu's highlighted item, a check item's state and whether a popup menu or dialog is open reach no watcher. What does arrive is coarse: opening or closing a popup is a CHILDREN change on the overlay root of the scene that hosts it, and a MenuBar announces its own EXPANDED. The accessibility tree carries all of it, through synthetic children the owning widget declares.
  • A subtree's setLocale or setInheritanceHost changes every name, description and formatted value under it and announces only LAYOUT. A watcher that follows text re-reads it after either, and after I18n.observeChanges fires for the process's language.

A watcher may read the widget, and may mutate anything: a nested change is announced synchronously, in full, before the outer dispatch continues. What it must not assume is a frame — a notification is delivered before any layout or paint the mutation asked for, so a watcher that reads geometry reads the geometry of the last pass.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    changed(Widget<?> source, Change change)
    Tells this watcher that source changed.
  • Method Details

    • changed

      void changed(Widget<?> source, Change change)
      Tells this watcher that source changed.
      Parameters:
      source - the widget that changed
      change - what changed on it, and what moved it