Yes, I agree with you; maybe this could be considered as part of the Minilang syntax refactoring effort you are leading: we could use similar attributes in widgets. But in the meantime again, thanks for the hint about the "#" syntax.
Jacopo On Mar 10, 2012, at 9:41 AM, Adrian Crum wrote: > Having a separate invoke attribute would be nice - it would make the widget > code clearer. > > -Adrian > > On 3/10/2012 8:39 AM, Jacopo Cappellato wrote: >> Ah, this is nice... I didn't know about this, thank you Adrian. >> >> Jacopo >> >> On Mar 10, 2012, at 9:37 AM, Adrian Crum wrote: >> >>> To call a function/method, just append "#" plus the function/method name to >>> the script location. >>> >>> -Adrian >>> >>> On 3/10/2012 8:35 AM, Jacopo Cappellato wrote: >>>> Hi all, >>>> >>>> from the widgets (screens, forms...) we can call a script using the >>>> following syntax: >>>> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy"/> >>>> >>>> What about adding an optional "invoke" attribute to it, to specify a >>>> method in the script? >>>> >>>> For example: >>>> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy" >>>> invoke="someMethod"/> >>>> >>>> In this way we would enable components to reorganize their scripts into >>>> less source files; for example, instead of having: >>>> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy"/> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy"/> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy"/> >>>> >>>> we could group the three files into one with three methods: >>>> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryScripts.groovy" >>>> invoke="editCategory"/> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryScripts.groovy" >>>> invoke="editCategoryContentContent"/> >>>> <script >>>> location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryScripts.groovy" >>>> invoke="editCategorySeo"/> >>>> >>>> Jacopo >>>>
