81 lines
2.1 KiB
Smalltalk
81 lines
2.1 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioPillarASTextNotebook,
|
|
#superclass : #SpPresenterWithModel,
|
|
#instVars : [
|
|
'sidebar',
|
|
'viewport',
|
|
'model',
|
|
'empty',
|
|
'perspectives'
|
|
],
|
|
#category : #'Grafoscopio-New-UI'
|
|
}
|
|
|
|
{ #category : #specs }
|
|
GrafoscopioPillarASTextNotebook class >> defaultSpec [
|
|
^ SpBoxLayout newHorizontal
|
|
add:
|
|
(SpBoxLayout newVertical
|
|
add: #empty height: self toolbarHeight;
|
|
add: #sidebar;
|
|
yourself)
|
|
width: 51;
|
|
add: #viewport;
|
|
yourself
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarASTextNotebook >> basicInstallPerspective: aPerspective [
|
|
viewport ifNotNil: [ viewport aboutToBeUninstalledFrom: self ].
|
|
viewport := self perspectives
|
|
at: aPerspective
|
|
ifAbsentPut: [ self instantiate: aPerspective on: model document ].
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPillarASTextNotebook >> createDefaultComponent [
|
|
^ self basicInstallPerspective: GrafoscopioPerspective defaultPerspective
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPillarASTextNotebook >> initializeWidgets [
|
|
super initializeWidgets.
|
|
sidebar := self sidebar.
|
|
self createDefaultComponent.
|
|
empty := self newLabel.
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPillarASTextNotebook >> installPerspective: aPerspective [
|
|
self basicInstallPerspective: aPerspective .
|
|
self modelChanged
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPillarASTextNotebook >> modelChanged [
|
|
viewport modelChanged.
|
|
self needRebuild: false.
|
|
self buildWithSpec
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPillarASTextNotebook >> perspectives [
|
|
^ perspectives ifNil: [ perspectives := Dictionary new ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarASTextNotebook >> setModelBeforeInitialization: aDomainObject [
|
|
super setModelBeforeInitialization: aDomainObject.
|
|
model := aDomainObject
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
GrafoscopioPillarASTextNotebook >> sidebar [
|
|
| bar |
|
|
bar := self instantiate: SpSidebar.
|
|
GrafoscopioPerspective perspectives
|
|
do:
|
|
[ :p | bar addAction: [ self installPerspective: p ] icon: p icon ].
|
|
^ bar
|
|
]
|