-
-
Notifications
You must be signed in to change notification settings - Fork 353
/
SpecTableLayoutAdd.class.st
54 lines (47 loc) · 1.16 KB
/
SpecTableLayoutAdd.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"
A SpecTableLayoutAdd represents the action to add a subwidget into a spec table layout
"
Class {
#name : #SpecTableLayoutAdd,
#superclass : #SpecTableLayoutSend,
#instVars : [
'subwidget'
],
#category : #'Spec-Layout-Actions'
}
{ #category : #'instance creation' }
SpecTableLayoutAdd class >> subwidget: aSymbol [
^ self new
subwidget: aSymbol;
yourself
]
{ #category : #'instance creation' }
SpecTableLayoutAdd >> generateArguments [
self arguments: {{subwidget}}
]
{ #category : #initialization }
SpecTableLayoutAdd >> initialize [
super initialize.
self selector: #add:
]
{ #category : #accessing }
SpecTableLayoutAdd >> subwidget [
^ subwidget
]
{ #category : #accessing }
SpecTableLayoutAdd >> subwidget: aSpec [
subwidget := aSpec isSymbol
ifTrue: [{#model. aSpec}]
ifFalse: [
aSpec isCollection
ifTrue: [
aSpec isEmpty
ifTrue: [ "should raise an error" ]
ifFalse: [ aSpec first == #model
ifTrue: [ aSpec ]
ifFalse: [ {#model}, aSpec ]]]
ifFalse: [
"Not a symbol or a collection. We assume it's an object to add directly (like a morph by example)"
aSpec ]].
self generateArguments
]