Skip to content

Commit

Permalink
Merge pull request #194 from ba-st/deprecate-listbox-dropdown
Browse files Browse the repository at this point in the history
Deprecate listbox dropdown
  • Loading branch information
gcotelli authored Jan 22, 2021
2 parents dce1623 + c2b0bc4 commit a28ead9
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/Components.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ There's a variety of single selection components to choose. All of them support
- `notifyChangesTo:` can be used to subscribe for receiving a notification when the selection changes

The component supplier supports several single selection components:
- `dropdownListApplying:` will provide a dropdown list
- `singleSelectionListBoxDisplayingAtOnce:applying:` will provide a list box
- `dropdownListApplying:` and - `dropdownListApplying:applyingToOptions:` provide a dropdown list
- `singleSelectionListBoxDisplayingAtOnce:applying:` and `singleSelectionListBoxDisplayingAtOnce:applying:applyingToOptions: provide a list box
- `radioRenderingWith:applyingToLabel:applyingToInput:` will provide a group of radio boxes

### Multiple Selection
Expand Down
2 changes: 2 additions & 0 deletions docs/Migration-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ To reflect this,

`PhrasingContainerWebView`, `GenericContainerWebView` and `IdentifiedWebView` have all been replaced by `ContainerWebView`. The deprecated classes are now located in the migration package `Willow-Core-MigrationTo14` and all their instance creation method now include a transformation rule. If the senders has access to a component supplier, "divs" can be created by sending `divisionContainerWrapping:applying:` and "spans" by sending `inlineContainerWrapping:applying:`. For all other scenarios, a `ContainerWebView` can specify the code to create the container element in the second argument of `wrapping:intoElementBuiltUsing:applying:`. The old requirement of using an `IdentifiedWebView` to allow re-rendering applies now to `ContainerWebView`, except this new class will only specify an id when its interaction is configured before it is rendered for the first time. Checks have been implemented to detect cases where the developer might need to send `beIdentifiable`in order to ensure an id is created for the container element.

`DropDownListWebView` and `SingleSelectionListBoxWebView` have been replaced by `SingleSelectionWebView`. The deprecated classes are now located in the migration package `Willow-Core-MigrationTo14` and all their instance creation method now include a transformation rule. If the senders has access to a component supplier, drop downs can be created by sending `dropdownListApplying:` and list boxes by sending `listBoxDisplayingAtOnce:applying:`. Otherwise they can be created by sending the corresponding instance creation method in `SingleSelectionWebView`.

## Version 10 to 11

`executeOnClient:` no longer receives the script and now the block result it's automatically attached to it. So you have to:
Expand Down
26 changes: 26 additions & 0 deletions source/Willow-Core-MigrationTo14/DropDownListWebView.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Class {
#name : #DropDownListWebView,
#superclass : #Object,
#category : #'Willow-Core-MigrationTo14'
}

{ #category : #'instance creation' }
DropDownListWebView class >> applying: aComponentCommand [

self
deprecated:
'Use componentSupplier dropdownListApplying: if available, otherwise create a SingleSelectionWebView using the same implementation'
transformWith:
'`@receiver applying: `@aComponentCommand'
-> 'self componentSupplier dropdownListApplying: `@aComponentCommand'
when: [ thisContext activeHome notNil
and: [ thisContext activeHome sender receiver respondsTo: #componentSupplier ]
];
deprecated:
'Use componentSupplier dropdownListApplying: if available, otherwise create a SingleSelectionWebView using the same implementation'
transformWith:
'`@receiver applying: `@aComponentCommand'
-> 'SingleSelectionWebView dropDownListApplying: `@aComponentCommand applyingToOptions: [ ]'.

^ SingleSelectionWebView dropDownListApplying: aComponentCommand applyingToOptions: [ ]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Class {
#name : #SingleSelectionListBoxWebView,
#superclass : #Object,
#category : #'Willow-Core-MigrationTo14'
}

{ #category : #'instance creation' }
SingleSelectionListBoxWebView class >> displayingAtOnce: aNumberOfElements [

self
deprecated:
'Use componentSupplier singleSelectionListBoxDisplayingAtOnce:applying: if available, otherwise create a SingleSelectionWebView using the same implementation'
transformWith:
'`@receiver displayingAtOnce: `@aNumberOfElements'
->
'self componentSupplier singleSelectionListBoxDisplayingAtOnce: `@aNumberOfElements applying: [ ]'
when: [ thisContext activeHome notNil
and: [ thisContext activeHome sender receiver respondsTo: #componentSupplier ]
];
deprecated:
'Use componentSupplier singleSelectionListBoxDisplayingAtOnce:applying: if available, otherwise create a SingleSelectionWebView using the same implementation'
transformWith:
'`@receiver displayingAtOnce: `@aNumberOfElements'
->
'SingleSelectionWebView
listBoxDisplayingAtOnce: `@aNumberOfElements
applying: [ ]
applyingToOptions: [ ]'.

^ SingleSelectionWebView
listBoxDisplayingAtOnce: aNumberOfElements
applying: [ ]
applyingToOptions: [ ]
]

{ #category : #'instance creation' }
SingleSelectionListBoxWebView class >> displayingAtOnce: aNumberOfElements applying: aComponentCommand [

self
deprecated:
'Use componentSupplier singleSelectionListBoxDisplayingAtOnce:applying: if available, otherwise create a SingleSelectionWebView using the same implementation'
transformWith:
'`@receiver displayingAtOnce: `@aNumberOfElements applying: `@aComponentCommand'
->
'self componentSupplier singleSelectionListBoxDisplayingAtOnce: `@aNumberOfElements applying: `@aComponentCommand'
when: [ thisContext activeHome notNil
and: [ thisContext activeHome sender receiver respondsTo: #componentSupplier ]
];
deprecated:
'Use componentSupplier singleSelectionListBoxDisplayingAtOnce:applying: if available, otherwise create a SingleSelectionWebView using the same implementation'
transformWith:
'`@receiver displayingAtOnce: `@aNumberOfElements applying: `@aComponentCommand'
->
'SingleSelectionWebView
listBoxDisplayingAtOnce: `@aNumberOfElements
applying: `@aComponentCommand
applyingToOptions: [ ]'.

^ SingleSelectionWebView
listBoxDisplayingAtOnce: aNumberOfElements
applying: aComponentCommand
applyingToOptions: [ ]
]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Extension { #name : #DropDownListWebView }
Extension { #name : #SingleSelectionWebView }

{ #category : #'*Willow-Core-MigrationTo14' }
DropDownListWebView >> onTrigger [
SingleSelectionWebView >> onTrigger [

self
deprecated: 'Use #on instead.'
Expand Down

0 comments on commit a28ead9

Please sign in to comment.