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