xiaochong / zkui

Grails ZK UI Plugin
http://grails.org/plugin/zkui
GNU Lesser General Public License v3.0
24 stars 8 forks source link

Modify BindComposer to wire and listen with ZK Selectors #56

Closed aaloise closed 12 years ago

aaloise commented 12 years ago

Please, add this two lines in org.grails.plugins.zkui.composer.BindComposer

Selectors.wireComponents(comp, _viewModel, true); Selectors.wireEventListeners(comp, _viewModel);

Inside method doAfterCompose right before Selectors.wireVariables(comp, _viewModel, Selectors.newVariableResolvers(_viewModel.getClass(), null));

With that our ViewModels can Wire and Listen just like SelectorComposer. Also including the necessary imports of those two annotations in ViewModel artifact

aaloise commented 12 years ago

I would perform a pull request but don't know how to do it

xiaochong commented 12 years ago

Can you tell me why do it?

MVVM isolates the View layer and the Model layer avoiding tight coupling between the View and Controller layer.

Put UI components in View Model go against MVVM,so it not be advocated.

aaloise commented 12 years ago

Well, I just thought that it would be a cool feature to combine Selectors with MVVM if someone needs to do it. I saw it on Access UI Components Inside ViewModel and found it interesting

But if you think that's not a good idea feel free to reject my suggestion, after all you are the project owner

xiaochong commented 12 years ago

Well,it useful in some case,so I accept your suggestion.

But i will not documented it since we do not encourage this approach.

Btw, you can fork zkui project then pull request your code.

aaloise commented 12 years ago

Ok, thank you for accepting the sugestion. I agree with yout about keeping the aproach out of the plugin documentation.

I'll try to pull request the code.

aaloise commented 12 years ago

Pull request accepted