Comments (9)
๐ค jacek99 ย ๐ Aug 12, 2009 at 14:33 UTC
One of the biggest problems in Java is the lack of proper two-way
databinding between POJOs and GUI components. it is possible, but becomes
VERY verbose since every setter needs to fire a firePropertyChange event.
I've tried to tackle this problem in my ClassBuilder utility, but your
approach is WAY better.
I've summarized the two-way binding issue here:
http://code.google.com/p/javabuilders/wiki/ClassBuilder
(see the "What is the problem we're trying to solve?" section)
it would be amazing if @ Data had an option to generate all the
PropertyChangeSupport plumbing on the class and setters...this would
singlehandedly fix in Java what Sun was unable to do for 10 years.
P.S. There should be an option to specify the type of PropertyChangeSupport
class you want to use, there are specialized types for Swing that ensure
that firePropertyChange calls are always on the EDT thread, for example.
See the Wiki link for @ Bindable (not sure if that is the API you would want
to use) or maybe
@ Data(bindableVia=SwingPropertyChangeSupport.class)
Thanks! Amazing project you have here.
from lombok.
๐ค warchildwts ย ๐ Aug 16, 2009 at 18:22 UTC
If you look through some of the discussion sections, I do believe this is in the
works. From what I can tell, instead of working with the @ Data annotation, there
will be a @ Property annotation instead.
from lombok.
๐ค reinierz ย ๐ Aug 18, 2009 at 12:07 UTC
Correct, it's in the works, there are a few discussion threads in the newsgroups about how to get this right, and
it won't be on Data, it'll be a separate annotation most likely called @ Property.
from lombok.
๐ค jacek99 ย ๐ Aug 18, 2009 at 16:12 UTC
Perfect..just a reminder that whatever solution you come up with, it must allow
overriding which type of PropertyChangeSupport class is used. In Swing apps the
SwingPropertyChangeSupport is necessary, otherwise EDT violations will occur:
http://java.sun.com/javase/6/docs/api/javax/swing/event/SwingPropertyChangeSupport.html
from lombok.
๐ค psccox ย ๐ Dec 08, 2009 at 23:28 UTC
Don't forget vetoable properties, as per the JavaBeans spec.
(BeanInfo generation via annotations, e.g. for icons, editors etc would be nice too!)
from lombok.
๐ค reinierz ย ๐ Jul 25, 2010 at 00:24 UTC
Issue #180 has been merged into this issue.
from lombok.
๐ค Greg.Matoga ย ๐ Jul 26, 2010 at 17:54 UTC
Quick and dirty hack: http://code.google.com/p/lomprop/ - use the @ BindableData annotation - generates proper getters and setters, methods: addPropertyChangeListener, removePropertyChangeListener; and an initialized field $propertyChangeSupport. Resulting bean is bindable using JSR-295 (tested in NetBeans).
from lombok.
End of migration
from lombok.
I'm closing this, with pain in my heart.
The problem is: The 'obvious' ways to do this, which somewhat match what the community does, are, in my opinion, bad. Possibly not their fault, given that they don't have code gen in their tool box.
I do not want to introduce a feature in lombok when I know a better take is realistic.
Nevertheless, this feature clearly isn't important enough: GUIs with java aren't exactly popular. Perhaps a self-fulfilling prophecy (GUI building in java is not popular and insofar that people do it, they don't use the notion of binding properties/fields to a widget as the way to make it happen, because it's hard to set it up), but it does mean that in order to change the world, we need to be out there advocating for this newer, better way.
If the community at large is clearly shrieking out for a fix, I could be tempted in getting the soapbox out. But the 'build GUIs in java' community seems hard to reach and somewhat conservative to me: That plan seems clearly doomed to failure for me.
Which leaves us with no options. I won't accept a crappy take on properties, and a good take probably won't be understood / adopted by the community.
To make matters worse, neither I nor as far as I know @rspilker works on GUIs in their daily java travails, so the ideas we have about a really cool take on properties in java are based on academics and lack experience. They also lack the 'scratch your own itch' factor. These are on us and can be mitigated with broader community support reviewing the work and/or a contributor that does have personal experience, of course, so these aren't show stoppers. Just - not helping.
from lombok.
Related Issues (20)
- @FieldDefaults: Keep the global setting experimental, make the annotation permanent.
- [FEATURE] Allow to easily add interfaces to Builders
- [BUG] Support for Eclipse 2024-06 (4.32) HOT 14
- [FEATURE] Super Constructor
- [FEATURE] enhance @FieldNameConstants with specific prefix string HOT 2
- [BUG] SuperBuilder does not compile then binding generics to an array HOT 5
- [BUG] SaSessionForFastjsonCustomized็ฑปไธญ็getModelๆฅ้ HOT 1
- [FEATURE] setX() for mutable state, fluent otherwise HOT 2
- [BUG] Lombok 1.18.34 (Edit updated) not working with eclipse 24-06 HOT 3
- [QUESTION} How to build lombok using JDK21 (javac)
- Support for an entirely new constructor generation HOT 2
- [FEATURE] Support for use extension method within the same class it was declared in
- [@ToStringJSON, @ToStringJSONPretty] Please add feature when class have some others lombok JSON. For default actual mode of lombok ToString. HOT 1
- [BUG] Lombok with Java 21 Compilation failure with v1.18.32
- [BUG] Warning when using @StandardException with the -Xlint:this-escape compiler flag
- [BUG] Potential NPE in EclipseHandlerUtil.setDocComment(..) HOT 1
- [BUG] @Delegate throwing null pointer exception on enums
- [BUG] `@Getter` with `AccessLevel` and `onMethod_` causes a compile error
- [BUG] `StringIndexOutOfBoundsException` in `EclipseHandlerUtil.getDocComment()`
- [BUG] Encountering stack overflow error when building spring app with lombok. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lombok.