I started using Metawidget (with Java) recently and I am having problems figuring out how to write my own ActionListeners for the autocreated fields. Can anyone give me some hints, tips or examples? Do I need to write my own annotation for that?
Thank you for your help in advance!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Quite how you decide whether to attach an ActionListener is up to you. It could be as crude as just checking attributes.name or you could create your own custom annotation (and then a custom Inspector) and then look for that. Here's an example:
I'm using Swing.
The problem I have right now is, as soon as I switch to the TabbedLayout as it is in the example, all @Action buttons disappear from my UI. Is there a way to fix that?
When I used the simple config such as mWidget.setConfig(xmlDocument);, then it works fine. With the CompisiteInspector, the tabs are fine, but all my buttons go away.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Everybody!
I started using Metawidget (with Java) recently and I am having problems figuring out how to write my own ActionListeners for the autocreated fields. Can anyone give me some hints, tips or examples? Do I need to write my own annotation for that?
Thank you for your help in advance!
Thanks for your interest in Metawidget.
To attach an ActionListener, add a custom WidgetProcessor. Here are some helpful links:
http://blog.kennardconsulting.com/2012/06/swingmetawidget-limiting-length-of.html
http://metawidget.org/doc/reference/en/html/ch02s05.html
Quite how you decide whether to attach an ActionListener is up to you. It could be as crude as just checking
attributes.name
or you could create your own custom annotation (and then a customInspector
) and then look for that. Here's an example:http://blog.kennardconsulting.com/2010/05/custom-annotations-uifacescomponentprop.html
Note the examples are for JSF and Swing, but the API is the same for all supported frameworks.
Thank you so much. I got it working with that reply!
I'm using Swing.
The problem I have right now is, as soon as I switch to the TabbedLayout as it is in the example, all @Action buttons disappear from my UI. Is there a way to fix that?
When I used the simple config such as mWidget.setConfig(xmlDocument);, then it works fine. With the CompisiteInspector, the tabs are fine, but all my buttons go away.
Can you send example code to support@metawidget.org?