@@ -2,112 +2,22 @@ Class {
22 #name : #GtPhlowDetailsView ,
33 #superclass : #GtPhlowViewDecorator ,
44 #instVars : [
5- ' rows'
5+ ' rows' ,
6+ ' localSend'
67 ],
78 #category : #' GToolkit-Phlow-! Views'
89}
910
1011{ #category : #' api - converting' }
1112GtPhlowDetailsView >> asElementDo: aBlockClosure [
12- | grid cells header |
13- grid := BrHorizontalGrid new .
14- grid columnCount: 2 .
15- grid cellSpacing: 0 .
16- grid hMatchParent.
17- grid vFitContent.
18- header :=
19- {self createHeaderCell: ' Name' .
20- self createHeaderCell: ' Value' }.
21- cells := rows flatCollect:
22- [:eachRow |
23-
24- | rowName rowValue |
25- rowName := self createRowName: eachRow.
26- rowValue := self createRowValue: eachRow.
27-
28- self configureRowName: rowName value: rowValue.
29-
30- { rowName . rowValue}].
31- grid addChildren: header.
32- grid addChildren: cells.
33- grid := grid asScrollableElement.
34- self beViewElement: grid.
35- ^ aBlockClosure value: grid
36- ]
37-
38- { #category : #' api - converting' }
39- GtPhlowDetailsView >> configureRowName: rowNameLabel value: rowValueLabel [
40- | clickHandler eventSharer |
41-
42- clickHandler := BlEventHandler on: BlClickEvent
43- do:
44- [:anEvent |
45-
46- rowValueLabel viewModel ifNotNil: [
47- anEvent consumed: true .
48- self inform: ' Spawn!' .
49- rowValueLabel phlow
50- spawnObject: rowValueLabel viewModel model ]].
13+ | detailsElement viewElement |
14+ detailsElement := GtPhlowDetailsElement new
15+ detailsView: self .
16+ viewElement := detailsElement asScrollableElement.
5117
52- eventSharer := BlSharedEventDistributor shareEvents: {
53- BlMouseEnterEvent .
54- BlMouseLeaveEvent .
55- BlMouseDownEvent .
56- BlMouseUpEvent .
57- BlDragLeaveEvent .
58- BlDragEndEvent }.
18+ self beViewElement: viewElement.
5919
60- rowNameLabel addEventHandler: eventSharer.
61- rowValueLabel addEventHandler: eventSharer.
62-
63- rowNameLabel addEventHandler: clickHandler.
64- rowValueLabel addEventHandler: clickHandler
65- ]
66-
67- { #category : #' api - converting' }
68- GtPhlowDetailsView >> createHeaderCell: aString [
69- ^ (BrLabel new )
70- aptitude: (BrGlamorousLabelAptitude new foreground: Color gray);
71- hFitContent;
72- padding: (BlInsets top: 3 left: 6 bottom: 3 right: 6 );
73- text: aString
74- ]
75-
76- { #category : #' api - converting' }
77- GtPhlowDetailsView >> createRowName: eachRow [
78- ^ (BrLabel new )
79- aptitude: (BrGlamorousLabelAptitude + BrGlamorousListItemAptitude );
80- hFitContent;
81- padding: (BlInsets top: 3 left: 6 bottom: 3 right: 6 );
82- constraintsDo: [ :c | c grid horizontal specAlignment: BlGridAlignment fill ];
83- text: eachRow name
84- ]
85-
86- { #category : #' api - converting' }
87- GtPhlowDetailsView >> createRowValue: eachRow [
88- | value text |
89- [
90- value := eachRow valueComputation value.
91- text := eachRow textComputation value: value.
92- ]
93- on: Exception
94- do: [ :anException |
95- | anElement |
96- anElement := anException asDebuggableElement.
97- anElement id: GtPhlowExceptionId .
98- anElement phlow beViewContent; entity: self .
99- ^ anElement ].
100-
101- ^ (BrLabel new )
102- in: [:aLabel | aLabel viewModel model: value];
103- aptitude: BrGlamorousLabelAptitude + BrGlamorousListItemAptitude ;
104- hMatchParent;
105- padding: (BlInsets
106- top: 3
107- left: 6
108- bottom: 3
109- right: 6 );
110- text: text
20+ ^ aBlockClosure value: viewElement
11121]
11222
11323{ #category : #views }
@@ -130,12 +40,23 @@ GtPhlowDetailsView >> initialize [
13040 rows := OrderedCollection new
13141]
13242
43+ { #category : #private }
44+ GtPhlowDetailsView >> localSend [
45+ ^ localSend
46+ ]
47+
48+ { #category : #private }
49+ GtPhlowDetailsView >> localSend: aBlock [
50+ " Do not use; only used by remote views as an hack"
51+ localSend := aBlock
52+ ]
53+
13354{ #category : #' as yet unclassified' }
13455GtPhlowDetailsView >> phlowDetailRows [
13556 ^ rows
13657]
13758
138- { #category : #' api - scripting ' }
59+ { #category : #private }
13960GtPhlowDetailsView >> row: aString value: aBlockClosure [
14061 rows add: (GtPhlowDetailsRow new
14162 name: aString;
0 commit comments