61 lines
1.7 KiB
Smalltalk
61 lines
1.7 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioViewportTextVisitor,
|
|
#superclass : #GrafoscopioVisitor,
|
|
#instVars : [
|
|
'viewport',
|
|
'stack',
|
|
'presenter',
|
|
'pages'
|
|
],
|
|
#category : #'Grafoscopio-New-UI'
|
|
}
|
|
|
|
{ #category : #visiting }
|
|
GrafoscopioViewportTextVisitor >> createViewportFor: aDocumentNode into: aPresenter [
|
|
presenter := aPresenter.
|
|
aDocumentNode acceptVisitor: self.
|
|
^ viewport
|
|
]
|
|
|
|
{ #category : #visiting }
|
|
GrafoscopioViewportTextVisitor >> initialize [
|
|
super initialize.
|
|
pages := Dictionary new
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioViewportTextVisitor >> renamePageFor: aNode [
|
|
pages at: aNode ifPresent: [ : p | p title: aNode name ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioViewportTextVisitor >> showPageFor: aNode ifProviderDoestExistInstall: aBlock [
|
|
| page |
|
|
page := pages at: aNode ifAbsentPut: [ aBlock value ].
|
|
presenter viewport: page
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioViewportTextVisitor >> visitPillarNode: aGrafoscopioPillarNode [
|
|
self
|
|
showPageFor: aGrafoscopioPillarNode
|
|
ifProviderDoestExistInstall: [ | text |
|
|
text := presenter
|
|
instantiate: GrafoscopioNewTextModel
|
|
on: (GrafoscopioPillarToTextDecorator on: aGrafoscopioPillarNode).
|
|
text
|
|
onModifyNodeLocationDo: [ :model | model model text: model body text ].
|
|
text ]
|
|
]
|
|
|
|
{ #category : #visiting }
|
|
GrafoscopioViewportTextVisitor >> visitTextNode: aNode [
|
|
self
|
|
showPageFor: aNode
|
|
ifProviderDoestExistInstall: [ | text |
|
|
text := presenter instantiate: GrafoscopioNewTextModel on: aNode.
|
|
text
|
|
onModifyNodeLocationDo: [ :model | model model text: model body text ].
|
|
text ]
|
|
]
|