Designer @autogenerated fields are private, protected would be better

I´m new to Vaadin and give it a test at the moment. The designer is for newbies like me a great help.
I also want to use Grails as framework for developing the application and UI logic.

Because the designer can’t import groovy files even if they contain native java code (I get a NullpointerException) I decided to subclass the java class that is generated by the designer, implement my UI logic in this subclass that´s a groovy class and use this subclass in my application.
Unfortunately the members of the UI components I drag into the designer are private members of the CustomComponent class. So I can´t use them directly in my subclass. I would have to write protected getters for all these members. This is quite cumbersome for a groovy/grails developer.
Couldn´t you make those members protected?

Regards Helmut

Hi,

I think this sounds fairly reasonable. I guess the fields are private because things break easily if you use them (reference a field, then rename/remove it), but the same is true within the class itself, so they might as well be protected - it’s your own fault if you break stuff. Or package-private could be considered as well.

I’m just quickly jotting down thoughts here, I think we’ll need to consider this more carefully before changing - but the case is valid IMO, and we should do something.

Would you like to add a ticket? Target the “Plug-in for Eclipse backlog” milestone and the “Visual Designer” component…

Best Regards,
Marc

Hi Marc,

I´ve just created a ticket.

Thank you for your response.
Helmut

Ick. We require javadoc comments for protected and public class items (fields and methods), but not on private elements (they’re internal to the class itself, so they do not have to be documented for external access).

Making the elements protected will generate Eclipse warnings for protected fields w/o javadoc comments.

What’s so hard about right-clicking in Eclipse and choosing ‘Generate Getters/Setters’? Process a whole class in seconds…