TableViewBuilder idea
Mike Hearn
mike at hydraulic.software
Mon Jan 23 14:34:21 UTC 2023
One thing worth considering is that the approach of putting everything in a
third party library makes it much harder to find things. JavaFX has a lot
of capabilities that you can't find out about unless you spend time
maintaining an encyclopedic knowledge of hundreds of GitHub repositories.
This isn't unique to JavaFX obviously, lots of frameworks and ecosystems
have the same issue. But there is tremendous value in standard libraries,
in having things be in one place where browsing the docs or using
autocomplete is sufficient to discover them.
Consider if there was no javafx.controls module! Instead for every widget
you had to find them on GitHub and they all came from different authors,
had different levels of documentation, might conflict with each other and
so on. Some toolkits do work that way (e.g. reactjs, compose) but I didn't
enjoy it much.
On Sun, 22 Jan 2023 at 17:38, Thiago Milczarek Sayão <thiago.sayao at gmail.com>
wrote:
> label = "%key"
>
> tableViewBuilder.enableI18n(true).build();
>
> It's just an idea. It also can be done setting a i18n transformer class on
> the builder.
>
>
> Em dom., 22 de jan. de 2023 13:24, Michael Strauß <michaelstrau2 at gmail.com>
> escreveu:
>
>> This looks interesting, but I'd rather have this as a library.
>> One question: how does this approach work with language localization,
>> given that "label" is a constant?
>>
>> On Sun, Jan 22, 2023 at 1:08 AM Thiago Milczarek Sayão
>> <thiago.sayao at gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > TableView data usually comes from a database and is mapped to java
>> objects (I don't have actual statistics on this but it's probably a true
>> assertion).
>> > It Would be very useful if we could just copy database mapped objects
>> to javafx observables and say: Display it on a tableview.
>> > Configuration of each column would be done as an annotation, like this:
>> >
>> > public class EmployeeObservable {
>> > @Column(label = "Registration", style = "-fx-alignment: right")
>> > private IntegerProperty registration = new SimpleIntegerProperty();
>> >
>> > @Column(label = "Name")
>> > private StringProperty name = new SimpleStringProperty();
>> >
>> > @Column(label = "Salary", converter =
>> BigDecimalCurrencyConverter.class)
>> > private ObjectProperty<BigDecimal> salary = new
>> SimpleObjectProperty<>();
>> >
>> > //boilerplate here
>> > }
>> >
>> >
>> > Other annotation options:
>> >
>> > @Column(ignore = true)
>> >
>> > @Column(graphicsConverter = CheckBoxGraphicsConverter.class)
>> >
>> > And to apply it:
>> >
>> > TableViewBuilder<EmployeeObservable> builder = new
>> TableViewBuilder<>(tableView, EmployeeObservable.class);
>> > builder.build();
>> >
>> >
>> > I actually have implemented this and it's very useful. I can't share it
>> because I've done it for a private company, but it's easy to re-do it.
>> >
>> > I'm not sure if it would go in a general purpose toolkit, but I thought
>> it would be nice to share (the idea).
>> >
>> > -- Thiago.
>> >
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230123/2246feb4/attachment-0001.htm>
More information about the openjfx-dev
mailing list