Incorporando cambios de la sesión de trabajo con Johan.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-05-12 11:42:48 +00:00
parent 2b7175b8fc
commit 89d9ad27ad
3 changed files with 260 additions and 15 deletions

View File

@ -0,0 +1,35 @@
Class {
#name : #GrafoscopioButtonModel,
#superclass : #ComposableModel,
#instVars : [
'button'
],
#category : #'Grafoscopio-UI'
}
{ #category : #specs }
GrafoscopioButtonModel class >> defaultSpec [
^ SpecLayout composed add: #button
]
{ #category : #accessing }
GrafoscopioButtonModel >> button [
^ button
]
{ #category : #accessing }
GrafoscopioButtonModel >> button: anObject [
button := anObject
]
{ #category : #api }
GrafoscopioButtonModel >> content: anAssoc [
button label: anAssoc key.
button action: anAssoc value.
]
{ #category : #initalize }
GrafoscopioButtonModel >> initializeWidgets [
button := self newButton.
]

View File

@ -160,7 +160,7 @@ GrafoscopioNode >> asSton [
{ #category : #initialization }
GrafoscopioNode >> becomeDefaultTestTree [
| node1 node2 node3 |
| node1 node2 node3 node4 |
self level: 0.
self header: 'Arbol principal'.
node1 := GrafoscopioNode new
@ -175,6 +175,11 @@ GrafoscopioNode >> becomeDefaultTestTree [
header: 'Child';
body: 'Just testing'.
node1 addNode: node3.
node4 := GrafoscopioNode new
header: 'Button';
body: 'Click me!'->[42 inspect];
tagAs: 'johan'.
node1 addNode: node4.
self
addNode: node1;
addNode: node2.
@ -591,7 +596,7 @@ GrafoscopioNode >> saveContent: anObject [
GrafoscopioNode >> specModelClass [
self tags = 'código' ifTrue: [^GrafoscopioCodeModel].
self tags = 'johan' ifTrue:[^GrafoscopioButtonModel].
"por defecto"
^ GrafoscopioTextModel
]

View File

@ -1,10 +1,21 @@
"
I am a Grafoscopio Notebook.
Example:
| testTree nb |
testTree := GrafoscopioNode new becomeDefaultTestTree.
nb := GrafoscopioNotebook new.
nb notebookContent: testTree.
nb openWithSpec
"
Class {
#name : #GrafoscopioNotebook,
#superclass : #ComposableModel,
#instVars : [
'tree',
'header',
'body'
'body',
'windowMainMenu'
],
#category : #'Grafoscopio-UI'
}
@ -14,13 +25,15 @@ GrafoscopioNotebook class >> defaultSpec [
"comment stating purpose of message"
^ SpecLayout composed
newRow: [:row |
row newColumn: [ :tc |
tc add: #tree
] width: 300.
row newColumn: [ :bc |
bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight.
bc add: #body ]]
newColumn: [:tcol|
tcol newRow: [ :wrow | wrow add: #windowMainMenu ] height: (self toolbarHeight);
newRow: [:row |
row newColumn: [ :tc |
tc add: #tree
] width: 300.
row newColumn: [ :bc |
bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight.
bc add: #body ]]]
]
{ #category : #accessing }
@ -33,7 +46,7 @@ GrafoscopioNotebook >> body: anObject [
body := anObject
]
{ #category : #'as yet unclassified' }
{ #category : #operation }
GrafoscopioNotebook >> changeBody: aNodeCollection [
| node |
node := aNodeCollection first.
@ -72,17 +85,20 @@ GrafoscopioNotebook >> initializePresenter [
arg isEmpty ifFalse: [self changeBody: arg ]].
header whenTextChanged: [ :arg |
(tree selectedItem) content header: header text.
"tree updateTree"]
(tree selectedItem content header) = arg
ifFalse: [
(tree selectedItem) content header: header text.
tree roots: tree roots]]
]
{ #category : #initialization }
GrafoscopioNotebook >> initializeWidgets [
windowMainMenu := self newWindowMainMenu.
tree := TreeModel new.
body := self newText.
header := self newText.
header := self newTextInput.
body disable.
body text: '<-- Select a node in the left panel'.
@ -91,13 +107,149 @@ GrafoscopioNotebook >> initializeWidgets [
displayBlock: [:node | node title ].
]
{ #category : #API }
{ #category : #initialization }
GrafoscopioNotebook >> newWindowMainMenu [
^MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Cuaderno';
icon: Smalltalk ui icons smallObjectsIcon;
subMenu: self notebookSubMenu ].
group addItem: [ :item |
item
name: 'Proyecto';
icon: Smalltalk ui icons catalogIcon;
subMenu: self projectSubMenu ] ];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Guardar documento';
icon: Smalltalk ui icons smallSaveIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Deshacer';
icon: Smalltalk ui icons smallUndoIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Rehacer';
icon: Smalltalk ui icons smallRedoIcon;
action: [ self inform: 'Por implementar...' ] ]];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Agregar nodo';
icon: MendaIcons new plusIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Eliminar nodo';
icon: MendaIcons new minusIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Subir nodo';
icon: MendaIcons new arrowUpIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Bajar nodo';
icon: MendaIcons new arrowDownIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Mover nodo a la izquierda';
icon: MendaIcons new arrowLeftIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Mover nodo a la derecha';
icon: MendaIcons new arrowRightIcon;
action: [ self inform: 'Por implementar...' ] ]];
addGroup: [ :group |
group addItem: [ :item |
item
name: nil;
description: 'Intercambiar: código <--> texto';
icon: MendaIcons new smalltalkCodeIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Etiquetar como...';
icon: MendaIcons new tagAddIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Desetiquetar ....';
icon: MendaIcons new tagMinusIcon;
action: [ self inform: 'Por implementar...' ] ].
group addItem: [ :item |
item
name: nil;
description: 'Editar etiquetas...';
icon: FontAwesomeIcons new tagsIcon;
action: [ self inform: 'Por implementar...' ] ]. ].
]
{ #category : #api }
GrafoscopioNotebook >> notebookContent: aTree [
tree roots: aTree children
]
{ #category : #initialization }
GrafoscopioNotebook >> notebookSubMenu [
^ MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Guardar';
icon: Smalltalk ui icons smallSaveIcon;
shortcut: $s command;
action: [ self inform: 'Guardar | Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Guardar como...';
icon: Smalltalk ui icons smallSaveAsIcon;
action: [ self inform: 'Guardar | Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Exportar como html';
icon: Smalltalk ui icons smallWindowIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Exportar como pdf';
icon: Smalltalk ui icons smallPrintIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Ver html';
icon: Smalltalk ui icons smallInspectItIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Ver pdf';
icon: Smalltalk ui icons smallInspectItIcon;
action: [ self inform: 'Por implementar ...' ] ] ]
]
{ #category : #persistence }
GrafoscopioNotebook >> openFromFile: aFileName [
"I open a notebook from a file named aFileName containing a grafoscopio tree"
@ -111,6 +263,49 @@ GrafoscopioNotebook >> openFromFile: aFileName [
^ nb openWithSpec.
]
{ #category : #initialization }
GrafoscopioNotebook >> projectSubMenu [
^ MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Activar repositorio remoto...';
icon: Smalltalk ui icons smallPushpinIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Activar repositorio local...';
icon: Smalltalk ui icons homeIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Agregar archivo...';
icon: Smalltalk ui icons newerPackagesAvailableIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Eliminar archivo...';
icon: Smalltalk ui icons packageDeleteIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Enviar al histórico';
icon: Smalltalk ui icons smallScreenshotIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Acreditarse';
icon: Smalltalk ui icons userIcon;
action: [ self inform: 'Por implementar ...' ] ] ]
]
{ #category : #api }
GrafoscopioNotebook >> title [
^'GrafoscopioNotebook'
]
{ #category : #accessing }
GrafoscopioNotebook >> tree [
^ tree
@ -120,3 +315,13 @@ GrafoscopioNotebook >> tree [
GrafoscopioNotebook >> tree: anObject [
tree := anObject
]
{ #category : #accessing }
GrafoscopioNotebook >> windowMainMenu [
^ windowMainMenu
]
{ #category : #accessing }
GrafoscopioNotebook >> windowMainMenu: anObject [
windowMainMenu := anObject
]