Let's say I have subclassed the default TableView<T> class provided by javafx and created a class PersonTableView extends TableView<Person>. That subclass exists in java code and does not use fxml at all. It defines and encapsulates behaviour that I need specifically for my Person object.
Now I want to use an instance of my custom class inside of an fxml file, just like I would use all the default controls. And that exactly is my problem, I don't know how I can do that, or if this is even a good / common design decision.
I want to encapsulate the behaviour for my specific TableView inside its own class, but the layout should be defined in fxml as it has nothing to do with logic, it is only cosmetics.
I imagine a kind of syntax and functionality like it can be found in WPF from .NET, where you can use your custom classes in markup like any other control, because xaml and c# are more tightly coupled than java and fxml.
From my current Point of View, what I described cannot be done and I would instead end up using only a very small amount of fxml and a lot more code, even for the parts that are just layout. For Example I do not want to use code like this:
AnchorPane.setRightAnchor(customControl, 65.0); because I believe that it is a good Idea to have this defined inside my fxml.
So my question is either, how do I implement what was just described above; or, if that is uncommon, what is the common, "best-practice" way to get similar functionality to what I just described?
<?import com.example.PersonTableView ?>at the top of the fxml file and you should be able to do<PersonTableView ...>.