From b7948d25e1fe3cd7dbc1c87d1162d7a4c6ccdd15 Mon Sep 17 00:00:00 2001 From: Tudor Girba Date: Wed, 17 Jul 2024 13:03:02 +0200 Subject: [PATCH] add wardley map snippet group with support for node profiles feenkcom/gtoolkit#3904 --- .../LeWardleyMapSnippetGroup.class.st | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/Lepiter-Snippets/LeWardleyMapSnippetGroup.class.st diff --git a/src/Lepiter-Snippets/LeWardleyMapSnippetGroup.class.st b/src/Lepiter-Snippets/LeWardleyMapSnippetGroup.class.st new file mode 100644 index 000000000..38680f054 --- /dev/null +++ b/src/Lepiter-Snippets/LeWardleyMapSnippetGroup.class.st @@ -0,0 +1,49 @@ +Class { + #name : #LeWardleyMapSnippetGroup, + #superclass : #LeSnippetGroup, + #category : #'Lepiter-Snippets' +} + +{ #category : #accessing } +LeWardleyMapSnippetGroup >> gtNodeProfilesFor: aView [ + + | elements | + ^ aView columnedList + title: 'Node profiles'; + items: [ ((self items + flatCollect: [ :aSnippet | aSnippet wardleyMap nodes collect: [ :aNode | aNode -> aSnippet ] ]) + groupedBy: [ :each | each key label ]) associations + sorted: [ :a :b | a key < b key ] ]; + column: 'Label' text: [ :each | each key ]; + column: 'Positions' + text: [ :association | + ', ' + join: (association value + collect: [ :innerAssociation | innerAssociation key evolution printShowingDecimalPlaces: 2 ]) ]; + column: 'Profile' + stencil: [ :association | + elements := association value + collect: [ :innerAssociation | + BlElement new + size: 10 @ 10; + aptitude: (BrStyleCommonAptitude new + default: [ :s | + s background: (Color black alpha: 0.2) ]; + hovered: [ :s | + s background: BrGlamorousColors primaryBorderColor. ]; + pressed: [ :s | + s background: BrGlamorousColors pressedButtonBorderColor ]); + when: BlClickEvent + do: [ :e | + e target phlow spawnObject: innerAssociation value. + e consumed: true ]; + geometry: BlCircleGeometry new; + background: (Color black alpha: 0.2); + relocate: (innerAssociation key evolution * 100 + 5) @ 5 ]. + BlElement new + size: 110 @ 20; + geometry: (BlRoundedRectangleGeometry cornerRadius: 10); + border: Color veryVeryLightGray; + addChildren: elements ] + width: 120 +]