blob: 90c9a0ab99b20b93cde2d7258b5b02ad1107a449 [file] [log] [blame]
<md-content layout="column" layout-align="center stretch" class="content">
<ul class="breadcrumb">
<li><a href="#/documentation/2.0.2">2.0.2</a> <span class="divider">/</span></li>
<li><a href="#/documentation/2.0.2/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/2.0.2/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>
<li>forceRefresh: This property is used to indicate that the dynamic mapping is based on an iterableExpression which may return a different result overtime for the same object contrary to the example before
<code>aql:self.eClass().eAllStructuralFeatures</code>. By setting forceRefresh to true, we will force the refresh of the user interface when evaluating this 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>