Skip to content

Commit

Permalink
[2032] Add domainType on PageDescription in the view DSL
Browse files Browse the repository at this point in the history
Bug: eclipse-sirius#2032
Signed-off-by: Florian Rouëné <florian.rouene@obeosoft.com>
  • Loading branch information
frouene committed Jun 16, 2023
1 parent 08ef88c commit 7669ab1
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.adoc
Expand Up @@ -21,6 +21,9 @@

- https://github.com/eclipse-sirius/sirius-components/issues/2058[#2058] [view] Fix an issue where the default icon for List widget candidates was missing when the candidates were not EObjects.
- https://github.com/eclipse-sirius/sirius-components/issues/2060[#2060] [form] Fix an issue where the list widget was displayed on a single line inside a flexbox container, no matter the length of the labels of its items.
- https://github.com/eclipse-sirius/sirius-components/issues/2032[#2032] [form] Add domainType on PageDescription in the view DSL and takes into account the impacts for the FormDescriptionAggregator.
Change for `IPropertiesDescriptionRegistry` which now handles `PageDescription` directly instead of `FormDescription`.
Add of the `selection` variable available in some context.

=== New Features

Expand Down
Expand Up @@ -87,9 +87,8 @@ private FormDescription getAttributeDetails() {
form.setTitleExpression("Attribute Details");

PageDescription page = ViewFactory.eINSTANCE.createPageDescription();
// FormDescriptionAggregator works at the Page level and uses a *list* of selected
// objects as input to determine which pages to instantiate according to their precondition.
page.setPreconditionExpression("aql:self->first().oclIsKindOf(domain::Attribute)");
page.setDomainType("domain::Attribute");
page.setPreconditionExpression("");
page.setLabelExpression("aql:self.name + ': ' + self.getDataType().capitalize()");
form.getPages().add(page);
page.getGroups().add(this.createGroup());
Expand Down
Expand Up @@ -51,6 +51,7 @@ public PageDescriptionBuilder name(java.lang.String value) {
this.getPageDescription().setName(value);
return this;
}

/**
* Setter for LabelExpression.
*
Expand All @@ -60,6 +61,17 @@ public PageDescriptionBuilder labelExpression(java.lang.String value) {
this.getPageDescription().setLabelExpression(value);
return this;
}

/**
* Setter for DomainType.
*
* @generated
*/
public PageDescriptionBuilder domainType(java.lang.String value) {
this.getPageDescription().setDomainType(value);
return this;
}

/**
* Setter for SemanticCandidatesExpression.
*
Expand Down
Expand Up @@ -65,6 +65,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {

this.addNamePropertyDescriptor(object);
this.addLabelExpressionPropertyDescriptor(object);
this.addDomainTypePropertyDescriptor(object);
this.addSemanticCandidatesExpressionPropertyDescriptor(object);
this.addPreconditionExpressionPropertyDescriptor(object);
}
Expand Down Expand Up @@ -94,6 +95,17 @@ protected void addLabelExpressionPropertyDescriptor(Object object) {
ViewPackage.Literals.PAGE_DESCRIPTION__LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Domain Type feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addDomainTypePropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_PageDescription_domainType_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_PageDescription_domainType_feature", "_UI_PageDescription_type"),
ViewPackage.Literals.PAGE_DESCRIPTION__DOMAIN_TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Semantic Candidates Expression feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
Expand Down Expand Up @@ -196,6 +208,7 @@ public void notifyChanged(Notification notification) {
switch (notification.getFeatureID(PageDescription.class)) {
case ViewPackage.PAGE_DESCRIPTION__NAME:
case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION:
case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE:
case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION:
case ViewPackage.PAGE_DESCRIPTION__PRECONDITION_EXPRESSION:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
Expand Down
Expand Up @@ -209,6 +209,7 @@ _UI_ConditionalNodeStyle_style_feature=Style
_UI_FormDescription_pages_feature=Pages
_UI_PageDescription_name_feature=Name
_UI_PageDescription_labelExpression_feature=Label Expression
_UI_PageDescription_domainType_feature=Domain Type
_UI_PageDescription_semanticCandidatesExpression_feature=Semantic Candidates Expression
_UI_PageDescription_preconditionExpression_feature=Precondition Expression
_UI_PageDescription_groups_feature=Groups
Expand Down
Expand Up @@ -81,15 +81,37 @@ public interface PageDescription extends EObject {
*/
void setLabelExpression(String value);

/**
* Returns the value of the '<em><b>Domain Type</b></em>' attribute. The default value is <code>""</code>. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @return the value of the '<em>Domain Type</em>' attribute.
* @model default="" dataType="org.eclipse.sirius.components.view.DomainType"
* @generated
* @see #setDomainType(String)
* @see org.eclipse.sirius.components.view.ViewPackage#getPageDescription_DomainType()
*/
String getDomainType();

/**
* Sets the value of the '{@link org.eclipse.sirius.components.view.PageDescription#getDomainType <em>Domain
* Type</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @param value the new value of the '<em>Domain Type</em>' attribute.
* @generated
* @see #getDomainType()
*/
void setDomainType(String value);

/**
* Returns the value of the '<em><b>Semantic Candidates Expression</b></em>' attribute. The default value is
* <code>"aql:self"</code>. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the value of the '<em>Semantic Candidates Expression</em>' attribute.
* @see #setSemanticCandidatesExpression(String)
* @see org.eclipse.sirius.components.view.ViewPackage#getPageDescription_SemanticCandidatesExpression()
* @model default="aql:self" dataType="org.eclipse.sirius.components.view.InterpretedExpression"
* @generated
* @see #setSemanticCandidatesExpression(String)
* @see org.eclipse.sirius.components.view.ViewPackage#getPageDescription_SemanticCandidatesExpression()
*/
String getSemanticCandidatesExpression();

Expand Down
Expand Up @@ -2888,14 +2888,22 @@ public interface ViewPackage extends EPackage {
*/
int PAGE_DESCRIPTION__LABEL_EXPRESSION = 1;

/**
* The feature id for the '<em><b>Domain Type</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
int PAGE_DESCRIPTION__DOMAIN_TYPE = 2;

/**
* The feature id for the '<em><b>Semantic Candidates Expression</b></em>' attribute. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
* @ordered
*/
int PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION = 2;
int PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION = 3;

/**
* The feature id for the '<em><b>Precondition Expression</b></em>' attribute. <!-- begin-user-doc --> <!--
Expand All @@ -2904,7 +2912,7 @@ public interface ViewPackage extends EPackage {
* @generated
* @ordered
*/
int PAGE_DESCRIPTION__PRECONDITION_EXPRESSION = 3;
int PAGE_DESCRIPTION__PRECONDITION_EXPRESSION = 4;

/**
* The feature id for the '<em><b>Groups</b></em>' containment reference list. <!-- begin-user-doc --> <!--
Expand All @@ -2913,7 +2921,7 @@ public interface ViewPackage extends EPackage {
* @generated
* @ordered
*/
int PAGE_DESCRIPTION__GROUPS = 4;
int PAGE_DESCRIPTION__GROUPS = 5;

/**
* The feature id for the '<em><b>Toolbar Actions</b></em>' containment reference list. <!-- begin-user-doc --> <!--
Expand Down Expand Up @@ -8088,6 +8096,18 @@ public interface ViewPackage extends EPackage {
*/
EAttribute getPageDescription_LabelExpression();

/**
* Returns the meta object for the attribute
* '{@link org.eclipse.sirius.components.view.PageDescription#getDomainType <em>Domain Type</em>}'. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Domain Type</em>'.
* @generated
* @see org.eclipse.sirius.components.view.PageDescription#getDomainType()
* @see #getPageDescription()
*/
EAttribute getPageDescription_DomainType();

/**
* Returns the meta object for the attribute
* '{@link org.eclipse.sirius.components.view.PageDescription#getSemanticCandidatesExpression <em>Semantic
Expand Down Expand Up @@ -11113,6 +11133,14 @@ interface Literals {
*/
EAttribute PAGE_DESCRIPTION__LABEL_EXPRESSION = eINSTANCE.getPageDescription_LabelExpression();

/**
* The meta object literal for the '<em><b>Domain Type</b></em>' attribute feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
*/
EAttribute PAGE_DESCRIPTION__DOMAIN_TYPE = eINSTANCE.getPageDescription_DomainType();

/**
* The meta object literal for the '<em><b>Semantic Candidates Expression</b></em>' attribute feature. <!--
* begin-user-doc --> <!-- end-user-doc -->
Expand Down
Expand Up @@ -74,31 +74,48 @@ public class PageDescriptionImpl extends MinimalEObjectImpl.Container implements
* The default value of the '{@link #getLabelExpression() <em>Label Expression</em>}' attribute. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @see #getLabelExpression()
* @generated
* @ordered
* @see #getLabelExpression()
*/
protected static final String LABEL_EXPRESSION_EDEFAULT = null;

/**
* The cached value of the '{@link #getLabelExpression() <em>Label Expression</em>}' attribute. <!-- begin-user-doc
* --> <!-- end-user-doc -->
* The default value of the '{@link #getDomainType() <em>Domain Type</em>}' attribute. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getLabelExpression()
* @generated
* @ordered
* @see #getDomainType()
*/
protected String labelExpression = LABEL_EXPRESSION_EDEFAULT;

protected static final String DOMAIN_TYPE_EDEFAULT = "";
/**
* The default value of the '{@link #getSemanticCandidatesExpression() <em>Semantic Candidates Expression</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getSemanticCandidatesExpression()
* @generated
* @ordered
* @see #getSemanticCandidatesExpression()
*/
protected static final String SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT = "aql:self";
/**
* The cached value of the '{@link #getLabelExpression() <em>Label Expression</em>}' attribute. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @generated
* @ordered
* @see #getLabelExpression()
*/
protected String labelExpression = LABEL_EXPRESSION_EDEFAULT;
/**
* The cached value of the '{@link #getDomainType() <em>Domain Type</em>}' attribute. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
* @ordered
* @see #getDomainType()
*/
protected String domainType = DOMAIN_TYPE_EDEFAULT;

/**
* The cached value of the '{@link #getSemanticCandidatesExpression() <em>Semantic Candidates Expression</em>}'
Expand Down Expand Up @@ -215,6 +232,29 @@ public void setLabelExpression(String newLabelExpression) {
this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION, oldLabelExpression, this.labelExpression));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public String getDomainType() {
return this.domainType;
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setDomainType(String newDomainType) {
String oldDomainType = this.domainType;
this.domainType = newDomainType;
if (this.eNotificationRequired())
this.eNotify(new ENotificationImpl(this, Notification.SET, ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE, oldDomainType, this.domainType));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -316,6 +356,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
return this.getName();
case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION:
return this.getLabelExpression();
case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE:
return this.getDomainType();
case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION:
return this.getSemanticCandidatesExpression();
case ViewPackage.PAGE_DESCRIPTION__PRECONDITION_EXPRESSION:
Expand Down Expand Up @@ -343,6 +385,9 @@ public void eSet(int featureID, Object newValue) {
case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION:
this.setLabelExpression((String) newValue);
return;
case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE:
this.setDomainType((String) newValue);
return;
case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION:
this.setSemanticCandidatesExpression((String) newValue);
return;
Expand Down Expand Up @@ -375,6 +420,9 @@ public void eUnset(int featureID) {
case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION:
this.setLabelExpression(LABEL_EXPRESSION_EDEFAULT);
return;
case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE:
this.setDomainType(DOMAIN_TYPE_EDEFAULT);
return;
case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION:
this.setSemanticCandidatesExpression(SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT);
return;
Expand Down Expand Up @@ -403,6 +451,8 @@ public boolean eIsSet(int featureID) {
return NAME_EDEFAULT == null ? this.name != null : !NAME_EDEFAULT.equals(this.name);
case ViewPackage.PAGE_DESCRIPTION__LABEL_EXPRESSION:
return LABEL_EXPRESSION_EDEFAULT == null ? this.labelExpression != null : !LABEL_EXPRESSION_EDEFAULT.equals(this.labelExpression);
case ViewPackage.PAGE_DESCRIPTION__DOMAIN_TYPE:
return DOMAIN_TYPE_EDEFAULT == null ? this.domainType != null : !DOMAIN_TYPE_EDEFAULT.equals(this.domainType);
case ViewPackage.PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION:
return SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT == null ? this.semanticCandidatesExpression != null : !SEMANTIC_CANDIDATES_EXPRESSION_EDEFAULT.equals(this.semanticCandidatesExpression);
case ViewPackage.PAGE_DESCRIPTION__PRECONDITION_EXPRESSION:
Expand Down Expand Up @@ -430,6 +480,8 @@ public String toString() {
result.append(this.name);
result.append(", labelExpression: ");
result.append(this.labelExpression);
result.append(", domainType: ");
result.append(this.domainType);
result.append(", semanticCandidatesExpression: ");
result.append(this.semanticCandidatesExpression);
result.append(", preconditionExpression: ");
Expand Down
Expand Up @@ -2170,7 +2170,7 @@ public EAttribute getPageDescription_LabelExpression() {
* @generated
*/
@Override
public EAttribute getPageDescription_SemanticCandidatesExpression() {
public EAttribute getPageDescription_DomainType() {
return (EAttribute) this.pageDescriptionEClass.getEStructuralFeatures().get(2);
}

Expand All @@ -2180,18 +2180,28 @@ public EAttribute getPageDescription_SemanticCandidatesExpression() {
* @generated
*/
@Override
public EAttribute getPageDescription_PreconditionExpression() {
public EAttribute getPageDescription_SemanticCandidatesExpression() {
return (EAttribute) this.pageDescriptionEClass.getEStructuralFeatures().get(3);
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EAttribute getPageDescription_PreconditionExpression() {
return (EAttribute) this.pageDescriptionEClass.getEStructuralFeatures().get(4);
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EReference getPageDescription_Groups() {
return (EReference) this.pageDescriptionEClass.getEStructuralFeatures().get(4);
return (EReference) this.pageDescriptionEClass.getEStructuralFeatures().get(5);
}

/**
Expand Down Expand Up @@ -4032,6 +4042,7 @@ public void createPackageContents() {
this.pageDescriptionEClass = this.createEClass(PAGE_DESCRIPTION);
this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__NAME);
this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__LABEL_EXPRESSION);
this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__DOMAIN_TYPE);
this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION);
this.createEAttribute(this.pageDescriptionEClass, PAGE_DESCRIPTION__PRECONDITION_EXPRESSION);
this.createEReference(this.pageDescriptionEClass, PAGE_DESCRIPTION__GROUPS);
Expand Down Expand Up @@ -4632,6 +4643,8 @@ public void initializePackageContents() {
IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
this.initEAttribute(this.getPageDescription_LabelExpression(), this.getInterpretedExpression(), "labelExpression", null, 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE,
IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
this.initEAttribute(this.getPageDescription_DomainType(), this.getDomainType(), "domainType", "", 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE,
!IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
this.initEAttribute(this.getPageDescription_SemanticCandidatesExpression(), this.getInterpretedExpression(), "semanticCandidatesExpression", "aql:self", 0, 1, PageDescription.class,
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
this.initEAttribute(this.getPageDescription_PreconditionExpression(), this.getInterpretedExpression(), "preconditionExpression", "", 0, 1, PageDescription.class, !IS_TRANSIENT, !IS_VOLATILE,
Expand Down

0 comments on commit 7669ab1

Please sign in to comment.