You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,26 @@ This menu provides `metrics` to have statistics on the Molecule code in selected
103
103
This menu provides actions and tools depending on the selected classes.
104
104
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.
105
105
106
+
### See Component implementations
107
+
\
108
+
When right-clicking a Trait that uses the `MolComponentType` Trait, a new option appears in the `Molecule` sub-menu (as shown above):
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
+
\
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):
Copy file name to clipboardExpand all lines: documentation/Create and connect Components.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,14 @@ They're directly linked, in the sense that a change detected in the first Compon
5
5
\
6
6
GPS (Global Positioning System) is the american subsystem of GNSS (Global Navigation Satellite Systems).
7
7
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. \
9
9
A graphical form of the example is available in the [Molecule-Geographical-Position-Example](https://github.com/OpenSmock/Molecule-Geographical-Position-Example) repository.
- [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)
16
16
+ [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)
17
17
*[Define Services and Events](https://github.com/OpenSmock/Molecule/blob/documentation/documentation/Create%20and%20connect%20Components.md#define-services-and-events)
18
18
*[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
100
100
101
101
## Create a Component implementation of a Type
102
102
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
105
105
106
106
### Create a new Component from scratch
107
107
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
118
118
For this tutorial, the GNSS needs to send its geographical data to the Map. \
119
119
In order to do that, its contract needs to be redefined to indicate which Services and Events are produced and provided by it.
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). \
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.
185
185
```smalltalk
186
186
MolGNSSDataImpl>>getAccuracyRadiusInMeters
187
187
"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
229
229
To return to `componentActivate`, after every 50 milliseconds, a random geographical position is generated which is sent through the `currentPositionChanged: aGeoPosition` Event.
## 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.
@@ -338,7 +338,7 @@ The Pharo **Transcript** (also located in the **Browse** tab of Pharo) will star
338
338
339
339
### Starting a Component with a name
340
340
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.
342
342
343
343
## Stopping a Component
344
344
Components are stopped using the `MolComponentImpl class>>stop` instruction. \
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:\
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.\
6
6
Producers are created in the `componentInitialize` method.
7
7
8
8
For multiple Producers (multiple named launched components of the same Type), the syntax is
Copy file name to clipboardExpand all lines: documentation/Tests.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# 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`,
3
3
```smalltalk
4
4
Object subclass: #MolGPS-Examples
5
5
instanceVariableNames: ''
6
6
classVariableNames: ''
7
7
package: 'Molecule-Tutorial'
8
8
```
9
9
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.
11
11
12
12
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.
13
13
```smalltalk
@@ -37,8 +37,8 @@ MolGPS-Examples>>stop
37
37
38
38
## Switching Components on the fly
39
39
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.
42
42
43
43
## Calling another script
44
44
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