Skip to content

Add Component::bindVisible #23030

@mshabarov

Description

@mshabarov

What is needed:

  • Add public void bindVisible(Signal<Boolean> visibleSignal) to Element
  • Component::bindVisible delegates to getElement().bindVisible(visibleSignal)
  • bindVisible has a similar contract as for Element.bindProperty(...):
    • bindVisible(null) unbinds;
    • calling setVisible or a second bindVisible while a binding is active throws BindingActiveException
    • binding is only active while attached;
    • null value behaves as false.
  • Memory-optimal feature storage, similar to TextBindingFeature as the visibility has a special handling in the framework;
    • A lightweight VisibilityBindingFeature on the node to hold an optional Registration and Signal<Boolean> reference. Lazily instantiation only when bindVisible is called to avoid overhead for typical components with no bindings.
    • Provide hasBinding(), setBinding(registration, signal), and removeBinding() (disposing registration), similar to TextBindingFeature usage in bindText.
    • Uses ElementEffect.bind() to actually establish a binding.

Metadata

Metadata

Assignees

Projects

Status

Done

Status

Done / Pending Release

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions