|
| 1 | +Class { |
| 2 | + #name : #PyramidAddStampPresenter, |
| 3 | + #superclass : #SpPresenter, |
| 4 | + #instVars : [ |
| 5 | + 'stampManagerPresenter', |
| 6 | + 'treeTableAddStamp', |
| 7 | + 'selectedStampToAdd', |
| 8 | + 'addStampButton' |
| 9 | + ], |
| 10 | + #category : #'Pyramid-Toplo-plugin-theme-management' |
| 11 | +} |
| 12 | + |
| 13 | +{ #category : #adding } |
| 14 | +PyramidAddStampPresenter >> addSelectedStampToElement [ |
| 15 | + |
| 16 | + selectedStampToAdd ifNil: [ ^ self ]. |
| 17 | + |
| 18 | + selectedStampToAdd command |
| 19 | + setValueFor: self stampManagerPresenter currentSelectedElement |
| 20 | + with: true. |
| 21 | + |
| 22 | + self refreshStampTreeTable. |
| 23 | +] |
| 24 | + |
| 25 | +{ #category : #accessing } |
| 26 | +PyramidAddStampPresenter >> addStampButton [ |
| 27 | + |
| 28 | + ^ addStampButton |
| 29 | +] |
| 30 | + |
| 31 | +{ #category : #layout } |
| 32 | +PyramidAddStampPresenter >> defaultLayout [ |
| 33 | + |
| 34 | + | defaultLayout stampToolBarAddButton | |
| 35 | + |
| 36 | + defaultLayout := SpBoxLayout newVertical spacing: 6; yourself. |
| 37 | + |
| 38 | + stampToolBarAddButton := SpBoxLayout newHorizontal hAlignStart; yourself. |
| 39 | + stampToolBarAddButton add: addStampButton width: 380. |
| 40 | + |
| 41 | + defaultLayout add: treeTableAddStamp expand: true. |
| 42 | + defaultLayout add: stampToolBarAddButton expand: false. |
| 43 | + |
| 44 | + ^ defaultLayout |
| 45 | +] |
| 46 | + |
| 47 | +{ #category : #'initialization - deprecated' } |
| 48 | +PyramidAddStampPresenter >> initializePresenter [ |
| 49 | + |
| 50 | + addStampButton := SpButtonPresenter new |
| 51 | + label: 'Add Stamp'; |
| 52 | + icon: (Smalltalk ui icons iconNamed: #add); |
| 53 | + whenActivatedDo: [ self addSelectedStampToElement ]. |
| 54 | + |
| 55 | + treeTableAddStamp := SpTreeTablePresenter new. |
| 56 | + treeTableAddStamp whenSelectedItemChangedDo: [ :aStampSelected | selectedStampToAdd := aStampSelected ]. |
| 57 | + treeTableAddStamp addColumn: (SpCompositeTableColumn new |
| 58 | + title: 'List of stamps'; |
| 59 | + addColumn: (SpStringTableColumn evaluated: #name); |
| 60 | + yourself). |
| 61 | +] |
| 62 | + |
| 63 | +{ #category : #adding } |
| 64 | +PyramidAddStampPresenter >> refreshStampTreeTable [ |
| 65 | + |
| 66 | + self stampManagerPresenter refreshStampTreeTable |
| 67 | +] |
| 68 | + |
| 69 | +{ #category : #accessing } |
| 70 | +PyramidAddStampPresenter >> stampManagerPresenter [ |
| 71 | + |
| 72 | + ^ stampManagerPresenter |
| 73 | +] |
| 74 | + |
| 75 | +{ #category : #accessing } |
| 76 | +PyramidAddStampPresenter >> stampManagerPresenter: aPyramidStampManagerPresenter [ |
| 77 | + |
| 78 | + stampManagerPresenter := aPyramidStampManagerPresenter |
| 79 | +] |
| 80 | + |
| 81 | +{ #category : #accessing } |
| 82 | +PyramidAddStampPresenter >> treeTableAddStamp [ |
| 83 | + |
| 84 | + ^ treeTableAddStamp |
| 85 | +] |
0 commit comments