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 } { #category : #initialization }
GrafoscopioNode >> becomeDefaultTestTree [ GrafoscopioNode >> becomeDefaultTestTree [
| node1 node2 node3 | | node1 node2 node3 node4 |
self level: 0. self level: 0.
self header: 'Arbol principal'. self header: 'Arbol principal'.
node1 := GrafoscopioNode new node1 := GrafoscopioNode new
@ -175,6 +175,11 @@ GrafoscopioNode >> becomeDefaultTestTree [
header: 'Child'; header: 'Child';
body: 'Just testing'. body: 'Just testing'.
node1 addNode: node3. node1 addNode: node3.
node4 := GrafoscopioNode new
header: 'Button';
body: 'Click me!'->[42 inspect];
tagAs: 'johan'.
node1 addNode: node4.
self self
addNode: node1; addNode: node1;
addNode: node2. addNode: node2.
@ -591,7 +596,7 @@ GrafoscopioNode >> saveContent: anObject [
GrafoscopioNode >> specModelClass [ GrafoscopioNode >> specModelClass [
self tags = 'código' ifTrue: [^GrafoscopioCodeModel]. self tags = 'código' ifTrue: [^GrafoscopioCodeModel].
self tags = 'johan' ifTrue:[^GrafoscopioButtonModel].
"por defecto" "por defecto"
^ GrafoscopioTextModel ^ 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 { Class {
#name : #GrafoscopioNotebook, #name : #GrafoscopioNotebook,
#superclass : #ComposableModel, #superclass : #ComposableModel,
#instVars : [ #instVars : [
'tree', 'tree',
'header', 'header',
'body' 'body',
'windowMainMenu'
], ],
#category : #'Grafoscopio-UI' #category : #'Grafoscopio-UI'
} }
@ -14,13 +25,15 @@ GrafoscopioNotebook class >> defaultSpec [
"comment stating purpose of message" "comment stating purpose of message"
^ SpecLayout composed ^ SpecLayout composed
newColumn: [:tcol|
tcol newRow: [ :wrow | wrow add: #windowMainMenu ] height: (self toolbarHeight);
newRow: [:row | newRow: [:row |
row newColumn: [ :tc | row newColumn: [ :tc |
tc add: #tree tc add: #tree
] width: 300. ] width: 300.
row newColumn: [ :bc | row newColumn: [ :bc |
bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight. bc newRow: [ :bcr | bcr add: #header ] height: self toolbarHeight.
bc add: #body ]] bc add: #body ]]]
] ]
{ #category : #accessing } { #category : #accessing }
@ -33,7 +46,7 @@ GrafoscopioNotebook >> body: anObject [
body := anObject body := anObject
] ]
{ #category : #'as yet unclassified' } { #category : #operation }
GrafoscopioNotebook >> changeBody: aNodeCollection [ GrafoscopioNotebook >> changeBody: aNodeCollection [
| node | | node |
node := aNodeCollection first. node := aNodeCollection first.
@ -72,17 +85,20 @@ GrafoscopioNotebook >> initializePresenter [
arg isEmpty ifFalse: [self changeBody: arg ]]. arg isEmpty ifFalse: [self changeBody: arg ]].
header whenTextChanged: [ :arg | header whenTextChanged: [ :arg |
(tree selectedItem content header) = arg
ifFalse: [
(tree selectedItem) content header: header text. (tree selectedItem) content header: header text.
"tree updateTree"] tree roots: tree roots]]
] ]
{ #category : #initialization } { #category : #initialization }
GrafoscopioNotebook >> initializeWidgets [ GrafoscopioNotebook >> initializeWidgets [
windowMainMenu := self newWindowMainMenu.
tree := TreeModel new. tree := TreeModel new.
body := self newText. body := self newText.
header := self newText. header := self newTextInput.
body disable. body disable.
body text: '<-- Select a node in the left panel'. body text: '<-- Select a node in the left panel'.
@ -91,13 +107,149 @@ GrafoscopioNotebook >> initializeWidgets [
displayBlock: [:node | node title ]. 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 [ GrafoscopioNotebook >> notebookContent: aTree [
tree roots: aTree children 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 } { #category : #persistence }
GrafoscopioNotebook >> openFromFile: aFileName [ GrafoscopioNotebook >> openFromFile: aFileName [
"I open a notebook from a file named aFileName containing a grafoscopio tree" "I open a notebook from a file named aFileName containing a grafoscopio tree"
@ -111,6 +263,49 @@ GrafoscopioNotebook >> openFromFile: aFileName [
^ nb openWithSpec. ^ 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 } { #category : #accessing }
GrafoscopioNotebook >> tree [ GrafoscopioNotebook >> tree [
^ tree ^ tree
@ -120,3 +315,13 @@ GrafoscopioNotebook >> tree [
GrafoscopioNotebook >> tree: anObject [ GrafoscopioNotebook >> tree: anObject [
tree := anObject tree := anObject
] ]
{ #category : #accessing }
GrafoscopioNotebook >> windowMainMenu [
^ windowMainMenu
]
{ #category : #accessing }
GrafoscopioNotebook >> windowMainMenu: anObject [
windowMainMenu := anObject
]