Filtri Menu 0 0.00

ZK Component extractor

ZK Component extractor

Hello,

today we share a little tool for extracting components name and id from a standard zul file.

schermata-component-extractor-google-chrome-1

The idea behind this tool borns after reading this small talk by Ashish Dasnurkar and after a comment on his works. I think in ZK there are many ways to access components from controller class (i.e. getFellow(), Composer, CDI…) but none of them save us from writing component variable declaration. This is why i need this tool.

There is a working demo at this link. Here are the source of the standalone zul page. I used a regular expression (<(\w*) [^>]*id=[“|’](\w*)[“|’][^>]*) to parse the zul file, it sounds a simply and reasonable approach to me. Another approach could be to create the components via the Execution.createComponents() and iterating over component tree, but it will be a little more complex and involve security risk, so i choose the easy way.

Hoping some guys from zkoss will accept the feature request to integrate this feature directly in zk studio.

Comments appreciated,

Thank you and see you next time

Condividi:

Iscriviti alla newsletter

Iscriviti alla nostra newsletter per ricevere offerte di sconto anticipate, aggiornamenti e informazioni sui nuovi prodotti.
Top