Preliminar support for tags integrated to the UI. Next: Showing the tags in the left of the nodes' headers.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2015-01-13 18:28:45 +00:00
parent f1191bb493
commit 0885fedfb9
2 changed files with 104 additions and 5 deletions

View File

@ -15,6 +15,7 @@ Class {
'browser', 'browser',
'explorer', 'explorer',
'mainTree', 'mainTree',
'tagsAvailable',
'\r\t\t\t\t\t\t\t\t\tnonVar1', '\r\t\t\t\t\t\t\t\t\tnonVar1',
'cacheNode', 'cacheNode',
'workingFile', 'workingFile',
@ -70,6 +71,34 @@ GrafoscopioBrowser >> addFileToRepository [
'echo "Added file to enabled repository"'. 'echo "Added file to enabled repository"'.
] ]
{ #category : #tags }
GrafoscopioBrowser >> addTagTo: aNode [
"Tags the node passed as argument with a value from the collection of tags available"
| selection |
tagsAvailable isNil
ifFalse: [
selection := UIManager default chooseFrom: tagsAvailable title: 'Elija una etiqueta'.
aNode tagAs: (tagsAvailable at: selection)
]
ifTrue: [self messageNoTagsAvailable].
]
{ #category : #tags }
GrafoscopioBrowser >> addToTagsAvailable [
"Adds a tag to the collection of tags available"
| tag |
tagsAvailable isNil
ifTrue: [tagsAvailable := OrderedCollection new].
tag := UIManager default
textEntry: 'Nombre de la etiqueta'
title: 'Agregue una etiqueta'.
tagsAvailable add: tag.
]
{ #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"
@ -252,7 +281,10 @@ browser
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowserNamed: aName [ GrafoscopioBrowser >> buildBrowserNamed: aName [
"Main method for building the interface for trees and its nodes. The name of the browser corresponds to the name of the file where tree is stored (or is named 'draft.ston' by default)" "Main method for building the interface for trees and its nodes. The name of the browser corresponds to the name of the file
where tree is stored (or is named 'draft.ston' by default)"
self configureInitialTags.
browser := GLMTabulator new browser := GLMTabulator new
title: aName, ' | Grafoscopio'. title: aName, ' | Grafoscopio'.
@ -352,6 +384,20 @@ GrafoscopioBrowser >> configureFossil [
] ]
{ #category : #'system-support' }
GrafoscopioBrowser >> configureInitialTags [
"Configures a list of predefined tags available to use. More tags should be added from a repository.
The idea is that nodes are processed and show differently according to their tags. So users should be
able to define their own tags with custom UI and behaviour"
tagsAvailable := OrderedCollection new.
tagsAvailable
add: 'original';
add: 'transmediado';
add: 'texto';
add: 'código'.
]
{ #category : #'system-support' } { #category : #'system-support' }
GrafoscopioBrowser >> configurePandoc [ GrafoscopioBrowser >> configurePandoc [
"Stablish where is located pandoc according to the operative system and the input of the user" "Stablish where is located pandoc according to the operative system and the input of the user"
@ -520,6 +566,20 @@ GrafoscopioBrowser >> messageAbout [
title: 'About Grafoscopio'. title: 'About Grafoscopio'.
] ]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> messageNoTagsAvailable [
"Shows that there is no tags available and the procedure to add some tags"
UIManager default
abort:
'Use primero el menu:',
(String with: Character cr),
'"Etiquetas > Agregar a disponibles"',
(String with: Character cr),
'para agregar etiquetas y luego sí agregue etiquetas al nodo'
title: 'Sin etiquetas disponibles!'
]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> messageNotImplementedYet [ GrafoscopioBrowser >> messageNotImplementedYet [
"Shows that a feature is not implemeted and point to further documentation on the web" "Shows that a feature is not implemeted and point to further documentation on the web"
@ -805,6 +865,16 @@ GrafoscopioBrowser >> saveWorkingTree [
self inform: 'Archivo guardado como: ', workingFile asString. self inform: 'Archivo guardado como: ', workingFile asString.
] ]
{ #category : #tags }
GrafoscopioBrowser >> showTagsAvailable [
"Adds a tag to the collection of tags available"
tagsAvailable isNil
ifTrue: [self messageNoTagsAvailable]
ifFalse: [self messageNotImplementedYet]
]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> treeForTransmediatonOn: aTree [ GrafoscopioBrowser >> treeForTransmediatonOn: aTree [
"Shows the correspondent tree of a node" "Shows the correspondent tree of a node"
@ -971,11 +1041,16 @@ GrafoscopioBrowser >> treeOn: constructor [
icon: GLMUIThemeExtraIcons glamorousSave icon: GLMUIThemeExtraIcons glamorousSave
entitled: 'Save current tree'; entitled: 'Save current tree';
"Menu options" "Options Menu
============="
"For trees"
act: [ GrafoscopioBrowser open] entitled: 'Nuevo ...' categorized: 'Arbol'; act: [ GrafoscopioBrowser open] entitled: 'Nuevo ...' categorized: 'Arbol';
act: [ GrafoscopioBrowser new openFromFile] entitled: 'Abrir/Cargar ...' categorized: 'Arbol'; act: [ GrafoscopioBrowser new openFromFile] entitled: 'Abrir/Cargar ...' categorized: 'Arbol';
act: [self saveToFile] entitled: 'Guardar como ...' categorized: 'Arbol'; act: [self saveToFile] entitled: 'Guardar como ...' categorized: 'Arbol';
act: [self exportAsHtml] entitled: 'Exportar como html' categorized: 'Arbol'; act: [self exportAsHtml] entitled: 'Exportar como html' categorized: 'Arbol';
"For nodes"
act: [:treePresentation | act: [:treePresentation |
(treePresentation selection isNotNil) (treePresentation selection isNotNil)
ifTrue: [self copyNodeIntoCache: treePresentation selection]. ifTrue: [self copyNodeIntoCache: treePresentation selection].
@ -984,13 +1059,29 @@ GrafoscopioBrowser >> treeOn: constructor [
(treePresentation selection isNotNil) (treePresentation selection isNotNil)
ifTrue: [self replaceContentsFromCache: treePresentation selection]. ifTrue: [self replaceContentsFromCache: treePresentation selection].
treePresentation update] entitled: 'Pegar nodo' categorized: 'Nodo'; treePresentation update] entitled: 'Pegar nodo' categorized: 'Nodo';
"act: [ ]; entitled: 'Etiquetar > como: Código';
act: [ ]; entitled: 'Etiquetar > como: Texto';" "For tags"
act: [self showTagsAvailable] entitled: 'Ver disponibles' categorized: 'Etiquetas';
act: [self addToTagsAvailable] entitled: 'Agregar a disponibles' categorized: 'Etiquetas';
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';
"For projects"
act: [self enableRepository] entitled: 'Activar' categorized: 'Proyecto'; act: [self enableRepository] entitled: 'Activar' categorized: 'Proyecto';
act: [self addFileToRepository] entitled: 'Agregar archivo' categorized: 'Proyecto'; act: [self addFileToRepository] entitled: 'Agregar archivo' categorized: 'Proyecto';
act: [self messageNotImplementedYet] entitled: 'Eliminar archivo' categorized: 'Proyecto'; act: [self messageNotImplementedYet] entitled: 'Eliminar archivo' categorized: 'Proyecto';
act: [self repositoryCommit] entitled: 'Enviar al histórico' categorized: 'Proyecto'; act: [self repositoryCommit] entitled: 'Enviar al histórico' categorized: 'Proyecto';
act: [self repositoryCredentials] entitled: 'Acreditarse' categorized: 'Proyecto'; act: [self repositoryCredentials] entitled: 'Acreditarse' categorized: 'Proyecto';
"For help"
act: [self messageNotImplementedYet] entitled: 'Ver como html en línea' categorized: 'Ayuda';
act: [self messageNotImplementedYet] entitled: 'Ver como html fuera línea' categorized: 'Ayuda';
act: [self messageNotImplementedYet] entitled: 'Ver como árbol en grafoscopio' categorized: 'Ayuda';
"For grafoscopio"
act: [self updateGrafoscopio] entitled: 'Actualizar' categorized: 'Grafoscopio'; act: [self updateGrafoscopio] entitled: 'Actualizar' categorized: 'Grafoscopio';
act: [self updatePrerrequisites] entitled: 'Actualizar prerrequisitos' categorized: 'Grafoscopio'; act: [self updatePrerrequisites] entitled: 'Actualizar prerrequisitos' categorized: 'Grafoscopio';
act: [self messageNotImplementedYet] entitled: 'Herramientas externas > Actualizar' categorized: 'Grafoscopio'; act: [self messageNotImplementedYet] entitled: 'Herramientas externas > Actualizar' categorized: 'Grafoscopio';

View File

@ -445,6 +445,14 @@ GrafoscopioNode >> returnConfig [
^configDict ^configDict
] ]
{ #category : #accessing }
GrafoscopioNode >> tagAs: aTag [
"Tags the recipient node with aTag. For the moment we will have only one tag. In the future we will have several and there will be rules to
know if a tag excludes others from the same node"
tags := aTag.
]
{ #category : #'add/remove nodes' } { #category : #'add/remove nodes' }
GrafoscopioNode >> visitedGoTo: aCollection [ GrafoscopioNode >> visitedGoTo: aCollection [
"Stores the current node in a collection and recursively stores its children" "Stores the current node in a collection and recursively stores its children"