Going back to the non-dynamic interface in the test functionality :-/
This commit is contained in:
parent
ca87a3ad61
commit
16aca70b31
@ -46,6 +46,152 @@ GrafoscopioGUI class >> defaultSpec [
|
||||
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 }
|
||||
GrafoscopioGUI class >> exampleBootstrapUI [
|
||||
"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 instantiateModels: #(
|
||||
tree TreeModel
|
||||
header TextModel
|
||||
play GlamourPresentationModel).
|
||||
header TextInputFieldModel
|
||||
bodyWhenMarkup TextModel
|
||||
bodyWhenCode GlamourPresentationModel).
|
||||
notebook := GrafoscopioNode new becomeDefaultTestTree.
|
||||
ui tree
|
||||
roots: notebook children;
|
||||
@ -74,7 +221,7 @@ GrafoscopioGUI class >> exampleBootstrapUI [
|
||||
addHSplitter;
|
||||
newRow: #header bottom: 0.8] right: 0.7;
|
||||
addVSplitter;
|
||||
newColumn: #play];
|
||||
newColumn: #bodyWhenCode];
|
||||
yourself.
|
||||
|
||||
ui openWithSpecLayout: lay.
|
||||
@ -257,6 +404,7 @@ GrafoscopioGUI >> updateBody [
|
||||
^ nodeBody text: 'I should be playground because I am tagged as ', tree selectedItem content tags
|
||||
]
|
||||
ifFalse: [
|
||||
"nodeBody := self newText."
|
||||
^ nodeBody text: tree selectedItem content body
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user