-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1463 from hernanmd/component_list_mnu
Fix MNU when using component list as input port in custom presenter
- Loading branch information
Showing
5 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Class { | ||
#name : 'SpComplexComponentListExample', | ||
#superclass : 'SpPresenter', | ||
#instVars : [ | ||
'leftPresenter', | ||
'rightPresenter', | ||
'toolbarPresenter' | ||
], | ||
#category : 'Spec2-Tests-Utils', | ||
#package : 'Spec2-Tests', | ||
#tag : 'Utils' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
SpComplexComponentListExample class >> open [ | ||
<example> | ||
^ self new open | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SpComplexComponentListExample >> connectPresenters [ | ||
|
||
leftPresenter | ||
transmitTo: rightPresenter | ||
transform: [ : item | { item label asNumber . (item label asNumber * 2) } ] | ||
] | ||
|
||
{ #category : 'layout' } | ||
SpComplexComponentListExample >> defaultLayout [ | ||
|
||
^ SpBoxLayout newTopToBottom | ||
add: toolbarPresenter expand: false; | ||
add: (SpBoxLayout newLeftToRight | ||
add: leftPresenter; | ||
add: rightPresenter; | ||
yourself); | ||
yourself. | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SpComplexComponentListExample >> initializePresenters [ | ||
|
||
toolbarPresenter := self newToolbar. | ||
leftPresenter := self instantiate: SpComplexComponentListLeftExample on: self. | ||
rightPresenter := self instantiate: SpComplexComponentListRightExample on: self. | ||
] |
32 changes: 32 additions & 0 deletions
32
src/Spec2-Tests/SpComplexComponentListLeftExample.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Class { | ||
#name : 'SpComplexComponentListLeftExample', | ||
#superclass : 'SpPresenter', | ||
#instVars : [ | ||
'componentListPresenter' | ||
], | ||
#category : 'Spec2-Tests-Utils', | ||
#package : 'Spec2-Tests', | ||
#tag : 'Utils' | ||
} | ||
|
||
{ #category : 'layout' } | ||
SpComplexComponentListLeftExample >> defaultLayout [ | ||
|
||
^ SpBoxLayout newTopToBottom | ||
add: componentListPresenter expand: true; | ||
yourself. | ||
] | ||
|
||
{ #category : 'ports' } | ||
SpComplexComponentListLeftExample >> defaultOutputPort [ | ||
|
||
^ componentListPresenter | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SpComplexComponentListLeftExample >> initializePresenters [ | ||
|
||
componentListPresenter := self newComponentList | ||
items: ((10 to: 20) asArray collect: #asPresenter); | ||
yourself. | ||
] |
37 changes: 37 additions & 0 deletions
37
src/Spec2-Tests/SpComplexComponentListRightExample.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Class { | ||
#name : 'SpComplexComponentListRightExample', | ||
#superclass : 'SpPresenter', | ||
#instVars : [ | ||
'componentListPresenter', | ||
'pageTitle' | ||
], | ||
#category : 'Spec2-Tests-Utils', | ||
#package : 'Spec2-Tests', | ||
#tag : 'Utils' | ||
} | ||
|
||
{ #category : 'transmission' } | ||
SpComplexComponentListRightExample >> defaultInputPort [ | ||
|
||
^ SpListItemsPort newPresenter: componentListPresenter | ||
|
||
] | ||
|
||
{ #category : 'layout' } | ||
SpComplexComponentListRightExample >> defaultLayout [ | ||
|
||
^ SpBoxLayout newTopToBottom | ||
add: pageTitle expand: false; | ||
add: componentListPresenter; | ||
yourself. | ||
|
||
|
||
] | ||
|
||
{ #category : 'initialization' } | ||
SpComplexComponentListRightExample >> initializePresenters [ | ||
|
||
pageTitle := self newLabel. | ||
componentListPresenter := self newComponentList. | ||
|
||
] |
34 changes: 34 additions & 0 deletions
34
src/Spec2-Tests/SpTransmissionWithComponentListTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Class { | ||
#name : 'SpTransmissionWithComponentListTest', | ||
#superclass : 'SpSmokeTest', | ||
#category : 'Spec2-Tests-Examples', | ||
#package : 'Spec2-Tests', | ||
#tag : 'Examples' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
SpTransmissionWithComponentListTest >> classToTest [ | ||
|
||
^ SpComplexComponentListExample | ||
] | ||
|
||
{ #category : 'running' } | ||
SpTransmissionWithComponentListTest >> setUp [ | ||
|
||
super setUp. | ||
presenter := SpComplexComponentListExample new. | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
SpTransmissionWithComponentListTest >> tearDown [ | ||
|
||
presenter delete. | ||
super tearDown. | ||
] | ||
|
||
{ #category : 'tests' } | ||
SpTransmissionWithComponentListTest >> testOpen [ | ||
|
||
self shouldnt: [ presenter open ] raise: MessageNotUnderstood. | ||
] |