Programmatic JavaFXBuilder w/o JavaFX bean properties
John McDonnell
mcdonnell.john at gmail.com
Fri May 25 05:53:53 PDT 2012
I would love not to have to replicate my POJO's as JavaFx beans, but how
will the Java FX property get updated when a standard POJO doesnt have a
mechanism (that I know of, apart from PropertyChangeSupport??) to listen to
changes made to properties, and update the JavaFX property?
Surely adding something like PCS, would mean that the bean isnt a POJO
anymore??
John
On 25 May 2012 13:20, Will Hoover <java.whoover at gmail.com> wrote:
> I was thinking that we could use something like the existing
> Bindings.bindBidirectional(property1, property2), but utilize what FXML has
> done under the hood...
>
> Then we could do something like Bindings.bind(person, "location.name",
> myJavaFxControlProperty). Where the specified JavaFX Property would be
> systematically bound (one-way) from the specified Property to the passed
> POJO path. This capability would at least give us a way to bind without
> creating a lot of boiler-plate code that is currently needed (i.e. JavaFX
> properties for all the domain model POJO properties used within an
> application). I noticed that most of the implementation for this currently
> exists within various components used by the FXMLLoader class. So, I would
> suspect that it would be trivial to implement?
>
> An even better solution would be to introduce an extension provider where
> other java specifications like JPA could play a role in the binding
> process.
> For example, JPA provides a mechanism to annotate an @Entity with
> @PrePersist, @PostPersist, @PreRemove, @PostRemove, @PreUpdate,
> @PostUpdate,
> and @PostLoad which allows a JPA binding provider implementation to capture
> changes to an @Entity POJO. Now, we could allow bi-directional binding
> using
> JavaFX control properties and JPA @Entity fields... Every time an @Entity
> field changes it can be reflected in the JavaFX control. Maybe something
> like Bindings.addProvider(myJpaToJavaFxBindingProvider) and
> Bindings.bindBidirectional(jpaAnnotatedPerson, "location.name",
> myJavaFxControlProperty)?
>
> -----Original Message-----
> From: Richard Bair [mailto:richard.bair at oracle.com]
> Sent: Thursday, May 24, 2012 9:30 PM
> To: Will Hoover
> Cc: openjfx-dev at openjdk.java.net
> Subject: Re: Programmatic JavaFXBuilder w/o JavaFX bean properties
>
> I'm not sure what you have in mind?
>
>
>
> On May 24, 2012, at 11:07 AM, Will Hoover <java.whoover at gmail.com> wrote:
>
> > Is there a way to programmatically use some of the automatic POJO binding
> > capabilities of the JavaFXBuilder class?
> >
> >
> >
> > I know we can use JavaFX bean properties using Bindings like
> > http://docs.oracle.com/javafx/2/binding/jfxpub-binding.htm , but who
> wants
> > to create a property for all the fields used in an domain entity/model
> > class?
> >
> >
> >
> >
> >
>
>
--
John
More information about the openjfx-dev
mailing list