Features which would make JavaFX great
899700Nov 16 2011 — edited Nov 17 2011Hi
At my previous job I wrote a client application using WPF. It offers a few features for which I'm trying to find equivalents in JavaFX.
I'm just starting to learn/investigate JavaFX and it seems like a nice library.
WPF offers two controls which in my opinion is the cornerstone of their framework, namely ContentControl and ItemsControl (and derived classes like ListView).
With a ContentControl I can bind a ViewModel to it's content and then provide a template with which to render it. In WPF it would look something like:
<ContentControl
Content="{Binding Path=Person}"
ContentTemplate="{StaticResource PersonTemplate}"/>
where Person would be a property on the current DataContext.
I guess the equivalent in JavaFX could be:
<ContentControl ContentProperties="model=${model.Person}" ContentTemplate="PersonTemplate.fxml"/>
where model is a variable which has a Person property and PersonTemplate.fxml would be another FXML script which could then use it's model property (which would be the Person object) for rendering. I'm just making up the ContentProperties syntax for illustration purposes.
The ItemsControl can be used to display a list of objects. The WPF example would look something like:
<ItemsControl
ItemsSource="{Binding Path=People}"
ItemTemplate="{StaticResource PersonTemplate}"/>
where People could be an observable list of Person objects. If it is observable, the by adding or removing Person objects from the list, the user interface gets updated automatically.
I guess I could write controls like these, but since they provide such great flexibility I'd imagine that they would better fit as part of JavaFX, if not already supported.