Skip to content

Commit

Permalink
Introduce newProgress in SpApplication. It was missing
Browse files Browse the repository at this point in the history
Then since all the newInform and friends were defined as extensions move their users as extensions too (else it does not make sense).
  • Loading branch information
Ducasse committed Nov 19, 2023
1 parent a3c8db3 commit d3caae4
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 71 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
69 changes: 63 additions & 6 deletions src/Spec2-Dialogs/SpApplication.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
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 [
"Display a message during execution of the given block."

^ self newProgress informUser: aString during: aBlock
]

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

Expand All @@ -25,13 +62,9 @@ SpApplication >> newJobList [
]

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

self
deprecated: 'Use #newJobList'
transformWith: '`@receiver newProgress'
-> '`@receiver newJobList'.
^ SpJobListPresenter newApplication: self
^ SpProgressDialog new
]

{ #category : '*Spec2-Dialogs' }
Expand All @@ -51,3 +84,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
]
23 changes: 12 additions & 11 deletions src/Spec2-Dialogs/SpNotificationCenterPresenter.class.st
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Class {
#name : #SpNotificationCenterPresenter,
#superclass : #SpPresenterWithModel,
#name : 'SpNotificationCenterPresenter',
#superclass : 'SpPresenterWithModel',
#instVars : [
'itemList',
'descriptionText',
'clearButton'
],
#category : #'Spec2-Dialogs'
#category : 'Spec2-Dialogs',
#package : 'Spec2-Dialogs'
}

{ #category : #examples }
{ #category : 'examples' }
SpNotificationCenterPresenter class >> example2 [

<example>
Expand All @@ -21,14 +22,14 @@ SpNotificationCenterPresenter class >> example2 [
"1 to: 10 do: [ :each | app notify: each printString ]"
]

{ #category : #initialization }
{ #category : 'initialization' }
SpNotificationCenterPresenter >> clearNotificationsAction [

itemList items: OrderedCollection new.
descriptionText text: ' No notification '
]

{ #category : #initialization }
{ #category : 'initialization' }
SpNotificationCenterPresenter >> connectPresenters [

"Why this is not working
Expand All @@ -38,7 +39,7 @@ SpNotificationCenterPresenter >> connectPresenters [

]

{ #category : #layout }
{ #category : 'layout' }
SpNotificationCenterPresenter >> defaultLayout [

| upperLayout lowerLayout |
Expand All @@ -56,7 +57,7 @@ SpNotificationCenterPresenter >> defaultLayout [
yourself
]

{ #category : #initialization }
{ #category : 'initialization' }
SpNotificationCenterPresenter >> initializePresenters [

itemList := self newList
Expand All @@ -70,20 +71,20 @@ SpNotificationCenterPresenter >> initializePresenters [
yourself
]

{ #category : #initialization }
{ #category : 'initialization' }
SpNotificationCenterPresenter >> initializeWindow: aWindowPresenter [

aWindowPresenter title: 'Notifications'
]

{ #category : #initialization }
{ #category : 'initialization' }
SpNotificationCenterPresenter >> modelChanged [

itemList items: announcingObject value items.
itemList selectFirst
]

{ #category : #updating }
{ #category : 'updating' }
SpNotificationCenterPresenter >> updatePresenter [

self modelChanged
Expand Down

0 comments on commit d3caae4

Please sign in to comment.