blob: 2f96ec67caf9af2d9e207828982972885ce9ae0e [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> <span class="divider">/</span></li>
<li><a href="#/documentation/2.0.2/language/widgets">Widgets</a></li>
</ul>
<h2 id="Radio">Radio</h2>
<h3 id="description">Description</h3>
<p>The radio widget can be used to display and edit a mono-valued property which can take one of several existing values. It can thus be used to edit a mono-valued EReference with a couple of potential values or an EEnum. The properties available on this widget are very similar to the ones available on a
<a href="#/documentation/2.0.2/language/widgets/select">select</a> widget. On top of the common properties of all widgets (identifier, labelExpression, helpExpression, isEnabledExpression, propertyValidationRules), it has the following properties:
</p>
<ul>
<li>valueExpression: The value expression is used to compute the value to select. This expression must return an object.</li>
<li>editExpression: This expression will be executed when the user will select a radio button. The selected value will be accessible using the variable
<code>newValue</code>. The variable
<code>newValue</code> will contain a candidate selected from the result of the
<code>candidatesExpression</code>. This expression does not have to return anything.
</li>
<li>candidatesExpression: This expression is used to compute all the radio buttons to create and the value that will be associated with each of them. This expression must return a collection of objects.</li>
<li>candidateDisplayExpression: This expression will compute the label of each radio button using the value associated to the button. This value will be accessible using the variable named
<code>candidate</code>. This expression must return a string.
</li>
<li>numberOfColumns: The number of columns to use to create the radio buttons. If you have twelve candidates and if you want them to be displayed on three lines, you can use the expression
<code>aql:4</code> to have your radio buttons created on four columns.
</li>
<li>style: The style of the radio widget.</li>
<li>conditionalStyles: All the conditional styles of the radio widget.</li>
</ul>
<h3 id="displayeenum">Display an EEnum</h3>
<p>In order to display in the user interface some radio buttons with the value of an EAttribute with an eType EEnum (i.e. the visibility of an EObject), you can create a radio widget with the following properties:</p>
<ul>
<li>labelExpression:
<code>aql:'Visibility:'</code>
</li>
<li>valueExpression:
<code>aql:packagename::Visibility.getEEnumLiteralByLiteral(self.visibility.toString())</code>
</li>
<li>editExpression:
<code>aql:self.eSet('visibility', newValue.instance)</code>
</li>
<li>candidatesExpression:
<code>aql:packagename::Visibility.eLiterals</code>
</li>
<li>candidateDisplayExpression:
<code>aql:candidate.name</code>
</li>
</ul>
<p>In this scenario, we will display a property with the eType &#171;Visibility&#187; coming from a package with the name &#171;packagename&#187;. EEF does not provide a default interpreter but you can easily configure EEF to be used with the AQL interpreter. In the integration of EEF with the AQL interpreter, you can register additional services, written in Java, in which you can expose to AQL new operations. The operation
<code>eSet(java.lang.String, java.lang.Object)</code> used in the example does not exist in AQL. You would have to create it yourself.
</p>
</md-content>