Hi,
When I create an AWM the hints defined for the fields are put literally into the generated application sheet. How can I access these hints via the API?
Thanks
Guido
Hi,
When I create an AWM the hints defined for the fields are put literally into the generated application sheet. How can I access these hints via the API?
Thanks
Guido
The hints are saved as metadata of the properties from the class generated by AWM. You can see them by editing the generated class (page) using the class editor (you need to configure your user profile to be an advanced user). See https://extensions.xwiki.org/xwiki/bin/view/Extension/App+Within+Minutes+Application#HApplicationPages . The page I’m referring is the “Holiday Class”. So in order to access the hints you need something like this:
$xwiki.getDocument('Demo.Code.DemoClass').getxWikiClass().get('shortText1').getHint()
Thanks, Marius!
I now use Java to display my AWMs and use code like the below to get the hints.
com.xpn.xwiki.XWikiContext context = contextProvider.get();
com.xpn.xwiki.objects.BaseObject obj = context.getDoc().getFirstObject("shortText1");
com.xpn.xwiki.objects.PropertyInterface pi = obj.getField("shortText1");
com.xpn.xwiki.objects.BaseProperty bp = (BaseProperty) pi;
String hint = bp.getPropertyClass(context).getHint();