Dinamic dictionary as a learning exercise for more comples UI. Empty playgrounds are working.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-01-14 14:40:38 +00:00
parent 3664284fd0
commit 483ac2acc9
2 changed files with 49 additions and 6 deletions

View File

@ -16,7 +16,10 @@ DynamicDict class >> defaultSpec [
<spec: #default> <spec: #default>
^ SpecLayout composed ^ SpecLayout composed
add: #list; newRow: [:row |
row
add: #list right: 0.7;
add: #content left: 0.3];
yourself yourself
] ]
@ -33,8 +36,10 @@ DynamicDict >> content: anObject [
{ #category : #'as yet unclassified' } { #category : #'as yet unclassified' }
DynamicDict >> initializePresenter [ DynamicDict >> initializePresenter [
list whenSelectedItemChanged: [:item | list whenSelectedItemChanged: [:item |
self rebuildWithNewLayout. item = 'first'
ifTrue: [ self rebuildWithTextLayout ].
item = 'second'
ifTrue: [ self rebuildWithCodeLayout ].
] ]
] ]
@ -45,7 +50,10 @@ DynamicDict >> initializeWidgets [
data := { 'first' -> 'I\"m just text' . 'second' -> 'ProfStef openPharoZenWorkspace'} asOrderedDictionary. data := { 'first' -> 'I\"m just text' . 'second' -> 'ProfStef openPharoZenWorkspace'} asOrderedDictionary.
list := self newList. list := self newList.
list items: data keys. list items: data keys.
self focusOrder add: list. content := self newText.
self focusOrder
add: list;
add: content.
] ]
{ #category : #accessing } { #category : #accessing }
@ -58,6 +66,41 @@ DynamicDict >> list: anObject [
list := anObject list := anObject
] ]
{ #category : #'as yet unclassified' }
DynamicDict >> rebuildWithCodeLayout [
| newLayout |
content := self instantiate: (GlamourPresentationModel).
newLayout := SpecLayout composed
newRow: [:row |
row
add: #list right: 0.7;
add: #content left: 0.3];
yourself.
self needRebuild: false.
content needRebuild: true.
Transcript show: 'código + ', self content asString, String cr.
self buildWithSpecLayout: newLayout.
]
{ #category : #'as yet unclassified' }
DynamicDict >> rebuildWithTextLayout [
| newLayout |
content := self newText.
newLayout := SpecLayout composed
newRow: [:row |
row
add: #list right: 0.7;
add: #content left: 0.3];
yourself.
self needRebuild: false.
list needRebuild: false.
content needRebuild: true.
Transcript show: 'texto + ', self content asString, String cr..
self buildWithSpecLayout: newLayout.
]
{ #category : #api } { #category : #api }
DynamicDict >> title [ DynamicDict >> title [
^'Dynamic UI | test' ^'Dynamic UI | test'

View File

@ -639,8 +639,8 @@ GrafoscopioBrowser >> bodyIn: constructor [
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioBrowser >> bodyIn: constructor for: aNode [ GrafoscopioBrowser >> bodyIn: constructor for: aNode [
"Shows the body in a constructor for selected node, if node is not tagged. If it is tagged it will return itself, so it can be rendered "Shows the body in a constructor for selected node, if node is not tagged.
properly for other messages" If it is tagged it will return itself, so it can be rendered properly for other messages"
| specialTags | | specialTags |