Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.
He leads the J2V8 project and has served on several …
Eclipse is obviously known for its great Java tooling, but the real power of Eclipse comes from the thousands of plug-ins that integrate seamlessly. No project exemplifies this more than the Eclipse Modelling Project. As we get closer to the Eclipse Luna release, I’m counting down 10 new features that I’m most excited about. On Friday we used Eclipse Sirius to create a model for the FIFA World Cup of soccer. From this model we created a series of graphical editors. Today we will create automatically generated forms from that same model using Number 8 on Luna Top 10 List: EMF Forms.
EMF Forms is part of the EMF Client Platform Project, a framework for building EMF-based Rich Client applications. Instead of manually coding form-based UIs, EMF forms renders the user interface from a view model. The view model defines layout, components and the bindings to the EMF Model. From our model of the FIFA World Cup, we will create a series of forms for tracking the details of each nation.
We will begin by defining a form for filling inputting player information. The form editor allows you to define your view model. The view model is comprised of both the visual elements (text boxes, date selectors, tables trees, etc…) and the bindings to the data model. You can also preview the form directly from the editor.
From this straight-forward view model, we can now directly manipulate each player on the pitch:
View models can be built to represent a single EMF Class (such as a player in this case) or from a subset of the class diagram. For example, a complex form can be used to display all the players on a team. Or a master/detail form can be created that lists all the teams in the tournament, with each team displaying the current roster.
Using EMF & EMF Forms, you can easily customize the label, hint text and supply custom validation of your forms. The visibility of certain UI elements can also be defined using custom rules.
EMF Client platform, and EMF Forms in particular, provide a great way to create highly interactive Rich Client applications from simple EMF Model. The actual UI is created at runtime by an extensible rendering component and it is possible to adapt all widgets and layouts. It is even possible to render a UI in another Toolkit, such as JavaFX.
For more Eclipse Tips & Tricks, follow me on Twitter.
Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.
He leads the J2V8 project and has served on several …