Going back to the non-dynamic interface in the test functionality :-/

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-01-09 14:17:17 +00:00
parent ca87a3ad61
commit 16aca70b31

View File

@ -46,6 +46,152 @@ GrafoscopioGUI class >> defaultSpec [
yourself yourself
] ]
{ #category : #examples }
GrafoscopioGUI class >> exampleBootstrapDynamicUI1 [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
UI and get some ideas"
|notebook leftUpperPanel leftPanel treeBrowser |
"Creating a notebook-tree with dummy data"
notebook := GrafoscopioNode new becomeDefaultTestTree.
"Defining the tree roots part"
leftUpperPanel := DynamicComposableModel new.
leftUpperPanel instantiateModels: #(tree TreeModel).
leftUpperPanel tree
roots: notebook children;
childrenBlock: [:node | node children ];
displayBlock: [:node | node title ].
leftUpperPanel layout: (SpecLayout composed
add: #tree;
yourself).
"to debug upto here uncomment the next line, and comment all other 'openWithSpec' ones"
"leftUpperPanel openWithSpec."
"Integrating the previous tree with the node header and creating the body according to
the tags on the node"
leftPanel := DynamicComposableModel new.
leftPanel assign: leftUpperPanel to: #roots.
leftPanel instantiateModels: #(header TextInputFieldModel).
treeBrowser := DynamicComposableModel new.
leftUpperPanel tree
whenSelectedItemChanged: [:node |
node
ifNil:[
leftPanel header text: ''.
treeBrowser instantiateModels: #(body TextModel).
Transcript show: 'Nada que mostrar', String cr]
ifNotNil: [
leftPanel header text: (leftUpperPanel tree selectedItem content header).
leftUpperPanel tree selectedItem content tags = 'código'
ifTrue: [
treeBrowser instantiateModels: #(body GlamourPresentationModel).
Transcript show: 'I am code', String cr.
Transcript show: treeBrowser body asString, String cr.
]
ifFalse: [
treeBrowser instantiateModels: #(body TextModel).
treeBrowser body text: (leftUpperPanel tree selectedItem content body).
Transcript show: 'I am NOT code', String cr.
Transcript show: treeBrowser body asString, String cr.
]
]
].
leftPanel layout:
(SpecLayout composed
newColumn: [:column |
column
add: #roots;
add: #header height: 35];
yourself).
"Integrating the previous tree with node body content"
treeBrowser assign: leftPanel to: #leftTree.
treeBrowser layout:
(SpecLayout composed
newRow: [:r | r add: #leftTree; add: #body ];
yourself
).
treeBrowser openWithSpec.
]
{ #category : #examples }
GrafoscopioGUI class >> exampleBootstrapDynamicUI2 [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
UI and get some ideas"
|notebook leftUpperPanel leftPanel treeBrowser |
"Creating a notebook-tree with dummy data"
notebook := GrafoscopioNode new becomeDefaultTestTree.
"Defining the tree roots part"
leftUpperPanel := DynamicComposableModel new.
leftUpperPanel instantiateModels: #(tree TreeModel).
leftUpperPanel tree
roots: notebook children;
childrenBlock: [:node | node children ];
displayBlock: [:node | node title ].
leftUpperPanel layout: (SpecLayout composed
add: #tree;
yourself).
"to debug upto here uncomment the next line, and comment all other 'openWithSpec' ones"
"leftUpperPanel openWithSpec."
"Integrating the previous tree with the node header and creating the body according to
the tags on the node"
leftPanel := DynamicComposableModel new.
leftPanel assign: leftUpperPanel to: #roots.
leftPanel instantiateModels: #(header TextInputFieldModel).
treeBrowser := DynamicComposableModel new.
leftUpperPanel tree
whenSelectedItemChanged: [:node |
node
ifNil:[
leftPanel header text: ''.
treeBrowser instantiateModels: #(body TextModel).
Transcript show: 'Nada que mostrar', String cr]
ifNotNil: [
leftPanel header text: (leftUpperPanel tree selectedItem content header).
leftUpperPanel tree selectedItem content tags = 'código'
ifTrue: [
treeBrowser instantiateModels: #(body GlamourPresentationModel).
treeBrowser assign: leftPanel to: #leftTree.
treeBrowser layout:
(SpecLayout composed
newRow: [:r | r add: #leftTree; add: #body ];
yourself
).
Transcript show: 'I am code', String cr.
Transcript show: treeBrowser body asString, String cr.
]
ifFalse: [
treeBrowser instantiateModels: #(body TextModel).
treeBrowser body text: (leftUpperPanel tree selectedItem content body).
treeBrowser assign: leftPanel to: #leftTree.
treeBrowser layout:
(SpecLayout composed
newRow: [:r | r add: #leftTree; add: #body ];
yourself
).
Transcript show: 'I am NOT code', String cr.
Transcript show: treeBrowser body asString, String cr.
]
]
].
leftPanel layout:
(SpecLayout composed
newColumn: [:column |
column
add: #roots;
add: #header height: 35];
yourself).
"Integrating the previous tree with node body content"
treeBrowser openWithSpec.
]
{ #category : #examples } { #category : #examples }
GrafoscopioGUI class >> exampleBootstrapUI [ GrafoscopioGUI class >> exampleBootstrapUI [
"Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio "Starting from an example UI from the Spec-Glamour, to customize towards the grafoscopio
@ -57,8 +203,9 @@ GrafoscopioGUI class >> exampleBootstrapUI [
ui title: 'new | Grafoscopio'. ui title: 'new | Grafoscopio'.
ui instantiateModels: #( ui instantiateModels: #(
tree TreeModel tree TreeModel
header TextModel header TextInputFieldModel
play GlamourPresentationModel). bodyWhenMarkup TextModel
bodyWhenCode GlamourPresentationModel).
notebook := GrafoscopioNode new becomeDefaultTestTree. notebook := GrafoscopioNode new becomeDefaultTestTree.
ui tree ui tree
roots: notebook children; roots: notebook children;
@ -74,7 +221,7 @@ GrafoscopioGUI class >> exampleBootstrapUI [
addHSplitter; addHSplitter;
newRow: #header bottom: 0.8] right: 0.7; newRow: #header bottom: 0.8] right: 0.7;
addVSplitter; addVSplitter;
newColumn: #play]; newColumn: #bodyWhenCode];
yourself. yourself.
ui openWithSpecLayout: lay. ui openWithSpecLayout: lay.
@ -257,6 +404,7 @@ GrafoscopioGUI >> updateBody [
^ nodeBody text: 'I should be playground because I am tagged as ', tree selectedItem content tags ^ nodeBody text: 'I should be playground because I am tagged as ', tree selectedItem content tags
] ]
ifFalse: [ ifFalse: [
"nodeBody := self newText."
^ nodeBody text: tree selectedItem content body ^ nodeBody text: tree selectedItem content body
] ]