<div dir="auto">label = "%key"<div dir="auto"><br></div><div dir="auto">tableViewBuilder.enableI18n(true).build();</div><div dir="auto"><br></div><div dir="auto">It's just an idea. It also can be done setting a i18n transformer class on the builder.</div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Em dom., 22 de jan. de 2023 13:24, Michael Strauß <<a href="mailto:michaelstrau2@gmail.com">michaelstrau2@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This looks interesting, but I'd rather have this as a library.<br>
One question: how does this approach work with language localization,<br>
given that "label" is a constant?<br>
<br>
On Sun, Jan 22, 2023 at 1:08 AM Thiago Milczarek Sayão<br>
<<a href="mailto:thiago.sayao@gmail.com" target="_blank" rel="noreferrer">thiago.sayao@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> 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).<br>
> It Would be very useful if we could just copy database mapped objects to javafx observables and say: Display it on a tableview.<br>
> Configuration of each column would be done as an annotation, like this:<br>
><br>
> public class EmployeeObservable {<br>
>     @Column(label = "Registration", style = "-fx-alignment: right")<br>
>     private IntegerProperty registration = new SimpleIntegerProperty();<br>
><br>
>     @Column(label = "Name")<br>
>     private StringProperty name = new SimpleStringProperty();<br>
><br>
>     @Column(label = "Salary", converter = BigDecimalCurrencyConverter.class)<br>
>     private ObjectProperty<BigDecimal> salary = new SimpleObjectProperty<>();<br>
><br>
>     //boilerplate here<br>
> }<br>
><br>
><br>
> Other annotation options:<br>
><br>
> @Column(ignore = true)<br>
><br>
> @Column(graphicsConverter = CheckBoxGraphicsConverter.class)<br>
><br>
> And to apply it:<br>
><br>
> TableViewBuilder<EmployeeObservable> builder = new TableViewBuilder<>(tableView, EmployeeObservable.class);<br>
> builder.build();<br>
><br>
><br>
> 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.<br>
><br>
> I'm not sure if it would go in a general purpose toolkit, but I thought it would be nice to share (the idea).<br>
><br>
> -- Thiago.<br>
><br>
</blockquote></div></div>