diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d6fef4..b9fc578 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,10 +18,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - smalltalk: [ Pharo64-9.0 , Pharo64-8.0 ] + smalltalk: [ Pharo64-12.0 , Pharo64-alpha ] name: ${{ matrix.smalltalk }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: hpi-swa/setup-smalltalkCI@v1 with: smalltalk-image: ${{ matrix.smalltalk }} diff --git a/src/BaselineOfInteractions/BaselineOfInteractions.class.st b/src/BaselineOfInteractions/BaselineOfInteractions.class.st index e3d324b..64e8ddf 100644 --- a/src/BaselineOfInteractions/BaselineOfInteractions.class.st +++ b/src/BaselineOfInteractions/BaselineOfInteractions.class.st @@ -11,6 +11,8 @@ BaselineOfInteractions >> baseline: spec [ spec package: 'Interactions'; - package: 'Interactions-Widgets'; - package: 'Interactions-Widgets-Tests' + package: 'Interactions-Widgets' + with: [ spec requires: #( 'Interactions' ) ]; + package: 'Interactions-Tests' + with: [ spec requires: #( 'Interactions' 'Interactions-Widgets' ) ] ] diff --git a/src/Interactions-Tests/SpecInteractionTest.class.st b/src/Interactions-Tests/SpecInteractionTest.class.st new file mode 100644 index 0000000..666ea3a --- /dev/null +++ b/src/Interactions-Tests/SpecInteractionTest.class.st @@ -0,0 +1,120 @@ +Class { + #name : 'SpecInteractionTest', + #superclass : 'TestCase', + #instVars : [ + 'backend', + 'widget' + ], + #category : 'Interactions-Tests', + #package : 'Interactions-Tests' +} + +{ #category : 'running' } +SpecInteractionTest >> setUp [ + super setUp. + + backend := SpecInteraction default +] + +{ #category : 'running' } +SpecInteractionTest >> tearDown [ + widget ifNotNil: [ :w | w delete ]. + super tearDown +] + +{ #category : 'tests' } +SpecInteractionTest >> testCanOpenAConfirmation [ + + | confirm window | + confirm := ITConfirmation new + title: 'Remove File'; + message: 'Are you sure you want to delete this file?'; + yesLabel: 'delete'. + + widget := backend for: confirm. + widget doInteraction. + + window := widget window. + self assert: window title equals: confirm title. + self assert: widget label equals: confirm message. + self assertCollection: (window buttons collect: #label) hasSameElements: #('no' 'delete') +] + +{ #category : 'tests' } +SpecInteractionTest >> testCanOpenAFileRequest [ + + | fileRequest window | + fileRequest := ITFileRequest new + title: 'Image file to open?'; + filter: '.image'; + currentFolder: FileLocator home. + + widget := backend for: fileRequest. + widget doInteraction. + + window := widget window. + self assert: window title equals: fileRequest title. + self assert: widget fileNavigationSystem filtersDropList selectedItem basename equals: '.image'. + self assert: widget fileNavigationSystem currentDirectory equals: FileLocator home. +] + +{ #category : 'tests' } +SpecInteractionTest >> testCanOpenAnInformation [ + + | inform window | + inform := ITInformation new + title: 'Some confirmation needed'; + message: 'Do you want to proceed?'. + + widget := backend for: inform. + widget doInteraction. + + window := widget window. + self assert: window title equals: inform title. + self assert: widget label equals: inform message. + self assertCollection: (window buttons collect: #label) hasSameElements: #('Ok') +] + +{ #category : 'tests' } +SpecInteractionTest >> testCanSelectAFile [ + + | fileRequest fs file bImage | + fs := FileSystem memory. + (fs root / 'a.image') ensureCreateFile. + bImage := (fs root / 'b.image') ensureCreateFile. + fileRequest := ITFileRequest new + title: 'Image file to open?'; + filter: '.image'; + currentFolder: fs root; + yourself. + + widget := backend for: fileRequest. + widget doInteraction. + widget selectFile: bImage. + file := widget confirm. + + self assert: widget fileNavigationSystem currentDirectory equals: fs root. + self assert: file equals: bImage +] + +{ #category : 'tests' } +SpecInteractionTest >> testCanSelectAFolder [ + + | fileRequest fs folder bFolder | + fs := FileSystem memory. + (fs root / 'a') ensureCreateDirectory. + bFolder := (fs root / 'b') ensureCreateDirectory. + fileRequest := ITFileRequest new + beForFolderOpening; + title: 'Folder to open?'; + currentFolder: fs root; + yourself. + + widget := backend for: fileRequest. + widget doInteraction. + widget selectFile: bFolder. + folder := widget confirm. + + self assert: widget fileNavigationSystem currentDirectory equals: fs root. + self assert: folder equals: bFolder +] diff --git a/src/Interactions-Tests/package.st b/src/Interactions-Tests/package.st new file mode 100644 index 0000000..2bda6d6 --- /dev/null +++ b/src/Interactions-Tests/package.st @@ -0,0 +1 @@ +Package { #name : 'Interactions-Tests' } diff --git a/src/Interactions-Widgets-Tests/ITConfirmationPresenterTest.class.st b/src/Interactions-Widgets-Tests/ITConfirmationPresenterTest.class.st deleted file mode 100644 index 4f19083..0000000 --- a/src/Interactions-Widgets-Tests/ITConfirmationPresenterTest.class.st +++ /dev/null @@ -1,60 +0,0 @@ -Class { - #name : 'ITConfirmationPresenterTest', - #superclass : 'TestCase', - #instVars : [ - 'presenter', - 'window' - ], - #category : 'Interactions-Widgets-Tests', - #package : 'Interactions-Widgets-Tests' -} - -{ #category : 'running' } -ITConfirmationPresenterTest >> setUp [ - presenter := ITConfirmationPresenter on: ITConfirmation example -] - -{ #category : 'running' } -ITConfirmationPresenterTest >> tearDown [ - window close -] - -{ #category : 'tests' } -ITConfirmationPresenterTest >> testDialogHasThreeButtons [ - "yes no cancel" - window := presenter openDialogWithSpec. - - self - assert: window buttons size - equals: 3. -] - -{ #category : 'tests' } -ITConfirmationPresenterTest >> testGetFalseWhenClickingOnFalseButton [ - | answer | - window := presenter openDialogWithSpec. - answer := window triggerCancelAction. - - self - assert: answer - equals: false -] - -{ #category : 'tests' } -ITConfirmationPresenterTest >> testGetInteractionCancelledExceptionWhenClickingOnCancelButton [ - window := presenter openDialogWithSpec. - self - should: [ window triggerCancelAction ] - raise: SpInteractionCancelled. -] - -{ #category : 'tests' } -ITConfirmationPresenterTest >> testGetTrueWhenClickingOnTrueButton [ - | answer | - window := presenter openDialogWithSpec. - answer := window triggerOkAction. - - self - assert: answer - equals: true -] diff --git a/src/Interactions-Widgets-Tests/ITInformationPresenterTest.class.st b/src/Interactions-Widgets-Tests/ITInformationPresenterTest.class.st deleted file mode 100644 index a50907a..0000000 --- a/src/Interactions-Widgets-Tests/ITInformationPresenterTest.class.st +++ /dev/null @@ -1,52 +0,0 @@ -Class { - #name : 'ITInformationPresenterTest', - #superclass : 'TestCase', - #instVars : [ - 'presenter', - 'window', - 'information' - ], - #category : 'Interactions-Widgets-Tests', - #package : 'Interactions-Widgets-Tests' -} - -{ #category : 'running' } -ITInformationPresenterTest >> setUp [ - information := ITInformation example. - presenter := ITInformationPresenter on: information. -] - -{ #category : 'running' } -ITInformationPresenterTest >> tearDown [ - window close -] - -{ #category : 'tests' } -ITInformationPresenterTest >> testDialogHasOnlyOkButton [ - window := presenter openDialogWithSpec. - - self - assert: window buttons size - equals: 1. - self - assert: window buttons first label - equals: 'Ok'. -] - -{ #category : 'tests' } -ITInformationPresenterTest >> testInformationMessageIsSet [ - window := presenter openDialogWithSpec. - - self - assert: presenter messageText text - equals: information message -] - -{ #category : 'tests' } -ITInformationPresenterTest >> testInformationTitleIsSet [ - window := presenter openDialogWithSpec. - - self - assert: window title - equals: information title -] diff --git a/src/Interactions-Widgets-Tests/ITItemChooserPresenterTest.class.st b/src/Interactions-Widgets-Tests/ITItemChooserPresenterTest.class.st deleted file mode 100644 index 851d001..0000000 --- a/src/Interactions-Widgets-Tests/ITItemChooserPresenterTest.class.st +++ /dev/null @@ -1,53 +0,0 @@ -" -An ITCollectionChooserTest is a test class for testing the behavior of ITCollectionChooser -" -Class { - #name : 'ITItemChooserPresenterTest', - #superclass : 'TestCase', - #instVars : [ - 'presenter', - 'window' - ], - #category : 'Interactions-Widgets-Tests', - #package : 'Interactions-Widgets-Tests' -} - -{ #category : 'running' } -ITItemChooserPresenterTest >> setUp [ - presenter := ITItemsChooserPresenter new -] - -{ #category : 'tests' } -ITItemChooserPresenterTest >> testItemSelectedWhenSelectItemAndTriggerOkButton [ - presenter model: #(1 2 3 4 5 6). - presenter tablePresenter selectIndex: 2. - - window := presenter openDialogWithSpec. - window triggerOkAction. - - self assert: presenter selectedItem equals: 2. -] - -{ #category : 'tests' } -ITItemChooserPresenterTest >> testPresenterIsCancelledWhenOkActionTriggerred [ - presenter openDialogWithSpec triggerCancelAction. - self assert: presenter isCancelled -] - -{ #category : 'tests' } -ITItemChooserPresenterTest >> testPresenterIsNotCancelledWhenOkActionTriggerred [ - presenter openDialogWithSpec triggerOkAction. - self deny: presenter isCancelled -] - -{ #category : 'tests' } -ITItemChooserPresenterTest >> testSelectionIsNilWhenSelectItemAndTriggerCancelButton [ - presenter model: #(1 2 3 4 5 6). - presenter tablePresenter selectIndex: 2. - - window := presenter openDialogWithSpec. - window triggerCancelAction. - - self assert: presenter isCancelled. - self assert: presenter selectedItem equals: nil. -] diff --git a/src/Interactions-Widgets-Tests/package.st b/src/Interactions-Widgets-Tests/package.st deleted file mode 100644 index 2df7230..0000000 --- a/src/Interactions-Widgets-Tests/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : 'Interactions-Widgets-Tests' } diff --git a/src/Interactions-Widgets/ITConfirmationPresenter.class.st b/src/Interactions-Widgets/ITConfirmationPresenter.class.st deleted file mode 100644 index e6e86ee..0000000 --- a/src/Interactions-Widgets/ITConfirmationPresenter.class.st +++ /dev/null @@ -1,20 +0,0 @@ -" -I ask the user a confirmation of its intent. -I open myself in a dialog box. -" -Class { - #name : 'ITConfirmationPresenter', - #superclass : 'ITInformationPresenter', - #category : 'Interactions-Widgets', - #package : 'Interactions-Widgets' -} - -{ #category : 'example' } -ITConfirmationPresenter class >> example [ - (self on: ITConfirmation example) openDialogWithSpec -] - -{ #category : 'private' } -ITConfirmationPresenter >> icon [ - ^ (self iconNamed: #question) magnifyBy: 2 -] diff --git a/src/Interactions-Widgets/ITInformationPresenter.class.st b/src/Interactions-Widgets/ITInformationPresenter.class.st deleted file mode 100644 index bc7c706..0000000 --- a/src/Interactions-Widgets/ITInformationPresenter.class.st +++ /dev/null @@ -1,66 +0,0 @@ -" -I notify the user of different kind of information: alert, abort, accessDenied. -I open myself in a dialog box. -" -Class { - #name : 'ITInformationPresenter', - #superclass : 'SpPresenterWithModel', - #instVars : [ - 'iconPresenter', - 'messageText' - ], - #category : 'Interactions-Widgets', - #package : 'Interactions-Widgets' -} - -{ #category : 'specs' } -ITInformationPresenter class >> defaultSpec [ - ^ SpBoxLayout newHorizontal - add: #iconPresenter width: 150; - add: #messageText; - yourself -] - -{ #category : 'example' } -ITInformationPresenter class >> example [ - (self on: ITInformation example) openDialogWithSpec -] - -{ #category : 'private' } -ITInformationPresenter >> icon [ - self model type = #abort - ifTrue: [ ^ (self iconNamed: #stop) magnifyBy: 5 ]. - self model type = #alert - ifTrue: [ ^ (self iconNamed: #warning) magnifyBy: 5 ]. - self model type = #deny - ifTrue: [ ^ (self iconNamed: #lock) magnifyBy: 5 ]. - ^ self iconNamed: #blank -] - -{ #category : 'initialization' } -ITInformationPresenter >> initialExtent [ - - ^ (self currentWorld extent x / 2) @ 200 -] - -{ #category : 'initialization' } -ITInformationPresenter >> initializePresenters [ - iconPresenter := self newImage - image: self icon; - yourself. - messageText := self newText - text: self model message; - disable; - yourself. -] - -{ #category : 'initialization' } -ITInformationPresenter >> initializeWindow: aWindowPresenter [ - super initializeWindow: aWindowPresenter. - aWindowPresenter title: self model title -] - -{ #category : 'private' } -ITInformationPresenter >> messageText [ - ^ messageText -] diff --git a/src/Interactions-Widgets/ITItemsChooserPresenter.class.st b/src/Interactions-Widgets/ITItemsChooserPresenter.class.st deleted file mode 100644 index 0c1e7ee..0000000 --- a/src/Interactions-Widgets/ITItemsChooserPresenter.class.st +++ /dev/null @@ -1,181 +0,0 @@ -" -I'm a widget use to select one or more element from a collection - -API - -beMultiselection - turn to multiselection by adding checkbox - -selectedItem - return the selected Item - -selectedItems - return a collection of Item -" -Class { - #name : 'ITItemsChooserPresenter', - #superclass : 'SpPresenter', - #instVars : [ - 'tablePresenter', - 'stringColumnDisplayBlock', - 'columns', - 'selectedItems', - 'items', - 'isMultiSelection' - ], - #classVars : [ - 'Columns' - ], - #category : 'Interactions-Widgets', - #package : 'Interactions-Widgets' -} - -{ #category : 'specs' } -ITItemsChooserPresenter class >> defaultSpec [ - ^ SpBoxLayout newVertical - add: #tablePresenter; - yourself -] - -{ #category : 'instance creation' } -ITItemsChooserPresenter class >> example [ - | presenter | - presenter := ITItemsChooserPresenter openOn: (1 to: 10). - presenter isCancelled - ifTrue: [ ^ self inform: 'Item chooser has been cancelled!' ]. - self inform: 'You clicked accept button'. - presenter selectedItem inspect -] - -{ #category : 'instance creation' } -ITItemsChooserPresenter class >> exampleMultiSelection [ - | presenter | - presenter := ITItemsChooserPresenter new - model: (1 to: 10); - beMultipleSelection; - openModalWithSpec; - yourself. - presenter isCancelled - ifTrue: [ ^ self inform: 'Item chooser has been cancelled!' ]. - self inform: 'You clicked accept button'. - presenter selectedItems inspect -] - -{ #category : 'instance creation' } -ITItemsChooserPresenter class >> exampleSingleSelection [ - | presenter | - presenter := ITItemsChooserPresenter new - model: (1 to: 10); - displayBlock: [ :item | item * 2 ]; - openModalWithSpec; - yourself. - presenter isCancelled - ifTrue: [ ^ self inform: 'Item chooser has been cancelled!' ]. - self inform: 'You clicked accept button'. - presenter selectedItem inspect -] - -{ #category : 'class initialization' } -ITItemsChooserPresenter class >> initialize [ - Columns := { SpStringTableColumn title: 'name' evaluated: [:item | item asString ] } -] - -{ #category : 'instance creation' } -ITItemsChooserPresenter class >> openOn: aCollection [ - ^ self - openOn: aCollection - withDisplayBlock: [ :item | item asString ] -] - -{ #category : 'instance creation' } -ITItemsChooserPresenter class >> openOn: aCollection withDisplayBlock: aDisplayBlock [ - | presenter | - presenter := self new. - presenter - model: aCollection; - displayBlock: aDisplayBlock; - openModalWithSpec. - ^ presenter -] - -{ #category : 'api' } -ITItemsChooserPresenter >> beMultipleSelection [ - isMultiSelection := true. - self - columns: - {self checkBoxColumn. - (SpStringTableColumn evaluated: [ :item | item asString ])} -] - -{ #category : 'private' } -ITItemsChooserPresenter >> checkBoxColumn [ - ^ (SpCheckBoxTableColumn - evaluated: [ :item | selectedItems includes: item ]) - onActivation: [ :item | selectedItems add: item ]; - onDesactivation: [ :item | selectedItems remove: item ]; - width: 30 -] - -{ #category : 'api' } -ITItemsChooserPresenter >> columns: aCollectionOfColumn [ - tablePresenter columns: aCollectionOfColumn -] - -{ #category : 'api' } -ITItemsChooserPresenter >> displayBlock: aDisplayBlock [ - isMultiSelection - ifTrue: [ self - columns: - {self checkBoxColumn. - (self newStringTableColumnEvaluated: aDisplayBlock)} ] - ifFalse: - [ self columns: {(self newStringTableColumnEvaluated: aDisplayBlock)} ] -] - -{ #category : 'initialization' } -ITItemsChooserPresenter >> initialize [ - super initialize. - selectedItems := OrderedCollection new. - isMultiSelection := false -] - -{ #category : 'initialization' } -ITItemsChooserPresenter >> initializeWidgets [ - columns := Columns. - tablePresenter := self newTable. - tablePresenter columns: columns. - tablePresenter selectIndex: 1 -] - -{ #category : 'api' } -ITItemsChooserPresenter >> isCancelled [ - ^ self window isCancelled -] - -{ #category : 'api' } -ITItemsChooserPresenter >> model: aCollection [ - tablePresenter items: aCollection. - items := aCollection copy -] - -{ #category : 'private' } -ITItemsChooserPresenter >> newStringTableColumnEvaluated: aDisplayBlock [ - ^ SpStringTableColumn evaluated: aDisplayBlock -] - -{ #category : 'api' } -ITItemsChooserPresenter >> selectedItem [ - ^ self isCancelled - ifTrue: [ nil ] - ifFalse: [ tablePresenter selection selectedItem ] -] - -{ #category : 'api' } -ITItemsChooserPresenter >> selectedItems [ - ^ selectedItems -] - -{ #category : 'accessing' } -ITItemsChooserPresenter >> tablePresenter [ - ^ tablePresenter -] diff --git a/src/Interactions-Widgets/SpConfirmDialog.extension.st b/src/Interactions-Widgets/SpConfirmDialog.extension.st new file mode 100644 index 0000000..a9f689c --- /dev/null +++ b/src/Interactions-Widgets/SpConfirmDialog.extension.st @@ -0,0 +1,12 @@ +Extension { #name : 'SpConfirmDialog' } + +{ #category : '*Interactions-Widgets' } +SpConfirmDialog class >> for: aConfirmation [ + + ^ self new + title: aConfirmation title; + label: aConfirmation message; + acceptLabel: aConfirmation yesLabel; + cancelLabel: aConfirmation noLabel; + yourself +] diff --git a/src/Interactions-Widgets/SpDialogPresenter.extension.st b/src/Interactions-Widgets/SpDialogPresenter.extension.st new file mode 100644 index 0000000..6d1556a --- /dev/null +++ b/src/Interactions-Widgets/SpDialogPresenter.extension.st @@ -0,0 +1,6 @@ +Extension { #name : 'SpDialogPresenter' } + +{ #category : '*Interactions-Widgets' } +SpDialogPresenter >> doInteraction [ + ^ self openDialog +] diff --git a/src/Interactions-Widgets/SpInformDialog.extension.st b/src/Interactions-Widgets/SpInformDialog.extension.st new file mode 100644 index 0000000..aa285c5 --- /dev/null +++ b/src/Interactions-Widgets/SpInformDialog.extension.st @@ -0,0 +1,10 @@ +Extension { #name : 'SpInformDialog' } + +{ #category : '*Interactions-Widgets' } +SpInformDialog class >> for: anITInformation [ + + ^ self new + title: anITInformation title; + label: anITInformation message; + yourself +] diff --git a/src/Interactions-Widgets/SpecInteraction.class.st b/src/Interactions-Widgets/SpecInteraction.class.st new file mode 100644 index 0000000..0e68f0f --- /dev/null +++ b/src/Interactions-Widgets/SpecInteraction.class.st @@ -0,0 +1,54 @@ +" +I am the entity in charge of receiving User interactions and convert them to Spec widgets. +I use double dispatch on User interactions entity. +" +Class { + #name : 'SpecInteraction', + #superclass : 'Object', + #classInstVars : [ + 'default' + ], + #category : 'Interactions-Widgets', + #package : 'Interactions-Widgets' +} + +{ #category : 'accessing' } +SpecInteraction class >> default [ + + ^ default ifNil:[ default := self new ] +] + +{ #category : 'querying' } +SpecInteraction >> for: aUserInteraction [ + + ^ aUserInteraction widgetFor: self +] + +{ #category : 'accessing' } +SpecInteraction >> widgetForConfirmation: aConfirmation [ + + ^ SpConfirmDialog for: aConfirmation +] + +{ #category : 'accessing' } +SpecInteraction >> widgetForFileRequest: aFileRequest [ + + | widget widgetClass | + widgetClass := aFileRequest isForFileOpening + ifTrue: [ StOpenFilePresenter ] + ifFalse: [ StOpenDirectoryPresenter ]. + widget := widgetClass for: aFileRequest. + + aFileRequest currentFolder ifNotNil: [ :folder | widget openFolder: folder ]. + aFileRequest filter ifNotNil: [ :filter | + widget fileNavigationSystem filter: + (StCustomExtensionsFilter extensions: { filter }) ]. + + ^ widget +] + +{ #category : 'accessing' } +SpecInteraction >> widgetForInformation: anITInformation [ + + ^ SpInformDialog for: anITInformation +] diff --git a/src/Interactions-Widgets/SpecUIManager.class.st b/src/Interactions-Widgets/SpecUIManager.class.st deleted file mode 100644 index de7dd39..0000000 --- a/src/Interactions-Widgets/SpecUIManager.class.st +++ /dev/null @@ -1,11 +0,0 @@ -Class { - #name : 'SpecUIManager', - #superclass : 'UIManager', - #category : 'Interactions-Widgets', - #package : 'Interactions-Widgets' -} - -{ #category : 'ui requests' } -SpecUIManager >> inform: anITInformation [ - ^ (ITInformationPresenter on: anITInformation) openDialogWithSpec -] diff --git a/src/Interactions-Widgets/StFileSystemPresenter.extension.st b/src/Interactions-Widgets/StFileSystemPresenter.extension.st new file mode 100644 index 0000000..68545d9 --- /dev/null +++ b/src/Interactions-Widgets/StFileSystemPresenter.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'StFileSystemPresenter' } + +{ #category : '*Interactions-Widgets' } +StFileSystemPresenter >> doInteraction [ + + ^ self open +] diff --git a/src/Interactions/ITConfirmation.class.st b/src/Interactions/ITConfirmation.class.st index 1c59a48..9f6cc1b 100644 --- a/src/Interactions/ITConfirmation.class.st +++ b/src/Interactions/ITConfirmation.class.st @@ -5,7 +5,7 @@ My actions labels can be customized. " Class { #name : 'ITConfirmation', - #superclass : 'ITUserInteraction', + #superclass : 'ITUserInteractionWithMessage', #instVars : [ 'cancelLabel', 'cancelBlock', @@ -93,6 +93,12 @@ ITConfirmation >> questionWithoutCancel [ ^ UIManager default questionWithoutCancel: message title: title ] +{ #category : 'private' } +ITConfirmation >> widgetFor: aBackend [ + + ^ aBackend widgetForConfirmation: self +] + { #category : 'accessing' } ITConfirmation >> yesLabel [ ^ trueLabel ifNil: [ trueLabel := 'yes' ] diff --git a/src/Interactions/ITFileRequest.class.st b/src/Interactions/ITFileRequest.class.st index eb14842..2b93346 100644 --- a/src/Interactions/ITFileRequest.class.st +++ b/src/Interactions/ITFileRequest.class.st @@ -1,120 +1,67 @@ " -I'm using to interact with user by asking to choose a File/Directory or save a directory +I'm used to interact with user by asking to choose a File/Directory or save a directory -for more information about how to customize -look at - FDFileDialogPresenter clas >> #fullExample " Class { #name : 'ITFileRequest', - #superclass : 'Object', + #superclass : 'ITUserInteraction', #instVars : [ - 'previewer', - 'columns', - 'bookmarks', - 'okAction', - 'defaultFolder', - 'filtersCustomization', - 'extensionString' + 'filter', + 'currentFolder', + 'isForFileOpening' ], #category : 'Interactions', #package : 'Interactions' } -{ #category : 'example' } -ITFileRequest class >> example [ - ITFileRequest new - "previewer: ;" - "columns: ;" - "bookmarks: ;" - okAction: [:fileReference | fileReference inspect ] ; - "defaultFolder: ;" - "filtersCustomization: ;" - "extensionString: ;" - chooseDirectory -] +{ #category : 'configuring' } +ITFileRequest >> beForFolderOpening [ -{ #category : 'accessing' } -ITFileRequest >> bookmarks: aCollectionOfBookmark [ - bookmarks := aCollectionOfBookmark + isForFileOpening := false ] -{ #category : 'action' } -ITFileRequest >> chooseDirectory [ - " - model := ITFileRequest new. - model defaultFolder: '/home' asFileReference. - model chooseDirectory" - - | fileDialog | - fileDialog := FDOpenDirectoryDialog new. - self commonActionFor: fileDialog. - ^ fileDialog confirm -] +{ #category : 'accessing' } +ITFileRequest >> currentFolder [ -{ #category : 'action' } -ITFileRequest >> chooseFile [ - | fileDialog | - fileDialog := FDOpenFileDialog new. - self commonActionFor: fileDialog. - ^ fileDialog confirm + ^ currentFolder ] { #category : 'accessing' } -ITFileRequest >> columns: aCollectionOfColumn [ - columns := aCollectionOfColumn -] +ITFileRequest >> currentFolder: aFileReference [ -{ #category : 'private' } -ITFileRequest >> commonActionFor: fileDialog [ - self configureFileDialog: fileDialog. - fileDialog openModalWithSpec + aFileReference exists ifFalse: [ ^ self ]. + + currentFolder := aFileReference ] -{ #category : 'action' } -ITFileRequest >> configurationForSaveFileDialog: fileDialog [ - extensionString ifNotNil: [ fileDialog extension: extensionString ]. - self commonActionFor: fileDialog +{ #category : 'accessing' } +ITFileRequest >> filter [ + + ^ filter ] -{ #category : 'setup' } -ITFileRequest >> configureFileDialog: fileDialog [ - "I do this because fileDialog have default value" +{ #category : 'accessing' } +ITFileRequest >> filter: aFilterName [ - previewer ifNotNil: [ fileDialog previewer: previewer ]. - columns ifNotNil: [ fileDialog column: columns ]. - bookmarks ifNotNil: [ fileDialog bookmarks: bookmarks ]. - okAction ifNotNil: [ fileDialog okAction: okAction ]. - defaultFolder ifNotNil: [ fileDialog defaultFolder: defaultFolder ]. - filtersCustomization - ifNotNil: [ fileDialog filtersCustomization: filtersCustomization ] + "will configure the file chooser to only allow files with the selected filter" + filter := aFilterName ] -{ #category : 'accessing' } -ITFileRequest >> defaultFolder: aFileReference [ - defaultFolder := aFileReference -] +{ #category : 'initialization' } +ITFileRequest >> initialize [ -{ #category : 'accessing' } -ITFileRequest >> filtersCustomization: aCollectionOfFilter [ - filtersCustomization := aCollectionOfFilter + super initialize. + isForFileOpening := true. ] -{ #category : 'accessing' } -ITFileRequest >> okAction: aBlockUseByTheOkButton [ - "this block take one argument , a FileReference" - okAction := aBlockUseByTheOkButton +{ #category : 'testing' } +ITFileRequest >> isForFileOpening [ + + ^ isForFileOpening ] -{ #category : 'accessing' } -ITFileRequest >> previewer: aPreviewer [ - previewer := aPreviewer -] +{ #category : 'private' } +ITFileRequest >> widgetFor: aBackend [ -{ #category : 'action' } -ITFileRequest >> saveFile [ - | fileDialog | - fileDialog := FDSaveFileDialog new. - self configurationForSaveFileDialog: fileDialog. - ^ fileDialog selectedFile + ^ aBackend widgetForFileRequest: self ] diff --git a/src/Interactions/ITInformation.class.st b/src/Interactions/ITInformation.class.st index 9bc5841..afaed31 100644 --- a/src/Interactions/ITInformation.class.st +++ b/src/Interactions/ITInformation.class.st @@ -2,11 +2,10 @@ I represent an information to be communicated to the user. I can be configured to be an information of different types: abort, access denied, alert. -I'm used by the UIManager to show (or not, dependending on the interaction mode) a UI corrresponding to this model. " Class { #name : 'ITInformation', - #superclass : 'ITUserInteraction', + #superclass : 'ITUserInteractionWithMessage', #instVars : [ 'type' ], @@ -45,3 +44,9 @@ ITInformation >> beAlert [ ITInformation >> type [ ^ type ] + +{ #category : 'private' } +ITInformation >> widgetFor: aBackend [ + + ^ aBackend widgetForInformation: self +] diff --git a/src/Interactions/ITRequest.class.st b/src/Interactions/ITRequest.class.st index 2c4ecf5..5ad111a 100644 --- a/src/Interactions/ITRequest.class.st +++ b/src/Interactions/ITRequest.class.st @@ -1,6 +1,10 @@ +" +I represent an information to be asked to the user. +I can be configured to be request a simple data, a password, use enttry completion. +" Class { #name : 'ITRequest', - #superclass : 'ITUserInteraction', + #superclass : 'ITUserInteractionWithMessage', #instVars : [ 'initialAnswer', 'validationBlock', diff --git a/src/Interactions/ITUIChoice.class.st b/src/Interactions/ITUIChoice.class.st index b29ec94..f0a686e 100644 --- a/src/Interactions/ITUIChoice.class.st +++ b/src/Interactions/ITUIChoice.class.st @@ -4,7 +4,7 @@ Values are provided with a collection of objects. " Class { #name : 'ITUIChoice', - #superclass : 'ITUserInteraction', + #superclass : 'ITUserInteractionWithMessage', #instVars : [ 'items', 'displayBlock' diff --git a/src/Interactions/ITUserInteraction.class.st b/src/Interactions/ITUserInteraction.class.st index ef1c19c..171c3ca 100644 --- a/src/Interactions/ITUserInteraction.class.st +++ b/src/Interactions/ITUserInteraction.class.st @@ -1,30 +1,16 @@ " -I'm an abstraction of a user interactionr. -I factorize some common information of my hierarchy. - -My subclasses are used by the UIManager to show (or not, dependending on the interaction mode) a UI corrresponding to this model. +I'm an abstraction of a user interaction. " Class { #name : 'ITUserInteraction', #superclass : 'Object', #instVars : [ - 'message', 'title' ], #category : 'Interactions', #package : 'Interactions' } -{ #category : 'accessing' } -ITUserInteraction >> message [ - ^ message -] - -{ #category : 'accessing' } -ITUserInteraction >> message: anObject [ - message := anObject -] - { #category : 'accessing' } ITUserInteraction >> title [ ^ title diff --git a/src/Interactions/ITUserInteractionWithMessage.class.st b/src/Interactions/ITUserInteractionWithMessage.class.st new file mode 100644 index 0000000..cabcd22 --- /dev/null +++ b/src/Interactions/ITUserInteractionWithMessage.class.st @@ -0,0 +1,22 @@ +" +I'm an abstraction of a user interaction that provides a message. +" +Class { + #name : 'ITUserInteractionWithMessage', + #superclass : 'ITUserInteraction', + #instVars : [ + 'message' + ], + #category : 'Interactions', + #package : 'Interactions' +} + +{ #category : 'accessing' } +ITUserInteractionWithMessage >> message [ + ^ message +] + +{ #category : 'accessing' } +ITUserInteractionWithMessage >> message: anObject [ + message := anObject +] diff --git a/src/Interactions/UIManager2.class.st b/src/Interactions/UIManager2.class.st deleted file mode 100644 index 81c8db8..0000000 --- a/src/Interactions/UIManager2.class.st +++ /dev/null @@ -1,763 +0,0 @@ -Class { - #name : 'UIManager2', - #superclass : 'Object', - #classVars : [ - 'Default' - ], - #category : 'Interactions', - #package : 'Interactions' -} - -{ #category : 'initialization' } -UIManager2 class >> default [ - ^ Default - ifNil: [ - "Note: The way the following is phrased ensures that you can always make 'more specific' managers merely by subclassing a tool builder and implementing a more specific way of reacting to #isActiveManager. For example, a BobsUIManager can subclass MorphicUIManager and will be considered before the parent (generic MorphicUIManager)." - self allSubclasses - detect: [ :any | any isActiveManager and: [ any subclasses noneSatisfy: [ :sub | sub isActiveManager ] ] ] - ifFound: [ :mgrClass | Default := mgrClass new ]. - Default ] -] - -{ #category : 'initialization' } -UIManager2 class >> default: aUIManager [ - - Default ifNotNil: [ :mgr | mgr deactivate ]. - Default := aUIManager. - Default activate -] - -{ #category : 'initialization' } -UIManager2 class >> forCurrentSystemConfiguration [ - ^(self allSubclasses - detect: [ :any | - any isValidForCurrentSystemConfiguration - and: [ any subclasses noneSatisfy: #isValidForCurrentSystemConfiguration ] ] - ifNone: [ NonInteractiveUIManager ]) new -] - -{ #category : 'initialization' } -UIManager2 class >> isActiveManager [ - "Answer whether I should act as the active UI manager." - - ^false -] - -{ #category : 'testing' } -UIManager2 class >> isValidForCurrentSystemConfiguration [ - - ^false -] - -{ #category : 'utilities' } -UIManager2 class >> nonInteractiveDuring: aBlock [ - | currentManager | - currentManager := self default. - currentManager nonInteractiveManager. - - aBlock ensure: [ currentManager beDefault ] -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> abort: aStringOrText [ - "Open an error dialog." -self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> abort: aStringOrText title: aString [ - "Open an error dialog." -self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'private' } -UIManager2 >> activate [ -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> alert: aStringOrText [ - "Open an alert dialog." - self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> alert: aStringOrText title: aString [ - "Open an alert dialog." - self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> alert: aStringOrText title: aString configure: aBlock [ - "Open an alert dialog. - Configure the dialog with the 1 argument block before opening modally." - self deprecated: 'deprecated'. - ^self subclassResponsibility -] - -{ #category : 'private' } -UIManager2 >> beDefault [ - - self class default: self -] - -{ #category : 'ui requests' } -UIManager2 >> chooseDirectory [ - "Let the user choose a directory." - - ^self chooseDirectoryFrom: FileSystem workingDirectory -] - -{ #category : 'ui requests' } -UIManager2 >> chooseDirectory: label [ - "Let the user choose a directory." - - ^self chooseDirectory: label from: FileSystem workingDirectory -] - -{ #category : 'ui requests' } -UIManager2 >> chooseDirectory: label from: dir [ - "Let the user choose a directory." - - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> chooseDirectoryFrom: dir [ - "Let the user choose a directory" - - ^self chooseDirectory: nil from: dir -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self chooseFrom: aList lines: #() -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList lines: linesArray [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self chooseFrom: aList lines: linesArray title: '' -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList lines: linesArray message: messageString [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self - chooseFrom: aList - lines: linesArray - message: messageString - title: '' -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList lines: linesArray message: messageString title: aString [ - "Choose an item from the given list. Answer the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self - chooseFrom: aList - lines: linesArray - title: - (aString - ifEmpty: [ messageString ] - ifNotEmpty: [ aString , String cr , messageString ]) -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList lines: linesArray title: aString [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList message: messageString [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self chooseFrom: aList lines: #() message: messageString -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList message: messageString title: aString [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self - chooseFrom: aList - lines: #() - message: messageString - title: aString -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList title: aString [ - "Choose an item from the given list. Answer the index of the selected item." - - self deprecated: 'store into ' , ITUIChoice className. - ^ self chooseFrom: aList lines: #() title: aString -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: labelList values: valueList [ - "Choose an item from the given list. Answer the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self chooseFrom: labelList values: valueList lines: #() -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: labelList values: valueList lines: linesArray [ - "Choose an item from the given list. Answer the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self chooseFrom: labelList values: valueList lines: linesArray title: '' -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList values: valueList lines: linesArray message: messageString [ - "Choose an item from the given list. Answer the index of the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self chooseFrom: aList values: valueList lines: linesArray message: messageString title: '' -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: labelList values: valueList lines: linesArray message: messageString title: aString [ - "Choose an item from the given list. Answer the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self - chooseFrom: labelList - values: valueList - lines: linesArray - title: (aString - ifEmpty: [ messageString ] - ifNotEmpty: [ aString, String cr, messageString ]) -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: labelList values: valueList lines: linesArray title: aString [ - "Choose an item from the given list. Answer the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList values: valueList message: messageString [ - "Choose an item from the given list. Answer the index of the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self chooseFrom: aList values: valueList lines: #() message: messageString -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: aList values: valueList message: messageString title: aString [ - "Choose an item from the given list. Answer the index of the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self chooseFrom: aList values: valueList lines: #() message: messageString title: aString -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFrom: labelList values: valueList title: aString [ - "Choose an item from the given list. Answer the selected item." - self deprecated: 'store into ' , ITUIChoice className. - ^self chooseFrom: labelList values: valueList lines: #() title: aString -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFullFileNameMatching: patterns [ - "Let the user choose a file matching the given patterns" - - ^self chooseFullFileNameMatching: patterns label: nil -] - -{ #category : 'ui requests' } -UIManager2 >> chooseFullFileNameMatching: patterns label: labelString [ - "Let the user choose a file matching the given patterns" - - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> chooseOrRequestFrom: labelList values: valueList lines: linesArray title: aString [ - - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> confirm: queryString [ - "Put up a yes/no menu with caption queryString. Answer true if the - response is yes, false if no. This is a modal question--the user must - respond yes or no." - self deprecated: 'use question instead'. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> confirm: queryString label: titleString [ - self deprecated: 'store into ' , ITConfirmation className. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> confirm: queryString label: title trueChoice: trueChoice falseChoice: falseChoice cancelChoice: cancelChoice default: defaultOption [ - "Put up a yes/no/cancel menu with caption queryString. The actual wording for the choices will be as provided in the trueChoice, falseChoice and cancelChoice parameters. - defaultOption should be one of true, false or nil to set the default button. - Answer true if the response is the true-choice, false if it's the false-choice, nil if the cancelChoice. - This is a modal question -- the user must respond." - self deprecated: 'store into ' , ITConfirmation className. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> confirm: aString orCancel: cancelBlock [ - "Put up a yes/no/cancel menu with caption aString. Answer true if - the response is yes, false if no. If cancel is chosen, evaluate - cancelBlock. This is a modal question--the user must respond yes or no." - self deprecated: 'store into ' , ITConfirmation className. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> confirm: queryString trueChoice: trueChoice falseChoice: falseChoice [ - "Put up a yes/no menu with caption queryString. The actual wording for the two choices will be as provided in the trueChoice and falseChoice parameters. Answer true if the response is the true-choice, false if it's the false-choice. - This is a modal question -- the user must respond one way or the other." - self deprecated: 'store into ' , ITConfirmation className. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> confirm: queryString trueChoice: trueChoice falseChoice: falseChoice cancelChoice: cancelChoice default: aSymbol [ - "Put up a yes/no/cancel menu with caption queryString. The actual wording for the choices will be as provided in the trueChoice, falseChoice and cancelChoice parameters. - Default should be one of #yes, #no or #cancel to set the default button. - Answer true if the response is the true-choice, false if it's the false-choice, nil if the cancelChoice. - This is a modal question -- the user must respond." - self deprecated: 'store into ' , ITConfirmation className. - ^self subclassResponsibility -] - -{ #category : 'private' } -UIManager2 >> deactivate [ -] - -{ #category : 'debug' } -UIManager2 >> debugProcess: process context: context label: title fullView: bool [ - self deprecated: 'use ITDebug instead'. - self debugProcess: process context: context label: title fullView: bool notification: nil -] - -{ #category : 'debug' } -UIManager2 >> debugProcess: process context: context label: title fullView: bool notification: notificationString [ - self deprecated: ''. - self subclassResponsibility -] - -{ #category : 'ui process' } -UIManager2 >> defer: aBlock [ - "Evaluate the given Block in the UI thread as soon as there is nothing scheduled. - Evaluate immediately when there is no UI" - - aBlock value -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> deny: aStringOrText [ - "Open a denial dialog." - self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> deny: aStringOrText title: aString [ - "Open a denial dialog." -self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'display' } -UIManager2 >> displayProgress: titleString from: minVal to: maxVal during: workBlock [ - "SystemProgressMorph show: titleString from: minVal to: during: " - - ^ workBlock asJob - title: titleString; - min: minVal; - max: maxVal; - run -] - -{ #category : 'ui requests' } -UIManager2 >> edit: aText [ - "Open an editor on the given string/text." - - ^self edit: aText label: nil -] - -{ #category : 'ui requests' } -UIManager2 >> edit: aText label: labelString [ - "Open an editor on the given string/text." - - ^self edit: aText label: labelString accept: nil -] - -{ #category : 'ui requests' } -UIManager2 >> edit: aText label: labelString accept: aBlockOrNil [ - "Open an editor on the given string/text." - - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> fontFromUser: priorFont [ - - self subclassResponsibility -] - -{ #category : 'error handling' } -UIManager2 >> handleError: anError [ - self deprecated: 'Store into ITError'. - self handleError: anError log: true -] - -{ #category : 'error handling' } -UIManager2 >> handleError: anError log: shouldLog [ - self deprecated: 'Store into ITError'. - self subclassResponsibility -] - -{ #category : 'accessing' } -UIManager2 >> headlessManager [ - "Answer an instance of headless manager, which will be used when image runs headless - and non-interactive. We put it here, so subclasses can override it." - - ^CommandLineUIManager replacing: self -] - -{ #category : 'ui requests' } -UIManager2 >> inform: aString [ - "Display a message for the user to read and then dismiss." - self deprecated: 'store into ' , ITNotification className. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> informUser: aString during: aBlock [ - "Display a message above (or below if insufficient room) the cursor - during execution of the given block. - UIManager default informUser: 'Just a sec!' during: [(Delay forSeconds: 1) wait]. - " - self deprecated: 'store into ' , ITProgressNotification className. - ^self informUserDuring: [:bar | bar label: aString. aBlock value] -] - -{ #category : 'ui requests' } -UIManager2 >> informUserDuring: aBlock [ - "Display a message above (or below if insufficient room) the cursor - during execution of the given block. - UIManager default informUserDuring:[:bar| - #(one two three) do:[:info| - bar label: info. - (Delay forSeconds: 1) wait]]" - - self deprecated: 'store into ' , ITProgressNotification className. - ^ self subclassResponsibility -] - -{ #category : 'ui process' } -UIManager2 >> interruptName: labelString preemptedProcess: theInterruptedProcess [ - "Create a Notifier on the active scheduling process with the given label." - - ^self error: 'Cannot perform a given request' -] - -{ #category : 'error handling' } -UIManager2 >> logError: anError [ - - Smalltalk - logError: anError messageText - inContext: anError signalerContext -] - -{ #category : 'default actions' } -UIManager2 >> lowSpaceWatcherDefaultAction: preemptedProcess [ -] - -{ #category : 'ui requests' } -UIManager2 >> merge: merger informing: aString [ - - self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> multiLineRequest: queryString initialAnswer: defaultAnswer answerHeight: answerHeight [ - "Create a multi-line instance of me whose question is queryString with - the given initial answer. Invoke it centered at the given point, and - answer the string the user accepts. Answer nil if the user cancels. An - empty string returned means that the ussr cleared the editing area and - then hit 'accept'. Because multiple lines are invited, we ask that the user - use the ENTER key, or (in morphic anyway) hit the 'accept' button, to - submit; that way, the return key can be typed to move to the next line." - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'display' } -UIManager2 >> newDisplayDepthNoRestore: pixelSize [ - - self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> newMenuIn: aThemedMorph for: aModel [ - "Answer a new menu." - self deprecated: 'storeIntoITMenuInFor'. - ^self subclassResponsibility -] - -{ #category : 'non-interactive' } -UIManager2 >> nonInteractiveManager [ - "Answer an instance of non-interactive manager, which will be used when image runs headless. - We put it here, so subclasses can override it." - - ^NonInteractiveUIManager replacing: self -] - -{ #category : 'events' } -UIManager2 >> onEventSensorStartup: anEventSensor [ - - -] - -{ #category : 'default actions' } -UIManager2 >> onFontsChanged [ - 1 halt. - -] - -{ #category : 'events' } -UIManager2 >> onPrimitiveError: aString [ -] - -{ #category : 'ui requests' } -UIManager2 >> openComparisionFrom: targetMethodSource to: originalMethodSource belongingTo: aClass from: aChange [ - self flag: #notImplementor. - self deprecated: 'store into ITCodeDiff'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> proceed: aStringOrText [ - "Open a proceed dialog." - self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> proceed: aStringOrText title: aString [ - "Open a proceed dialog and answer true if not cancelled, false otherwise." - self deprecated: 'reification'. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> question: aStringOrText [ - "Open a question dialog." - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> question: aStringOrText title: aString [ - "Open a question dialog and answer true if yes, - false if no and nil if cancelled." -self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> questionWithoutCancel: aStringOrText [ - "Open a question dialog." - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> questionWithoutCancel: aStringOrText title: aString [ - "Open a question dialog and answer true if yes, - false if no and nil if cancelled." -self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> request: queryString [ - "Create an instance of me whose question is queryString. Invoke it - centered at the cursor, and answer the string the user accepts. Answer - the empty string if the user cancels." - self flag: #sameA. - self deprecated: ''. - ^self request: queryString initialAnswer: '' -] - -{ #category : 'ui requests' } -UIManager2 >> request: queryString entryCompletion: anEntryCompletion [ - "Create an instance of me whose question is queryString. Invoke it - centered at the cursor, and answer the string the user accepts. Answer - the empty string if the user cancels." - self flag: #sameA. - self deprecated: ''. - ^self request: queryString initialAnswer: '' entryCompletion: anEntryCompletion -] - -{ #category : 'ui requests' } -UIManager2 >> request: queryString initialAnswer: defaultAnswer [ - "Create an instance of me whose question is queryString with the given initial answer. Answer the - string the user accepts. Answer the empty string if the user cancels." - self flag: #sameA. -self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> request: queryString initialAnswer: defaultAnswer entryCompletion: anEntryCompletion [ - "Create an instance of me whose question is queryString with the given - initial answer. Invoke it centered at the given point, and answer the - string the user accepts. Answer the empty string if the user cancels." - self flag: #sameA. - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> request: aStringOrText initialAnswer: defaultAnswer title: aTitle [ - "Create an instance of me whose question is queryString with the given - initial answer. Invoke it centered at the given point, and answer the - string the user accepts. Answer the empty string if the user cancels." - self flag: #sameA. - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> request: aStringOrText initialAnswer: defaultAnswer title: aTitle entryCompletion: anEntryCompletion [ - "Create an instance of me whose question is queryString with the given - initial answer. Invoke it centered at the given point, and answer the - string the user accepts. Answer the empty string if the user cancels." - self flag: #sameA. - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui requests' } -UIManager2 >> requestPassword: queryString [ - "Create an instance of me whose question is queryString. Invoke it centered - at the cursor, and answer the string the user accepts. Answer the empty - string if the user cancels." - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'display' } -UIManager2 >> restoreDisplay [ - - self subclassResponsibility -] - -{ #category : 'display' } -UIManager2 >> restoreDisplayAfter: aBlock [ - - self subclassResponsibility -] - -{ #category : 'display' } -UIManager2 >> showWaitCursorWhile: aBlock [ - | process | - process := [ [ true ] "loop until the end of aBlock processing" - whileTrue: [ - Smalltalk logStdErrorDuring: [ :stream | - "Wait wheel in ASCII art" - '\|/-' - do: [ :char | - stream << char. - 0.1 second wait. - stream << Character backspace ] ] ] ] fork. - [ aBlock value ] - ensure: [ process terminate ] -] - -{ #category : 'ui process' } -UIManager2 >> spawnNewProcess [ - "Do nothing by default." -] - -{ #category : 'ui process' } -UIManager2 >> spawnNewProcessIfThisIsUI: suspendedProcess [ - - self uiProcess == suspendedProcess ifTrue: [ - self spawnNewProcess. - ^true - ]. - ^false "no new process was created" - -] - -{ #category : 'default actions' } -UIManager2 >> syntaxErrorNotificationDefaultAction: anException [ - - ^ self subclassResponsibility -] - -{ #category : 'ui process' } -UIManager2 >> terminateUIProcess [ - "Do nothing by default." -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> textEntry: aStringOrText [ - "Open a text entry dialog." - self flag: #sameA. - self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> textEntry: aStringOrText title: aString [ - "Open a text entry dialog." - self flag: #sameA. -self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'ui TEasilyThemed' } -UIManager2 >> textEntry: aStringOrText title: aString entryText: defaultEntryText [ - "Open a text entry dialog." - self flag: #sameA. -self deprecated: ''. - ^self subclassResponsibility -] - -{ #category : 'default actions' } -UIManager2 >> unhandledErrorDefaultAction: anException [ - "Provide a default handling for unhandled error. - We should never reach this code, because it should be overridden by subclasses. - (but we can't put 'self subclassResponsibility' , because it will cause infinite loop, - in case if current ui manager having no override of this method). - This method is only for documentation purposes." - - - Smalltalk snapshot: false andQuit: true -] - -{ #category : 'default actions' } -UIManager2 >> warningDefaultAction: aWarning [ - "Handle warning notification. Should be overidden by subclass." - - self subclassResponsibility -]