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:
parent
0efe65d061
commit
b0005e05fc
98
repository/Grafoscopio/GlamourPresentationModel.class.st
Normal file
98
repository/Grafoscopio/GlamourPresentationModel.class.st
Normal 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
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user