Preliminary support for tagged nodes! :-). When a tag is added the node needs to be revisited to show the changes in the body pane. Will be nice to have this happening as soon as the tag is added.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2015-01-17 16:23:39 +00:00
parent 990ff595b1
commit 9bf5bb4332

View File

@ -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' } { #category : #'graphical interface' }
GrafoscopioBrowser >> bodyForTransmediaOn: constructor [ GrafoscopioBrowser >> bodyForTransmediaOn: constructor [
"Shows the body of a transmedia type of node" "Shows the body of a transmedia type of node"
@ -93,17 +139,33 @@ GrafoscopioBrowser >> bodyForTransmediaOn: constructor [
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> bodyOn: constructor [ GrafoscopioBrowser >> bodyIn: constructor [
"Shows the body of a selected node" "Shows the body of a selected node"
(constructor text) (constructor text)
title: 'Cuerpo | Body '; title: 'Texto ';
format:[:eachNode | format:[:eachNode |
(eachNode body) isNil (eachNode body) isNil
ifTrue: [ '' ] ifTrue: [ '' ]
ifFalse: [ eachNode body]]. 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' } { #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowser [ GrafoscopioBrowser >> buildBrowser [
"Main method for building the interface for trees and its nodes" "Main method for building the interface for trees and its nodes"
@ -125,11 +187,11 @@ browser
(browser transmit) (browser transmit)
to: #tree; to: #tree;
andShow: [:a | self treeOn: a]. andShow: [:a | self treeOn: a].
"Creating a self updatable body pane" "Creating a self updateable body pane"
(browser transmit) (browser transmit)
to: #nodeBody; to: #nodeBody;
from: #tree; from: #tree;
andShow: [ :a | self bodyOn: a]. andShow: [ :a | self bodyIn: a].
(browser transmit ) (browser transmit )
from: #tree port: #selection; from: #tree port: #selection;
from: #nodeBody port: #text; from: #nodeBody port: #text;
@ -188,9 +250,11 @@ browser
andShow: [:a | self treeOn: a]. andShow: [:a | self treeOn: a].
"Creating a self updatable body pane" "Creating a self updatable body pane"
(browser transmit) (browser transmit)
to: #nodeBody;
from: #tree; from: #tree;
andShow: [ :a | self bodyOn: a]. to: #nodeBody;
andShow: [ :a :node |
self bodyIn: a for: node.
self bodyForCodeIn: a for: node].
(browser transmit ) (browser transmit )
from: #tree port: #selection; from: #tree port: #selection;
from: #nodeBody port: #text; from: #nodeBody port: #text;
@ -284,7 +348,8 @@ GrafoscopioBrowser >> configureInitialTags [
tagsAvailable tagsAvailable
add: 'obra'; add: 'obra';
add: 'original'; add: 'original';
add: 'transmediado'. add: 'transmediado';
add: 'código'.
] ]
{ #category : #'system-support' } { #category : #'system-support' }
@ -831,9 +896,15 @@ GrafoscopioBrowser >> treeOn: constructor [
"For tags" "For tags"
act: [:treePresentation | act: [:treePresentation |
(treePresentation selection isNotNil) (treePresentation selection isNotNil)
ifTrue: [self addTagTo: treePresentation selection] ] ifTrue: [self addTagTo: treePresentation selection]]
entitled: 'Agregar al nodo' categorized: 'Etiquetas'; entitled: 'Agregar al nodo' categorized: 'Etiquetas';
act: [self messageNotImplementedYet] entitled: 'Eliminar del 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 showTagsAvailable] entitled: 'Ver disponibles' categorized: 'Etiquetas';
act: [self addToTagsAvailable] entitled: 'Agregar a disponibles' categorized: 'Etiquetas'; act: [self addToTagsAvailable] entitled: 'Agregar a disponibles' categorized: 'Etiquetas';