more refactors. version 0,0001 ready

Co-authored-by: Generated <Generated>
This commit is contained in:
SantiagoBragagnolo 2020-03-25 00:03:29 +00:00
parent dc23b56283
commit e5d8958fa3
15 changed files with 523 additions and 112 deletions

View File

@ -89,6 +89,11 @@ GrafoscopioAbstractNode >> isLeaf [
^ self class isLeaf
]
{ #category : #'as yet unclassified' }
GrafoscopioAbstractNode >> moveDown [
self subclassResponsibility
]
{ #category : #accessing }
GrafoscopioAbstractNode >> name [
^ name
@ -99,6 +104,11 @@ GrafoscopioAbstractNode >> name: aName [
name := aName
]
{ #category : #'as yet unclassified' }
GrafoscopioAbstractNode >> order [
^ order ifNil: [ 0 ]
]
{ #category : #accessing }
GrafoscopioAbstractNode >> tagAs: aTag [
self

View File

@ -27,10 +27,22 @@ GrafoscopioBranchNode >> acceptsChildsOfClass: aClass [
GrafoscopioUnitNode} includes: aClass
]
{ #category : #accessing }
GrafoscopioBranchNode >> addAtBeginningChild: aBlock ofClass: aClass [
(self acceptsChildsOfClass: aClass)
ifTrue: [| child |
child := aBlock value.
child parent: self.
self children addFirst: child]
]
{ #category : #accessing }
GrafoscopioBranchNode >> addChild: aBlock ofClass: aClass [
(self acceptsChildsOfClass: aClass)
ifTrue: [ self children add: aBlock value ]
ifTrue: [ | child |
child := aBlock value.
child parent: self.
self children add: child ]
]
{ #category : #accessing }
@ -52,3 +64,24 @@ GrafoscopioBranchNode >> children: aCollection [
GrafoscopioBranchNode >> isLeaf [
^ false
]
{ #category : #'as yet unclassified' }
GrafoscopioBranchNode >> moveDown: aNode [
| index |
"Moves the current node a place before in the children collection where is located"
index := children indexOf: aNode.
children swap: index with: (index + 1 min: children size)
]
{ #category : #'as yet unclassified' }
GrafoscopioBranchNode >> moveUp: aNode [
| index |
"Moves the current node a place before in the children collection where is located"
index := children indexOf: aNode.
children swap: index with: (index - 1 max: 1)
]
{ #category : #'as yet unclassified' }
GrafoscopioBranchNode >> remove: aGrafoscopioTextNode [
children remove: aGrafoscopioTextNode
]

View File

@ -24,13 +24,49 @@ GrafoscopioDocumentEditionPerspective class >> icon [
^ self iconNamed: #merge
]
{ #category : #'as yet unclassified' }
GrafoscopioDocumentEditionPerspective >> addNewNodeOfClass: aClass [
(tree selectedItem ifNil: [ document ])
{ #category : #'adding - convenience' }
GrafoscopioDocumentEditionPerspective >> addAtBeginningNewNodeOfClass: aClass [
self
addAtBeginningOf: (tree selectedItem ifNil: [ document ])
aNodeOfClass: aClass
]
{ #category : #'adding - base' }
GrafoscopioDocumentEditionPerspective >> addAtBeginningOf: aNode aNodeOfClass: aClass [
aNode
addAtBeginningChild: [ self instantiateNode: aClass ]
ofClass: aClass.
self modelChanged
]
{ #category : #'adding - convenience' }
GrafoscopioDocumentEditionPerspective >> addAtLastNewNodeOfClass: aClass [
self
addAtLastOf: (tree selectedItem ifNil: [ document ])
aNodeOfClass: aClass
]
{ #category : #'adding - base' }
GrafoscopioDocumentEditionPerspective >> addAtLastOf: aNode aNodeOfClass: aClass [
aNode
addChild: [ self instantiateNode: aClass ]
ofClass: aClass.
self needRebuild: false.
self buildWithSpec
self modelChanged
]
{ #category : #'adding - convenience' }
GrafoscopioDocumentEditionPerspective >> addNewNodeAtBeginningOf: aNode [
self addAtBeginningOf: aNode aNodeOfClass: self chooseKindsOfNode
]
{ #category : #'adding - convenience' }
GrafoscopioDocumentEditionPerspective >> addNewNodeAtLastOf: aNode [
self addAtLastOf: aNode aNodeOfClass: self chooseKindsOfNode
]
{ #category : #'adding - convenience' }
GrafoscopioDocumentEditionPerspective >> addNewNodeOfClass: aClass [
^ self addAtLastNewNodeOfClass: aClass
]
{ #category : #initialization }
@ -40,7 +76,17 @@ GrafoscopioDocumentEditionPerspective >> createDefaultViewportVisitor [
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> createViewport [
^ self createDefaultViewportVisitor createViewportFor: document into: self
^ self renderViewport: document
]
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> informNodeHasChanged: aNode [
| path |
path := tree selection selectedPath.
tree roots: {document}.
tree selectPath: path.
]
{ #category : #initialization }
@ -52,7 +98,10 @@ GrafoscopioDocumentEditionPerspective >> initializeWidgets [
children: [ :node |
node isLeaf
ifTrue: [ {} ]
ifFalse: [ node children ] ]
ifFalse: [ node children reject:[: a | a isLeaf ] ]].
tree activateOnDoubleClick.
tree whenSelectionChangedDo: [ : a | self renderViewport: a selectedItem ].
tree whenActivatedDo: [ : a | self tooglePresenterForEdition: a ].
]
{ #category : #'as yet unclassified' }
@ -66,11 +115,37 @@ GrafoscopioDocumentEditionPerspective >> instantiateNode: aClass [
name: name;
yourself ].
^ aClass new
" self error: 'Unexpected class'"
]
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> updateModel: aModel [
document := aModel document.
tree roots: aModel document children.
GrafoscopioDocumentEditionPerspective >> modelChanged [
| path |
viewport := self createViewport.
path := tree selection selectedPath.
tree roots: {document}.
tree selectPath: path.
self needRebuild: false.
self buildWithSpec
]
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> renderViewport: aNode [
^ self createDefaultViewportVisitor createViewportFor: ( aNode ifNil: [ document ]) into: self
]
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> setModelBeforeInitialization: aDomainObject [
super setModelBeforeInitialization: aDomainObject.
document := aDomainObject .
]
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> tooglePresenterForEdition: anObect [
self halt.
]
{ #category : #initialization }
GrafoscopioDocumentEditionPerspective >> viewport [
^ viewport
]

View File

@ -21,6 +21,11 @@ GrafoscopioLeafNode >> acceptVisitor: aGrafoscopioVisitor [
]
{ #category : #accessing }
GrafoscopioLeafNode >> addAtBeginningChild: aBlock ofClass: aClass [
self error: 'Leaf nodes are abstract. '
]
{ #category : #accessing }
GrafoscopioLeafNode >> addChild: aBlock ofClass: aClass [
self error: 'Leaf nodes are abstract. '
@ -33,6 +38,16 @@ GrafoscopioLeafNode >> level [
^ parent ifNil: [ 0 ] ifNotNil: [ 1 + parent level ]
]
{ #category : #'as yet unclassified' }
GrafoscopioLeafNode >> moveDown [
parent moveDown: self.
]
{ #category : #'as yet unclassified' }
GrafoscopioLeafNode >> moveUp [
parent moveUp: self.
]
{ #category : #accessing }
GrafoscopioLeafNode >> parent [
"Returns the parent of the current node"
@ -41,13 +56,10 @@ GrafoscopioLeafNode >> parent [
{ #category : #accessing }
GrafoscopioLeafNode >> parent: aNode [
"A parent is a node that has the current node in its children"
aNode ifNil: [
parent := aNode.
^self ].
aNode parent = self ifTrue: [ ^ self ].
parent := aNode.
(aNode children includes: self)
ifFalse: [ aNode addNode: self ]
parent := aNode
]
{ #category : #'as yet unclassified' }
GrafoscopioLeafNode >> remove [
parent remove: self.
]

View File

@ -1,8 +1,9 @@
Class {
#name : #GrafoscopioNewCodeModel,
#superclass : #SpPresenter,
#superclass : #GrafoscopioNewTextModel,
#instVars : [
'body'
'preview',
'previewButton'
],
#category : #'Grafoscopio-New-UI'
}
@ -14,23 +15,91 @@ GrafoscopioNewCodeModel class >> defaultSpec [
yourself
]
{ #category : #accessing }
GrafoscopioNewCodeModel >> body [
^ body
]
{ #category : #accessing }
GrafoscopioNewCodeModel >> body: anObject [
body := anObject
]
{ #category : #API }
{ #category : #initialization }
GrafoscopioNewCodeModel >> content: aGrafoscopioNodeContent [
body text: aGrafoscopioNodeContent
self layout: (self createLayoutFor: aGrafoscopioNodeContent).
body text: (aGrafoscopioNodeContent ifNil: [ '' ])
]
{ #category : #initialization }
GrafoscopioNewCodeModel >> createLayoutFor: aGrafoscopioNodeContent [
^ SpBoxLayout newVertical
add:
(SpBoxLayout newHorizontal
add:
(SpBoxLayout newVertical
add: #up;
add: #down;
add: #delete;
yourself)
width: 30;
add:
(SpBoxLayout newHorizontal
add: #body;
add: #previewButton width: 30;
add: #preview;
yourself);
yourself)
height: (self heightFor: aGrafoscopioNodeContent)
]
{ #category : #initialization }
GrafoscopioNewCodeModel >> editionLayoutFor: aGrafoscopioNodeContent [
^ SpBoxLayout newVertical
add:
(SpBoxLayout newHorizontal
add:
(SpBoxLayout newVertical
add: #up;
add: #down;
add: #delete;
yourself)
width: 30;
add:
(SpBoxLayout newHorizontal
add: #body;
add: #previewButton width: 30;
add: #preview;
yourself);
yourself)
height: (self heightFor: aGrafoscopioNodeContent)
]
{ #category : #initialization }
GrafoscopioNewCodeModel >> initializeWidgets [
body := self newCode.
super initializeWidgets.
previewButton := self newButton.
previewButton icon: (self iconNamed: #smallFind).
previewButton action: [ self previewCode ].
preview := self newLabel
]
{ #category : #initialization }
GrafoscopioNewCodeModel >> newTextComponent [
^ self newCode
whenTextChangedDo: [ model text: body text ];
autoAccept: true;
yourself
]
{ #category : #initialization }
GrafoscopioNewCodeModel >> normalLayoutFor: aGrafoscopioNodeContent [
^ SpBoxLayout newVertical
add:
(SpBoxLayout newHorizontal
add:
(SpBoxLayout newHorizontal
add: #body;
add: #previewButton width: 30;
add: #preview;
yourself);
yourself)
height: (self heightFor: aGrafoscopioNodeContent)
]
{ #category : #initialization }
GrafoscopioNewCodeModel >> previewCode [
[ preview label: (self class compiler evaluate: body text) asString ]
on: Error
do: [ :e | preview label: e asString]
]

View File

@ -0,0 +1,83 @@
Class {
#name : #GrafoscopioNewTextInputModel,
#superclass : #SpDynamicPresenter,
#instVars : [
'#body',
'#model => SpObservableSlot',
'#onModifyNodeLocationDo'
],
#category : #'Grafoscopio-New-UI'
}
{ #category : #specs }
GrafoscopioNewTextInputModel class >> defaultSpec [
^ SpBoxLayout newVertical
add: #body height: 300;
yourself
]
{ #category : #API }
GrafoscopioNewTextInputModel >> content: aGrafoscopioNodeContent [
self layout: (self createLayoutFor: aGrafoscopioNodeContent).
body text: (aGrafoscopioNodeContent ifNil: [ '' ])
]
{ #category : #API }
GrafoscopioNewTextInputModel >> createLayoutFor: aGrafoscopioNodeContent [
^ SpBoxLayout newVertical
add: #body
height: (self heightFor: aGrafoscopioNodeContent)
]
{ #category : #'as yet unclassified' }
GrafoscopioNewTextInputModel >> heightFor: aGrafoscopioNodeContent [
^ aGrafoscopioNodeContent
ifNil: [ 100 ]
ifNotNil: [ (aGrafoscopioNodeContent asString lines size * self class toolbarHeight) max: 100 ]
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> informModification [
onModifyNodeLocationDo
ifNotNil: [ onModifyNodeLocationDo cull: self ]
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> initialize [
super initialize.
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> initializePrivateAnnouncements [
super initializePrivateAnnouncements.
self property: #model whenChangedDo: [ self modelChanged ]
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> initializeWidgets [
body := self newTextComponent.
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> model: aModel [
model := aModel
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> modelChanged [
self content: model text.
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> newTextComponent [
^ self newTextInput whenTextChangedDo: [
model text: body text.
self informModification ];
yourself
]
{ #category : #initialization }
GrafoscopioNewTextInputModel >> onModifyNodeLocationDo: aBlock [
onModifyNodeLocationDo := aBlock
]

View File

@ -1,37 +1,68 @@
Class {
#name : #GrafoscopioNewTextModel,
#superclass : #SpPresenter,
#superclass : #GrafoscopioNewTextInputModel,
#instVars : [
'body'
'up',
'down',
'delete',
'editionMode'
],
#category : #'Grafoscopio-New-UI'
}
{ #category : #specs }
GrafoscopioNewTextModel class >> defaultSpec [
^ SpBoxLayout newVertical
add: #body height: 300;
yourself
]
{ #category : #accessing }
GrafoscopioNewTextModel >> body [
^ body
]
{ #category : #accessing }
GrafoscopioNewTextModel >> body: anObject [
body := anObject
]
{ #category : #API }
GrafoscopioNewTextModel >> content: aGrafoscopioNodeContent [
body text: aGrafoscopioNodeContent
{ #category : #initialization }
GrafoscopioNewTextModel >> createLayoutFor: aGrafoscopioNodeContent [
^ editionMode
ifTrue: [ self editionLayoutFor: aGrafoscopioNodeContent ]
ifFalse: [ self normalLayoutFor: aGrafoscopioNodeContent ]
]
{ #category : #initialization }
GrafoscopioNewTextModel >> initializeWidgets [
body := self newText.
body autoAccept: true.
GrafoscopioNewTextModel >> editionLayoutFor: aGrafoscopioNodeContent [
^ SpBoxLayout newVertical
add:
(SpBoxLayout newHorizontal
add:
(SpBoxLayout newVertical
add: #up;
add: #down;
add: #delete;
yourself)
width: 30;
add: #body;
yourself)
height: (self heightFor: aGrafoscopioNodeContent)
]
{ #category : #initialization }
GrafoscopioNewTextModel >> initializeWidgets [
super initializeWidgets .
editionMode := true.
up := self newButton icon: (self iconNamed: #up) ; color: Color transparent ; yourself .
down := self newButton icon: (self iconNamed: #down) ; color: Color transparent ; yourself .
delete := self newButton icon: (self iconNamed: #delete) ; color: Color transparent ; yourself .
up action: [ model moveUp. self informModification. ].
down action: [ model moveDown. self informModification.].
delete action: [ model remove .self informModification. ]
]
{ #category : #initialization }
GrafoscopioNewTextModel >> newTextComponent [
^ self newText
whenTextChangedDo: [ model text: body text ];
autoAccept: true;
yourself
]
{ #category : #initialization }
GrafoscopioNewTextModel >> normalLayoutFor: aGrafoscopioNodeContent [
^ SpBoxLayout newVertical
add: #body
height: (self heightFor: aGrafoscopioNodeContent)
]
{ #category : #initialization }
GrafoscopioNewTextModel >> toogleEditionMode [
editionMode := editionMode not.
]

View File

@ -1,6 +1,6 @@
Class {
#name : #GrafoscopioPerspective,
#superclass : #SpPresenter,
#superclass : #SpPresenterWithModel,
#instVars : [
'toolbar',
'viewport'
@ -53,9 +53,8 @@ GrafoscopioPerspective >> addItemTo: aGroup [
GrafoscopioPerspective >> addingMenu [
| menu |
menu := self newMenu.
GrafoscopioAbstractNode allSubclasses
select: [ :c | c showInMenu ]
thenDo: [ :n |
self kindsOfNode
do: [ :n |
menu
addItem: [ :item |
item
@ -65,6 +64,19 @@ GrafoscopioPerspective >> addingMenu [
^ menu
]
{ #category : #'as yet unclassified' }
GrafoscopioPerspective >> chooseKindsOfNode [
| idx values |
values := self kindsOfNode.
idx := UIManager default
chooseFrom: values
lines: {}
title: 'What kind of node? '.
^ idx = 0
ifTrue: [ nil ]
ifFalse: [ values at: idx ]
]
{ #category : #initialization }
GrafoscopioPerspective >> createToolbar [
| aMenu |
@ -144,6 +156,11 @@ GrafoscopioPerspective >> initializeWidgets [
viewport := self createViewport
]
{ #category : #'as yet unclassified' }
GrafoscopioPerspective >> kindsOfNode [
^ GrafoscopioAbstractNode allSubclasses select: [ :c | c showInMenu ]
]
{ #category : #initialization }
GrafoscopioPerspective >> subMenu [
^ self newMenu

View File

@ -19,3 +19,8 @@ GrafoscopioProject >> initialize [
document := GrafoscopioRootNode new.
dictionary := GrafoscopioRootNode new
]
{ #category : #initialization }
GrafoscopioProject >> name: aName [
document name: aName
]

View File

@ -21,10 +21,22 @@ GrafoscopioRootNode >> acceptsChildsOfClass: aClass [
^ {GrafoscopioUnitNode} includes: aClass
]
{ #category : #accessing }
GrafoscopioRootNode >> addAtBeginningChild: aBlock ofClass: aClass [
(self acceptsChildsOfClass: aClass)
ifTrue: [ | child |
child := aBlock value.
child parent: self.
self children addFirst: child ]
]
{ #category : #accessing }
GrafoscopioRootNode >> addChild: aBlock ofClass: aClass [
(self acceptsChildsOfClass: aClass)
ifTrue: [ self children add: aBlock value ]
ifTrue: [ | child |
child := aBlock value.
child parent: self.
self children add: child ]
]
{ #category : #'as yet unclassified' }
@ -44,3 +56,13 @@ GrafoscopioRootNode >> initialize [
GrafoscopioRootNode >> level [
^ 1
]
{ #category : #accessing }
GrafoscopioRootNode >> text [
^ name
]
{ #category : #accessing }
GrafoscopioRootNode >> text: aText [
name := aText
]

View File

@ -31,6 +31,11 @@ GrafoscopioTextNode >> acceptVisitor: aGrafoscopioVisitor [
]
{ #category : #'as yet unclassified' }
GrafoscopioTextNode >> text [
^ text
]
{ #category : #accessing }
GrafoscopioTextNode >> text: aString [
text := aString

View File

@ -1,12 +1,12 @@
Class {
#name : #GrafoscopioTreeNotebook,
#superclass : #SpPresenter,
#superclass : #SpPresenterWithModel,
#instVars : [
'#sidebar',
'#viewport',
'#model => SpObservableSlot',
'#empty',
'#perspectives'
'sidebar',
'viewport',
'model',
'empty',
'perspectives'
],
#category : #'Grafoscopio-New-UI'
}
@ -24,43 +24,49 @@ GrafoscopioTreeNotebook class >> defaultSpec [
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 ].
]
{ #category : #initialization }
GrafoscopioTreeNotebook >> createDefaultComponent [
^ GrafoscopioPerspective defaultPerspective new
]
{ #category : #initialization }
GrafoscopioTreeNotebook >> initialize [
super initialize.
perspectives := Dictionary new.
]
{ #category : #initialization }
GrafoscopioTreeNotebook >> initializePrivateAnnouncements [
super initializePrivateAnnouncements.
self property: #model whenChangedDo: [ self updateModel ]
^ self basicInstallPerspective: GrafoscopioPerspective defaultPerspective
]
{ #category : #initialization }
GrafoscopioTreeNotebook >> initializeWidgets [
super initializeWidgets.
sidebar := self sidebar.
viewport := self createDefaultComponent.
self createDefaultComponent.
empty := self newLabel.
]
{ #category : #initialization }
GrafoscopioTreeNotebook >> installPerspective: aPerspective [
viewport ifNotNil: [ viewport aboutToBeUninstalledFrom: self ].
viewport := (perspectives at: aPerspective ifAbsentPut: [ self instantiate: aPerspective ]) .
self updateModel.
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 >> open: aGrafoscopioProject [
model := aGrafoscopioProject.
self openWithSpec.
self updateModel
GrafoscopioTreeNotebook >> setModelBeforeInitialization: aDomainObject [
super setModelBeforeInitialization: aDomainObject.
model := aDomainObject
]
{ #category : #initialization }
@ -72,12 +78,3 @@ GrafoscopioTreeNotebook >> sidebar [
[ :p | bar addAction: [ self installPerspective: p ] icon: p icon ].
^ bar
]
{ #category : #initialization }
GrafoscopioTreeNotebook >> updateModel [
viewport updateModel: model.
self needRebuild: false.
self buildWithSpec
]

View File

@ -29,3 +29,13 @@ GrafoscopioUnitNode >> acceptVisitor: aGrafoscopioVisitor [
GrafoscopioUnitNode >> acceptsChildsOfClass: aClass [
^ aClass isLeaf or: [ aClass = self class ]
]
{ #category : #accessing }
GrafoscopioUnitNode >> text [
^ name
]
{ #category : #accessing }
GrafoscopioUnitNode >> text: aText [
name := aText
]

View File

@ -81,6 +81,16 @@ GrafoscopioUrlNode >> shouldAskBeforeRemove [
^ false
]
{ #category : #content }
GrafoscopioUrlNode >> text [
^ self content
]
{ #category : #'as yet unclassified' }
GrafoscopioUrlNode >> text: aString [
]
{ #category : #'as yet unclassified' }
GrafoscopioUrlNode >> url [
^ link ifNil: [ link := self getUrl ]

View File

@ -15,7 +15,8 @@ GrafoscopioViewportVisitor >> createViewportFor: aDocumentNode into: aPresenter
presenter := aPresenter.
items := OrderedCollection new.
aDocumentNode acceptVisitor: self.
viewport := aPresenter instantiate: SpComponentListPresenter.
viewport := aPresenter viewport
ifNil: [ aPresenter instantiate: SpComponentListPresenter ].
viewport items: items.
^ viewport
]
@ -23,23 +24,54 @@ GrafoscopioViewportVisitor >> createViewportFor: aDocumentNode into: aPresenter
{ #category : #visiting }
GrafoscopioViewportVisitor >> visitCodeNode: aNode [
| code |
code := presenter newCode.
code text: aNode text.
code := presenter instantiate: GrafoscopioNewCodeModel.
code onModifyNodeLocationDo: [ presenter informNodeHasChanged: aNode ].
code model: aNode.
items add: code.
]
{ #category : #visiting }
GrafoscopioViewportVisitor >> visitRootNode: aNode [
| text |
text := presenter instantiate: GrafoscopioNewTextInputModel.
text model: aNode.
text onModifyNodeLocationDo: [ presenter informNodeHasChanged: aNode ].
items add: text.
super visitRootNode: aNode.
]
{ #category : #visiting }
GrafoscopioViewportVisitor >> visitTextNode: aNode [
| text |
text := presenter newText .
text text: aNode text.
text := presenter instantiate: GrafoscopioNewTextModel.
text onModifyNodeLocationDo: [ presenter informNodeHasChanged: aNode ].
text model: aNode.
items add: text.
]
{ #category : #visiting }
GrafoscopioViewportVisitor >> visitUnitNode: aNode [
| text |
text := presenter instantiate: GrafoscopioNewTextInputModel.
text model: aNode.
text onModifyNodeLocationDo: [ presenter informNodeHasChanged: aNode ].
items add: text.
items add: (presenter newButton
label: ' Add node on the beginning ';
action: [ presenter addNewNodeAtBeginningOf: aNode ];
yourself).
super visitUnitNode: aNode.
items add: (presenter newButton
label: ' Add node on the end ';
action: [ presenter addNewNodeAtLastOf: aNode ];
yourself)
]
{ #category : #visiting }
GrafoscopioViewportVisitor >> visitUrlNode: aNode [
| text |
text := presenter newText .
text text: aNode content.
items add: text.
text := presenter instantiate: GrafoscopioNewTextInputModel.
text onModifyNodeLocationDo: [ presenter informNodeHasChanged: aNode ].
text model: aNode.
items add: text.
]