Preliminary support for transmediated notes, for one original node to one child transmediated node. Next, to see what's happening with saving and having nodes shown when transmediated is selected.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2015-01-15 18:08:26 +00:00
parent 8627b14edc
commit a1a8d0d21c

View File

@ -38,21 +38,6 @@ GrafoscopioBrowser class >> open [
^ self new open ^ self new open
] ]
{ #category : #'as yet unclassified' }
GrafoscopioBrowser class >> openInMode: aMode [
^ self new openInMode: aMode
]
{ #category : #'as yet unclassified' }
GrafoscopioBrowser class >> openInModeTransmediaton [
^ self new openInModeTransmediaton
]
{ #category : #'as yet unclassified' }
GrafoscopioBrowser class >> openLandscape [
^ self new openLandscape
]
{ #category : #persistence } { #category : #persistence }
GrafoscopioBrowser >> addFileToRepository [ GrafoscopioBrowser >> addFileToRepository [
"Adds a selected file to a defined repository." "Adds a selected file to a defined repository."
@ -163,58 +148,6 @@ browser
transformed: [:node :text | node header: text asString] transformed: [:node :text | node header: text asString]
] ]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowserForTransmediaton: aTree [
"Main method for building the interface for trees and its nodes"
browser := GLMTabulator new
title: 'Transmediaton | Grafoscopio'.
"browser
column: [:c |
c row: #tree;
row: #nodeHeader] span: 2;
column: [ :c |
c row: #nodeBody span: 2] span: 4."
browser
updateOn: GLMItemAdded from: #yourself;
updateOn: GLMItemRemoved from: #yourself.
browser
column: #one;
column: #two;
column: #three.
(browser transmit)
to: #one;
andShow: [ self treeForTransmediatonOn: aTree ].
(browser transmit)
to: #two;
from: #one;
andShow: [ :a |
(a text)
display: [ 'Contenido original' ] ].
(browser transmit)
to: #three;
from: #two;
andShow: [ :a |
(a text)
display: [ 'Transmediado' ];
populate: #focus
on: $f
entitled: 'Focus'
with: [ :list | list selection ] ].
(browser transmit)
toOutsidePort: #focus;
from: #three port: #focus.
(browser transmit)
to: #one port: #selection;
fromOutsidePort: #focus.
(browser transmit)
to: #two port: #selection;
fromOutsidePort: #focus.
browser openOn: aTree
]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowserLandscape [ GrafoscopioBrowser >> buildBrowserLandscape [
@ -277,32 +210,38 @@ browser
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> buildBrowserTransmediaton [ GrafoscopioBrowser >> buildBrowserNamed: aName inMode: aModeName [
"Main method for building the interface for trees and its nodes" "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). The name of the mode correspond to a way of showing and dealing with
the data.
The idea is to support several modes in the future, starting with the 'Transmediaton' mode and adding more as needed."
self configureInitialTags.
browser := GLMTabulator new browser := GLMTabulator new
title: 'Transmediaton | Grafoscopio'. title: aName, ' | Grafoscopio'.
browser browser
column: [:c | column: [:c |
c row: #tree; c row: #tree span: 6;
row: #nodeHeader] span: 2; row: #nodeHeader span: 1] span: 2;
column: [ :c | column: [ :c |
c row: #nodeBody span: 2] span: 4. c row: #nodeBody span: 2] span: 5.
browser browser
updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemAdded from: #yourself;
updateOn: GLMItemRemoved from: #yourself. updateOn: GLMItemRemoved from: #yourself.
(browser transmit) (browser transmit)
to: #tree; to: #tree;
andShow: [:a | self treeForTransmediatonOn: a]. andShow: [:a | self treeOn: a].
"Creating a self updatable body pane" "Creating a self updatable body pane"
(browser transmit) (browser transmit)
to: #nodeBody; to: #nodeBody;
from: #tree; from: #tree;
andShow: [ :a | self bodyForTransmediaOn: a]. andShow: [ :a |
(aModeName = 'transmedia')
ifTrue: [self bodyForTransmediaOn: a]].
(browser transmit ) (browser transmit )
from: #tree port: #selection; from: #tree port: #selection;
from: #nodeBody port: #text; from: #nodeBody port: #text;
@ -574,8 +513,44 @@ GrafoscopioBrowser >> openDefault [
] ]
{ #category : #persistence } { #category : #persistence }
GrafoscopioBrowser >> openFromFile [ GrafoscopioBrowser >> openFromFile: aFileName [
"Opens a tree from a file. Maybe this should be integrated with the 'open' method" "Opens a tree from a file named aFileName"
| currentChildren |
self configureSettings.
aFileName isNil ifTrue: [ ^nil ].
workingFile := aFileName name asFileReference.
currentChildren := (STON fromString: aFileName contents).
self buildBrowserNamed: aFileName basenameWithIndicator.
mainTree := GrafoscopioNode new
header: 'Arbol principal';
level: 0.
mainTree children: currentChildren.
browser openOn: mainTree children.
]
{ #category : #persistence }
GrafoscopioBrowser >> openFromFile: aFileName inMode: aModeName [
"Opens a tree from a file named aFileName"
| currentChildren |
self configureSettings.
aFileName isNil ifTrue: [ ^nil ].
workingFile := aFileName name asFileReference.
currentChildren := (STON fromString: aFileName contents).
self buildBrowserNamed: aFileName basenameWithIndicator inMode: aModeName.
mainTree := GrafoscopioNode new
header: 'Arbol principal';
level: 0.
mainTree children: currentChildren.
browser openOn: mainTree children.
]
{ #category : #persistence }
GrafoscopioBrowser >> openFromFileSelector [
"Opens a tree from a file by using the file selector GUI."
| fileStream currentChildren | | fileStream currentChildren |
self configureSettings. self configureSettings.
@ -594,83 +569,6 @@ GrafoscopioBrowser >> openFromFile [
browser openOn: mainTree children. browser openOn: mainTree children.
] ]
{ #category : #persistence }
GrafoscopioBrowser >> openFromFileInMode: aMode [
"Opens a tree from a file and shows it on a specific graphical mode. Graphical modes are like themes in Grafoscopio which organize interface in a particular
layout to optimize interaction in a particular setting. For the moment only 'transmediaton' mode is supported (transmediaton is a transmedia hackathon)"
| fileStream currentChildren |
self configureSettings.
fileStream := UITheme builder
fileOpen: 'Elija un archivo .ston'
extensions: #('ston').
fileStream isNil ifTrue: [ ^nil ].
workingFile := fileStream name asFileReference.
currentChildren := (STON fromStream: fileStream).
mainTree := GrafoscopioNode new
header: 'Arbol principal';
level: 0.
mainTree children: currentChildren.
aMode = 'transmediaton'
ifTrue: [self buildBrowserTransmediaton ].
browser openOn: mainTree children.
]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> openInMode: aMode [
"**Experimental feature.**
Opens grafoscopio in several 'modes'. Each mode corresponds to a operation way, with an specific interface.
We will start with a 'transmediaton' mode to let the people create some transmedia content.
After that we will enable other modes"
browser := GLMTabulator new
title: 'Grafoscopio'.
browser
column: #original span: 3;
column: #transmediado span: 3.
browser
updateOn: GLMItemAdded from: #yourself;
updateOn: GLMItemRemoved from: #yourself.
" browser := GLMTabulator new.
browser
row: #main;
row: [ :r | r column: #selectionInterval; column: #selectedText; column: #full ].
(browser transmit)
to: #main;
andShow: [ :a | a text ].
(browser transmit)
to: #selectionInterval;
from: #main port: #selectionInterval;
andShow: [ :a | a text title: '#selectionInterval port' ].
(browser transmit)
to: #selectedText;
from: #main port: #selectedText;
andShow: [ :a | a text title: '#selectedText port' ].
(browser transmit)
to: #full;
from: #main port: #text;
andShow: [ :a | a text title: '#text port']."
]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> openInModeTransmediaton [
"**Experimental feature.**
Opens grafoscopio in several 'modes'. Each mode corresponds to a operation way, with an specific interface.
We will start with a 'transmediaton' mode to let the people create some transmedia content.
After that we will enable other modes"
| draftsLocation |
"self configureSettings."
self buildBrowserTransmediaton.
mainTree := GrafoscopioNode new.
mainTree becomeDefaultTree.
draftsLocation := FileSystem disk workingDirectory / 'Grafoscopio' / 'Drafts'.
draftsLocation ensureCreateDirectory.
workingFile := draftsLocation / 'draft.ston'.
browser openOn: mainTree children.
]
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
GrafoscopioBrowser >> openLandscape [ GrafoscopioBrowser >> openLandscape [
"Opens a new browser with a default tree in landscape mode" "Opens a new browser with a default tree in landscape mode"
@ -711,20 +609,24 @@ GrafoscopioBrowser >> panelBrowserForTransmediaton [
Opens grafoscopio in several 'modes'. Each mode corresponds to a operation way, with an specific interface. Opens grafoscopio in several 'modes'. Each mode corresponds to a operation way, with an specific interface.
We will start with a 'transmediaton' mode to let the people create some transmedia content. We will start with a 'transmediaton' mode to let the people create some transmedia content.
After that we will enable other modes" After that we will enable other modes"
| transmediaNode |
browser := GLMTabulator new. browser := GLMTabulator new.
browser browser
column: [ :c | column: [ :c |
c row: [ :r | r column: #original; column: #transmediado] span: 7; c row: [ :r | r column: #original; column: #transmediado] span: 7";
row: #buttons; span: 1]. row: #buttons; span: 1"].
(browser transmit) (browser transmit)
to: #original; to: #original;
andShow: [ :a | andShow: [ :a |
a text a text
title: 'Original'; title: 'Original';
format:[:eachNode | format:[:eachNode |
(eachNode body) isNil (eachNode tags) = 'original'
ifTrue: [ '' ] ifFalse: [ '' ]
ifFalse: [ eachNode body]]]. ifTrue: [
transmediaNode := eachNode children detect: [:node | node tags = 'transmediado'].
eachNode body]]].
(browser transmit) (browser transmit)
from: #original; from: #original;
toOutsidePort: #text. toOutsidePort: #text.
@ -733,17 +635,19 @@ GrafoscopioBrowser >> panelBrowserForTransmediaton [
andShow: [ :a | andShow: [ :a |
a text a text
title: 'Transmediado'; title: 'Transmediado';
format:[:eachNode | format:[transmediaNode isNotNil
(eachNode children) isEmpty ifFalse: [ '' ]
ifTrue: [ '' ] ifTrue: [transmediaNode body]
ifFalse: [eachNode children first body]]. ]. ]
(browser transmit) ].
" (browser transmit)
to: #buttons; to: #buttons;
andShow: [ :a | andShow: [ :a |
a actionList a actionList
"act: [:entity | entity inspect ] entitled: 'Subir';" act: [:entity | entity inspect ] entitled: 'Subir';
act: [:entity | entity explore ] entitled: 'Previsualizar'; act: [:entity | entity explore ] entitled: 'Previsualizar';
act: [:entity | entity explore ] entitled: 'Publicar']. act: [:entity | entity explore ] entitled: 'Publicar'].
"
^ browser. ^ browser.
] ]
@ -827,103 +731,6 @@ GrafoscopioBrowser >> showTagsAvailable [
] ]
{ #category : #'graphical interface' }
GrafoscopioBrowser >> treeForTransmediatonOn: aTree [
"Shows the correspondent tree of a node"
| constructor |
constructor := GLMBrowser.
(constructor tree) "Layout"
title: aTree header;
children: [ :eachNode |
(eachNode children) isNil
ifTrue: [ self inform: 'Seleccione un nodo para ver su contenido' ]
ifFalse:[ eachNode children ] ];
format:[:eachNode |
(eachNode header) isNil
ifTrue: [ '' ]
ifFalse: [ eachNode header ]];
"Adding/Removing nodes"
act: [:treePresentation |
(treePresentation selection) isNotNil
ifTrue: [treePresentation selection addNodeAfter].
treePresentation update]
icon: GLMUIThemeExtraIcons glamorousZoomIn
entitled: 'Add node';
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [(treePresentation selection parent)
removeNode: treePresentation selection]
ifFalse: [treePresentation entity removeLast].
treePresentation update]
icon: GLMUIThemeExtraIcons glamorousZoomOut
entitled: 'Remove node';
"Move nodes in the same hierarchy"
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [treePresentation selection moveBefore].
treePresentation update]
icon: GLMUIThemeExtraIcons glamorousUp
entitled: 'Move node up';
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [treePresentation selection moveAfter].
treePresentation update]
icon: GLMUIThemeExtraIcons glamorousDown
entitled: 'Move node down';
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [treePresentation selection promote].
treePresentation update]
icon: GLMUIThemeExtraIcons glamorousLeft
entitled: 'Move node left';
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [treePresentation selection demote].
treePresentation update]
icon: GLMUIThemeExtraIcons glamorousRight
entitled: 'Move node rigt';
act: [ :treePresentation | treePresentation update ]
icon: GLMUIThemeExtraIcons glamorousRefresh
entitled: 'Update';
act: [self saveWorkingTree]
icon: GLMUIThemeExtraIcons glamorousSave
entitled: 'Save current tree';
"Menu options"
act: [ GrafoscopioBrowser new openFromFileInMode: 'transmediaton'] entitled: 'Arbol > Abrir/Cargar ...';
act: [self saveToFile] entitled: 'Arbol > Guardar como ...';
act: [self exportAsHtml] entitled: 'Arbol > Exportar como html';
"act: [:x | x printString inspect] entitled: 'Arbol > Definir título';"
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [self copyNodeIntoCache: treePresentation selection].
treePresentation update] entitled: 'Nodo > Copiar nodo';
act: [:treePresentation |
(treePresentation selection isNotNil)
ifTrue: [self replaceContentsFromCache: treePresentation selection].
treePresentation update] entitled: 'Nodo > Pegar nodo';
act: [self enableRepository] entitled: 'Proyecto > Activar';
act: [self addFileToRepository] entitled: 'Proyecto > Agregar archivo';
act: [:x | x printString inspect] entitled: 'Proyecto > Eliminar archivo';
act: [self repositoryCommit] entitled: 'Proyecto > Enviar al histórico';
act: [self repositoryCredentials] entitled: 'Proyecto > Acreditarse';
act: [self updateSystem] entitled: 'Grafoscopio > Actualizar';
act: [self updateSystem] entitled: 'Grafoscopio > Actualizar prerrequisitos';
act: [:x | x printString inspect] entitled: 'Grafoscopio > Actualizar herramientas externas';
act: [self configurePandoc] entitled: 'Grafoscopio > Herramientas externas > Definir ruta a pandoc';
act: [:x | x printString inspect] entitled: 'Grafoscopio > Herramientas externas > Definir ruta a fossil';
act: [:x | x printString inspect] entitled: 'Grafoscopio > Acerca de...'.
]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> treeOn: constructor [ GrafoscopioBrowser >> treeOn: constructor [
"Shows the correspondent tree of a node" "Shows the correspondent tree of a node"
@ -943,6 +750,9 @@ GrafoscopioBrowser >> treeOn: constructor [
ifFalse: [ (eachNode tags) asSymbol ] ifFalse: [ (eachNode tags) asSymbol ]
ifTrue: [ #() ] ]; ifTrue: [ #() ] ];
"Nodes Toolbar
=============="
"Adding nodes" "Adding nodes"
act: [:treePresentation | act: [:treePresentation |
(treePresentation selection) isNotNil (treePresentation selection) isNotNil
@ -961,7 +771,6 @@ GrafoscopioBrowser >> treeOn: constructor [
entitled: 'Remove node'; entitled: 'Remove node';
"Move nodes in the same hierarchy" "Move nodes in the same hierarchy"
act: [:treePresentation | act: [:treePresentation |
(treePresentation selection isNotNil) (treePresentation selection isNotNil)
ifTrue: [treePresentation selection moveBefore]. ifTrue: [treePresentation selection moveBefore].
@ -1003,7 +812,7 @@ GrafoscopioBrowser >> treeOn: constructor [
"For trees" "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 openFromFileSelector] 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';
@ -1033,17 +842,23 @@ GrafoscopioBrowser >> treeOn: constructor [
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 modes"
act: [GrafoscopioBrowser new openFromFile: workingFile fullName asFileReference] entitled: 'Predeterminado' categorized: 'Modos';
act: [self buildBrowserNamed: workingFile inMode: 'transmedia'] entitled: 'Transmedia' categorized: 'Modos';
"For help" "For help"
act: [self messageNotImplementedYet] entitled: 'Ver como html en línea' categorized: 'Ayuda'; 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 html fuera línea' categorized: 'Ayuda';
act: [self messageNotImplementedYet] entitled: 'Ver como árbol en grafoscopio' categorized: 'Ayuda'; act: [self messageNotImplementedYet] entitled: 'Ver como árbol en grafoscopio' categorized: 'Ayuda';
"For external tools"
act: [self messageNotImplementedYet] entitled: 'Actualizar' categorized: 'Herramientas externas';
act: [self configurePandoc] entitled: 'Definir ruta a pandoc' categorized: 'Herramientas externas';
act: [self messageNotImplementedYet] entitled: 'Definir ruta a fossil' categorized: 'Herramientas externas';
"For grafoscopio" "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 configurePandoc] entitled: 'Herramientas externas > Definir ruta a pandoc' categorized: 'Grafoscopio';
act: [self messageNotImplementedYet] entitled: 'Herramientas externas > Definir ruta a fossil' categorized: 'Grafoscopio';
act: [self messageAbout] entitled: 'Acerca de...' categorized: 'Grafoscopio'. act: [self messageAbout] entitled: 'Acerca de...' categorized: 'Grafoscopio'.
] ]