Skip to content

Commit

Permalink
Adding icons and "show node as root" button
Browse files Browse the repository at this point in the history
  • Loading branch information
carolahp committed Aug 16, 2022
1 parent 38fc615 commit da3be9d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 37 deletions.
11 changes: 5 additions & 6 deletions src/ProfilerUI/ProfilerInputPresenter.class.st
Expand Up @@ -41,16 +41,15 @@ ProfilerInputPresenter >> initializePresenters [
icon: (self iconNamed: #glamorousGo);
label: 'Profile it'.

self layout: (SpBoxLayout newTopToBottom
add: (SpBoxLayout newLeftToRight
add: profileItButton height: self class toolbarHeight;
add: profilerDropList height: self class buttonHeight;
self layout: (SpBoxLayout newLeftToRight
add: codeInput;
add: (SpBoxLayout newTopToBottom
addLast: profilerDropList" height: self class toolbarHeight";
addLast: profileItButton
yourself)
expand: false
fill: false
padding: 5;

add: codeInput height: self class toolbarHeight*10;
yourself).

self focusOrder
Expand Down
11 changes: 6 additions & 5 deletions src/ProfilerUI/ProfilerModel.class.st
Expand Up @@ -103,17 +103,18 @@ ProfilerModel >> menu: menu shifted: b [
ifNotNil: [ :current |
current menu: menu shifted: b.
menu addLine.
menu
(menu
add: 'Expand all from here'
target: self
selector: #expandAllFromNode:
argument: current .
argument: current) icon: (self iconNamed: #windowMenuInactive).
menu addLine.
menu
add: 'See as root'
(menu
add: 'Show as root'
target: self
selector: #setTallyRoot:
argument: current ].
argument: current)
icon: (self iconNamed: #glamorousRedo) ].
^ menu
]

Expand Down
63 changes: 43 additions & 20 deletions src/ProfilerUI/ProfilerResultsPresenter.class.st
Expand Up @@ -15,7 +15,8 @@ Class {
'thresholdFilterInput',
'thresholdExpandInput',
'navigationToolbar',
'reportButton'
'reportButton',
'showAsRootButton'
],
#category : #'ProfilerUI-View'
}
Expand Down Expand Up @@ -88,9 +89,11 @@ ProfilerResultsPresenter >> handleSelectionChange: item [
item
ifNil: [
browseButton disable.
showAsRootButton disable.
codePresenter methodOrBlock: nil ]
ifNotNil: [
browseButton enable.
showAsRootButton enable.
codePresenter methodOrBlock: item methodOrBlock.
navigationToolbar selectedItem ifNotNil: [ :btn |
btn selectedPath: item path ] ]
Expand All @@ -102,8 +105,7 @@ ProfilerResultsPresenter >> initializeActions [
treeTable
whenSelectedItemChangedSend: #handleSelectionChange
to: self.
"Code section actions"
browseButton action: [ treeTable selectedItem browseItem ].

"Report"
reportButton action: [
UIManager default edit: viewModel report label: 'Profiling Report' ].
Expand Down Expand Up @@ -148,6 +150,7 @@ ProfilerResultsPresenter >> initializePresenters [
bePlacedAtStart;
fill: true;
expand: false ];
addLast: (showAsRootButton := self newShowAsRootButton);
addLast: (browseButton := self newBrowseButton))
height: h;
yourself).
Expand All @@ -161,29 +164,38 @@ ProfilerResultsPresenter >> newBrowseButton [
icon: (self iconNamed: #glamorousBrowse);
label: 'Browse';
disable;
action: [ treeTable selectedItem browseItem ];
yourself
]

{ #category : #'private - factory' }
ProfilerResultsPresenter >> newConfigurationSectionLayout [

^ (SpBoxLayout newTopToBottom
add: (SpBoxLayout newLeftToRight
add: (treeDropList := self newTreeVisualizationDropList);
add: (expandAllButton := self newButton label: 'Expand All') width: 100;
add: (collapseAllButton := self newButton label: 'Collapse All') width: 100;
yourself);
add: (SpBoxLayout newLeftToRight
add: (self newLabel label: 'Hide nodes under: ') width: 125;
add: (thresholdFilterInput := self newThresholdFilterInput) width: 55;
add: (self newLabel label: '%') width: 25;
yourself);
add: (SpBoxLayout newLeftToRight
add: (self newLabel label: 'Expand nodes over: ') width: 125;
add: (thresholdExpandInput := self newThresholdExpandInput) width: 55;
add: (self newLabel label: '%') width: 25;
yourself);
yourself)
^ SpBoxLayout newTopToBottom
add: (SpBoxLayout newLeftToRight
add: (treeDropList := self newTreeVisualizationDropList);
add: (expandAllButton := self newButton
label: 'Expand All';
icon: (self iconNamed: #windowMenu))
width: 100;
add: (collapseAllButton := self newButton
label: 'Collapse All';
icon: (self iconNamed: #windowMinimize))
width: 100;
yourself);
add: (SpBoxLayout newLeftToRight
add: (self newLabel label: 'Hide nodes under: ') width: 125;
add: (thresholdFilterInput := self newThresholdFilterInput)
width: 55;
add: (self newLabel label: '%') width: 25;
yourself);
add: (SpBoxLayout newLeftToRight
add: (self newLabel label: 'Expand nodes over: ') width: 125;
add: (thresholdExpandInput := self newThresholdExpandInput)
width: 55;
add: (self newLabel label: '%') width: 25;
yourself);
yourself
]

{ #category : #'private - factory' }
Expand Down Expand Up @@ -219,6 +231,17 @@ ProfilerResultsPresenter >> newReportButton [
yourself
]

{ #category : #'private - factory' }
ProfilerResultsPresenter >> newShowAsRootButton [

^ self newButton
icon: (self iconNamed: #glamorousRedo);
label: 'Show node as root';
action: [ viewModel setTallyRoot: treeTable selectedItem ];
disable;
yourself
]

{ #category : #'private - factory' }
ProfilerResultsPresenter >> newThresholdExpandInput [

Expand Down
12 changes: 6 additions & 6 deletions src/ProfilerUI/TallyModel.class.st
Expand Up @@ -85,18 +85,18 @@ TallyModel >> leavesInto: aCollection fromSender: anObject [

{ #category : #menu }
TallyModel >> menu: menu shifted: b [
menu
(menu
add: 'Browse (b)'
target: self
selector: #browseItem.
menu
selector: #browseItem) icon: (self iconNamed: #glamorousBrowse).
(menu
add: 'Inspect (i)'
target: self
selector: #inspectItem.
menu
selector: #inspectItem) icon: (self iconNamed: #glamorousInspect).
(menu
add: 'Explore (I)'
target: self
selector: #exploreItem.
selector: #exploreItem) icon: (self iconNamed: #smallFind).

]

Expand Down

0 comments on commit da3be9d

Please sign in to comment.