diff --git a/src/Spec2-Core/SpAbstractListPresenter.class.st b/src/Spec2-Core/SpAbstractListPresenter.class.st index 83755284..1bc84da2 100644 --- a/src/Spec2-Core/SpAbstractListPresenter.class.st +++ b/src/Spec2-Core/SpAbstractListPresenter.class.st @@ -61,28 +61,6 @@ SpAbstractListPresenter >> activateOnSingleClick [ activateOnSingleClick := true ] -{ #category : 'testing' } -SpAbstractListPresenter >> activatesOnDoubleClick [ - "Answer true if activation event is triggered on double click" - - self - deprecated: 'Use isActiveOnDoubleClick' - transformWith: '`@receiver activatesOnDoubleClick' -> '`@receiver isActiveOnDoubleClick'. - - ^ activateOnSingleClick not -] - -{ #category : 'testing' } -SpAbstractListPresenter >> activatesOnSingleClick [ - "Answer true if activation event is triggered on single click" - - self - deprecated: 'Use isActiveOnSingleClick' - transformWith: '`@receiver activatesOnSingleClick' -> '`@receiver isActiveOnSingleClick'. - - ^ activateOnSingleClick -] - { #category : 'api' } SpAbstractListPresenter >> beMultipleSelection [ "Enable multiple selection." diff --git a/src/Spec2-Core/SpAbstractTreePresenter.class.st b/src/Spec2-Core/SpAbstractTreePresenter.class.st index e36f761c..6c577241 100644 --- a/src/Spec2-Core/SpAbstractTreePresenter.class.st +++ b/src/Spec2-Core/SpAbstractTreePresenter.class.st @@ -47,28 +47,6 @@ SpAbstractTreePresenter >> activateOnSingleClick [ activateOnSingleClick := true ] -{ #category : 'testing' } -SpAbstractTreePresenter >> activatesOnDoubleClick [ - "Answer true if activation event is triggered on double click" - - self - deprecated: 'Use isActiveOnDoubleClick' - transformWith: '`@receiver activatesOnDoubleClick' -> '`@receiver isActiveOnDoubleClick'. - - ^ activateOnSingleClick not -] - -{ #category : 'testing' } -SpAbstractTreePresenter >> activatesOnSingleClick [ - "Answer true if activation event is triggered on single click" - - self - deprecated: 'Use isActiveOnSingleClick' - transformWith: '`@receiver activatesOnSingleClick' -> '`@receiver isActiveOnSingleClick'. - - ^ activateOnSingleClick -] - { #category : 'api' } SpAbstractTreePresenter >> beMultipleSelection [ "Enable multiple selection." diff --git a/src/Spec2-Core/SpApplication.class.st b/src/Spec2-Core/SpApplication.class.st index 96fe2e5a..29cb5dbf 100644 --- a/src/Spec2-Core/SpApplication.class.st +++ b/src/Spec2-Core/SpApplication.class.st @@ -117,15 +117,6 @@ SpApplication >> backend [ backend ] ] -{ #category : 'showing' } -SpApplication >> close [ - - self - deprecated: 'Use #closeAllWindows instead' - transformWith: '`@receiver close' -> '`@receiver closeAllWindows'. - self closeAllWindows -] - { #category : 'accessing' } SpApplication >> closeAllWindows [ diff --git a/src/Spec2-Core/SpDropListPresenter.class.st b/src/Spec2-Core/SpDropListPresenter.class.st index 728ed958..b21394d6 100644 --- a/src/Spec2-Core/SpDropListPresenter.class.st +++ b/src/Spec2-Core/SpDropListPresenter.class.st @@ -163,32 +163,6 @@ SpDropListPresenter >> hasIcons [ each icon isNotNil or: [ (self getIconFor: each) isNotNil ] ] ] ] -{ #category : 'api' } -SpDropListPresenter >> iconBlock [ - "Answer the block that will be used to retrieve the icon to be displayed along with the - elements." - - self - deprecated: 'Please use #displayIcon instead' - transformWith: '`@receiver iconBlock' - -> '`@receiver displayIcon'. - - ^ iconBlock -] - -{ #category : 'api' } -SpDropListPresenter >> iconBlock: aBlock [ - "Answer a block that will be used to retrieve the icon to be displayed along with the elements. - `aBlock` receives one argument (an element from the list)" - - self - deprecated: 'Please use #displayIcon: instead' - transformWith: '`@receiver iconBlock: `@arg' - -> '`@receiver displayIcon: `@arg'. - - iconBlock := aBlock -] - { #category : 'initialization' } SpDropListPresenter >> initialize [ super initialize. diff --git a/src/Spec2-Core/SpDynamicPresenter.class.st b/src/Spec2-Core/SpDynamicPresenter.class.st deleted file mode 100644 index c49e2b5e..00000000 --- a/src/Spec2-Core/SpDynamicPresenter.class.st +++ /dev/null @@ -1,76 +0,0 @@ -" -IMPORTANT: This presenter is obsolete since all layouts now are dynamic. - -This presenter just adds as value the capability to store widgets in a dictionary, which is not really an important need, so we are considering remove it. -Also, it is currently broken. - -I'm a CompsableModel with a dynamic behavior for managing subwidgets and the value holder communicates with them. - -The idea is that instead of having a fix set of valueHolders controlling various aspects of the model. I have a dictionary to hold such elements. - -You can also have a look at DynamicalPopup for an example. - -I provide the following variables and its accessors -- layout to put a layout created dynamically. -- widget is a Dictionary containing my dynamics widgets. - -I'm specializing -- doesNotUnderstand: to search in my dictionary before rise an exception, so that the programmer can simply use accessors to access my dynamic elements. -- openWithSpec to use the layout in my variable if it is not nil. - -I provide the following messages -- instantiateModels: to create instances of subwidgets. It takes a collection of pair, first of each pair is the string to use as key in the dictionary, second is the class name to instantiate. -- assign:to: to put in the dictionary a widget already instantiated. - -todo -- needFullRebuild: -- retrieveSpec: -" -Class { - #name : 'SpDynamicPresenter', - #superclass : 'SpPresenter', - #traits : 'SpTDynamicPresenter', - #classTraits : 'SpTDynamicPresenter classTrait', - #category : 'Spec2-Core-Base', - #package : 'Spec2-Core', - #tag : 'Base' -} - -{ #category : 'instance creation' } -SpDynamicPresenter >> assign: aPresenter to: anInstVarName [ - self presenterAt: anInstVarName put: aPresenter. - aPresenter owner: self -] - -{ #category : 'error handling' } -SpDynamicPresenter >> doesNotUnderstand: aMessage [ - "To make sure that we can use accessors to access the dynamically managed subcomponents." - - ^ self presenterAt: aMessage selector ifAbsent: [ super doesNotUnderstand: aMessage ] -] - -{ #category : 'instance creation' } -SpDynamicPresenter >> instantiatePresenters: aCollectionOfPairs [ - aCollectionOfPairs pairsDo: [ :k :v | self presenterAt: k asSymbol put: (self createInstanceFor: v) ] -] - -{ #category : 'api' } -SpDynamicPresenter >> needFullRebuild: aBoolean [ - - self needRebuild: aBoolean. - self presentersDo: [ :w | w needRebuild: aBoolean ] -] - -{ #category : 'api' } -SpDynamicPresenter >> open [ - - self layout ifNil: [ ^ super open ]. - ^ self asWindow openWith: self layout -] - -{ #category : 'api' } -SpDynamicPresenter >> openModal [ - - self layout ifNil: [ ^ super open ]. - ^ self asModalWindow openWith: self layout -] diff --git a/src/Spec2-Core/SpStringTableColumn.class.st b/src/Spec2-Core/SpStringTableColumn.class.st index 730826b5..d68995f7 100644 --- a/src/Spec2-Core/SpStringTableColumn.class.st +++ b/src/Spec2-Core/SpStringTableColumn.class.st @@ -125,7 +125,7 @@ SpStringTableColumn >> onAcceptEdition: aBlock [ acceptAction := aBlock ] -{ #category : #api } +{ #category : 'api' } SpStringTableColumn >> onTextChanged: aBlock [ "Set the block to execute when cell edition is edited. `aBlock` receives two arguments: @@ -135,7 +135,7 @@ SpStringTableColumn >> onTextChanged: aBlock [ textChanged := aBlock ] -{ #category : #api } +{ #category : 'api' } SpStringTableColumn >> sortFunction [ ^ super sortFunction ifNil: [ self evaluation ascending ] @@ -156,7 +156,7 @@ SpStringTableColumn >> sortFunction: aBlockOrSortFunction [ self isSortable: aBlockOrSortFunction isNotNil ] -{ #category : #accessing } +{ #category : 'accessing' } SpStringTableColumn >> textChanged [ ^ textChanged diff --git a/src/Spec2-Core/SpTDynamicPresenter.trait.st b/src/Spec2-Core/SpTDynamicPresenter.trait.st deleted file mode 100644 index 00246dc4..00000000 --- a/src/Spec2-Core/SpTDynamicPresenter.trait.st +++ /dev/null @@ -1,64 +0,0 @@ -" -I'm a trait that add ""dynamic"" behavior to presenters. -I can be used to create components that may have variable number of children. - -DEPRECATED: This trait should not be used, since all presenters are dynamic now. -" -Trait { - #name : 'SpTDynamicPresenter', - #instVars : [ - 'presenters' - ], - #category : 'Spec2-Core-Base', - #package : 'Spec2-Core', - #tag : 'Base' -} - -{ #category : 'testing' } -SpTDynamicPresenter classSide >> isDeprecated [ - - ^ true -] - -{ #category : 'private - accessing' } -SpTDynamicPresenter >> basicPresenters [ - - ^ presenters ifNil: [ presenters := OrderedDictionary new ] -] - -{ #category : 'accessing' } -SpTDynamicPresenter >> presenterAt: aName [ - - ^ self basicPresenters - at: aName - ifAbsent: [ self readSlotNamed: aName ] -] - -{ #category : 'accessing' } -SpTDynamicPresenter >> presenterAt: aName ifAbsent: aBlock [ - ^ self basicPresenters - at: aName - ifAbsent: [ [ self readSlotNamed: aName ] - on: SlotNotFound - do: aBlock ] -] - -{ #category : 'accessing' } -SpTDynamicPresenter >> presenterAt: aName put: aPresenter [ - - ^ self basicPresenters - at: aName - put: aPresenter -] - -{ #category : 'accessing' } -SpTDynamicPresenter >> presenters [ - - ^ self basicPresenters values -] - -{ #category : 'enumerating' } -SpTDynamicPresenter >> presentersDo: aBlock [ - - self basicPresenters valuesDo: aBlock -] diff --git a/src/Spec2-Core/SpToolbarToggleButtonPresenter.class.st b/src/Spec2-Core/SpToolbarToggleButtonPresenter.class.st index 10013da9..21c05dca 100644 --- a/src/Spec2-Core/SpToolbarToggleButtonPresenter.class.st +++ b/src/Spec2-Core/SpToolbarToggleButtonPresenter.class.st @@ -93,15 +93,6 @@ SpToolbarToggleButtonPresenter >> isSelected [ ^ self state ] -{ #category : 'api' } -SpToolbarToggleButtonPresenter >> selected: aBoolean [ - - self - deprecated: 'Use #state: instead.' - transformWith: '`@receiver selected: `@arg' -> '`@receiver state: `@arg'. - self setSelection: aBoolean -] - { #category : 'private' } SpToolbarToggleButtonPresenter >> setSelection: aBoolean [ @@ -157,19 +148,6 @@ SpToolbarToggleButtonPresenter >> whenDeactivatedDo: aBlock [ newSelectedValue ifFalse: [ aBlock value ] ] ] -{ #category : 'api - events' } -SpToolbarToggleButtonPresenter >> whenSelectedDo: aBlock [ - "Inform when the button has been selected. - `aBlock` receives zero arguments." - - self - deprecated: 'Use #whenActivatedDo: instead.' - transformWith: '`@receiver whenSelectedDo: `@arg' -> '`@receiver whenActivatedDo: `@arg'. - - self whenChangedDo: [ :newSelectedValue | - newSelectedValue ifTrue: [ aBlock value ] ] -] - { #category : 'api - events' } SpToolbarToggleButtonPresenter >> whenToggledDo: aBlock [ "Inform when the button has been toggles. @@ -180,16 +158,3 @@ SpToolbarToggleButtonPresenter >> whenToggledDo: aBlock [ self property: #selected whenChangedDo: aBlock ] - -{ #category : 'api - events' } -SpToolbarToggleButtonPresenter >> whenUnselectedDo: aBlock [ - "Inform when the button has been unselected. - `aBlock` receives zero arguments." - - self - deprecated: 'Use #whenDeactivatedDo: instead.' - transformWith: '`@receiver whenUnselectedDo: `@arg' -> '`@receiver whenDeactivatedDo: `@arg'. - - self whenChangedDo: [ :newSelectedValue | - newSelectedValue ifFalse: [ aBlock value ] ] -] diff --git a/src/Spec2-Core/SpWindowPresenter.class.st b/src/Spec2-Core/SpWindowPresenter.class.st index 8937f2f5..45a701d2 100644 --- a/src/Spec2-Core/SpWindowPresenter.class.st +++ b/src/Spec2-Core/SpWindowPresenter.class.st @@ -386,17 +386,6 @@ SpWindowPresenter >> isResizable [ ^ resizable ] -{ #category : 'testing' } -SpWindowPresenter >> isResizeable [ - "Answer if window is resizeable" - - self - deprecated: 'Use #isResizable instead' - transformWith: '`@receiver isResizeable' -> '`@receiver isResizable'. - - ^ self isResizable -] - { #category : 'testing' } SpWindowPresenter >> isTopWindow [ "Answer true if this si the active window (the one that has the focus)" diff --git a/src/Spec2-Dialogs/SpApplication.extension.st b/src/Spec2-Dialogs/SpApplication.extension.st index 43b0f1fd..ffca462d 100644 --- a/src/Spec2-Dialogs/SpApplication.extension.st +++ b/src/Spec2-Dialogs/SpApplication.extension.st @@ -80,16 +80,6 @@ SpApplication >> newJobList [ ^ SpJobListPresenter newApplication: self ] -{ #category : '*Spec2-Dialogs' } -SpApplication >> newProgress [ - - self - deprecated: 'Use #newJobList' - transformWith: '`@receiver newProgress' - -> '`@receiver newJobList'. - ^ SpJobListPresenter newApplication: self -] - { #category : '*Spec2-Dialogs' } SpApplication >> newRequest [ diff --git a/src/Spec2-Interactions/SpInteractionCancelled.class.st b/src/Spec2-Interactions/SpInteractionCancelled.class.st deleted file mode 100644 index 71e96b90..00000000 --- a/src/Spec2-Interactions/SpInteractionCancelled.class.st +++ /dev/null @@ -1,14 +0,0 @@ -" -I am the error raised when the user cancelled a request. -" -Class { - #name : 'SpInteractionCancelled', - #superclass : 'SpCancelledInteractionError', - #category : 'Spec2-Interactions', - #package : 'Spec2-Interactions' -} - -{ #category : 'testing' } -SpInteractionCancelled class >> isDeprecated [ - ^ true -] diff --git a/src/Spec2-Interactions/SpInvalidUserInput.class.st b/src/Spec2-Interactions/SpInvalidUserInput.class.st deleted file mode 100644 index 6d67e063..00000000 --- a/src/Spec2-Interactions/SpInvalidUserInput.class.st +++ /dev/null @@ -1,14 +0,0 @@ -" -I am the error raised when a user entered bad input during interaction. -" -Class { - #name : 'SpInvalidUserInput', - #superclass : 'SpInvalidUserInputError', - #category : 'Spec2-Interactions', - #package : 'Spec2-Interactions' -} - -{ #category : 'testing' } -SpInvalidUserInput class >> isDeprecated [ - ^ true -] diff --git a/src/Spec2-Layout/SpPanedLayout.class.st b/src/Spec2-Layout/SpPanedLayout.class.st index e22f92c2..74c375b7 100644 --- a/src/Spec2-Layout/SpPanedLayout.class.st +++ b/src/Spec2-Layout/SpPanedLayout.class.st @@ -86,30 +86,6 @@ SpPanedLayout >> add: aChild withConstraints: aBlock place: aPosition [ self announceChildAdded: aChild. ] -{ #category : 'api - adding' } -SpPanedLayout >> addFirst: aPresenter [ - "Add aPresenter as first element of the paned layout." - - self - deprecated: 'Use #first: instead' - transformWith: '`@receiver addFirst: `@arg' - -> '`@receiver first: `@arg'. - - self first: aPresenter -] - -{ #category : 'api - adding' } -SpPanedLayout >> addSecond: aPresenterOrName [ - "Add aPresenterOrName as second element of the paned layout." - - self - deprecated: 'Use #second: instead' - transformWith: '`@receiver addSecond: `@arg' - -> '`@receiver second: `@arg'. - - self second: aPresenterOrName -] - { #category : 'api' } SpPanedLayout >> children [ @@ -158,35 +134,6 @@ SpPanedLayout >> isVertical [ ^ self direction = SpLayoutDirection vertical ] -{ #category : 'api' } -SpPanedLayout >> position [ - "Indicates original position of splitter. - It can be nil (then it defaults to 50%). - It can be a percentage (e.g. 30 percent)" - - self - deprecated: 'Use #positionOfSlider instead' - transformWith: '`@receiver position' -> '`@receiver positionOfSlider'. - - ^ positionOfSlider -] - -{ #category : 'api' } -SpPanedLayout >> position: aNumber [ - "Position of the slider. - - `aNumber` can be a fixed number indicating the exact position where the slider will - be placed in the pane. - - `aNumber` can also be a fraction or a percentage, indicating the percentage position - of the slider. E.g. 30 percent (0.3) indicates the slider will be place at 1/3 of the - panel." - - self - deprecated: 'Use #positionOfSlider: instead' - transformWith: '`@receiver position: `@arg' -> '`@receiver positionOfSlider: `@arg'. - - positionOfSlider := aNumber -] - { #category : 'api' } SpPanedLayout >> positionOfSlider [ "Indicates original position of splitter. diff --git a/src/Spec2-Morphic-Backend-Tests/SpMorphicAdapterTestCase.class.st b/src/Spec2-Morphic-Backend-Tests/SpMorphicAdapterTestCase.class.st deleted file mode 100644 index d7a69fd1..00000000 --- a/src/Spec2-Morphic-Backend-Tests/SpMorphicAdapterTestCase.class.st +++ /dev/null @@ -1,11 +0,0 @@ -Class { - #name : 'SpMorphicAdapterTestCase', - #superclass : 'SpMorphicAdapterTest', - #category : 'Spec2-Morphic-Backend-Tests', - #package : 'Spec2-Morphic-Backend-Tests' -} - -{ #category : 'testing' } -SpMorphicAdapterTestCase class >> isDeprecated [ - ^ true -] diff --git a/src/Spec2-Morphic-Tests/SpVersatileDialogPresenterTest.class.st b/src/Spec2-Morphic-Tests/SpVersatileDialogPresenterTest.class.st deleted file mode 100644 index 0324205d..00000000 --- a/src/Spec2-Morphic-Tests/SpVersatileDialogPresenterTest.class.st +++ /dev/null @@ -1,68 +0,0 @@ -Class { - #name : 'SpVersatileDialogPresenterTest', - #superclass : 'SpSmokeTest', - #category : 'Spec2-Morphic-Tests', - #package : 'Spec2-Morphic-Tests' -} - -{ #category : 'testing' } -SpVersatileDialogPresenterTest class >> isDeprecated [ - - ^ true -] - -{ #category : 'accessing' } -SpVersatileDialogPresenterTest >> classToTest [ - ^ SpVersatileDialogPresenter -] - -{ #category : 'tests' } -SpVersatileDialogPresenterTest >> testListBox [ - - | dialog app listPresenter | - app := SpMockApplication new. - - dialog := SpVersatileDialogPresenter newApplication: app. - listPresenter := dialog newList. - listPresenter items: #( one two three ). - dialog contentArea: listPresenter. - dialog - addButton: #ok - text: 'OK' - value: #ok - condition: [ listPresenter selection isEmpty not ]. - dialog addButton: #cancel text: 'Cancel' value: nil. - dialog mainIcon: (self iconNamed: #question). - - dialog openModal. - dialog withWindowDo: [ :w | w title: 'Confirmation' ]. - - dialog contentArea selection selectIndex: 2. - - (dialog buttons at: #ok) click. - - self assert: dialog result equals: #ok. - self assert: dialog contentArea selection selectedItem equals: #two -] - -{ #category : 'tests' } -SpVersatileDialogPresenterTest >> testResult [ - - | dialog app | - app := SpMockApplication new. - - dialog := SpVersatileDialogPresenter newApplication: app. - dialog mainMessage: 'Save content' asText allBold. - dialog addButton: #save text: 'Save' value: true. - dialog addButton: #cancel text: 'Cancel' value: false. - dialog mainIcon: (self iconNamed: #question). - dialog moreOptionsArea: (dialog newCheckBox label: 'Save header'). - - dialog openModal. - dialog withWindowDo: [ :w | w title: 'Confirmation' ]. - (dialog buttons at: #save) performAction. - dialog moreOptionsArea click. - - self assert: dialog result. - self assert: dialog moreOptionsArea state -] diff --git a/src/Spec2-Morphic/SpVersatileDialogPresenter.class.st b/src/Spec2-Morphic/SpVersatileDialogPresenter.class.st deleted file mode 100644 index 1e257238..00000000 --- a/src/Spec2-Morphic/SpVersatileDialogPresenter.class.st +++ /dev/null @@ -1,409 +0,0 @@ -" -A am versatile presenter for modal dialog windows with the customizable content - -I have: -- title -- main message - the basic text of the dialog -- main icon - the icon that is displayed next to the main message - or next to the content area, if any -- content area - a text or another presenter with the detailed information of the dialog -- buttons - added using addButton:text:value -- more options text - a label of the button that shows more options of the dialog -- less options text - a label of the button that shows more options of the dialog in case - that the options are visible -- footnote icon - an icon that is displayed next to the footnote -- footnote area - a text or another presenter with the footnote - -" -Class { - #name : 'SpVersatileDialogPresenter', - #superclass : 'SpDynamicPresenter', - #traits : 'SpTDynamicPresenter', - #classTraits : 'SpTDynamicPresenter classTrait', - #instVars : [ - 'mainMessage', - 'mainIcon', - 'contentArea', - 'buttons', - 'moreOptionsButton', - 'moreOptionsText', - 'lessOptionsText', - 'moreOptionsArea', - 'footnoteIcon', - 'footnoteArea', - 'moreOptionsVisible', - 'mainMessagePresenter', - 'mainIconPresenter', - 'contentAreaPresenter', - 'moreOptionsAreaPresenter', - 'footnoteIconPresenter', - 'footnoteAreaPresenter', - 'result', - 'defaultButtonId' - ], - #category : 'Spec2-Morphic-Widgets', - #package : 'Spec2-Morphic', - #tag : 'Widgets' -} - -{ #category : 'specs' } -SpVersatileDialogPresenter class >> example1 [ - - | dialog | - (dialog := SpVersatileDialogPresenter new) - mainMessage: 'Confirm your choice' asText allBold; - mainIcon: (self iconNamed: #question); - contentArea: 'Do you want to discard your content?'; - moreOptionsArea: (dialog newCheckBox label: 'Discard permanently'); - addButton: #yes text: 'yes' value: #yes; - addButton: #no text: 'no' value: #no; - addButton: #cancel text: 'cancel' value: #cancel; - footnoteIcon: (self iconNamed: #error); - footnoteArea: 'This operation can be very dangerous.'; - openModal. - dialog withWindowDo: [ :w | w title: 'Confirmation' ]. - dialog result traceCr. - - self inform: dialog moreOptionsArea state asString -] - -{ #category : 'specs' } -SpVersatileDialogPresenter class >> example2 [ - - | dialog | - dialog := SpVersatileDialogPresenter new - mainMessage: 'Save content' asText allBold; - addButton: #save text: 'Save' value: true; - addButton: #cancel text: 'Cancel' value: false; - mainIcon: (self iconNamed: #question); - openModal; - yourself. - - dialog withWindowDo: [ :w | w title: 'Confirmation' ]. - dialog result traceCr -] - -{ #category : 'specs' } -SpVersatileDialogPresenter class >> example3 [ - - | dialog | - dialog := SpVersatileDialogPresenter new - mainMessage: 'Save content' asText allBold; - addButton: #save text: 'Save' value: true; - addButton: #cancel text: 'Cancel' value: false; - mainIcon: (self iconNamed: #question); - footnoteIcon: (self iconNamed: #error); - footnoteArea: 'Saving may take several minutes'; - yourself. - - (dialog buttonAt: #save) icon: (self iconNamed: #smallSave). - - dialog openModal. - - dialog withWindowDo: [ :w | w title: 'Confirmation' ]. - dialog result traceCr -] - -{ #category : 'specs' } -SpVersatileDialogPresenter class >> example4 [ - - | dialog | - dialog := SpVersatileDialogPresenter new. - - 1 to: 5 do: [ :aNumber | dialog addButton: ('button' , aNumber asString) asSymbol text: aNumber printStringRoman value: aNumber ]. - - dialog defaultButtonId: #button2. - - dialog openModal. - - dialog withWindowDo: [ :w | w title: 'Select number' ]. - dialog result traceCr -] - -{ #category : 'specs' } -SpVersatileDialogPresenter class >> example5 [ - - | dialog listPresenter | - dialog := SpVersatileDialogPresenter new. - listPresenter := dialog newList. - listPresenter items: #(one two three). - dialog contentArea: listPresenter. - dialog - addButton: #ok - text: 'OK' - value: true - condition: [ listPresenter selection isEmpty not ]. - dialog addButton: #cancel text: 'Cancel' value: false. - dialog mainIcon: (self iconNamed: #question). - - dialog openModal. - - dialog withWindowDo: [ :w | w title: 'Confirmation' ]. - dialog result traceCr -] - -{ #category : 'api' } -SpVersatileDialogPresenter >> addButton: id text: buttonText value: anObject [ - - ^ self addButton: id text: buttonText value: anObject condition: true -] - -{ #category : 'api' } -SpVersatileDialogPresenter >> addButton: id text: buttonText value: anObject condition: aCondition [ - | aButton | - aButton := self newButton label: buttonText. - aButton action: [ aCondition value ifTrue: [ self return: anObject ] ]. - - buttons at: id put: aButton. - - self presenterAt: id put: aButton -] - -{ #category : 'api' } -SpVersatileDialogPresenter >> buttonAt: id [ - - ^ buttons at: id -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> buttons [ - - ^ buttons -] - -{ #category : 'initialization' } -SpVersatileDialogPresenter >> connectPresenters [ - - super connectPresenters. - - moreOptionsButton action: [ - moreOptionsVisible := moreOptionsVisible not. - self needRebuild: false. - self build ]. - - -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> contentArea [ - - ^ contentArea -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> contentArea: aTextOrPresenter [ - - contentArea := aTextOrPresenter. -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> contentAreaPresenter [ - ^ contentAreaPresenter -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> defaultButtonId [ - ^ defaultButtonId -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> defaultButtonId: anObject [ - defaultButtonId := anObject -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> footnoteArea [ - - ^ footnoteArea -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> footnoteArea: aTextOrPresenter [ - - footnoteArea := aTextOrPresenter. -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> footnoteIcon [ - - ^ footnoteIcon -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> footnoteIcon: aForm [ - - footnoteIcon := aForm. -] - -{ #category : 'initialization' } -SpVersatileDialogPresenter >> initialize [ - super initialize. - - moreOptionsVisible := false. - buttons := OrderedDictionary new -] - -{ #category : 'initialization' } -SpVersatileDialogPresenter >> initializeDialogWindow: aDialogWindowPresenter [ - aDialogWindowPresenter initialExtent: 400 @ 200 -] - -{ #category : 'initialization' } -SpVersatileDialogPresenter >> initializePresenters [ - - moreOptionsText := 'More options' asText. - lessOptionsText := 'Less options' asText. - moreOptionsButton := self newButton label: moreOptionsText. - -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> layout [ - | mainLayout row | - mainLayout := SpBoxLayout newTopToBottom. - - - "if the content area is not defined, place main message next to the main icon" - contentArea - ifNotNil: [ mainMessage - ifNotNil: [ mainMessagePresenter := (mainMessage isString or: [ mainMessage isText ]) ifTrue: [ self newLabel label: mainMessage ] ifFalse: [ mainMessage ]. - mainLayout add: #mainMessagePresenter ] ]. - - row := SpBoxLayout newLeftToRight. - - mainIcon - ifNotNil: [ mainIconPresenter := self newImage image: self mainIcon. - row add: #mainIconPresenter withConstraints: [ :constraints | constraints width: self mainIcon width * 2 ] ]. - - contentArea - ifNotNil: [ contentAreaPresenter := (contentArea isString or: [ contentArea isText ]) ifTrue: [ self newLabel label: contentArea ] ifFalse: [ contentArea ]. - row add: #contentAreaPresenter ] - ifNil: [ mainMessage - ifNotNil: [ mainMessagePresenter := (mainMessage isString or: [ mainMessage isText ]) ifTrue: [ self newLabel label: mainMessage ] ifFalse: [ mainMessage ]. - row add: #mainMessagePresenter ] ]. - - mainLayout add: row. - - row := SpBoxLayout newLeftToRight. - - - moreOptionsArea - ifNotNil: [ moreOptionsButton label: (moreOptionsVisible ifFalse: [ self moreOptionsText ] ifTrue: [ self lessOptionsText ]). - moreOptionsButton icon: (self iconNamed: (moreOptionsVisible ifFalse: [ #arrowDown ] ifTrue: [ #arrowUp ])). - - row add: #moreOptionsButton. - moreOptionsAreaPresenter := (moreOptionsArea isString or: [ moreOptionsArea isText ]) ifTrue: [ self newLabel label: moreOptionsArea ] ifFalse: [ moreOptionsArea ] ]. - buttons keysAndValuesDo: [ :buttonKey :aButton | row add: buttonKey ]. - - mainLayout add: row. - - moreOptionsVisible ifTrue: [ mainLayout add: #moreOptionsAreaPresenter ]. - - footnoteArea - ifNotNil: [ row := SpBoxLayout newLeftToRight. - footnoteIcon - ifNotNil: [ footnoteIconPresenter := self newImage image: footnoteIcon. - row add: #footnoteIconPresenter withConstraints: [ :constraints | constraints width: self footnoteIcon width * 2 ] ]. - - footnoteAreaPresenter := (footnoteArea isString or: [ footnoteArea isText ]) ifTrue: [ self newLabel label: footnoteArea ] ifFalse: [ footnoteArea ]. - row add: #footnoteAreaPresenter ]. - mainLayout add: row. - - defaultButtonId ifNotNil: [ (self buttonAt: defaultButtonId) takeKeyboardFocus ]. - - ^ mainLayout -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> lessOptionsText [ - - ^ lessOptionsText -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> lessOptionsText: aText [ - - lessOptionsText := aText. -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> mainIcon [ - - ^ mainIcon -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> mainIcon: aFrom [ - - mainIcon := aFrom -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> mainIconPresenter [ - ^ mainIconPresenter -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> mainMessage [ - - ^ mainMessage -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> mainMessage: aTextOrPresenter [ - - mainMessage := aTextOrPresenter. -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> mainMessagePresenter [ - ^ mainMessagePresenter -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> moreOptionsArea [ - - ^ moreOptionsArea -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> moreOptionsArea: aTextOrPresenter [ - - moreOptionsArea := aTextOrPresenter. -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> moreOptionsButton [ - ^ moreOptionsButton -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> moreOptionsText [ - - ^ moreOptionsText -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> moreOptionsText: aText [ - - moreOptionsText := aText. -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> result [ - - ^ result -] - -{ #category : 'accessing' } -SpVersatileDialogPresenter >> result: anObject [ - - result := anObject -] - -{ #category : 'private' } -SpVersatileDialogPresenter >> return: anObject [ - - self result: anObject. - self window close. -]