diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index ff3ae30..95b8356 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -74,16 +74,15 @@ GrafoscopioNode >> addLink: anUrl [ ] -{ #category : #'add/remove nodes' } +{ #category : #adding } GrafoscopioNode >> addNode: aNode [ "Adds the given node to the receivers collection of children, and sets this object as the parent of the node" - + aNode parent = self ifTrue: [ ^ self ]. self children add: aNode. aNode level: (self level) + 1. aNode parent: self. - ^aNode - + ^aNode ] { #category : #'add/remove nodes' } @@ -846,7 +845,7 @@ GrafoscopioNode >> parent [ { #category : #accessing } GrafoscopioNode >> parent: aNode [ "A parent is a node that has the current node in its children" - parent := aNode + aNode addNode: self. ] { #category : #'add/remove nodes' } @@ -948,6 +947,20 @@ GrafoscopioNode >> specModelClass [ ^ GrafoscopioTextModel ] +{ #category : #'as yet unclassified' } +GrafoscopioNode >> surfaceCopy [ + "I copy the most relevant values of the receiver. I'm useful to avoid copying references + to the rest of the container tree, which could end in copying the whole tree." + | newNode | + newNode := self class new. + ^ newNode + header: self header; + body: self body; + tags: self tags. + + +] + { #category : #accessing } GrafoscopioNode >> tagAs: aTag [ "Tags the recipient node with aTag (string). For the moment we will have only one tag. @@ -975,6 +988,11 @@ GrafoscopioNode >> tags [ ^ tags ] +{ #category : #accessing } +GrafoscopioNode >> tags: aCollection [ + tags := aCollection +] + { #category : #accessing } GrafoscopioNode >> title [ "Returns the receiver header"