Skip to content

Commit d0953d1

Browse files
authored
Merge pull request #179 from Eliott-Guevel/newInterfacesDetail
New component visualization options details
2 parents f48815a + 8f95c97 commit d0953d1

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@ This menu provides `metrics` to have statistics on the Molecule code in selected
103103
This menu provides actions and tools depending on the selected classes.
104104
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.
105105

106+
### See Component implementations
107+
![contextual menu see component implementations](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/a4221985-0578-4e95-a133-831548e0f5ef) \
108+
When right-clicking a Trait that uses the `MolComponentType` Trait, a new option appears in the `Molecule` sub-menu (as shown above):
109+
110+
![see component implementations github](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/68a94948-d6a0-4dce-9c67-2d1974b78fdf) \
111+
Clicking this option opens this window, showing all the Component implementations of a Type Trait. \
112+
The title of the window indicates the name of the Type Trait. \
113+
Clicking an implementation activates the Browse button, which is used to open it in the **System Browser** of Pharo (double-clicking also works). \
114+
Typing in the filtering list (above the two window buttons) filters the implementations' list.
115+
116+
### See Component users
117+
![contextual menu see component users](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/8a9aaa63-33f8-46ea-a638-fc896fc2a60c) \
118+
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):
119+
120+
![See component users github](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/682f388b-78a6-41d4-a3c4-2377fb7e9cf5) \
121+
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). \
122+
In columns are shown the Type Trait requiring and offering this interface. \
123+
Clicking a Type Trait activates the Browse button, which is used to open it in the **System Browser** of Pharo (double-clicking also works). \
124+
Typing in a filtering list (below the columns) filters the relevant Type Traits' list.
125+
106126
## <img src="/resources/puce.svg" width="32" height="32" align="bottom"> Using Components
107127

108128
### Start and stop method

documentation/Create and connect Components.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ They're directly linked, in the sense that a change detected in the first Compon
55
![gps molecule without figure](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/a949d2f8-c460-40be-985d-273881e5b3da) \
66
GPS (Global Positioning System) is the american subsystem of GNSS (Global Navigation Satellite Systems).
77

8-
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. \
8+
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. \
99
A graphical form of the example is available in the [Molecule-Geographical-Position-Example](https://github.com/OpenSmock/Molecule-Geographical-Position-Example) repository.
1010

1111
# Contents
1212
[STATIC PART: declaration](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#static-part-declaration)
1313
* [Define Component Types](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-component-types)
1414
- [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)
15-
+ [Define first Component Type MolGNSSData](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-the-first-component-type-molgnssdata)
15+
+ [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)
1616
+ [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)
1717
* [Define Services and Events](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-services-and-events)
1818
* [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)
@@ -100,8 +100,8 @@ This Event trait produces the `currentPositionChanged: aGeoPosition` Event
100100

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

106106
### Create a new Component from scratch
107107
To develop a new Component from scratch, a class needs to be created that must subclass the `MolAbstractComponentImpl` abstract Class.
@@ -118,7 +118,7 @@ We must use the Molecule Component interface `MolComponentImpl`, which is a Trai
118118
For this tutorial, the GNSS needs to send its geographical data to the Map. \
119119
In order to do that, its contract needs to be redefined to indicate which Services and Events are produced and provided by it.
120120
![implementation contrat molecule](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/a9c14388-0abe-4f09-8ac5-578054f98ad1) \
121-
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). \
121+
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). \
122122
![system browser red](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/7fa84d1d-45b4-4fe1-b524-6193fc7d6fec)
123123
![class side red](https://github.com/Eliott-Guevel/Molecule-various-fixes/assets/76944457/7b189b8a-1552-46df-a69d-44f78bb73848)
124124

@@ -181,7 +181,7 @@ MolGNSSDataImpl>>increaseAccuracy
181181
self accuracy: nextAccuracy ]
182182
```
183183

184-
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.
184+
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.
185185
```smalltalk
186186
MolGNSSDataImpl>>getAccuracyRadiusInMeters
187187
"Get and return the accuracy of the GNSS depending quality of signal and quantity of connected satellites"
@@ -229,9 +229,9 @@ To quickly detail this method, we first need to examine `getMolGNSSDataEventsNot
229229
To return to `componentActivate`, after every 50 milliseconds, a random geographical position is generated which is sent through the `currentPositionChanged: aGeoPosition` Event.
230230

231231
Generated methods take the following forms:
232-
- get[componentName]EventsNotifier
233-
- get[componentName]EventsSubscriber
234-
- get[componentName]ServicesProvider
232+
- `get[componentName]EventsNotifier`
233+
- `get[componentName]EventsSubscriber`
234+
- `get[componentName]ServicesProvider`
235235

236236
There is no need to manually type them.
237237

@@ -247,7 +247,7 @@ MolGNSSDataImpl>>componentPassivate
247247
```
248248

249249
## Create the Component implementation for MolGNSSMap
250-
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.
250+
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.
251251
```smalltalk
252252
MolAbstractComponentImpl subclass: #MolGNSSMapImpl
253253
uses: MolGNSSMap + MolGNSSDataEvents
@@ -338,7 +338,7 @@ The Pharo **Transcript** (also located in the **Browse** tab of Pharo) will star
338338

339339
### Starting a Component with a name
340340
It's also possible to create a component with a name by using the `MolComponentImpl class>>start: #[name]` method.
341-
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.
341+
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.
342342

343343
## Stopping a Component
344344
Components are stopped using the `MolComponentImpl class>>stop` instruction. \

documentation/Producers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Producers
2-
Producers are used to specify the sender of the Events created by components.
3-
Producers are created using the following syntax:
4-
`self forEvents: [componentName]Events useProducer: #[instanceName]`
5-
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.
2+
Producers are used to specify the sender of the Events created by components. \
3+
Producers are created using the following syntax: \
4+
`self forEvents: [componentName]Events useProducer: #[instanceName]` \
5+
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. \
66
Producers are created in the `componentInitialize` method.
77

88
For multiple Producers (multiple named launched components of the same Type), the syntax is

documentation/Table of contents.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ Welcome to the Molecule wiki!
44
[Principles](https://github.com/OpenSmock/Molecule/blob/main/documentation/Principles.md)
55

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

11-
Other tutorials focused on one specific part of Molecule:
10+
## Other tutorials focused on one specific part of Molecule
1211

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

documentation/Tests.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Tests
2-
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,
2+
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`,
33
```smalltalk
44
Object subclass: #MolGPS-Examples
55
instanceVariableNames: ''
66
classVariableNames: ''
77
package: 'Molecule-Tutorial'
88
```
99
then display the **Class side** of this class.
10-
This then allows the creation of methods for different test cases.
10+
This allows the creation of methods for different test cases.
1111

1212
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.
1313
```smalltalk
@@ -37,8 +37,8 @@ MolGPS-Examples>>stop
3737

3838
## Switching Components on the fly
3939
This test space can be useful for switching Components on the fly, stopping a component to start another having the same Type.
40-
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.
41-
See the Molecule-Examples package for more examples on this.
40+
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. \
41+
See the [Molecule-Examples](https://github.com/OpenSmock/Molecule/tree/main/src/Molecule-Examples) package for more examples on this.
4242

4343
## Calling another script
4444
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).

0 commit comments

Comments
 (0)