Adding the Glamourspec adaptor. We cannot load this package any more in pharo 8, since is subclass of composable model.

This commit is contained in:
SantiagoBragagnolo 2020-02-22 16:26:44 +00:00
parent 68fbf1c955
commit 5fea55c990
1 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,98 @@
"
I am a Spec ComposableModel for all Glamour presentations (GLMPresentation subclasses.) By default I open a Playground because its creation contract is special.
Example uses :
""open a playground""
GlamourPresentationModel new openWithSpec.
""open a playground on 42""
|ui|
ui := GlamourPresentationModel new.
ui presentationClass: GTPlayground startOn: (GTPlayPage new saveContent: '42').
ui openWithSpec
""open an inspector on 42""
|ui|
ui := GlamourPresentationModel new.
ui presentationClass: GTInspector startOn: 42.
ui openWithSpec
"
Class {
#name : #GlamourPresentationModel,
#superclass : #ComposablePresenter,
#instVars : [
'presentation',
'glmPres'
],
#category : #'Grafoscopio-UI'
}
{ #category : #specs }
GlamourPresentationModel class >> defaultSpec [
<spec: #default>
^ SpecLayout composed add: #presentation
]
{ #category : #example }
GlamourPresentationModel class >> example [
|ui lay|
ui := DynamicComposableModel new.
ui title: 'Too Much Glamour!'.
ui instantiateModels: #(
play GlamourPresentationModel
insp GlamourPresentationModel).
ui insp presentationClass: GTInspector startOn: 42.
lay := SpecLayout composed
newColumn: [ :c |
c newRow: [ :r | r add: #play];
newRow: [ :r | r add: #insp ]];
yourself.
ui openWithSpecLayout: lay.
]
{ #category : #deprecation }
GlamourPresentationModel class >> isDeprecated [
^ true
]
{ #category : #accessing }
GlamourPresentationModel >> glmPres [
glmPres isNil ifTrue:[glmPres := GTPlayground new startOn: GTPlayPage new].
^glmPres
]
{ #category : #initialization }
GlamourPresentationModel >> initializeWidgets [
"Should actually do nothing at all.
This is because we cannot create the morph and later set the presentation.
So we will do all of this in the presentation: accessor.
"
]
{ #category : #accessing }
GlamourPresentationModel >> presentation [
presentation isNil ifTrue:[
| morph |
morph := GLMMorphicRenderer new render: self glmPres.
morph hResizing: #spaceFill.
morph vResizing: #spaceFill.
presentation := MorphicGenericAdapter morph: morph].
^ presentation
]
{ #category : #accessing }
GlamourPresentationModel >> presentation: anObject [
presentation := anObject
]
{ #category : #api }
GlamourPresentationModel >> presentationClass: aGLMCompositePresentation startOn: anObject [
glmPres := aGLMCompositePresentation new startOn: anObject
]