Skip to content

Commit

Permalink
[3079] Add a name attribute on deck view descriptions
Browse files Browse the repository at this point in the history
This makes the LaneDescription and CardDescription easier to identify.

Bug: #3079
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
  • Loading branch information
florianbarbin committed Feb 12, 2024
1 parent e1dc693 commit 6a65705
Show file tree
Hide file tree
Showing 21 changed files with 1,111 additions and 863 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ image:doc/screenshots/deploymenDiagram.png[Deployment Diagram,70%]
- https://github.com/eclipse-sirius/sirius-web/issues/3020[#3020] [sirius-web] Improve the project browser to make the code more robust
- https://github.com/eclipse-sirius/sirius-web/issues/3021[#3021] [sirius-web] Leverage the new Spring Boot APIs to create the sirius-web-starter autoconfiguration
- https://github.com/eclipse-sirius/sirius-web/issues/3020[#3020] [sirius-web] Simplify the contribution of views in the workbench
- https://github.com/eclipse-sirius/sirius-web/issues/3079[#3079] [deck] Add a name attribute on CardDescription and LaneDescription


== v2024.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private CardDescription createCardDescription() {
EditCardTool editCardTool = this.createEditCardTool();
DeleteCardTool deleteCardTool = this.createDeleteCardTool();
return this.deckBuilders.newCardDescription()
.name("Card Description")
.semanticCandidatesExpression("aql:self.getTasksWithTag()")
.titleExpression("aql:self.name")
.labelExpression("aql:self.computeTaskDurationDays()")
Expand All @@ -83,6 +84,7 @@ private LaneDescription createLaneDescription() {
CardDropTool cardDropTool = this.createCardDropTool();
EditLaneTool editLaneTool = this.createEditLaneTool();
return this.deckBuilders.newLaneDescription()
.name("Lane Description")
.semanticCandidatesExpression("aql:self.ownedTags->select(tag | tag.prefix == 'daily')")
.labelExpression("aql:self.getTasksWithTag()->size() + ' / ' + self.eContainer().oclAsType(task::Project).ownedTasks->select(task | task.tags->exists(tag | tag.prefix == 'daily'))->size()")
.titleExpression("aql:self.suffix")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ public org.eclipse.sirius.components.view.deck.CardDescription build() {
return this.getCardDescription();
}

/**
* Setter for Name.
*
* @generated
*/
public CardDescriptionBuilder name(java.lang.String value) {
this.getCardDescription().setName(value);
return this;
}

/**
* Setter for SemanticCandidatesExpression.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*******************************************************************************
* Copyright (c) 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.sirius.components.view.builder.generated;

/**
* Builder for org.eclipse.sirius.components.view.deck.DeckElementDescription.
*
* @author BuilderGenerator
* @generated
*/
public abstract class DeckElementDescriptionBuilder {

/**
* Builder for org.eclipse.sirius.components.view.deck.DeckElementDescription.
* @generated
*/
protected abstract org.eclipse.sirius.components.view.deck.DeckElementDescription getDeckElementDescription();

/**
* Setter for Name.
*
* @generated
*/
public DeckElementDescriptionBuilder name(java.lang.String value) {
this.getDeckElementDescription().setName(value);
return this;
}
/**
* Setter for SemanticCandidatesExpression.
*
* @generated
*/
public DeckElementDescriptionBuilder semanticCandidatesExpression(java.lang.String value) {
this.getDeckElementDescription().setSemanticCandidatesExpression(value);
return this;
}
/**
* Setter for TitleExpression.
*
* @generated
*/
public DeckElementDescriptionBuilder titleExpression(java.lang.String value) {
this.getDeckElementDescription().setTitleExpression(value);
return this;
}
/**
* Setter for LabelExpression.
*
* @generated
*/
public DeckElementDescriptionBuilder labelExpression(java.lang.String value) {
this.getDeckElementDescription().setLabelExpression(value);
return this;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ public org.eclipse.sirius.components.view.deck.LaneDescription build() {
return this.getLaneDescription();
}

/**
* Setter for Name.
*
* @generated
*/
public LaneDescriptionBuilder name(java.lang.String value) {
this.getLaneDescription().setName(value);
return this;
}

/**
* Setter for SemanticCandidatesExpression.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,10 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IChildCreationExtender;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.components.view.deck.CardDescription;
import org.eclipse.sirius.components.view.deck.DeckFactory;
Expand All @@ -40,8 +32,7 @@
*
* @generated
*/
public class CardDescriptionItemProvider extends ItemProviderAdapter
implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
public class CardDescriptionItemProvider extends DeckElementDescriptionItemProvider {
/**
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand All @@ -61,51 +52,11 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (this.itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);

this.addSemanticCandidatesExpressionPropertyDescriptor(object);
this.addTitleExpressionPropertyDescriptor(object);
this.addLabelExpressionPropertyDescriptor(object);
this.addDescriptionExpressionPropertyDescriptor(object);
}
return this.itemPropertyDescriptors;
}

/**
* This adds a property descriptor for the Semantic Candidates Expression feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
*/
protected void addSemanticCandidatesExpressionPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_CardDescription_semanticCandidatesExpression_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_CardDescription_semanticCandidatesExpression_feature", "_UI_CardDescription_type"),
DeckPackage.Literals.CARD_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Title Expression feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addTitleExpressionPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_CardDescription_titleExpression_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_CardDescription_titleExpression_feature", "_UI_CardDescription_type"),
DeckPackage.Literals.CARD_DESCRIPTION__TITLE_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Label Expression feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected void addLabelExpressionPropertyDescriptor(Object object) {
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(),
this.getString("_UI_CardDescription_labelExpression_feature"),
this.getString("_UI_PropertyDescriptor_description", "_UI_CardDescription_labelExpression_feature", "_UI_CardDescription_type"),
DeckPackage.Literals.CARD_DESCRIPTION__LABEL_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Description Expression feature. <!-- begin-user-doc --> <!-- end-user-doc
* -->
Expand Down Expand Up @@ -177,7 +128,7 @@ protected boolean shouldComposeCreationImage() {
*/
@Override
public String getText(Object object) {
String label = ((CardDescription) object).getSemanticCandidatesExpression();
String label = ((CardDescription) object).getName();
return label == null || label.length() == 0 ? this.getString("_UI_CardDescription_type") : this.getString("_UI_CardDescription_type") + " " + label;
}

Expand All @@ -193,9 +144,6 @@ public void notifyChanged(Notification notification) {
this.updateChildren(notification);

switch (notification.getFeatureID(CardDescription.class)) {
case DeckPackage.CARD_DESCRIPTION__SEMANTIC_CANDIDATES_EXPRESSION:
case DeckPackage.CARD_DESCRIPTION__TITLE_EXPRESSION:
case DeckPackage.CARD_DESCRIPTION__LABEL_EXPRESSION:
case DeckPackage.CARD_DESCRIPTION__DESCRIPTION_EXPRESSION:
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
Expand All @@ -222,14 +170,4 @@ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors
newChildDescriptors.add(this.createChildParameter(DeckPackage.Literals.CARD_DESCRIPTION__DELETE_TOOL, DeckFactory.eINSTANCE.createDeleteCardTool()));
}

/**
* Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return ((IChildCreationExtender) this.adapterFactory).getResourceLocator();
}

}
Loading

0 comments on commit 6a65705

Please sign in to comment.