diff --git a/repository/Grafoscopio/GrafoscopioBrowser.class.st b/repository/Grafoscopio/GrafoscopioBrowser.class.st index 6898711..6d067ce 100644 --- a/repository/Grafoscopio/GrafoscopioBrowser.class.st +++ b/repository/Grafoscopio/GrafoscopioBrowser.class.st @@ -85,6 +85,52 @@ GrafoscopioBrowser >> addToTagsAvailable [ ] +{ #category : #'graphical interface' } +GrafoscopioBrowser >> bodyForCodeIn: constructor for: aNode [ + "Shows the body of a selected node" + + aNode tags = 'código' + ifFalse: [ ^self ]. + + (constructor smalltalkCode) + title: 'Código en Smalltalk'; + format: [aNode body] + + +" + ^(constructor smalltalkCode) + title: 'Código en Smalltalk'; + format:[aNode body]. + + + constructor tags = 'código' + ifFalse: [^self ] + ifTrue: [ + ^(constructor smalltalkCode) + title: 'Código de Smalltalk'; + populate: #acceptedCode icon: GLMUIThemeExtraIcons glamorousAccept on: $s entitled: 'Accept' with: [:text | text text ] + ]" +] + +{ #category : #'graphical interface' } +GrafoscopioBrowser >> bodyForCodeOn: constructor [ + "Shows the body of a selected node" + + ^(constructor smalltalkCode) + title: 'Código en Smalltalk'; + format:[:eachNode | eachNode body]. + + +" + constructor tags = 'código' + ifFalse: [^self ] + ifTrue: [ + ^(constructor smalltalkCode) + title: 'Código de Smalltalk'; + populate: #acceptedCode icon: GLMUIThemeExtraIcons glamorousAccept on: $s entitled: 'Accept' with: [:text | text text ] + ]" +] + { #category : #'graphical interface' } GrafoscopioBrowser >> bodyForTransmediaOn: constructor [ "Shows the body of a transmedia type of node" @@ -93,17 +139,33 @@ GrafoscopioBrowser >> bodyForTransmediaOn: constructor [ ] { #category : #'graphical interface' } -GrafoscopioBrowser >> bodyOn: constructor [ +GrafoscopioBrowser >> bodyIn: constructor [ "Shows the body of a selected node" (constructor text) - title: 'Cuerpo | Body '; + title: 'Texto '; format:[:eachNode | (eachNode body) isNil ifTrue: [ '' ] ifFalse: [ eachNode body]]. ] +{ #category : #'graphical interface' } +GrafoscopioBrowser >> bodyIn: constructor for: aNode [ + "Shows the body in a constructor for selected node, if node is not tagged. If it is tagged it will return itself, so it can be rendered + properly for other messages" + + aNode tags isNil + ifFalse: [^self ]. + + (constructor text) + title: 'Texto '; + format:[ + aNode body isNil + ifTrue: [ '' ] + ifFalse: [ aNode body]]. +] + { #category : #'graphical interface' } GrafoscopioBrowser >> buildBrowser [ "Main method for building the interface for trees and its nodes" @@ -125,11 +187,11 @@ browser (browser transmit) to: #tree; andShow: [:a | self treeOn: a]. -"Creating a self updatable body pane" +"Creating a self updateable body pane" (browser transmit) to: #nodeBody; from: #tree; - andShow: [ :a | self bodyOn: a]. + andShow: [ :a | self bodyIn: a]. (browser transmit ) from: #tree port: #selection; from: #nodeBody port: #text; @@ -188,9 +250,11 @@ browser andShow: [:a | self treeOn: a]. "Creating a self updatable body pane" (browser transmit) - to: #nodeBody; from: #tree; - andShow: [ :a | self bodyOn: a]. + to: #nodeBody; + andShow: [ :a :node | + self bodyIn: a for: node. + self bodyForCodeIn: a for: node]. (browser transmit ) from: #tree port: #selection; from: #nodeBody port: #text; @@ -284,7 +348,8 @@ GrafoscopioBrowser >> configureInitialTags [ tagsAvailable add: 'obra'; add: 'original'; - add: 'transmediado'. + add: 'transmediado'; + add: 'código'. ] { #category : #'system-support' } @@ -831,9 +896,15 @@ GrafoscopioBrowser >> treeOn: constructor [ "For tags" act: [:treePresentation | (treePresentation selection isNotNil) - ifTrue: [self addTagTo: treePresentation selection] ] - entitled: 'Agregar al nodo' categorized: 'Etiquetas'; - act: [self messageNotImplementedYet] entitled: 'Eliminar del nodo' categorized: 'Etiquetas'; + ifTrue: [self addTagTo: treePresentation selection]] + entitled: 'Agregar al nodo' categorized: 'Etiquetas'; + act: [:treePresentation | + (treePresentation selection isNotNil) + ifTrue: [ + treePresentation selection tagAs: nil. + browser update. + ]] + entitled: 'Eliminar del nodo' categorized: 'Etiquetas'; act: [self showTagsAvailable] entitled: 'Ver disponibles' categorized: 'Etiquetas'; act: [self addToTagsAvailable] entitled: 'Agregar a disponibles' categorized: 'Etiquetas';