Skip to content

Commit

Permalink
Allow configuring the selection interpreter for the autocomplete command
Browse files Browse the repository at this point in the history
  • Loading branch information
mtabacman committed Oct 13, 2024
1 parent 512cbbd commit f7ee7f3
Show file tree
Hide file tree
Showing 19 changed files with 251 additions and 210 deletions.
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
Extension { #name : #ComponentClassificationCommandBuilder }
Extension { #name : 'ComponentClassificationCommandBuilder' }

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> jQueryUI [

classificationNamespace := classificationNamespace >> #jQueryUI
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiButton [

^ self commandStyledWith: #uiButton
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiButtonIconPrimary [

^ self commandStyledWith: #uiButtonIconPrimary
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiCornerAll [

^ self commandStyledWith: #uiCornerAll
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiCornerLeft [

^ self commandStyledWith: #uiCornerLeft
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiHelperClearfix [

^ self commandStyledWith: #uiHelperClearfix
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiIcon [

^ self commandStyledWith: #uiIcon
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiIconClose [

^ self commandStyledWith: #uiIconClose
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiIconMinusthick [

^ self commandStyledWith: #uiIconMinusthick
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiIconPlusthick [

^ self commandStyledWith: #uiIconPlusthick
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiStateDefault [

^ self commandStyledWith: #uiStateDefault
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiStateHighlight [

^ self commandStyledWith: #uiStateHighlight
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiWidget [

^ self commandStyledWith: #uiWidget
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiWidgetContent [

^ self commandStyledWith: #uiWidgetContent
]

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentClassificationCommandBuilder >> uiWidgetHeader [

^ self commandStyledWith: #uiWidgetHeader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ComponentStyleClassUpdateBuilder }
Extension { #name : 'ComponentStyleClassUpdateBuilder' }

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
ComponentStyleClassUpdateBuilder >> toggleClass: aCssClass withEffect: anEffectSelector [

transformations
Expand Down
4 changes: 2 additions & 2 deletions source/Willow-JQueryUI/JQueryInstance.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #JQueryInstance }
Extension { #name : 'JQueryInstance' }

{ #category : #'*Willow-JQueryUI' }
{ #category : '*Willow-JQueryUI' }
JQueryInstance >> swappable [

^ self create: Swappable
Expand Down
51 changes: 34 additions & 17 deletions source/Willow-JQueryUI/JQueryUIAutocompleteCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,53 @@
I'm a component command enabling the autocompletion using JQueryUI.
"
Class {
#name : #JQueryUIAutocompleteCommand,
#superclass : #WebComponentCommand,
#name : 'JQueryUIAutocompleteCommand',
#superclass : 'WebComponentCommand',
#instVars : [
'scriptProvider'
'configurationCommand',
'selectInterpreter'
],
#category : 'Willow-JQueryUI-Frontend'
#category : 'Willow-JQueryUI-Frontend',
#package : 'Willow-JQueryUI',
#tag : 'Frontend'
}

{ #category : #'instance creation' }
JQueryUIAutocompleteCommand class >> obtainingSuggestionsFrom: anAutocompleteProvider [
{ #category : 'instance creation' }
JQueryUIAutocompleteCommand class >> configuredBy: aBlock [

^ self
toExecute:
[ :canvas | canvas jQuery this autocomplete sourceCallback: anAutocompleteProvider ]
^ self new initializeConfiguredBy: aBlock
]

{ #category : #'instance creation - private' }
JQueryUIAutocompleteCommand class >> toExecute: aBlock [
{ #category : 'instance creation' }
JQueryUIAutocompleteCommand class >> obtainingSuggestionsFrom: anAutocompleteProvider [

^ self new initializeToExecute: aBlock
^ self configuredBy: [ :autocomplete | autocomplete sourceCallback: anAutocompleteProvider ]
]

{ #category : #processing }
{ #category : 'processing' }
JQueryUIAutocompleteCommand >> applyTo: aComponent on: aCanvas [

^ (ComponentScriptCommand toExecute: scriptProvider) applyTo: aComponent on: aCanvas
^ ( ComponentScriptCommand toExecute: [ :canvas |
| autocomplete |

autocomplete := canvas jQuery this autocomplete.
configurationCommand value: autocomplete.
selectInterpreter applyTo: autocomplete on: canvas.
autocomplete
] ) applyTo: aComponent on: aCanvas
]

{ #category : 'initialization' }
JQueryUIAutocompleteCommand >> initializeConfiguredBy: aConfigurationCommand [

configurationCommand := aConfigurationCommand.
selectInterpreter := WebInteractionInterpreter
forEvaluationOf: #onSelect:
withAll: ( Array with: 'event' with: 'ui' )
]

{ #category : #'initialize-release' }
JQueryUIAutocompleteCommand >> initializeToExecute: aScriptProvider [
{ #category : 'configuring' }
JQueryUIAutocompleteCommand >> onSelect [

scriptProvider := aScriptProvider
^ selectInterpreter
]
18 changes: 10 additions & 8 deletions source/Willow-JQueryUI/JQueryUIButtonCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
I'm a component command that transforms a button into a JQueryUI button.
"
Class {
#name : #JQueryUIButtonCommand,
#superclass : #WebComponentCommand,
#name : 'JQueryUIButtonCommand',
#superclass : 'WebComponentCommand',
#instVars : [
'scriptProvider'
],
#category : 'Willow-JQueryUI-Frontend'
#category : 'Willow-JQueryUI-Frontend',
#package : 'Willow-JQueryUI',
#tag : 'Frontend'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
JQueryUIButtonCommand class >> describedBy: aDescription [

^ self toExecute: [ :canvas | canvas jQuery this button text: aDescription ]
]

{ #category : #'instance creation' }
{ #category : 'instance creation' }
JQueryUIButtonCommand class >> representedBy: anIcon [

^ self
Expand All @@ -26,19 +28,19 @@ JQueryUIButtonCommand class >> representedBy: anIcon [
primaryIcon: Classification >> #jQueryUI >> anIcon ]
]

{ #category : #'instance creation - private' }
{ #category : 'instance creation - private' }
JQueryUIButtonCommand class >> toExecute: aBlock [

^ self new initializeToExecute: aBlock
]

{ #category : #processing }
{ #category : 'processing' }
JQueryUIButtonCommand >> applyTo: aComponent on: aCanvas [

^ (ComponentScriptCommand toExecute: scriptProvider) applyTo: aComponent on: aCanvas
]

{ #category : #'initialize-release' }
{ #category : 'initialize-release' }
JQueryUIButtonCommand >> initializeToExecute: aScriptProvider [

scriptProvider := aScriptProvider
Expand Down
26 changes: 14 additions & 12 deletions source/Willow-JQueryUI/JQueryUIButtonSetWebView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,57 @@ Button Set Component.
https://api.jqueryui.com/buttonset/
"
Class {
#name : #JQueryUIButtonSetWebView,
#superclass : #SingleSelectionWebViewBehavior,
#name : 'JQueryUIButtonSetWebView',
#superclass : 'SingleSelectionWebViewBehavior',
#instVars : [
'commandToComponent',
'interactionInterpreter',
'elementCommandProvider'
],
#category : #'Willow-JQueryUI-WebViews'
#category : 'Willow-JQueryUI-WebViews',
#package : 'Willow-JQueryUI',
#tag : 'WebViews'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
JQueryUIButtonSetWebView class >> applying: aCommandToComponent obtainingCommandFrom: aLabelCommandProvider [

^ self new
initializeApplying: aCommandToComponent asWebComponentCommand
obtainingCommandFrom: aLabelCommandProvider
]

{ #category : #initialization }
{ #category : 'initialization' }
JQueryUIButtonSetWebView >> initializeApplying: aCommandToComponent obtainingCommandFrom: aLabelCommandProvider [

commandToComponent := aCommandToComponent.
elementCommandProvider := aLabelCommandProvider.
interactionInterpreter := EventInterpreterDispatcher defaultingToChange
]

{ #category : #configuring }
{ #category : 'configuring' }
JQueryUIButtonSetWebView >> on [

^ interactionInterpreter
]

{ #category : #rendering }
{ #category : 'rendering' }
JQueryUIButtonSetWebView >> renderContentOn: aCanvas [

( self renderedComponentOn: aCanvas )
with: [ self renderRadioGroupOn: aCanvas ]
applying: commandToComponent
]

{ #category : #'private-rendering' }
{ #category : 'private-rendering' }
JQueryUIButtonSetWebView >> renderLabelFor: anElement representedBy: radioButton identifiedAs: radioButtonId on: aCanvas [

aCanvas label
apply: (elementCommandProvider value: anElement);
for: radioButtonId
]

{ #category : #'private-rendering' }
{ #category : 'private-rendering' }
JQueryUIButtonSetWebView >> renderRadioButtonFor: anElement asPartOf: aRadioGroup on: aCanvas [

| radioButtonId radioButton |
Expand All @@ -70,7 +72,7 @@ JQueryUIButtonSetWebView >> renderRadioButtonFor: anElement asPartOf: aRadioGrou
on: aCanvas
]

{ #category : #'private-rendering' }
{ #category : 'private-rendering' }
JQueryUIButtonSetWebView >> renderRadioGroupOn: aCanvas [

aCanvas radioGroup
Expand All @@ -81,7 +83,7 @@ JQueryUIButtonSetWebView >> renderRadioGroupOn: aCanvas [
do: [ :element | self renderRadioButtonFor: element asPartOf: radioGroup on: aCanvas ] ]
]

{ #category : #'private-rendering' }
{ #category : 'private-rendering' }
JQueryUIButtonSetWebView >> renderedButtonIdentifiedAs: radioButtonId for: anElement asPartOf: aRadioGroup on: aCanvas [

| radioButton |
Expand All @@ -94,7 +96,7 @@ JQueryUIButtonSetWebView >> renderedButtonIdentifiedAs: radioButtonId for: anEle
^ radioButton
]

{ #category : #'private-rendering' }
{ #category : 'private-rendering' }
JQueryUIButtonSetWebView >> renderedComponentOn: aCanvas [

^(aCanvas div)
Expand Down
Loading

0 comments on commit f7ee7f3

Please sign in to comment.