Search code examples
javaeclipsebindzkemf

binding ZK with EMF (java)


I'm working on a ZK project and I have a third-party domain model based on EMF. I need to find a way to bind the ZK view with the EMF model.and I didn't find anything about that.


Solution

  • EMF is a code generation framework.
    From their website :

    Three levels of code generation are supported:
    Model - provides Java interfaces and implementation classes for all the classes in the model, plus a factory and package (meta data) implementation class.
    Adapters - generates implementation classes (called ItemProviders) that adapt the model classes for editing and display.
    Editor - produces a properly structured editor that conforms to the recommended style for Eclipse EMF model editors and serves as a starting point from which to start customizing.

    Next is the server layer you need to implement, so you can insert/save/update/delete your items.

    Next is just using the generated classes in ZK.
    The zul just need getters/setters from your generated objects. Those are generated by EMF, as you can see in this tutorial.
    The ViewModel/Controller need services to load/save your objects.

    To remind, ZK it's only a GUI framework, it don't matter what model/persistency you use.