FXMisc / Flowless

Efficient VirtualFlow for JavaFX
BSD 2-Clause "Simplified" License
185 stars 38 forks source link

Make VirtualizedScrollPane FXML ready #25

Closed aalmiray closed 8 years ago

aalmiray commented 8 years ago

The current design of this class has a no-args constructor which hinders the ability to use VirtualizedScrollPane inside an FXML file.

TomasMikula commented 8 years ago

has a no-args constructor

I suppose you mean "has no no-args constructor".

Taking the content node as a constructor parameter ensures that any instance of VirtualizedScrollPane is properly initialized. Splitting this initialization between a no-args constructor and, say, setContent, opens room for initialization bugs. I don't like when tools, in this case FXML, force us to write less robust code. (Not to mention that a multi-step initialization complicates both the implementation and use.) Isn't it time to fix FXML?

aalmiray commented 8 years ago

I completely agree with you. I rather have a bullet-proof design rather than opening it up for the sake of convenience of a tool. Unfortunately we can't extend FXML and can't tweak FXMLLoader (it's riddled with lost of private API usages). So the current options are to support FXML or not.

I guess for now the only way to create instances of VirtualizedScrollPane is through programmatic means

hwaite commented 7 years ago

Could constructor be updated to leverage javafx.beans.NamedArg?

hwaite commented 7 years ago

javafx.beans.DefaultProperty class annotation is also worthy of consideration. Would make FXML cleaner.