Thursday, April 29, 2010

Eco Action Language (EAL) & OCL

I have started to harvest the know how from our latest customer project. One new piece of functionality that will end up in new versions are Actions.

Actions in the Model are declarative definitions of what the user can do in your application.

Actions comes in 3 flavors as far as I am concerned; GlobalAction, ClassAction (he, he) and ContextAction.


Declarative actions will/can be used to generate menus and possible buttons in the user interface, just like Viewmodels can generate visible UI.

ClassActions are associated with a Class and the these actions should be available when right clicking an object of this class.

ContextActions are associated with a ViewModel and would only be visible in that ViewModel.

GlobalActions are actions like you see in the top level menu – they do not act on anything specific…

All actions Can, but are not required to , open up a ViewModel.

All actions have 3 expression, #1 is an OCL expression that controls if the action is enabled or not, #2 is an EAL expression that implements the actual action that will happen on execute and #3 is also an EAL expression that will fire if the action brought up a ViewModel.

Actions act on the available context, so all expressions for ClassActions will have a variable that contains the object the action executes on. ContextActions will have all the variables defined in the ViewModel on which they operate.

So all this use of EAL forced me to brush up on EAL syntax; like this expression so Create an object and set two or more of its properties…

Code Snippet
  1. let x=ContextAction.Create in
  2. (
  3.   Name:='NewContextAction'+ContextAction.Allinstances->size.asstring;
  4.   Presentation:='<Name>'
  5. )

EAL will let you to delete objects:

   1: self.Delete

But if you do not want a lot of logic in EAL, just add a method on your class and call that from EAL:

   1: self.MyMethod(vCurrent_SomeViewModelClass)

I intended to add more EAL examples here as I find the need.

The introduction of Actions in Modlr will greatly move our prototyping abilities forward, since you will be able to use Gaffr to create a rich application with a main menu (GlobalActions), with forms (ViewModel implementors) that has context specific actions (ContextActions) mixed with class specific actions.

Thursday, April 22, 2010

Enumerations in Modlr

One weakness that we recently rectified was the lack of enumeration definitions inside Modlr. Before you have to just assign an Enumerable type name to an attribute like so:


And then accept that Modlr treated your attribute of type string and not as an Enumerable:


This was simple because the Model was not informed about the Enumeration. In fact you had to define the enumeration some place in code yourself to get the CodeGen to use it.

But Now you can get up this dialog (add model elements, Edit Enumerations):


And in here you declare the enumeration name, values and code comments (and also the optional integer value).

If the CodeGen checkbox is checked we will add the enumeration to your code. The important thing here is that the model has been made more detailed by keeping the knowledge about enumerations inside the model, so that we can use the enumeration values in constraints, viewmodel validations etc.

Wednesday, April 21, 2010

Filter away exceptions

In Eco the OCL parser uses exceptions to abort operations that fails. Since the different levels in the parsing logic catch this exception, acts on it and then throws it again, you normally get not 1 but 5 halts for every error discovered (it halts on throw).

I have started to mask away these messages by adding the exception to the visual studio exception dialog like this. 


Saturday, April 17, 2010

This blog has moved

This blog is now located at You will be automatically redirected in 30 seconds, or you may click here. For feed subscribers, please update your feed subscriptions to

Sunday, April 11, 2010

MDL File importer

This is the third and last post on the Rational rose file importer.

Having this Rational Rose model:


I can now get this Modlr model:


The code is in the demos folder: PluginRoseFileRead

More importantly I tested this on a model I worked on some years ago for the swedish parliament:


It took almost two minutes to import it.

Notice to round magnifier in the diagram overview – we added this to Modlr some weeks ago, looks cool.

Contact Us | Terms of Use | Privacy Statement © 2009 CapableObjects