Tuesday, June 15, 2010

My 2 cents HTML export for the WC 2010 application

I would like to go further with the Eclipse World Cup 2010 application, to help skeptical people to believe in modeling technologies. The EEF team created an RCP 'forecasts' game. Yersterday, someone said that exporting the results in HTML could improve this game. No sooner said than done.


The RCP application comes with a metamodel project : 'fr.obeo.dsl.worldcupforecast'.

Here is a short description of how to make a simple HTML generator with Acceleo, based on this 'forecasts' metamodel.

It is recommended to use a bottom-up approach when developing generators; Acceleo eases this process by allowing you to initialize the content of a generation module with an HTML example, and offering specific actions to transform these examples (static text) in dynamic OCL expressions.

Let's create the 'results.html' example file which contains an image and a single row line.


We create the code generation project with the new HTML code generation file.


The main template is initialized with the example content. It is based on the 'forecasts' metamodel.


We would like to create a row line for each player, starting from the best to the least score. Thus, we create a 'for' statement to iterate over the players.


Finally, we run the coge generator on the forecasts model. It's done!


Note that you can directly access the online model in your launcher.


Here are the files : the results page, the Acceleo project, the MTL file.



10 comments:

Jesper said...

Is the rating online somewhere? I can't wait to submit a player name with a script tag in it!

;-)

The tooling, though, looks nice.

Jonathan Musset said...

Sorry, I forgot...

http://www.obeo.fr/download/eef/samples/wc2010/results.html

The results are also available in the RCP application.

Jonathan Musset said...

I will try to update this web page everyday...

Anonymous said...

What a wonderful idea to promote EEF!

In the World Cup Results and Ranking editor my score in the Rating tab is less than the sum of my scores in the Forecasts tab. Any idea why?

Jonathan Musset said...

The EEF team will answer your question. We had the same kind of problem with another guy and there were differences between the validated forecasts and the local forcasts. It happens when you commit the forecast before saving your file. The application isn't perfect ;-(

The EEF team is looking at your validated forecasts and will come back with an answer ;-)

Unknown said...

Hi Eclipsehowl,

I checked your scores sum and the problem is that you have probably committed your file after the validation of 12/06/10 match day. So your forecasts for this day are draw score for all matchs.

Unfortunately, the validated forecasts are not displayed. The forecast days you see is what you have committed from the last time.

Jonathan Musset said...

FYI :
Forecasts are validated at 06:00 AM UTC

http://wiki.eclipse.org/EEF_Sample_World_Cup_Forecasts

Anonymous said...

Hi Florian, hi Jonathan,

Too bad, the 12th was one of my best forecast days. But anyway, thanks for the information and this is a very nice way to promote technology. Keep on going!

carbon said...

html example codes for beginners
Vertical align image

sunset said...

html header tag color and font examples
H tag color font-family