Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 486500

Summary: Ensure collection properties are always created lazily.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF MVCAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 0.2.0   
Target Milestone: 4.0.0 (Neon) M7   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2016-01-25 12:44:56 EST
JavaFX only works with observable collections (and does not provider a property for them). Currently, we provider properties and the collections. We should remove the collections and only retain the properties, so that, internally, the observable value/collection could be replaced, and collection-specific change listeners would still be notified about subsequent changes.
Comment 1 Alexander Nyßen CLA 2016-01-26 01:08:55 EST
In addition we should think of wrapping the observable collections into some "MutingWrapper" (which prevents client listener registration and only accepts the listener of the property) before setting them on the property, so that no client can register listener's by mistake there.

Also, internal code should only use the collection and the properties could thus be lazily created when accessed by clients only. This should reduce the memory footprint to one comparable before adopting JavaFX properties (while there, even the collection themselves were lazily constructed).
Comment 2 Alexander Nyßen CLA 2016-03-03 02:04:17 EST
Having re-considered that, I would now opt to not restrict listener registration and leave that responsibility to clients. 

What should IMHO be done is creating the properties lazily throughout, so that memory footprint is reduced.
Comment 3 Alexander Nyßen CLA 2016-05-03 13:16:34 EDT
[486500] Ensure collection properties are initialized lazily.

- Ensured that (unmodifiable) collections and collection properties within AdaptableSupport, AbstractAnchor, AbstractContentPart, and AbstractVisualPart are lazily initialized.
- Augmented API of IAnchor/AbstractAnchor to offer a getPositionsUnmodifiable() accessor method.

While the last change is indeed an API change, I included it for RC1, as it is a mere addition of API that is fully implemented by the abstract base class.

Resolving as fixed in 4.0.0 RC1.
Comment 4 Alexander Nyßen CLA 2016-05-04 06:43:35 EDT
Changing milestone as this was included in the updated contribution for M7.