Skip to content

Commit

Permalink
[Enh] GT columns from desc
Browse files Browse the repository at this point in the history
Add columns to a gt list for each described field
  • Loading branch information
seandenigris authored Aug 11, 2023
1 parent 6d67df3 commit 96015b2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
22 changes: 22 additions & 0 deletions source/Magritte-GToolkit/GtPhlowProtoView.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Extension { #name : #GtPhlowProtoView }

{ #category : #'*Magritte-GToolkit' }
GtPhlowProtoView >> maColumnedListOf: aClass [

^ self
maColumnedListOf: aClass
descriptionsSelect: [ :desc | true ]
]

{ #category : #'*Magritte-GToolkit' }
GtPhlowProtoView >> maColumnedListOf: aClass descriptionsSelect: aBlock [

| result |
result := self columnedList.

aClass magritteTemplate magritteDescription children
select: aBlock
thenDo: [ :desc | desc gtAddColumnTo: result ].

^ result
]
26 changes: 26 additions & 0 deletions source/Magritte-GToolkit/MAElementDescription.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
Extension { #name : #MAElementDescription }

{ #category : #'*Magritte-GToolkit' }
MAElementDescription >> gtAddColumnTo: aView [

self
propertyAt: #columnWidth
ifPresent: [ :width |
aView
column: self label
text: [ :anObj | self readToString: anObj ]
width: width.
^ self ].

self
propertyAt: #columnWeight
ifPresent: [ :weight |
aView
column: self label
text: [ :anObj | self readToString: anObj ]
weight: weight.
^ self ].

aView
column: self label
text: [ :anObj | self readToString: anObj ]
]

{ #category : #'*Magritte-GToolkit' }
MAElementDescription >> gtCustomizeView: aView for: anObject [
aView title = aView defaultTitle ifTrue: [ aView title: self label ].
Expand Down

0 comments on commit 96015b2

Please sign in to comment.