Skip to content

Commit

Permalink
Cleaning class names, comments, method formatting of Spec2-PolyWidgets
Browse files Browse the repository at this point in the history
  • Loading branch information
guillep committed Aug 9, 2019
1 parent 88e29ed commit 9ff9597
Show file tree
Hide file tree
Showing 29 changed files with 778 additions and 737 deletions.
17 changes: 9 additions & 8 deletions src/Spec2-Deprecated/SpIconListPresenter.class.st
@@ -1,15 +1,16 @@
"
An IconListPresenter is a spec presenter for icon list.
See AbstractWidgetPresenter
Better use
self example
| iconList |
iconList := SpListPresenter new.
iconList
items: Smalltalk ui icons icons associations;
displayBlock: [ :assoc | assoc key ];
sortingBlock: [ :assocA :assocB | assocA key < assocB key ];
icons: [ :elem | elem value ].
iconList openWithSpec
You can also have a look at ExampleListPresenter >> exampleIconList for another example.
I provide the following variables icons and its accessors, it is a block that convert an item in the icon to display near the item.
todo
- getIconFor:
"
Class {
#name : #SpIconListPresenter,
Expand Down
Expand Up @@ -6,5 +6,5 @@ Class {

{ #category : #running }
SpInputTextDropListTest >> classToTest [
^ SpInputTextDropList
^ SpInputTextDropListPresenter
]
Expand Up @@ -6,7 +6,7 @@ Class {

{ #category : #running }
SpLabelledContainerTest >> classToTest [
^ SpLabelledContainer
^ SpLabelledContainerPrestenter
]

{ #category : #running }
Expand Down
Expand Up @@ -6,5 +6,5 @@ Class {

{ #category : #running }
SpLabelledDropListTest >> classToTest [
^ SpLabelledDropList
^ SpLabelledDropListPresenter
]
2 changes: 1 addition & 1 deletion src/Spec2-PolyWidgets-Tests/SpLabelledListTest.class.st
Expand Up @@ -6,5 +6,5 @@ Class {

{ #category : #running }
SpLabelledListTest >> classToTest [
^ SpLabelledList
^ SpLabelledListPresenter
]
Expand Up @@ -6,5 +6,5 @@ Class {

{ #category : #running }
SpLabelledSliderInputTest >> classToTest [
^ SpLabelledSliderInput
^ SpLabelledSliderInputPresenter
]
Expand Up @@ -6,5 +6,5 @@ Class {

{ #category : #running }
SpLabelledTextInputTest >> classToTest [
^ SpLabelledTextInput
^ SpLabelledTextInputPresenter
]
2 changes: 1 addition & 1 deletion src/Spec2-PolyWidgets-Tests/SpSliderInputTest.class.st
Expand Up @@ -6,5 +6,5 @@ Class {

{ #category : #running }
SpSliderInputTest >> classToTest [
^ SpSliderInput
^ SpSliderInputPresenter
]
130 changes: 2 additions & 128 deletions src/Spec2-PolyWidgets/SpInputTextDropList.class.st
@@ -1,131 +1,5 @@
"
I am an elementary Spec widget that associates an TextInputField and a DropListPresenter.
self example
I provide accessors dropList and input and shortcuts for the most common methods of their api.
"
Class {
#name : #SpInputTextDropList,
#superclass : #SpPresenter,
#instVars : [
'dropList',
'input'
],
#category : #'Spec2-PolyWidgets-Elementary'
#superclass : #SpInputTextDropListPresenter,
#category : #'Spec2-PolyWidgets-ToRemoveBeforerelease'
}

{ #category : #specs }
SpInputTextDropList class >> defaultSpec [
<spec: #default>
^ SpLayout composed
newRow: [ :row |
row
add: #input origin: 0 @ 0 corner: 0.3 @ 1;
add: #dropList origin: 0.3 @ 0 corner: 1 @ 1 ];
yourself
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> acceptOnCR: aBoolean [
self input acceptOnCR: aBoolean
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> beEncrypted [
self input beEncrypted
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> displayBlock: aBlock [
self dropList displayBlock: aBlock
]

{ #category : #accessing }
SpInputTextDropList >> dropList [
^ dropList
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> emptyList [
self dropList emptyList
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> encrypted: aBoolean [
self input encrypted: aBoolean
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> entryCompletion: anEntryCompletion [
self input entryCompletion: anEntryCompletion
]

{ #category : #initialization }
SpInputTextDropList >> initializeWidgets [
input := self instantiate: SpTextInputFieldPresenter.
dropList := self instantiate: SpDropListPresenter.
self focusOrder
add: input;
add: dropList
]

{ #category : #accessing }
SpInputTextDropList >> input [
^ input
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> items: aList [
self dropList items: aList
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> listSize [
self dropList listSize
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> placeholder: aText [
self input placeholder: aText
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> resetSelection [
self dropList resetSelection
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> selectedItem [
self dropList selectedItem
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> setIndex: anIndex [
self dropList setIndex: anIndex
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> text [
self input text
]

{ #category : #'api-shortcuts' }
SpInputTextDropList >> text: aText [
self input text: aText
]

{ #category : #'events-shortcuts' }
SpInputTextDropList >> whenSelectedItemChanged: aBlock [
self dropList whenSelectedItemChanged: aBlock
]

{ #category : #'events-shortcuts' }
SpInputTextDropList >> whenSelectionChanged: aBlock [
self dropList whenSelectionChanged: aBlock
]

{ #category : #'events-shortcuts' }
SpInputTextDropList >> whenSelectionIndexChanged: aBlock [
self dropList whenSelectionIndexChanged: aBlock
]
131 changes: 131 additions & 0 deletions src/Spec2-PolyWidgets/SpInputTextDropListPresenter.class.st
@@ -0,0 +1,131 @@
"
I am an elementary Spec widget that associates an TextInputField and a DropListPresenter.
self example
I provide accessors dropList and input and shortcuts for the most common methods of their api.
"
Class {
#name : #SpInputTextDropListPresenter,
#superclass : #SpPresenter,
#instVars : [
'dropList',
'input'
],
#category : #'Spec2-PolyWidgets-Elementary'
}

{ #category : #specs }
SpInputTextDropListPresenter class >> defaultSpec [
<spec: #default>
^ SpLayout composed
newRow: [ :row |
row
add: #input origin: 0 @ 0 corner: 0.3 @ 1;
add: #dropList origin: 0.3 @ 0 corner: 1 @ 1 ];
yourself
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> acceptOnCR: aBoolean [
self input acceptOnCR: aBoolean
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> beEncrypted [
self input beEncrypted
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> displayBlock: aBlock [
self dropList displayBlock: aBlock
]

{ #category : #accessing }
SpInputTextDropListPresenter >> dropList [
^ dropList
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> emptyList [
self dropList emptyList
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> encrypted: aBoolean [
self input encrypted: aBoolean
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> entryCompletion: anEntryCompletion [
self input entryCompletion: anEntryCompletion
]

{ #category : #initialization }
SpInputTextDropListPresenter >> initializeWidgets [
input := self instantiate: SpTextInputFieldPresenter.
dropList := self instantiate: SpDropListPresenter.
self focusOrder
add: input;
add: dropList
]

{ #category : #accessing }
SpInputTextDropListPresenter >> input [
^ input
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> items: aList [
self dropList items: aList
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> listSize [
self dropList listSize
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> placeholder: aText [
self input placeholder: aText
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> resetSelection [
self dropList resetSelection
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> selectedItem [
self dropList selectedItem
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> setIndex: anIndex [
self dropList setIndex: anIndex
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> text [
self input text
]

{ #category : #'api-shortcuts' }
SpInputTextDropListPresenter >> text: aText [
self input text: aText
]

{ #category : #'events-shortcuts' }
SpInputTextDropListPresenter >> whenSelectedItemChanged: aBlock [
self dropList whenSelectedItemChanged: aBlock
]

{ #category : #'events-shortcuts' }
SpInputTextDropListPresenter >> whenSelectionChanged: aBlock [
self dropList whenSelectionChanged: aBlock
]

{ #category : #'events-shortcuts' }
SpInputTextDropListPresenter >> whenSelectionIndexChanged: aBlock [
self dropList whenSelectionIndexChanged: aBlock
]

0 comments on commit 9ff9597

Please sign in to comment.