Skip to content

Commit

Permalink
Added helper methods in SpPresenter and SpApplication
Browse files Browse the repository at this point in the history
- started to reorganised the extensions (newInform was an extension but not its user method in SpApplication
- we will have to look because in SpPresenter the newInform are not extensions so may be none of them should be extensions
  • Loading branch information
Ducasse committed Nov 21, 2023
1 parent e2c8cf7 commit c9874d7
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 54 deletions.
54 changes: 0 additions & 54 deletions src/Spec2-Core/SpApplication.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,6 @@ SpApplication >> adapterBindings [
^ self backend adapterBindings
]

{ #category : 'ui - dialogs' }
SpApplication >> alert: aString [
"Displays an inform dialog, for more configurable version please use `self application newInform title: ....`."

^ self newAlert
title: 'Alert';
label: aString;
openModal
]

{ #category : 'accessing - backend' }
SpApplication >> backend [

Expand Down Expand Up @@ -150,16 +140,6 @@ SpApplication >> configuration [
configuration ]
]

{ #category : 'ui - dialogs' }
SpApplication >> confirm: aString [
"Displays a confirm dialog, for more configurable version please use `self application newConfirm title: ....`."

^ self newConfirm
title: 'Please confirm';
label: aString;
openModal
]

{ #category : 'showing' }
SpApplication >> defaultBlockedDialogWindowPresenterClass [

Expand Down Expand Up @@ -251,16 +231,6 @@ SpApplication >> iconProvider: anIconProvider [
iconProvider := anIconProvider
]

{ #category : 'ui - dialogs' }
SpApplication >> inform: aString [
"Displays an inform dialog, for more configurable version please use `self application newInform title: ....`."

^ self newInform
title: 'Alert';
label: aString;
openModal
]

{ #category : 'accessing' }
SpApplication >> locale [

Expand Down Expand Up @@ -292,18 +262,6 @@ SpApplication >> notificationCenter [
^ notificationCenter ifNil: [ notificationCenter := SpNotificationCenter new forApplication: self; yourself ]
]

{ #category : 'ui - dialogs' }
SpApplication >> notificationClass [

^ SpNotificationItem
]

{ #category : 'ui - dialogs' }
SpApplication >> notify: aString [

self notificationCenter add: (self notificationClass with: aString)
]

{ #category : 'accessing - properties' }
SpApplication >> properties [

Expand Down Expand Up @@ -386,18 +344,6 @@ SpApplication >> run [
self start
]

{ #category : 'ui - dialogs' }
SpApplication >> selectDirectoryTitle: aString [

^ self backend selectDirectoryTitle: aString
]

{ #category : 'ui - dialogs' }
SpApplication >> selectFileTitle: aString [

^ self backend selectFileTitle: aString
]

{ #category : 'ui' }
SpApplication >> showWaitCursorWhile: aBlock [

Expand Down
7 changes: 7 additions & 0 deletions src/Spec2-Core/SpPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,13 @@ SpPresenter >> inform: aString [
^ self application inform: aString
]

{ #category : 'simple dialog helpers' }
SpPresenter >> informUser: aString during: aBlock [
"Displays a simple inform dialog while a task is perform without progress bar."

^ self application informUser: aString during: aBlock
]

{ #category : 'TOREMOVE' }
SpPresenter >> initialExtent [

Expand Down
70 changes: 70 additions & 0 deletions src/Spec2-Dialogs/SpApplication.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
Extension { #name : 'SpApplication' }

{ #category : '*Spec2-Dialogs' }
SpApplication >> alert: aString [
"Displays an inform dialog, for more configurable version please use `self application newInform title: ....`."

^ self newAlert
title: 'Alert';
label: aString;
openModal
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> confirm: aString [
"Displays a confirm dialog, for more configurable version please use `self application newConfirm title: ....`."

^ self newConfirm
title: 'Please confirm';
label: aString;
openModal
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> inform: aString [
"Displays an inform dialog, for more configurable version please use `self application newInform title: ....`."

^ self newInform
title: 'Alert';
label: aString;
openModal
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> informUser: aString during: aBlock [
"Displays an inform user dialog."

^ self newInformUser
title: aString;
informUserDuring: aBlock;
openModal
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> newAlert [

Expand All @@ -18,6 +58,12 @@ SpApplication >> newInform [
^ SpInformDialog newApplication: self
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> newInformUser [

^ SpInformUserDialog newApplication: self
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> newJobList [

Expand Down Expand Up @@ -51,3 +97,27 @@ SpApplication >> newSelect [

^ SpSelectDialog newApplication: self
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> notificationClass [

^ SpNotificationItem
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> notify: aString [

self notificationCenter add: (self notificationClass with: aString)
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> selectDirectoryTitle: aString [

^ self backend selectDirectoryTitle: aString
]

{ #category : '*Spec2-Dialogs' }
SpApplication >> selectFileTitle: aString [

^ self backend selectFileTitle: aString
]

0 comments on commit c9874d7

Please sign in to comment.