blob: 5a1392538e5d80404b32600c6de7e74334bcf1f6 [file] [log] [blame]
<md-content layout="column" layout-align="center stretch" class="content">
<ul class="breadcrumb">
<li><a href="#/documentation/1.7.1">1.7.1</a> <span class="divider">/</span></li>
<li><a href="#/documentation/1.7.1/language/overview">Language</a></li>
</ul>
<h2 id="DynamicMappings">Dynamic Mappings</h2>
<h3 id="description">Description</h3>
<p>The dynamic mapping is an advanced concept used to handle complex meta-model more easily. In a very complex meta-model, you cannot define the
<a href="#/documentation/1.7.1/language/widgets">widgets</a> of your properties, as such a more powerful mechanism is needed to define your user interface more quickly. This concept has been created to fulfill the following requirement: &#171;how can we create a text widget for each property with the type EString?&#187;.
</p>
<h3 id="properties">Properties</h3>
<ul>
<li>iterableExpression: This expression will use concepts of the meta-model in order to compute the number of element to take into account. This expression must return a collection of elements on which we will iterate to create the widgets. For example, to fulfill our requirement of one text widget for each property with the type EString, you could type the following iterableExpression
<code>aql:self.eClass().eAllStructuralFeatures</code>.
</li>
<li>iterator: The iterator will be used to define a name to manipulate the result of the iterable expression. To fulfill our requirement, we could use the name
<code>eStructuralFeature</code>.
</li>
<li>ifs: This property will contain all the use cases that can be handled by our dynamic mapping.</li>
</ul>
<p>An &#171;if&#187; contains the following two properties:</p>
<ul>
<li>predicateExpression: The expression that needs to be validated in order to create the widget of the if. This expression must return a boolean. To fulfill our requirement, we would use the expression
<code>aql:eStructuralFeature.eType = ecore::EString</code>. This expression will thus be executed for all the properties of our object given the fact that we are iterating on all its structural feature with our domain class expression and then for each structural feature, accessible in a variable named eStructuralFeature, we will ensure that the type of the feature is EString.
</li>
<li>widget: The widget to create. In our example, we would create a text widget in order to have a text widget for each property with the type EString.</li>
</ul>
</md-content>