-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JavaFX properties #1222
Comments
Duplicate of #521. |
Since this got some update, can anyone tell me how requests work here? Does it need some amount of upvotes to be looked at or is it random? |
Moreover, I would suggest that the @Property annotation generates
If a class is tagged with @Property I would suggest that all fields implementing either ReadOnlyProperty, WritableValue, or both should be handled as JavaFX properties. |
Indeed there are a few refinements that would need to be done. I'm actually thinking that the annotation should be |
This seems like a perfect fit for Lombok. Would this be difficult to implement? @rzwitserloot at one point you were considering this but since then none of the JavaFx related issues seem to get any response. |
@gtnarg I think you mean the Google Group thread. |
@omega09 - you are correct - I think I mistakenly referenced @rzwitserloot |
I created a simple implementation which currently works in eclipse. @FxBean This will generate getters for the properties itself and Getters and Setters for the values itself. |
Thanks @rgra, but I could not get this to work. I built your fork and referenced the resulting jar in a project with your given test file. I get no compilation errors but also no methods are generated - not in the Outline view in eclipse and not in the autocomplete options. What am I missing? |
@omega09 Here's the source I used which is working for me (when launching lombokized eclipse in debug mode from within eclipse) Did you replace the lombok jar which is eclipse using and which your project is using? |
No... So now this is working. There are a few things that need to be corrected. I don't know what's your preferred method here: that I point out each issue in this thread, that I fork your fork and commit my changes there, or that I create pull requests to yours. For now I'll use the first method:
Thanks again for starting this. |
@omega09 Sorry my post might have been misleading. |
@rgra I see, I thought it was a first step towards implementing this feature into Lombok. Looks like we're back to waiting for a formal review on this request. |
I have a somewhat working implementation of this for Eclipse. A problem I'm facing is that I don't know how to check if the field type implements specific interfaces. Does this require resolution? |
@omega09 If you talking about determining if a particular class instance implements an interface, you can use:
There's also a getInterfaces() method on the class object that returns an array of interface class objects the class implements. |
@tpmoney We're dealing with the AST/Eclipse Node directly. Neither of those would work. |
@omega09 if I'm not mistaken the NodeType we're dealing with should be |
@f-cramer |
Is there any update or implementation for this? :) |
I can upload my fork which is a partial work for Eclipse if you want. |
I would really appreciate that! Thank you! |
Ping. Any updates on this? Would love to help in any way I can 😄 |
Ping, too. I would be interested on this feature, too. |
What we would need is at least a before and after image. What would the code look like with |
Oh, and there is no way to way to see if a field implements an interface. That needs resolution. |
Hello, thank you for the fast reply. Here is one example for a Property and the three posible outcomes. One:
Would become:
Two:
Would become:
Three:
Would become:
This three cases have to be implemented for the folowing Property-Types:
For more information about FX-Properties you could read this: |
Hello, are you working on the issue or is more information needed? Greatings. |
+1 |
Duplicate of #521 |
JavaFX expands upon the JavaBean concept and uses properties for bindings (see http://docs.oracle.com/javase/8/javafx/properties-binding-tutorial/binding.htm).
When defining a property, you are instructed to write the following code:
The current @Getter and @Setter are not compatible, since
results in getting and setting a DoubleProperty and not the wrapped double. The getter for the property itself should also be renamed from getXXX to XXXProperty.
Can Lombok add support for this? Ideally you would have an annotation for those 3 methods for a single field, with an option to disable the wrapped value get and set and leave only the XXXProperty since getting and setting the amount is for backwards compatibility.
Example:
@Property DoubleProperty amountDue = new SimpleDoubleProperty();
would generate the first code block posted.
@Property(valueMethods=false) DoubleProperty amountDue = new SimpleDoubleProperty();
would generate only the getter for the property itself.
Addendum:
The getter and setter methods are
final
by convention. An optionfinalMethods=false
could be useful if someone wants to avoid the convention.The text was updated successfully, but these errors were encountered: