Skip to content

Commit

Permalink
add wardley map model group with support for node profiles feenkcom/g…
Browse files Browse the repository at this point in the history
  • Loading branch information
girba committed Jul 17, 2024
1 parent 25b1876 commit 884b075
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/GToolkit-WardleyMap/GtWardleyMapModelGroup.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Class {
#name : #GtWardleyMapModelGroup,
#superclass : #Object,
#traits : 'TGtGroupWithItems',
#classTraits : 'TGtGroupWithItems classTrait',
#category : #'GToolkit-WardleyMap'
}

{ #category : #accessing }
GtWardleyMapModelGroup >> gtItemsFor: aView [
<gtView>
^ aView columnedList
title: 'Items';
items: [ self items ];
column: 'Title' text: [:each | each title];
column: 'Nodes' text: [:each | each nodes size ];
column: 'Edges' text: [:each | each edges size ]
]

{ #category : #accessing }
GtWardleyMapModelGroup >> gtNodeProfilesFor: aView [
<gtView>
| elements |
^ aView columnedList
title: 'Node profiles';
items: [ ((self items flatCollect: [ :each | each nodes ])
groupedBy: [ :each | each label ]) associations
sorted: [ :a :b | a key < b key ] ];
column: 'Label' text: [ :each | each key ];
column: 'Positions'
text: [ :each |
', '
join: (each value collect: [ :node | node evolution printShowingDecimalPlaces: 2 ]) ];
column: 'Profile'
stencil: [ :association |
elements := association value
collect: [ :aNode |
BlElement new
size: 10 @ 10;
geometry: BlCircleGeometry new;
background: (Color black alpha: 0.2);
relocate: (aNode evolution * 100 + 5) @ 5 ].
BlElement new
size: 110 @ 20;
geometry: (BlRoundedRectangleGeometry cornerRadius: 10);
border: Color veryVeryLightGray;
addChildren: elements ]
width: 120
]

0 comments on commit 884b075

Please sign in to comment.