Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update this branch (#161) to start working on 1.3 #181

Merged
merged 42 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0b578b5
MolUtils: add required/offered types for a component contract interfa…
LabordePierre Feb 28, 2024
83b9607
Fix bad source-code problem
LabordePierre Feb 28, 2024
baa4946
Fix unit tests
LabordePierre Feb 28, 2024
c8b5d0c
Merge pull request #165 from OpenSmock/dev-164
labordep Feb 28, 2024
2f21bde
Added two new options to Molecule:
Feb 28, 2024
41be08f
Merge pull request #166 from Eliott-Guevel/SeeComponentImplementation…
labordep Mar 8, 2024
0e6ca0e
Removed New Component from the Library Tab since it has nothing to do…
Mar 25, 2024
960c1e3
Merge pull request #169 from Eliott-Guevel/SeeComponentImplementation…
labordep Mar 25, 2024
bcd2ad5
fixes 2nd problem #168
Mar 27, 2024
216fff5
removed flag
Mar 27, 2024
fd1da6b
Merge pull request #172 from Eliott-Guevel/SeeComponentImplementation…
labordep Mar 27, 2024
cb4aaca
See Component implementations: fix comments #168
Mar 28, 2024
01f9e3f
changed SpFilteringListPresenter to MolSpFilteringListPresenter
Mar 29, 2024
277d345
Merge pull request #173 from Eliott-Guevel/SeeComponentImplementation…
labordep Apr 2, 2024
6bacd9a
suffixed the two classes creating the interfaces with Presenter (as w…
Apr 2, 2024
53b1f8c
Merge pull request #174 from Eliott-Guevel/SeeComponentImplementation…
labordep Apr 3, 2024
1253192
removed testGarbageCollect and modified testFlushComponents
Apr 3, 2024
c3ed105
follow-up to last commit
Apr 3, 2024
adcf24e
Merge pull request #176 from OpenSmock/dev-issue171
labordep Apr 3, 2024
5c324a0
Fix #170: Add announcements for component life-cycle + unit tests.
labordep Apr 7, 2024
930a889
#171 remove not understanded tests, we cannot test the garbage collec…
labordep Apr 7, 2024
dc850d9
Add Pharo 13 CI script. Update Pharo 12 CI script.
labordep Jun 14, 2024
93e2be3
Update readme.
labordep Jun 14, 2024
96a8b1c
Merge pull request #178 from OpenSmock/ciForPharo13
labordep Jun 14, 2024
c5e77e6
Adding cleanUp for MolAnnouncements
ELePors Jun 25, 2024
96c46d6
Merge pull request #177 from OpenSmock/170-Add-announcers-to-know-whe…
labordep Jun 25, 2024
832e8c1
some storage
LabordePierre Jun 27, 2024
f48815a
Merge pull request #168 from OpenSmock/dev-incubator
labordep Jun 27, 2024
2cc02ee
Update Create and connect Components.md
Eliott-Guevel Jun 27, 2024
a1b4812
Update Producers.md
Eliott-Guevel Jun 27, 2024
673d26d
Update Table of contents.md
Eliott-Guevel Jun 27, 2024
8d18d1f
Update Tests.md
Eliott-Guevel Jun 27, 2024
68a4882
Update README.md
Eliott-Guevel Jun 27, 2024
d2c067d
Update README.md
Eliott-Guevel Jun 27, 2024
8f95c97
Update README.md
Eliott-Guevel Jun 27, 2024
d0953d1
Merge pull request #179 from Eliott-Guevel/newInterfacesDetail
labordep Jun 27, 2024
65eb126
force to tonel v1
labordep Jul 10, 2024
4bddd6e
Merge pull request #180 from OpenSmock/propertiesChanges
labordep Jul 10, 2024
b275042
Better tests set up and tear down
LabordePierre Aug 22, 2024
b4d9861
Merge pull request #183 from OpenSmock/182-Some-tests-are-KO
labordep Aug 22, 2024
0b73a65
remove p13 ci script and p13 state tag from readme
labordep Aug 22, 2024
7a05035
Merge pull request #184 from OpenSmock/removeP13CI
labordep Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/Pharo12CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
- 'main'
pull_request:
types: [assigned, opened, synchronize, reopened]
schedule:
- cron: '0 12 * * 0'

jobs:
build:
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,26 @@ This menu provides `metrics` to have statistics on the Molecule code in selected
This menu provides actions and tools depending on the selected classes.
With this menu you can force to `define` a Component, specially if you have deactivated the Molecule dynamic update or if you have a bug when a Component contract changed.

### See Component implementations
![contextual menu see component implementations](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/a4221985-0578-4e95-a133-831548e0f5ef) \
When right-clicking a Trait that uses the `MolComponentType` Trait, a new option appears in the `Molecule` sub-menu (as shown above):

![see component implementations github](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/68a94948-d6a0-4dce-9c67-2d1974b78fdf) \
Clicking this option opens this window, showing all the Component implementations of a Type Trait. \
The title of the window indicates the name of the Type Trait. \
Clicking an implementation activates the Browse button, which is used to open it in the **System Browser** of Pharo (double-clicking also works). \
Typing in the filtering list (above the two window buttons) filters the implementations' list.

### See Component users
![contextual menu see component users](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/8a9aaa63-33f8-46ea-a638-fc896fc2a60c) \
When right-clicking a interface (that is, a Trait that uses the `MolComponentEvents`, `MolComponentParameters` or `MolComponentServices` Traits), a new option appears in the `Molecule` sub-menu (as shown above):

![See component users github](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/682f388b-78a6-41d4-a3c4-2377fb7e9cf5) \
The title of the window indicates the name of the Type Trait as well as the type of interfaces it is about (events, parameters or services). \
In columns are shown the Type Trait requiring and offering this interface. \
Clicking a Type Trait activates the Browse button, which is used to open it in the **System Browser** of Pharo (double-clicking also works). \
Typing in a filtering list (below the columns) filters the relevant Type Traits' list.

## <img src="/resources/puce.svg" width="32" height="32" align="bottom"> Using Components

### Start and stop method
Expand Down
22 changes: 11 additions & 11 deletions documentation/Create and connect Components.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ They're directly linked, in the sense that a change detected in the first Compon
![gps molecule without figure](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/a949d2f8-c460-40be-985d-273881e5b3da) \
GPS (Global Positioning System) is the american subsystem of GNSS (Global Navigation Satellite Systems).

The complete GNSS example is present in the **Molecule-Examples** package, but if it's your first time using Molecule, you should follow this tutorial step-by-step in order to understand how Molecule works. \
The complete GNSS example is present in the [Molecule-Examples](https://github.com/OpenSmock/Molecule/tree/main/src/Molecule-Examples) package, but if it's your first time using Molecule, you should follow this tutorial step-by-step in order to understand how Molecule works. \
A graphical form of the example is available in the [Molecule-Geographical-Position-Example](https://github.com/OpenSmock/Molecule-Geographical-Position-Example) repository.

# Contents
[STATIC PART: declaration](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#static-part-declaration)
* [Define Component Types](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-component-types)
- [Adding Component contract with a Component Type](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#adding-component-contract-with-a-component-type)
+ [Define first Component Type MolGNSSData](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-the-first-component-type-molgnssdata)
+ [Define the first Component Type MolGNSSData](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-the-first-component-type-molgnssdata)
+ [Define the second Component Type MolGNSSMap](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-the-second-component-type-molgnssmap)
* [Define Services and Events](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-services-and-events)
* [Create a Component implementation of a Type](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#create-a-component-implementation-of-a-type)
Expand Down Expand Up @@ -100,8 +100,8 @@ This Event trait produces the `currentPositionChanged: aGeoPosition` Event

## Create a Component implementation of a Type
There are two ways to create a new Molecule Component :
- Create a new Component from scratch : write a new Class inheriting from the Component hierarchy
- Re-using an existing Class : augmenting that class with Component behavior
- Create a new Component from scratch: write a new Class inheriting from the Component hierarchy
- Re-using an existing Class: augmenting that class with Component behavior

### Create a new Component from scratch
To develop a new Component from scratch, a class needs to be created that must subclass the `MolAbstractComponentImpl` abstract Class.
Expand All @@ -118,7 +118,7 @@ We must use the Molecule Component interface `MolComponentImpl`, which is a Trai
For this tutorial, the GNSS needs to send its geographical data to the Map. \
In order to do that, its contract needs to be redefined to indicate which Services and Events are produced and provided by it.
![implementation contrat molecule](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/a9c14388-0abe-4f09-8ac5-578054f98ad1) \
Redefining a Component's contract is done on the **Class side** of Pharo (in the **System Browser**, accessible through the **Browse** tab of Pharo, click on the radio button located left to the Class side text, which is located in the middle of the **System Browser** window). \
Redefining a Component's contract is done on the **Class side** of Pharo (in the **System Browser** which is accessible through the **Browse** tab of Pharo, click on the radio button located left to the Class side text which is located in the middle of the **System Browser** window). \
![system browser red](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/7fa84d1d-45b4-4fe1-b524-6193fc7d6fec)
![class side red](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/7b189b8a-1552-46df-a69d-44f78bb73848)

Expand Down Expand Up @@ -181,7 +181,7 @@ MolGNSSDataImpl>>increaseAccuracy
self accuracy: nextAccuracy ]
```

Then, override the `getAccuracyRadiusInMeters` Service (which will simply return `accuracy`). The override is done since the `getAccuracyRadiusInMeters` Service is declared in the `providedComponentServices` part of `MolGNSSData`'s contract. And since `MolGNSSDataImpl` is an implemmentation of `MolGNSSData`, the `getAccuracyRadiusInMeters` is implemented here.
Then, override the `getAccuracyRadiusInMeters` Service (which will simply return `accuracy`). The override is done since the `getAccuracyRadiusInMeters` Service is declared in the `providedComponentServices` part of `MolGNSSData`'s contract. And since `MolGNSSDataImpl` is an implementation of `MolGNSSData`, the `getAccuracyRadiusInMeters` is implemented here.
```smalltalk
MolGNSSDataImpl>>getAccuracyRadiusInMeters
"Get and return the accuracy of the GNSS depending quality of signal and quantity of connected satellites"
Expand Down Expand Up @@ -229,9 +229,9 @@ To quickly detail this method, we first need to examine `getMolGNSSDataEventsNot
To return to `componentActivate`, after every 50 milliseconds, a random geographical position is generated which is sent through the `currentPositionChanged: aGeoPosition` Event.

Generated methods take the following forms:
- get[componentName]EventsNotifier
- get[componentName]EventsSubscriber
- get[componentName]ServicesProvider
- `get[componentName]EventsNotifier`
- `get[componentName]EventsSubscriber`
- `get[componentName]ServicesProvider`

There is no need to manually type them.

Expand All @@ -247,7 +247,7 @@ MolGNSSDataImpl>>componentPassivate
```

## Create the Component implementation for MolGNSSMap
Same way as `MolGNSSDataImpl`, we can move on to create the Map Component, being `MolGNSSMapImpl`. This component uses the `MolGNSSMap` Trait, used to define the Component's contract, as well as the `MolGNSSDataEvents` interface, which needs to be specified in order for the Component to consume its Service.
Same way as `MolGNSSDataImpl`, we can move on to create the Map Component, being `MolGNSSMapImpl`. This component uses the `MolGNSSMap` Trait, used to define the Component's contract, as well as the `MolGNSSDataEvents` interface which needs to be specified in order for the Component to consume its Service.
```smalltalk
MolAbstractComponentImpl subclass: #MolGNSSMapImpl
uses: MolGNSSMap + MolGNSSDataEvents
Expand Down Expand Up @@ -338,7 +338,7 @@ The Pharo **Transcript** (also located in the **Browse** tab of Pharo) will star

### Starting a Component with a name
It's also possible to create a component with a name by using the `MolComponentImpl class>>start: #[name]` method.
This will be useful for [Producers](https://github.com/OpenSmock/Molecule/blob/main/documentation/Creating%20Producers.md), which determine which component of a given Type A receives events from which component of a given Type B, if multiple components of the same Type exist.
This will be useful for [Producers](https://github.com/OpenSmock/Molecule/blob/main/documentation/Creating%20Producers.md), which determine which component of a given Type A receives events from which component of a given Type B if multiple components of the same Type exist.

## Stopping a Component
Components are stopped using the `MolComponentImpl class>>stop` instruction. \
Expand Down
8 changes: 4 additions & 4 deletions documentation/Producers.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Producers
Producers are used to specify the sender of the Events created by components.
Producers are created using the following syntax:
`self forEvents: [componentName]Events useProducer: #[instanceName]`
with [instanceName] being the name you chose for starting a component (see [Create and connect Components](https://github.com/OpenSmock/Molecule/blob/main/documentation/Create%20and%20connect%20Components)), `default` if no name was used.
Producers are used to specify the sender of the Events created by components. \
Producers are created using the following syntax: \
`self forEvents: [componentName]Events useProducer: #[instanceName]` \
with [instanceName] being the name you chose for starting a component (see [Create and connect Components](https://github.com/OpenSmock/Molecule/blob/main/documentation/Create%20and%20connect%20Components)), `default` if no name was used. \
Producers are created in the `componentInitialize` method.

For multiple Producers (multiple named launched components of the same Type), the syntax is
Expand Down
5 changes: 2 additions & 3 deletions documentation/Table of contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ Welcome to the Molecule wiki!
[Principles](https://github.com/OpenSmock/Molecule/blob/main/documentation/Principles.md)

# Tutorials
Step-by-step example describing an example between two Components interacting:

## Step-by-step example describing two Components interacting between one another
[Create and connect Components](https://github.com/OpenSmock/Molecule/blob/main/documentation/Create%20and%20connect%20Components.md)

Other tutorials focused on one specific part of Molecule:
## Other tutorials focused on one specific part of Molecule

[Connecting two Components](https://github.com/OpenSmock/Molecule/blob/main/documentation/Connecting%20two%20Components.md)

Expand Down
8 changes: 4 additions & 4 deletions documentation/Tests.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Tests
To create quick tests for your Components, you can create a package named [yourPackageName]-Examples or [yourPackageName]-Tests, then create an Object subclass named [yourPackageName]Examples,
To create quick tests for your Components, you can create a package named `[yourPackageName]-Examples` or `[yourPackageName]-Tests`, then create an Object subclass named `[yourPackageName]Examples`,
```smalltalk
Object subclass: #MolGPS-Examples
instanceVariableNames: ''
classVariableNames: ''
package: 'Molecule-Tutorial'
```
then display the **Class side** of this class.
This then allows the creation of methods for different test cases.
This allows the creation of methods for different test cases.

One practical thing is putting a `<script>` tag at the start of your methods. This will create a small icon next to your method in order to launch it without the use of a Playground.
```smalltalk
Expand Down Expand Up @@ -37,8 +37,8 @@ MolGPS-Examples>>stop

## Switching Components on the fly
This test space can be useful for switching Components on the fly, stopping a component to start another having the same Type.
Make sure that they have a different name or that the current launched Component is stopped before the other of the same Type is launched.
See the Molecule-Examples package for more examples on this.
Make sure that they have a different name or that the current launched Component is stopped before the other of the same Type is launched. \
See the [Molecule-Examples](https://github.com/OpenSmock/Molecule/tree/main/src/Molecule-Examples) package for more examples on this.

## Calling another script
To call another script, you simply have to call it like a regular function with `self [script]` since the `self` here represents the current class (for methods located in the class side).
Expand Down
3 changes: 2 additions & 1 deletion src/.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
#format : #tonel
#format : #tonel,
#version: #'1.0'
}
68 changes: 68 additions & 0 deletions src/Molecule-IDE-Tests/MolImplementationsPresenterTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Class {
#name : #MolImplementationsPresenterTest,
#superclass : #TestCase,
#instVars : [
'clockImplementations',
'geoPosImplementations'
],
#category : #'Molecule-IDE-Tests-Cases'
}

{ #category : #running }
MolImplementationsPresenterTest >> setUp [

super setUp.
MolComponentManager cleanUp.

"Put here a common initialization logic for tests"
clockImplementations := MolImplementationsPresenter new.
clockImplementations type: MolMyClockComponent.

geoPosImplementations := MolImplementationsPresenter new.
geoPosImplementations type: MolGeoPosEquipmentType.
]

{ #category : #running }
MolImplementationsPresenterTest >> tearDown [

MolComponentManager cleanUp.
super tearDown
]

{ #category : #running }
MolImplementationsPresenterTest >> testBrowseButtonActivated [

| enabled |
clockImplementations implementationList selectItem:
MolMyClockComponentImpl.
enabled := clockImplementations buttonBrowse isEnabled.

self assert: [ enabled ]
]

{ #category : #running }
MolImplementationsPresenterTest >> testFilter [

| implementations |
geoPosImplementations implementationList filterListItems: 'gps'.
implementations := geoPosImplementations implementationList items.

self assert: [ implementations size = 2 ]
]

{ #category : #running }
MolImplementationsPresenterTest >> testSelectingImplementation [

clockImplementations implementationList selectItem: MolMyClockComponentImpl.

self assert: [
clockImplementations implementationList selectedItem
= MolMyClockComponentImpl ]
]

{ #category : #running }
MolImplementationsPresenterTest >> testTitle [

self assert: [
clockImplementations title = 'MolMyClockComponent Implementations' ]
]
62 changes: 62 additions & 0 deletions src/Molecule-IDE-Tests/MolInterfacesPresenterTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Class {
#name : #MolInterfacesPresenterTest,
#superclass : #TestCase,
#instVars : [
'localTimeEvents'
],
#category : #'Molecule-IDE-Tests-Cases'
}

{ #category : #running }
MolInterfacesPresenterTest >> setUp [

super setUp.
MolComponentManager cleanUp.

"Put here a common initialization logic for tests"
localTimeEvents := MolInterfacesPresenter new.
localTimeEvents interface: MolMyLocalTimeEvents.
]

{ #category : #running }
MolInterfacesPresenterTest >> tearDown [

MolComponentManager cleanUp.
super tearDown
]

{ #category : #running }
MolInterfacesPresenterTest >> testBrowseButtonActivated [

| enabled |
localTimeEvents requiredList selectItem: MolMyAlarmComponent.
enabled := localTimeEvents buttonBrowse isEnabled.
self assert: [ enabled ]
]

{ #category : #running }
MolInterfacesPresenterTest >> testRequiredAnd [

localTimeEvents dropList selectItem: 'Required AND Offered'.
self assert: [ localTimeEvents requiredList items size = 0 ]
]

{ #category : #running }
MolInterfacesPresenterTest >> testRequiredOr [
"no need to select an option since OR is selected by default"

self assert: [ localTimeEvents requiredList items size = 2 ]
]

{ #category : #running }
MolInterfacesPresenterTest >> testRequiredXor [

localTimeEvents dropList selectItem: 'Required XOR Offered'.
self assert: [ localTimeEvents requiredList items size = 2 ]
]

{ #category : #running }
MolInterfacesPresenterTest >> testTitle [

self assert: [ localTimeEvents title = 'MolMyLocalTimeEvents events' ]
]
1 change: 0 additions & 1 deletion src/Molecule-IDE/MolCmdCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Class {
#superclass : #CmdCommand,
#instVars : [
'selectedItems',
'items',
'executionResult'
],
#category : #'Molecule-IDE-Menus'
Expand Down
63 changes: 63 additions & 0 deletions src/Molecule-IDE/MolImplementationsPresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Class {
#name : #MolImplementationsPresenter,
#superclass : #MolOptionsPresenter,
#instVars : [
'selectedType'
],
#category : #'Molecule-IDE-Tools'
}

{ #category : #initialization }
MolImplementationsPresenter >> buttonBrowseAction [
"an implementation needs to be selected in order to browse it"

| item |
item := implementationList selectedItem.

item ifNotNil: [
buttonBrowse enable.
item browse ]
]

{ #category : #initialization }
MolImplementationsPresenter >> connectPresenters [
"enables the Browse button if an implementation is selected"

implementationList whenSelectionChangedDo: [
implementationList selectedItem ifNotNil: [ buttonBrowse enable ] ]
]

{ #category : #initialization }
MolImplementationsPresenter >> defaultLayout [

^ SpBoxLayout newVertical
add: implementationList;
addLast: actionBar;
yourself
]

{ #category : #initialization }
MolImplementationsPresenter >> initializePresenters [

super initializePresenters.

implementationList := MolSpFilteringListDoubleClickPresenter new.
implementationList displayIcon: [ :elem |
self iconNamed: elem systemIconName ]
]

{ #category : #initialization }
MolImplementationsPresenter >> title [

^ selectedType asString , ' Implementations'
]

{ #category : #initialization }
MolImplementationsPresenter >> type: aType [
"when the Type Trait is given, loads the list"

"only one Type can be selected in the System Browser at a time"

selectedType := aType.
implementationList items: (self listImplementations: selectedType)
]
Loading
Loading