Sunday, May 30, 2010

What an Action can do

Actions can only do a couple of things.



The execute expression is an Eco-Action-Language expression that is rooted in some context.

For GlobalActions this context is null, so what you can do is limited to expressions that stem from a class of your model, like X.allinstances or X.Create. The EAL-editor is displayed by the button next to the expression:


If the Action is a ContextAction, you get access to the variables that the context define, these are named as vCurrent_TheViewModelClassName. So you can either act on classes as with GlobalActions or act on the current value of variables from the context. The variables follow the selections that the users do in ViewModel grids, so you can act on things the user has selected.

When you have an object context like this you can call methods that the objects class define:


And you can of course use all the attributes and navigate all the associations in as many steps as you need to get the desired effect.

If the action is a ClassAction the action is rooted in an object of that class, and you use the OCL identifier “self” to operate on this.


The EnableExpression is very similar to the ExecuteExpression, except it is not an EAL expression, it is an OCL Expression. As such it cannot have side effects (it cannot change anything in your domain of objects). And the EnableExpression must also evaluate to a boolean value of true or false.


Except from these differences the expression operate on the same context and can reach the same variables etc as described for the ExecuteExpression.

The EnableExpression is used to control when an action should be executable or not.

Consider that you have a state machine on the class X and you only want the Delete action to be enabled when X is in state Deletable : self.oclIsInState(#Deletable)

BringUpViewModel & ViewModelRootObjectExpression


An action can bring up a ViewModel defined UI, and when it does it will assign the Root object of the viewmodel the result of the ViewModelRootObjectExpression. If the ViewModel RootObject Expression is empty the Root object of the brought up ViewModel defined UI will be unassigned – and this might be perfectly fine for certain types of UI’s, like UI’s designed to seek persistent storage for example.

ViewModelIsModal & ExpressionAfterModalOk


If the action is set to bring up a ViewModel powered UI, you may also choose to bring that UI up as a Modal window (a dialog you need to Ok or Cancel to get away from). The WECPOF runtime will add an OK and Cancel button to the bottom of your window if this is set.

If the user clicks Cancel in such a window nothing else happens besides the fact that window is closed. But if the user clicks Ok the WECPOF runtime will execute the ExpressionAfterModalOk if you have defined it.

The ExpressionAfterModalOk is an EAL expression that works on the context exactly like the ExecuteExpression does, but the ExpressionAfterModalOk also bring the variables from the ViewModel UI that was modal and is now closing. This fact enables you to read values of the window about to close and to apply these values to your current context.

The variables taken from the window that is closing are prefixed with “vModalResult_” in order to avoid name collisions with the calling context.


This will enable you to create a Seek/Pick/Assign pattern in a WECPOF application.

Consider that you have a Car-rental-model, you a have a ViewModel that shows the rental contract and you now need to assign a Car to the Contract. The choice to use a ComboBox to scroll and find a car is no good because the number of possible Cars are 500+. So instead you add a ContextAction to the Rental contract ViewModel that brings up the Free-Car-Seeker-ViewModel, and you tick the ViewModelIsModal checkbox.

You also define the ExpressionAfterModalOk to be vCurrent_RentalContract.AssignedCar:=vModalResult_Current_PickedCar.

Framework Action

If you pick a framework action none of the other expressions will apply.


The Framework action is added to allow access to functions that operate on a different level then your model.

Save – saves the changed (created, deleted, updated) objects using the persistence mapper that you have used in your EcoSpace (Or in Gaffr).

Refresh – calls Refresh on your Persistence mapper if it supports Refresh (set up sync server to allow)

Undo/Redo – calls undo or redo on your ecospace. The current  WECPOF runtime uses a timer to create new undoblocks every other second if there are new changes.

Exit – quits the WECPOF application


Post a Comment

Subscribe to Post Comments [Atom]

<< Home

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