Proposal: Invalidation mechanism for redrawing/recalculating in custom components

Richard Bair richard.bair at
Mon Dec 17 14:39:30 PST 2012

> What the invalidateDisplayList method exactly does is schedule a call to
> the updateDisplayList method during the next frame, therefore avoiding
> multiple calls to updateDisplayList when setSelectedItem and setDefault are
> being called right after each other.
> This mechanism becomes even more useful when part of the redraw code is
> being shared between _selectedItemChanged and _defaultChanged.

Internally we do a similar thing in many cases -- batch changes up until the next pulse. Sometimes this leads to confusion (for example, CSS is applied once per pulse, so people are surprised when they ask for the size of a Button and find it is 0x0 -- because CSS / Layout haven't happened yet, until after the first pulse when it magically gets a size). But we have a JIRA I think about exposing the pulse listener mechanism for batching things up. Another option is an AnimationTimer which fires off once per pulse.

> Flex also has the following method pairs for measuring code and property
> calculation code:
> invalidateProperties() / commitProperties()
> invalidateSize() / measure()

you mean like requestLayout() / prefWidth / prefHeight / layout / etc?


More information about the openjfx-dev mailing list