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.

image

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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

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