Skip to content

Commit

Permalink
Merge 986cd1a
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Dec 31, 2018
2 parents 8686964 + 986cd1a commit 8f7830f
Show file tree
Hide file tree
Showing 59 changed files with 1,525 additions and 411 deletions.
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Changelog

## Dev [IN PROGRESS]

### Features

* **Add #addSpacer to SpecLayout** ([298eb26](https://github.com/pharo-spec/Spec/commit/298eb266541e5d25cc02a3f06293a0a22f8d9a82))
* **Add labelled presenter** ([bf76234](https://github.com/pharo-spec/Spec/commit/bf76234cb83df108dcfaa6c6a9dc75b8ece97610))
* **Do not force users to have getters for their presenters** ([f24bd7f](https://github.com/pharo-spec/Spec/commit/f24bd7f4de7cc6c9765cb0d18bfa8ca0a7257881))
* **Now presenters have a special icon in Calypso** ([5c47a63](https://github.com/pharo-spec/Spec/commit/5c47a63d599f681bebc117612ac5252a59a9141e))
* **Add ComposablePresenter>>#iconNamed:** ([d8ce2e2](https://github.com/pharo-spec/Spec/commit/d8ce2e2cc07729d67ed214ce1cf0a950a3f1f88d))
* **Layouts now understand `presenter` instead of `model`** ([7a78375](https://github.com/pharo-spec/Spec/commit/7a783758881fbbb6d536e2b0e2db97f91b3150a1))
* **It is now possible to add menus, status bar and menu bars to window presenters** ([ee0acf6](https://github.com/pharo-spec/Spec/commit/ee0acf6ce49245ae441e0e3475d52795e3426f2e))
* **Add NumberPresenter with its Morphic adapter** ([88792da](https://github.com/pharo-spec/Spec/commit/88792daa4b8c230946fda633ecbab43143c4124d))
* **Refactor dialog presenter to be more flexible** ([e835558](https://github.com/pharo-spec/Spec/commit/e8355589c1f56eedd37f68887f711cddfe04fa74))
* **New presenter: URL prensenter** ([49f941f](https://github.com/pharo-spec/Spec/commit/49f941fd6587052688b76e546dd824db22a8b615))
* **Introduction of real modals**: Those modals will stop the workflow of the user to force the interaction. Like everymodal everywhere else. ([27289a8](https://github.com/pharo-spec/Spec/commit/27289a8c73a711d18142b8e79d8d1d1d06d82c76))

### Bug fixes

* **#additianalKeybindings is not a value holder** ([547d5f0](https://github.com/pharo-spec/Spec/commit/547d5f09762ae30c965307f2129e4b1db0537241))
* ** ** ([](https://github.com/pharo-spec/Spec/commit/))
* ** ** ([](https://github.com/pharo-spec/Spec/commit/))

### Cleaning

* **Rename composable presenter** ([f29cf68](https://github.com/pharo-spec/Spec/commit/f29cf687d051ce3b75193331225df995cc18b9c5))
* **Remove WindowPresenter title variable** ([6a311e1](https://github.com/pharo-spec/Spec/commit/6a311e1d6d3c46eaab61270365ca5ab9927ed532))
* **Cut cyclic dependencies between Layouts and Core** ([4953967](https://github.com/pharo-spec/Spec/commit/495396701daf71e296db16c605163f23649a7236))
* **Remove deadcode** ([50b2a8c](https://github.com/pharo-spec/Spec/commit/50b2a8ce9693df84a81a0658f192d20b7f476a51))
* **Move all tests to tests packages** ([bae8f4c](https://github.com/pharo-spec/Spec/commit/bae8f4cbc4e9516b43a6634ec46630fb85d8f927))
* **Better about title managment** ([9d91152](https://github.com/pharo-spec/Spec/commit/9d91152c64d0e0b32166d65cb51ab486b945dac1))
* **Clean the interpreter** ([a509654](https://github.com/pharo-spec/Spec/commit/a50965405e37998e2bf321140ba4fab2f351202d) and [6587836](https://github.com/pharo-spec/Spec/commit/6587836cc38e0e3d753729e7d1085b883d924dab))
* **Clean tests** ([073ed26](https://github.com/pharo-spec/Spec/commit/073ed26c4115078bb237789596167666cf173ffa))
* **Remove SpecLayout>>selector** ([7e1d283](https://github.com/pharo-spec/Spec/commit/7e1d28359c53d43918a4aea5ef2167124ce14883))
* **Ensure presenter are not directly linked to MorphcAdapters** ([bc63f1c](https://github.com/pharo-spec/Spec/commit/bc63f1ca06a5fd652b7762bcfb46c1f862fc09cf))
* **Deprecate instantiateModels: for instantiatePresenters:** ([8bd78cc](https://github.com/pharo-spec/Spec/commit/8bd78ccfb79f04e7f0d618cfea3b5c7e2246811e))
* **Layouts now stores objects instead of arrays** ([2b35bc4](https://github.com/pharo-spec/Spec/commit/2b35bc454a722c549c7a531e03f785abf064cfa9))
* **Remove Spec table layout since Spec layout has the same behavior** ([103a827](https://github.com/pharo-spec/Spec/commit/103a827a88fc533a234d3f7a74fcdda60bf53de1))
* **Remove references to `Smalltalk ui theme`** ([b37dd2a](https://github.com/pharo-spec/Spec/commit/b37dd2afffb12adf1daa2d6b4ea6a0091e5b1239))
* **Remove Object>>isSpecAdaptor** ([1664920](https://github.com/pharo-spec/Spec/commit/1664920c4a16dbe7489e17f95ac0d5e115b9b90d))
* **Rename #ghostText into #placeholder** ([639e7e5](https://github.com/pharo-spec/Spec/commit/639e7e5f97f25126f219e780c385e0bdc7a72f09))
* **Clean windows/dialogs opening mechanism** ([39ce96a](https://github.com/pharo-spec/Spec/commit/39ce96accf02835aea2d607fa4eac25217e41572))

### Infrastructure

* **Enable TravisCI** ([8208767](https://github.com/pharo-spec/Spec/commit/8208767590371c5ce4e6938f0f79d6cea601fca8))
* **Add dependencies between packages** ([b655505](https://github.com/pharo-spec/Spec/commit/b655505c32533a18860a1e26819d7f93ef2e212a))
* **Make Spec loadable in non interactive mode** ([0411400](https://github.com/pharo-spec/Spec/commit/0411400b7aa6507d857ee7114964c5ff1c287d92))
* **Register Spec demo in the Help menu** ([d36d2ed](https://github.com/pharo-spec/Spec/commit/d36d2ed6b0804ac1171014d7a1b519bb6febcc74))
* **Add source code in Tonel format to demos** ([648a681](https://github.com/pharo-spec/Spec/commit/648a6813a09c23a64ff8b3bf98b15ff14a182e15))

22 changes: 21 additions & 1 deletion resources/migration/specPharo7ToSpecPharo8.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,24 @@ This is not necessary anymore. You only needs to implement the method `#adapterN
```Smalltalk
ButtonPresenter class >> adapterName
^ #ButtonAdapter
```
```

## Dialog's toolbar

The way dialogs toolbar works changed in this new version of Spec.

Before the dialog bar had one or two buttons: Ok and Cancel, but they where not configurable. Now the user can add itself multiple buttons and configure their action more easily.

So here is how the new way works:

If you do not override the method #initializeDialogWindow: in your dialog, two default buttons will be added: "Ok" and "Cancel". You can then configure their actions with the #okAction: and #cancelAction: selectors.

If you do not want those default buttons you can override #initializeDialogWindow: and use this new API:

```Smalltalk
aWindow
addButton: ''Debug''
do: [ :presenter | self accept. presenter close ];
addButton: ''Ignore''
do: [ :presenter | presenter close ]
```
60 changes: 41 additions & 19 deletions src/Spec-Core/ComposablePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,11 @@ ComposablePresenter >> newLabel [
^ self instantiate: LabelPresenter
]

{ #category : #widgets }
ComposablePresenter >> newLink [
^ self instantiate: LinkPresenter
]

{ #category : #widgets }
ComposablePresenter >> newList [
^ self instantiate: FastTablePresenter
Expand Down Expand Up @@ -882,32 +887,44 @@ ComposablePresenter >> on: anAnnouncement send: aSelector to: aTarget [

{ #category : #api }
ComposablePresenter >> openDialogWithSpec [
"Build the widget using the default spec and display it into a window"
"Build the widget using the default spec and display it into a dialog.
Be aware that this way will not create a real modal in the sens that the user will keep the focus on other windows. If you want to make the user focus on your dialog only you should use #openModalWithSpec instead."

^ self openDialogWithSpec: self defaultSpecSelector.
^ self openDialogWithSpec: self defaultSpecSelector
]

{ #category : #api }
ComposablePresenter >> openDialogWithSpec: aSpec [
"Build the widget using the spec name provided as argument and display it into a window"

"Build the widget using the default spec and display it into a dialog.
Be aware that this way will not create a real modal in the sens that the user will keep the focus on other windows. If you want to make the user focus on your dialog only you should use #openModalWithSpec: instead."

^ self openDialogWithSpecLayout: (self retrieveSpec: aSpec)
]

{ #category : #api }
ComposablePresenter >> openDialogWithSpecLayout: aSpec [
"Build the widget using the spec name provided as argument and display it into a window"
^ self openWithSpecLayout: aSpec in: DialogWindowPresenter
]

(self presenterWindow notNil and: [ self needRebuild not ])
ifTrue: [
self presenterWindow rebuildWithSpec: aSpec ]
ifFalse: [
self presenterWindow: (DialogWindowPresenter new presenter: self).
self presenterWindow openWithSpecLayout: aSpec.
self presenterWindow updateTitle.
self takeKeyboardFocus ].

^ self presenterWindow
{ #category : #api }
ComposablePresenter >> openModalWithSpec [
"Build the widget using the default spec and display it into a modal"

^ self openModalWithSpec: self defaultSpecSelector.
]

{ #category : #api }
ComposablePresenter >> openModalWithSpec: aSpec [
"Build the widget using the spec name provided as argument and display it into a modal"

^ self openModalWithSpecLayout: (self retrieveSpec: aSpec)
]

{ #category : #api }
ComposablePresenter >> openModalWithSpecLayout: aSpec [
^ self openWithSpecLayout: aSpec in: ModalWindowPresenter
]

{ #category : #api }
Expand All @@ -928,11 +945,16 @@ ComposablePresenter >> openWithSpec: aSpec [
ComposablePresenter >> openWithSpecLayout: aSpec [
"Build the widget using the spec name provided as argument and display it into a window"

^ self openWithSpecLayout: aSpec in: self defaultWindowPresenterClass
]

{ #category : #api }
ComposablePresenter >> openWithSpecLayout: aSpec in: aWindowClass [
"I build the widget with the spec as parameter and open it with the window presenter passed as parameter."

(self presenterWindow notNil and: [ self needRebuild not ])
ifTrue: [
self presenterWindow rebuildWithSpecLayout: aSpec ]
ifFalse: [
self presenterWindow: (self defaultWindowPresenterClass new presenter: self).
ifTrue: [ self presenterWindow rebuildWithSpecLayout: aSpec ]
ifFalse: [ self presenterWindow: (aWindowClass presenter: self).
self presenterWindow openWithSpecLayout: aSpec.
self takeKeyboardFocus ].
^ self presenterWindow
Expand Down
35 changes: 6 additions & 29 deletions src/Spec-Core/DialogWindowPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Class {
#name : #DialogWindowPresenter,
#superclass : #WindowPresenter,
#instVars : [
'contents',
'buttons',
'okAction',
'cancelAction',
Expand All @@ -31,28 +30,6 @@ DialogWindowPresenter >> addButton: aString do: aBlock [
yourself)
]

{ #category : #private }
DialogWindowPresenter >> buildWithSpecLayout: aSpec [
"Build the widget using the spec name provided as argument"
| widget |

(self spec notNil and: [ self needRebuild not ])
ifTrue: [
widget := self widget ]
ifFalse: [
contents := self presenter buildWithSpecLayout: aSpec.
[
widget := (self adapterFrom: self retrieveDefaultSpec) widget.
self addModelIn: widget withSpecLayout: aSpec ]
ensure: [ contents := nil ] ].

self extent ifNotNil: [ :ex |
(widget respondsTo: #extent:) ifTrue: [
widget extent: ex ] ].

^ widget
]

{ #category : #accessing }
DialogWindowPresenter >> buttons [
"buttons is an ordered dictionary that matches labels with actions.
Expand All @@ -61,6 +38,12 @@ DialogWindowPresenter >> buttons [
^ buttons
]

{ #category : #api }
DialogWindowPresenter >> cancelAction [

^ cancelAction
]

{ #category : #api }
DialogWindowPresenter >> cancelAction: aBlock [

Expand All @@ -73,12 +56,6 @@ DialogWindowPresenter >> cancelled [
^ cancelled
]

{ #category : #accessing }
DialogWindowPresenter >> contents [

^ contents
]

{ #category : #initialization }
DialogWindowPresenter >> initialize [

Expand Down
2 changes: 1 addition & 1 deletion src/Spec-Core/LabelPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LabelPresenter class >> adapterName [
{ #category : #specs }
LabelPresenter class >> title [

^ 'Label Morph'
^ 'Label presenter'
]

{ #category : #initialization }
Expand Down
104 changes: 104 additions & 0 deletions src/Spec-Core/LinkPresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"
Description
--------------------
I am a presenter used to display a link.
My adaptor should display me as a link the user should be able to click and it will open a web page in the user browser.
If I have no label, I will show the link directly as a label.
Public API and Key Messages
--------------------
- #url: Used to set the URL of the page to show
- #label: Used to know which text to display in the page
Examples
--------------------
(myPresenter instantiate: LinkPresenter)
url: 'https://pharo.org';
label: 'Pharo website'.
myPresenter newLink
url: 'https://pharo.org';
label: 'Pharo website'.
myPresenter newLink url: 'https://pharo.org'. ""The label here will be 'https://pharo.org'""
self example
"
Class {
#name : #LinkPresenter,
#superclass : #AbstractWidgetPresenter,
#instVars : [
'urlHolder',
'labelHolder'
],
#category : #'Spec-Core-Widgets'
}

{ #category : #specs }
LinkPresenter class >> adapterName [
^ #LinkAdapter
]

{ #category : #example }
LinkPresenter class >> example [
<sampleInstance>
^ self new
url: 'https://pharo.org';
label: 'Pharo website';
extent: 200 @ 20;
openWithSpec;
yourself
]

{ #category : #specs }
LinkPresenter class >> title [
^ 'Link presenter'
]

{ #category : #initialization }
LinkPresenter >> defaultColor [
^ nil
]

{ #category : #initialization }
LinkPresenter >> initialize [
super initialize.
labelHolder := nil asValueHolder.
urlHolder := nil asValueHolder.
labelHolder whenChangedDo: [ self changed: #getText ].
]

{ #category : #api }
LinkPresenter >> label [
^ labelHolder value ifNil: [ self url ]
]

{ #category : #api }
LinkPresenter >> label: aString [
^ labelHolder value: aString
]

{ #category : #accessing }
LinkPresenter >> labelHolder [
^ labelHolder
]

{ #category : #api }
LinkPresenter >> url [
^ urlHolder value
]

{ #category : #api }
LinkPresenter >> url: aString [
urlHolder value: aString
]

{ #category : #accessing }
LinkPresenter >> urlHolder [
^ urlHolder
]
Loading

0 comments on commit 8f7830f

Please sign in to comment.