Integrating code developed with the help of Johan Fabry for the new Spec-Glamour interface.

Co-authored-by: Johan Fabry <jfabry@dcc.uchile.cl>
This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-05-03 15:15:02 +00:00
parent db72fe731c
commit cc6760199f
4 changed files with 192 additions and 0 deletions

View File

@ -0,0 +1,38 @@
Class {
#name : #GrafoscopioCodeModel,
#superclass : #ComposableModel,
#instVars : [
'body'
],
#category : #'Grafoscopio-UI'
}
{ #category : #specs }
GrafoscopioCodeModel class >> defaultSpec [
^ SpecLayout composed add: #body
]
{ #category : #accessing }
GrafoscopioCodeModel >> body [
^ body
]
{ #category : #accessing }
GrafoscopioCodeModel >> body: anObject [
body := anObject
]
{ #category : #API }
GrafoscopioCodeModel >> content: aGrafoscopioNodeContent [
body
presentationClass: GTPlayground
startOn: (GTPlayPage new saveContent: aGrafoscopioNodeContent)
]
{ #category : #initialization }
GrafoscopioCodeModel >> initializeWidgets [
body := GlamourPresentationModel new.
]

View File

@ -587,6 +587,15 @@ GrafoscopioNode >> saveContent: anObject [
body := anObject body := anObject
] ]
{ #category : #accessing }
GrafoscopioNode >> specModelClass [
self tags = 'código' ifTrue: [^GrafoscopioCodeModel].
"por defecto"
^ GrafoscopioTextModel
]
{ #category : #accessing } { #category : #accessing }
GrafoscopioNode >> tagAs: aTag [ 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 "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

View File

@ -0,0 +1,109 @@
Class {
#name : #GrafoscopioNotebook,
#superclass : #ComposableModel,
#instVars : [
'tree',
'header',
'body'
],
#category : #'Grafoscopio-UI'
}
{ #category : #specs }
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 ]]
]
{ #category : #accessing }
GrafoscopioNotebook >> body [
^ body
]
{ #category : #accessing }
GrafoscopioNotebook >> body: anObject [
body := anObject
]
{ #category : #'as yet unclassified' }
GrafoscopioNotebook >> changeBody: aNodeCollection [
| node |
node := aNodeCollection first.
self needRebuild: false.
tree needRebuild: false.
body := self instantiate: node specModelClass new.
body content: node content.
body needRebuild: true.
header text: node header.
self buildWithSpecLayout: self class defaultSpec.
]
{ #category : #accessing }
GrafoscopioNotebook >> extent [
^800@500
]
{ #category : #accessing }
GrafoscopioNotebook >> header [
^ header
]
{ #category : #accessing }
GrafoscopioNotebook >> header: anObject [
header := anObject
]
{ #category : #initialization }
GrafoscopioNotebook >> initializePresenter [
tree whenSelectedItemsChanged: [ :arg |
arg isEmpty ifFalse: [self changeBody: arg ]].
header whenTextChanged: [ :arg |
(tree selectedItem) content header: header text.
tree updateTree]
]
{ #category : #initialization }
GrafoscopioNotebook >> initializeWidgets [
tree := TreeModel new.
body := self newText.
header := self newText.
body disable.
body text: 'Seleciona un nodo a la izquierda'.
tree childrenBlock: [:node | node children];
displayBlock: [:node | node title ].
]
{ #category : #API }
GrafoscopioNotebook >> notebookContent: aTree [
tree roots: aTree children
]
{ #category : #accessing }
GrafoscopioNotebook >> tree [
^ tree
]
{ #category : #accessing }
GrafoscopioNotebook >> tree: anObject [
tree := anObject
]

View File

@ -0,0 +1,36 @@
Class {
#name : #GrafoscopioTextModel,
#superclass : #ComposableModel,
#instVars : [
'body'
],
#category : #'Grafoscopio-UI'
}
{ #category : #specs }
GrafoscopioTextModel class >> defaultSpec [
^ SpecLayout composed add: #body
]
{ #category : #accessing }
GrafoscopioTextModel >> body [
^ body
]
{ #category : #accessing }
GrafoscopioTextModel >> body: anObject [
body := anObject
]
{ #category : #API }
GrafoscopioTextModel >> content: aGrafoscopioNodeContent [
body text: aGrafoscopioNodeContent
]
{ #category : #initialization }
GrafoscopioTextModel >> initializeWidgets [
body := self newText.
body beForText.
]